id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
28,444
formula.cpp
doxygen_doxygen/src/formula.cpp
/****************************************************************************** * * Copyright (C) 1997-2022 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 <map> #include <vector> #include <string> #include <utility> #include "formula.h" #include "message.h" #include "config.h" #include "util.h" #include "portable.h" #include "image.h" #include "fileinfo.h" #include "dir.h" #include "regex.h" #include "linkedmap.h" #include "threadpool.h" #include "portable.h" #include "latexgen.h" #include "debug.h" // TODO: remove these dependencies #include "doxygen.h" // for Doxygen::indexList #include "indexlist.h" // for Doxygen::indexList static int determineInkscapeVersion(const Dir &thisDir); struct FormulaManager::Private { LinkedMap<Formula> formulas; std::map<int,Formula *> formulaIdMap; bool repositoriesValid = true; StringVector tempFiles; }; FormulaManager::FormulaManager() : p(std::make_unique<Private>()) { } FormulaManager &FormulaManager::instance() { static FormulaManager fm; return fm; } void FormulaManager::initFromRepository(const QCString &dir) { std::ifstream f = Portable::openInputStream(dir+"/formula.repository"); if (f.is_open()) { uint32_t formulaCount=0; msg("Reading formula repository...\n"); std::string readLine; std::string line; std::string prefix("\\_form#"); int nextLineNr=1; bool hasNextLine = !getline(f,readLine).fail(); while (hasNextLine) { line = readLine; int lineNr = nextLineNr; // look ahead a bit because a formula can be spread over several lines while ((hasNextLine = !getline(f,readLine).fail())) { nextLineNr+=1; if (!readLine.compare(0, prefix.size(), prefix)) break; line += "\n" + readLine; } // new format: \_form#<digits>=<digits>x<digits>:formula static const reg::Ex re_new(R"(\\_form#(\d+)=(\d+)x(\d+):)"); // old format: \_form#<digits>:formula static const reg::Ex re_old(R"(\\_form#(\d+):)"); reg::Match match; int id = -1; int width = -1; int height = -1; std::string text; if (reg::search(line,match,re_new)) // try new format first { id = std::stoi(match[1].str()); width = std::stoi(match[2].str()); height = std::stoi(match[3].str()); text = line.substr(match.position()+match.length()); //printf("new format found id=%d width=%d height=%d text=%s\n",id,width,height,text.c_str()); } else if (reg::search(line,match,re_old)) // check for old format { //id = std::stoi(match[1].str()); //text = line.substr(match.position()+match.length()); //printf("old format found id=%d text=%s\n",id,text.c_str()); msg("old formula.repository format detected; forcing upgrade.\n"); p->repositoriesValid = false; break; } else // unexpected content { warn_uncond("%s/formula.repository contains invalid content at line %d: found: '%s'\n",qPrint(dir),lineNr,line.c_str()); p->repositoriesValid = false; break; } auto it = p->formulaIdMap.find(id); Formula *formula=nullptr; if (it!=p->formulaIdMap.end()) // formula already found in a repository for another output format { formula = it->second; if (formula->text().str()!=text) // inconsistency between repositories detected { msg("differences detected between formula.repository files; forcing upgrade.\n"); p->repositoriesValid = false; break; } formulaCount++; } else // create new formula from cache { //printf("formula not found adding it under id=%d\n",id); formula = p->formulas.add(text.c_str(),id,width,height); p->formulaIdMap.emplace(id,formula); } if (formula) // if an entry in the repository exists also check if there is a generated image { QCString formImgName; formImgName.sprintf("form_%d",formula->id()); FileInfo fiPng((dir+"/"+formImgName+".png").str()); FileInfo fiSvg((dir+"/"+formImgName+".svg").str()); // mark formula as cached, so we do not need to regenerate the images bool isCached = fiPng.exists() || fiSvg.exists(); formula->setCached(isCached); //printf("formula %d: cached=%d\n",formula->id(),isCached); FileInfo fiPngDark((dir+"/"+formImgName+"_dark.png").str()); FileInfo fiSvgDark((dir+"/"+formImgName+"_dark.svg").str()); bool isCachedDark = fiPngDark.exists() || fiSvgDark.exists(); formula->setCachedDark(isCachedDark); //printf("formula %d: cachedDark=%d\n",formula->id(),isCachedDark); } } // For the first repository all formulas should be new (e.g. formulaCount==0). // For the other repositories the same number of formulas should be found // (and number of formulas should be the same for all repositories, content is already check above) if (formulaCount>0 && formulaCount!=p->formulas.size()) // inconsistency between repositories { msg("differences detected between formula.repository files; forcing upgrade.\n"); p->repositoriesValid = false; } } else // no repository found for an output format { p->repositoriesValid = false; } } void FormulaManager::checkRepositories() { //printf("checkRepositories valid=%d\n",p->repositoriesValid); if (!p->repositoriesValid) { clear(); // clear cached formulas, so the corresponding images and repository files // are regenerated p->repositoriesValid = true; } } void FormulaManager::createLatexFile(const QCString &fileName,Format format,Mode mode,IntVector &formulasToGenerate) { // generate a latex file containing one formula per page. QCString texName=fileName+".tex"; std::ofstream f = Portable::openOutputStream(texName); if (f.is_open()) { TextStream t(&f); t << "\\documentclass{article}\n"; t << "\\usepackage{iftex}\n"; t << "\\usepackage{ifthen}\n"; t << "\\usepackage{epsfig}\n"; // for those who want to include images t << "\\usepackage[utf8]{inputenc}\n"; // looks like some older distributions with newunicode package 1.1 need this option. t << "\\usepackage{xcolor}\n"; if (mode==Mode::Dark) // invert page and text colors { t << "\\color{white}\n"; t << "\\pagecolor{black}\n"; } writeExtraLatexPackages(t); writeLatexSpecialFormulaChars(t); QCString macroFile = Config_getString(FORMULA_MACROFILE); if (!macroFile.isEmpty()) { FileInfo fi(macroFile.str()); QCString stripMacroFile = fi.fileName(); t << "\\input{" << stripMacroFile << "}\n"; } t << "\\pagestyle{empty}\n"; t << "\\begin{document}\n"; for (const auto &formula : p->formulas) { int id = formula->id(); // only formulas for which no image is cached are generated //printf("check formula %d: cached=%d cachedDark=%d\n",formula->id(),formula->isCached(),formula->isCachedDark()); if ((mode==Mode::Light && !formula->isCached()) || (mode==Mode::Dark && !formula->isCachedDark()) ) { // we force a pagebreak after each formula t << formula->text() << "\n\\pagebreak\n\n"; formulasToGenerate.push_back(id); } QCString resultName; resultName.sprintf("form_%d%s.%s",id, mode==Mode::Light?"":"_dark", format==Format::Vector?"svg":"png"); Doxygen::indexList->addImageFile(resultName); } t << "\\end{document}\n"; t.flush(); f.close(); } } static bool createDVIFile(const QCString &fileName) { QCString latexCmd = "latex"; const size_t argsLen = 4096; char args[argsLen]; int rerunCount=1; while (rerunCount<8) { //printf("Running latex...\n"); qsnprintf(args,argsLen,"-interaction=batchmode %s >%s",qPrint(fileName),Portable::devNull()); if ((Portable::system(latexCmd,args)!=0) || (Portable::system(latexCmd,args)!=0)) { err("Problems running latex. Check your installation or look " "for typos in %s.tex and check %s.log!\n",qPrint(fileName),qPrint(fileName)); return false; } // check the log file if we need to run latex again to resolve references QCString logFile = fileToString(fileName+".log"); if (logFile.isEmpty() || (logFile.find("Rerun to get cross-references right")==-1 && logFile.find("Rerun LaTeX")==-1)) { break; } rerunCount++; } return true; } static bool createPostscriptFile(const QCString &fileName,const QCString &formBase,int pageIndex) { const size_t argsLen = 4096; char args[argsLen]; // run dvips to convert the page with number pageIndex to an // postscript file. qsnprintf(args,argsLen,"-q -D 600 -n 1 -p %d -o %s_tmp.ps %s.dvi",pageIndex,qPrint(formBase),qPrint(fileName)); if (Portable::system("dvips",args)!=0) { err("Problems running dvips. Check your installation!\n"); return false; } return true; } static bool createEPSbboxFile(const QCString &formBase) { const size_t argsLen = 4096; char args[argsLen]; // extract the bounding box for the postscript file qsnprintf(args,argsLen,"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=bbox %s_tmp.ps 2>%s_tmp.epsi", qPrint(formBase),qPrint(formBase)); if (Portable::system(Portable::ghostScriptCommand(),args)!=0) { err("Problems running %s. Check your installation!\n",Portable::ghostScriptCommand()); return false; } return true; } static bool extractBoundingBox(const QCString &formBase, int *x1,int *y1,int *x2,int *y2, double *x1hi,double *y1hi,double *x2hi,double *y2hi) { FileInfo fi((formBase+"_tmp.epsi").str()); if (fi.exists()) { QCString eps = fileToString(formBase+"_tmp.epsi"); int i = eps.find("%%BoundingBox:"); if (i!=-1) { sscanf(eps.data()+i,"%%%%BoundingBox:%d %d %d %d",x1,y1,x2,y2); } else { err("Couldn't extract bounding box from %s_tmp.epsi\n",qPrint(formBase)); return false; } i = eps.find("%%HiResBoundingBox:"); if (i!=-1) { sscanf(eps.data()+i,"%%%%HiResBoundingBox:%lf %lf %lf %lf",x1hi,y1hi,x2hi,y2hi); } else { err("Couldn't extract high resolution bounding box from %s_tmp.epsi\n",qPrint(formBase)); return false; } } //printf("Bounding box [%d %d %d %d]\n",x1,y1,x2,y2); return true; } static std::mutex g_formulaUpdateMutex; static double updateFormulaSize(Formula *formula,int x1,int y1,int x2,int y2) { double scaleFactor = 1.25; int zoomFactor = Config_getInt(FORMULA_FONTSIZE); if (zoomFactor<8 || zoomFactor>50) zoomFactor=10; scaleFactor *= zoomFactor/10.0; if (formula) { std::lock_guard<std::mutex> lock(g_formulaUpdateMutex); formula->setWidth(static_cast<int>((x2-x1)*scaleFactor+0.5)); formula->setHeight(static_cast<int>((y2-y1)*scaleFactor+0.5)); } return scaleFactor; } static bool createCroppedPDF(const QCString &formBase,int x1,int y1,int x2,int y2) { const size_t argsLen = 4096; char args[argsLen]; // crop the image to its bounding box qsnprintf(args,argsLen,"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=pdfwrite" " -o %s_tmp.pdf -c \"[/CropBox [%d %d %d %d] /PAGES pdfmark\" -f %s_tmp.ps", qPrint(formBase),x1,y1,x2,y2,qPrint(formBase)); if (Portable::system(Portable::ghostScriptCommand(),args)!=0) { err("Problems running %s. Check your installation!\n",Portable::ghostScriptCommand()); return false; } return true; } static bool createCroppedEPS(const QCString &formBase) { const size_t argsLen = 4096; char args[argsLen]; // crop the image to its bounding box qsnprintf(args,argsLen,"-q -dBATCH -dNOPAUSE -P- -dNOSAFER -sDEVICE=eps2write" " -o %s_tmp.eps -f %s_tmp.ps",qPrint(formBase),qPrint(formBase)); if (Portable::system(Portable::ghostScriptCommand(),args)!=0) { err("Problems running %s. Check your installation!\n",Portable::ghostScriptCommand()); return false; } return true; } static bool createSVGFromPDF(const QCString &formBase,const QCString &outFile) { const size_t argsLen = 4096; char args[argsLen]; qsnprintf(args,argsLen,"%s_tmp.pdf %s",qPrint(formBase),qPrint(outFile)); if (Portable::system("pdf2svg",args)!=0) { err("Problems running pdf2svg. Check your installation!\n"); return false; } return true; } static bool createSVGFromPDFviaInkscape(const Dir &thisDir,const QCString &formBase,const QCString &outFile) { const size_t argsLen = 4096; char args[argsLen]; int inkscapeVersion = determineInkscapeVersion(thisDir); if (inkscapeVersion == -1) { err("Problems determining the version of inkscape. Check your installation!\n"); return false; } else if (inkscapeVersion == 0) { qsnprintf(args,argsLen,"-l %s -z %s_tmp.pdf 2>%s",qPrint(outFile),qPrint(formBase),Portable::devNull()); } else // inkscapeVersion >= 1 { qsnprintf(args,argsLen,"--export-type=svg --export-filename=%s %s_tmp.pdf 2>%s",qPrint(outFile),qPrint(formBase),Portable::devNull()); } if (Portable::system("inkscape",args)!=0) { err("Problems running inkscape. Check your installation!\n"); return false; } return true; } static bool updateEPSBoundingBox(const QCString &formBase, int x1,int y1,int x2,int y2, double x1hi,double y1hi,double x2hi,double y2hi) { // read back %s_tmp.eps and replace // bounding box values with x1,y1,x2,y2 and remove the HiResBoundingBox std::ifstream epsIn = Portable::openInputStream(formBase+"_tmp.eps"); std::ofstream epsOut = Portable::openOutputStream(formBase+"_tmp_corr.eps"); if (epsIn.is_open() && epsOut.is_open()) { std::string line; while (getline(epsIn,line)) { if (line.rfind("%%BoundingBox",0)==0) { epsOut << "%%BoundingBox: " << std::max(0,x1-1) << " " << std::max(0,y1-1) << " " << (x2+1) << " " << (y2+1) << "\n"; } else if (line.rfind("%%HiResBoundingBox",0)==0) { epsOut << "%%HiResBoundingBox: " << std::max(0.0,x1hi-1.0) << " " << std::max(0.0,y1hi-1.0) << " " << (x2hi+1.0) << " " << (y2hi+1.0) << "\n"; } else { epsOut << line << "\n"; } } epsIn.close(); epsOut.close(); } else { err("Problems correcting the eps files from %s_tmp.eps to %s_tmp_corr.eps\n", qPrint(formBase),qPrint(formBase)); return false; } return true; } static bool createPNG(const QCString &formBase,const QCString &outFile,double scaleFactor) { const size_t argsLen = 4096; char args[argsLen]; qsnprintf(args,argsLen,"-q -dNOSAFER -dBATCH -dNOPAUSE -dEPSCrop -sDEVICE=pngalpha -dGraphicsAlphaBits=4 -dTextAlphaBits=4 " "-r%d -sOutputFile=%s %s_tmp_corr.eps",static_cast<int>(scaleFactor*72),qPrint(outFile),qPrint(formBase)); if (Portable::system(Portable::ghostScriptCommand(),args)!=0) { err("Problems running %s. Check your installation!\n",Portable::ghostScriptCommand()); return false; } return true; } static StringVector generateFormula(const Dir &thisDir,const QCString &formulaFileName,Formula *formula,int pageNum,int pageIndex, FormulaManager::Format format,FormulaManager::HighDPI hd,FormulaManager::Mode mode) { StringVector tempFiles; QCString outputFile; outputFile.sprintf("form_%d%s.%s",pageNum, mode==FormulaManager::Mode::Light?"":"_dark", format==FormulaManager::Format::Vector?"svg":"png"); msg("Generating image %s for formula\n",qPrint(outputFile)); QCString formBase; formBase.sprintf("_form%d%s",pageNum,mode==FormulaManager::Mode::Light?"":"_dark"); if (!createPostscriptFile(formulaFileName,formBase,pageIndex)) return tempFiles; int x1=0,y1=0,x2=0,y2=0; double x1hi=0.0,y1hi=0.0,x2hi=0.0,y2hi=0.0; if (mode==FormulaManager::Mode::Light) { if (!createEPSbboxFile(formBase)) return tempFiles; // extract the bounding box info from the generated .epsi file if (!extractBoundingBox(formBase,&x1,&y1,&x2,&y2,&x1hi,&y1hi,&x2hi,&y2hi)) return tempFiles; } else // for dark images the bounding box is wrong (includes the black) so // use the bounding box of the light image instead. { QCString formBaseLight; formBaseLight.sprintf("_form%d",pageNum); if (!extractBoundingBox(formBaseLight,&x1,&y1,&x2,&y2,&x1hi,&y1hi,&x2hi,&y2hi)) return tempFiles; } // convert the corrected EPS to a bitmap double scaleFactor = updateFormulaSize(formula,x1,y1,x2,y2); if (format==FormulaManager::Format::Vector) { if (!createCroppedPDF(formBase,x1,y1,x2,y2)) return tempFiles; // if we have pdf2svg available use it to create a SVG image if (Portable::checkForExecutable("pdf2svg")) { createSVGFromPDF(formBase,outputFile); } else if (Portable::checkForExecutable("inkscape")) // alternative is to use inkscape { createSVGFromPDFviaInkscape(thisDir,formBase,outputFile); } else { err("Neither 'pdf2svg' nor 'inkscape' present for conversion of formula to 'svg'\n"); return tempFiles; } tempFiles.push_back(formBase.str()+"_tmp.pdf"); } else // format==FormulaManager::Format::Bitmap { if (!createCroppedEPS(formBase)) return tempFiles; if (!updateEPSBoundingBox(formBase,x1,y1,x2,y2,x1hi,y1hi,x2hi,y2hi)) return tempFiles; if (hd==FormulaManager::HighDPI::On) // for high DPI display it looks much better if the // image resolution is higher than the display resolution { scaleFactor*=2; } if (!createPNG(formBase,outputFile,scaleFactor)) return tempFiles; tempFiles.push_back(formBase.str()+"_tmp.eps"); tempFiles.push_back(formBase.str()+"_tmp_corr.eps"); } // remove intermediate image files tempFiles.push_back(formBase.str()+"_tmp.ps"); if (mode==FormulaManager::Mode::Light) { tempFiles.push_back(formBase.str()+"_tmp.epsi"); } return tempFiles; } void FormulaManager::createFormulasTexFile(Dir &thisDir,Format format,HighDPI hd,Mode mode) { IntVector formulasToGenerate; QCString formulaFileName = mode==Mode::Light ? "_formulas" : "_formulas_dark"; createLatexFile(formulaFileName,format,mode,formulasToGenerate); if (!formulasToGenerate.empty()) // there are new formulas { if (!createDVIFile(formulaFileName)) return; auto getFormula = [this](int pageNum) -> Formula * { auto it = p->formulaIdMap.find(pageNum); if (it!=p->formulaIdMap.end()) { return it->second; } return nullptr; }; int pageIndex=1; std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS)); if (numThreads>1) // multi-threaded version { ThreadPool threadPool(numThreads); std::vector< std::future< StringVector > > results; for (int pageNum : formulasToGenerate) { // create images for each formula. auto formula = getFormula(pageNum); auto processFormula = [=]() -> StringVector { return generateFormula(thisDir,formulaFileName,formula,pageNum,pageIndex,format,hd,mode); }; results.emplace_back(threadPool.queue(processFormula)); pageIndex++; } for (auto &f : results) { auto tf = f.get(); p->tempFiles.insert(p->tempFiles.end(),tf.begin(),tf.end()); // append tf to p->tempFiles } } else // single threaded version { for (int pageNum : formulasToGenerate) { // create images for each formula. auto formula = getFormula(pageNum); StringVector tf = generateFormula(thisDir,formulaFileName,formula,pageNum,pageIndex,format,hd,mode); p->tempFiles.insert(p->tempFiles.end(),tf.begin(),tf.end()); // append tf to p->tempFiles pageIndex++; } } // remove intermediate files produced by latex p->tempFiles.push_back(formulaFileName.str()+".dvi"); p->tempFiles.push_back(formulaFileName.str()+".log"); p->tempFiles.push_back(formulaFileName.str()+".aux"); } // remove the latex file itself p->tempFiles.push_back(formulaFileName.str()+".tex"); // write/update the formula repository so we know what text the // generated images represent (we use this next time to avoid regeneration // of the images, and to avoid forcing the user to delete all images in order // to let a browser refresh the images). std::ofstream f = Portable::openOutputStream("formula.repository"); if (f.is_open()) { TextStream t(&f); for (const auto &formula : p->formulas) { t << "\\_form#" << formula->id(); if (formula->width()!=-1 && formula->height()!=-1) { t << "=" << formula->width() << "x" << formula->height(); } t << ":" << formula->text() << "\n"; } } } void FormulaManager::generateImages(const QCString &path,Format format,HighDPI hd) { Dir d(path.str()); // store the original directory if (!d.exists()) { term("Output directory '%s' does not exist!\n",qPrint(path)); } std::string oldDir = Dir::currentDirPath(); QCString macroFile = Config_getString(FORMULA_MACROFILE); QCString stripMacroFile; if (!macroFile.isEmpty()) { FileInfo fi(macroFile.str()); macroFile=fi.absFilePath(); stripMacroFile = fi.fileName(); } // go to the html output directory (i.e. path) Dir::setCurrent(d.absPath()); Dir thisDir; if (!macroFile.isEmpty()) { copyFile(macroFile,stripMacroFile); } createFormulasTexFile(thisDir,format,hd,Mode::Light); if (Config_getEnum(HTML_COLORSTYLE)!=HTML_COLORSTYLE_t::LIGHT) // all modes other than light need a dark version { // note that the dark version reuses the bounding box of the light version so it needs to be // created after the light version. createFormulasTexFile(thisDir,format,hd,Mode::Dark); } // clean up temporary files if (!Debug::isFlagSet(Debug::Formula)) { for (const auto &file : p->tempFiles) { thisDir.remove(file); } } // reset the directory to the original location. Dir::setCurrent(oldDir); } void FormulaManager::clear() { p->formulas.clear(); p->formulaIdMap.clear(); } int FormulaManager::addFormula(const std::string &formulaText,int width,int height) { Formula *formula = p->formulas.find(formulaText); if (formula) // same formula already stored { return formula->id(); } // add new formula int id = static_cast<int>(p->formulas.size()); formula = p->formulas.add(formulaText.c_str(),id,width,height); p->formulaIdMap.emplace(id,formula); return id; } const Formula *FormulaManager::findFormula(int formulaId) const { auto it = p->formulaIdMap.find(formulaId); return it != p->formulaIdMap.end() ? it->second : nullptr; } #if 0 Formula *FormulaManager::findFormula(int formulaId) { auto it = p->formulaIdMap.find(formulaId); return it != p->formulaIdMap.end() ? it->second : nullptr; } #endif bool FormulaManager::hasFormulas() const { return !p->formulas.empty(); } static std::mutex g_inkscapeDetectionMutex; // helper function to detect and return the major version of inkscape. // return -1 if the version cannot be determined. static int determineInkscapeVersion(const Dir &thisDir) { std::lock_guard<std::mutex> lock(g_inkscapeDetectionMutex); // The command line interface (CLI) of Inkscape 1.0 has changed in comparison to // previous versions. In order to invokine Inkscape, the used version is detected // and based on the version the right syntax of the CLI is chosen. static int inkscapeVersion = -2; if (inkscapeVersion == -2) // initial one time version check { QCString inkscapeVersionFile = "inkscape_version" ; inkscapeVersion = -1; QCString args = "-z --version >"+inkscapeVersionFile+" 2>"+Portable::devNull(); if (Portable::system("inkscape",args)!=0) { // looks like the old syntax gave problems, lets try the new syntax args = " --version >"+inkscapeVersionFile+" 2>"+Portable::devNull(); if (Portable::system("inkscape",args)!=0) { return -1; } } // read version file and determine major version std::ifstream inkscapeVersionIn = Portable::openInputStream(inkscapeVersionFile); if (inkscapeVersionIn.is_open()) { std::string line; while (getline(inkscapeVersionIn,line)) { size_t dotPos = line.find('.'); if (line.rfind("Inkscape ",0)==0 && dotPos>0) { // get major version inkscapeVersion = std::stoi(line.substr(9,dotPos-9)); break; } } inkscapeVersionIn.close(); } else // failed to open version file { return -1; } if (!Debug::isFlagSet(Debug::Formula)) { thisDir.remove(inkscapeVersionFile.str()); } } return inkscapeVersion; }
25,622
C++
.cpp
708
31.326271
150
0.663031
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,445
msc.cpp
doxygen_doxygen/src/msc.cpp
/****************************************************************************** * * Copyright (C) 1997-2021 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 "msc.h" #include "portable.h" #include "config.h" #include "message.h" #include "docparser.h" #include "docnode.h" #include "doxygen.h" #include "indexlist.h" #include "util.h" #include "mscgen_api.h" #include "dir.h" #include "textstream.h" static const int maxCmdLine = 40960; static bool convertMapFile(TextStream &t,const QCString &mapName,const QCString &relPath, const QCString &context,const QCString &srcFile,int srcLine) { std::ifstream f = Portable::openInputStream(mapName); if (!f.is_open()) { err("failed to open map file %s for inclusion in the docs!\n" "If you installed Graphviz/dot after a previous failing run, \n" "try deleting the output directory and rerun doxygen.\n",qPrint(mapName)); return false; } const int maxLineLen=1024; char url[maxLineLen]; char ref[maxLineLen]; int x1=0, y1=0, x2=0, y2=0; std::string line; while (getline(f,line)) { bool isRef = false; //printf("ReadLine '%s'\n",line.c_str()); if (qstrncmp(line.c_str(),"rect",4)==0) { // obtain the url and the coordinates in the order used by graphviz-1.5 sscanf(line.c_str(),"rect %s %d,%d %d,%d",url,&x1,&y1,&x2,&y2); if (qstrcmp(url,"\\ref")==0 || qstrcmp(url,"@ref")==0) { isRef = true; sscanf(line.c_str(),"rect %s %s %d,%d %d,%d",ref,url,&x1,&y1,&x2,&y2); } // sanity checks if (y2<y1) { int temp=y2; y2=y1; y1=temp; } if (x2<x1) { int temp=x2; x2=x1; x1=temp; } bool link = false; if ( isRef ) { // handle doxygen \ref tag URL reference auto parser { createDocParser() }; auto dfAst { createRef( *parser.get(), url, context, srcFile, srcLine) }; auto dfAstImpl = dynamic_cast<const DocNodeAST*>(dfAst.get()); const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root); if (!df->file().isEmpty() || !df->anchor().isEmpty()) { link = true; t << "<area href=\""; t << externalRef(relPath,df->ref(),TRUE); } if (!df->file().isEmpty()) { QCString fn = df->file(); addHtmlExtensionIfMissing(fn); t << fn; } if (!df->anchor().isEmpty()) { t << "#" << df->anchor(); } } else { link = true; t << "<area href=\""; t << url; } if (link) { t << "\" shape=\"rect\" coords=\"" << x1 << "," << y1 << "," << x2 << "," << y2 << "\"" << " alt=\"\"/>\n"; } } } return true; } static bool do_mscgen_generate(const QCString& inFile,const QCString& outFile,mscgen_format_t msc_format, const QCString &srcFile,int srcLine) { auto mscgen_tool = Config_getString(MSCGEN_TOOL).stripWhiteSpace(); if (!mscgen_tool.isEmpty()) // use external mscgen tool { QCString type; switch (msc_format) { case mscgen_format_png: type = "png"; break; case mscgen_format_eps: type = "eps"; break; case mscgen_format_svg: type = "svg"; break; case mscgen_format_pngmap: case mscgen_format_svgmap: type = "ismap"; break; } int exitcode = Portable::system(mscgen_tool,"-T"+type+" -o "+outFile+" "+inFile); if (exitcode!=0) { err_full(srcFile,srcLine,"Problems running external tool %s given via MSCGEN_TOOL (exit status: %d)." " Look for typos in your msc file and check error messages above.", qPrint(mscgen_tool),exitcode); return false; } } else // use built-in mscgen tool { int code = mscgen_generate(inFile.data(),outFile.data(),msc_format); if (code!=0) { err_full(srcFile,srcLine,"Problems generating msc output (error=%s). Look for typos in you msc file '%s'", mscgen_error2str(code),qPrint(inFile)); return false; } } return true; } void writeMscGraphFromFile(const QCString &inFile,const QCString &outDir, const QCString &outFile,MscOutputFormat format, const QCString &srcFile,int srcLine ) { QCString absOutFile = outDir; absOutFile+=Portable::pathSeparator(); absOutFile+=outFile; mscgen_format_t msc_format = mscgen_format_png; QCString imgName = absOutFile; switch (format) { case MscOutputFormat::BITMAP: msc_format = mscgen_format_png; imgName+=".png"; break; case MscOutputFormat::EPS: msc_format = mscgen_format_eps; imgName+=".eps"; break; case MscOutputFormat::SVG: msc_format = mscgen_format_svg; imgName+=".svg"; break; default: return; } if (!do_mscgen_generate(inFile,imgName,msc_format,srcFile,srcLine)) { return; } if ( (format==MscOutputFormat::EPS) && (Config_getBool(USE_PDFLATEX)) ) { QCString epstopdfArgs(maxCmdLine, QCString::ExplicitSize); epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"", qPrint(absOutFile),qPrint(absOutFile)); if (Portable::system("epstopdf",epstopdfArgs)!=0) { err_full(srcFile,srcLine,"Problems running epstopdf when processing '%s.eps'. Check your TeX installation!", qPrint(absOutFile)); } else { Dir().remove((absOutFile + ".eps").data()); } } int i=std::max(imgName.findRev('/'),imgName.findRev('\\')); if (i!=-1) // strip path { imgName=imgName.right(imgName.length()-i-1); } Doxygen::indexList->addImageFile(imgName); } static QCString getMscImageMapFromFile(const QCString& inFile, const QCString& /* outDir */, const QCString& relPath,const QCString& context, bool writeSVGMap,const QCString &srcFile,int srcLine) { QCString outFile = inFile + ".map"; if (!do_mscgen_generate(inFile,outFile, writeSVGMap ? mscgen_format_svgmap : mscgen_format_pngmap, srcFile,srcLine)) return ""; TextStream t; convertMapFile(t, outFile, relPath, context, srcFile, srcLine); Dir().remove(outFile.str()); return t.str(); } void writeMscImageMapFromFile(TextStream &t,const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context, MscOutputFormat format, const QCString &srcFile, int srcLine ) { QCString mapName = baseName+".map"; t << "<img src=\"" << relPath << baseName << "."; switch (format) { case MscOutputFormat::BITMAP: t << "png"; break; case MscOutputFormat::EPS: t << "eps"; break; case MscOutputFormat::SVG: t << "svg"; break; default: t << "unknown"; } QCString imap = getMscImageMapFromFile(inFile,outDir,relPath,context,format==MscOutputFormat::SVG,srcFile,srcLine); if (!imap.isEmpty()) { t << "\" alt=\"" << baseName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n"; t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">" << imap << "</map>\n"; } else { t << "\" alt=\"" << baseName << "\" border=\"0\"/>\n"; } }
8,109
C++
.cpp
249
25.75502
117
0.583695
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,446
entry.cpp
doxygen_doxygen/src/entry.cpp
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 <algorithm> #include <atomic> #include <stdlib.h> #include "entry.h" #include "util.h" #include "section.h" #include "doxygen.h" #include "arguments.h" #include "config.h" //------------------------------------------------------------------ static AtomicInt g_num; Entry::Entry() : section(EntryType::makeEmpty()), program(static_cast<size_t>(0)), initializer(static_cast<size_t>(0)) { //printf("Entry::Entry(%p)\n",this); g_num++; m_parent=nullptr; //printf("Entry::Entry() tArgList=0\n"); mGrpId = -1; hasTagInfo = false; relatesType = RelatesType::Simple; hidden = FALSE; groupDocType = GROUPDOC_NORMAL; reset(); } Entry::Entry(const Entry &e) : section(e.section) { //printf("Entry::Entry(%p):copy\n",this); g_num++; type = e.type; name = e.name; hasTagInfo = e.hasTagInfo; tagInfoData = e.tagInfoData; protection = e.protection; mtype = e.mtype; spec = e.spec; vhdlSpec = e.vhdlSpec; initLines = e.initLines; isStatic = e.isStatic; localToc = e.localToc; explicitExternal = e.explicitExternal; proto = e.proto; subGrouping = e.subGrouping; commandOverrides = e.commandOverrides; exported = e.exported; virt = e.virt; args = e.args; bitfields = e.bitfields; argList = e.argList; tArgLists = e.tArgLists; program.str(e.program.str()); initializer.str(e.initializer.str()); includeFile = e.includeFile; includeName = e.includeName; doc = e.doc; docLine = e.docLine; docFile = e.docFile; brief = e.brief; briefLine = e.briefLine; briefFile = e.briefFile; inbodyDocs = e.inbodyDocs; inbodyLine = e.inbodyLine; inbodyFile = e.inbodyFile; relates = e.relates; relatesType = e.relatesType; read = e.read; write = e.write; inside = e.inside; exception = e.exception; typeConstr = e.typeConstr; bodyLine = e.bodyLine; bodyColumn = e.bodyColumn; endBodyLine = e.endBodyLine; mGrpId = e.mGrpId; anchors = e.anchors; fileName = e.fileName; startLine = e.startLine; startColumn = e.startColumn; sli = e.sli; lang = e.lang; hidden = e.hidden; artificial = e.artificial; groupDocType = e.groupDocType; id = e.id; extends = e.extends; groups = e.groups; req = e.req; m_fileDef = e.m_fileDef; qualifiers = e.qualifiers; m_parent = e.m_parent; // deep copy child entries m_sublist.reserve(e.m_sublist.size()); for (const auto &cur : e.m_sublist) { m_sublist.push_back(std::make_shared<Entry>(*cur)); } } Entry::~Entry() { //printf("Entry::~Entry(%p) num=%d\n",this,g_num); //printf("Deleting entry %d name %s type %x children %d\n", // num,qPrint(name),section,sublist->count()); g_num--; } void Entry::moveToSubEntryAndRefresh(Entry *&current) { current->m_parent=this; m_sublist.emplace_back(current); current = new Entry; } void Entry::moveToSubEntryAndRefresh(std::shared_ptr<Entry> &current) { current->m_parent=this; m_sublist.push_back(current); current = std::make_shared<Entry>(); } void Entry::moveToSubEntryAndKeep(Entry *current) { current->m_parent=this; m_sublist.emplace_back(current); } void Entry::moveToSubEntryAndKeep(std::shared_ptr<Entry> current) { current->m_parent=this; m_sublist.push_back(current); } void Entry::copyToSubEntry(Entry *current) { Entry *copy = new Entry(*current); copy->m_parent=this; m_sublist.emplace_back(copy); } void Entry::copyToSubEntry(const std::shared_ptr<Entry> &current) { std::shared_ptr<Entry> copy = std::make_shared<Entry>(*current); copy->m_parent=this; m_sublist.push_back(copy); } void Entry::removeSubEntry(const Entry *e) { auto it = std::find_if(m_sublist.begin(),m_sublist.end(), [e](const std::shared_ptr<Entry>&elem) { return elem.get()==e; }); if (it!=m_sublist.end()) { m_sublist.erase(it); } } void Entry::reset() { //printf("Entry::reset()\n"); name.clear(); type.clear(); args.clear(); bitfields.clear(); exception.clear(); program.str(std::string()); includeFile.clear(); includeName.clear(); doc.clear(); docFile.clear(); docLine=-1; relates.clear(); relatesType=RelatesType::Simple; brief.clear(); briefFile.clear(); briefLine=-1; inbodyDocs.clear(); inbodyFile.clear(); inbodyLine=-1; inside.clear(); fileName.clear(); initializer.str(std::string()); initLines = -1; startLine = 1; startColumn = 1; bodyLine = -1; bodyColumn = 1; endBodyLine = -1; mGrpId = -1; commandOverrides.reset(); exported = false; section = EntryType::makeEmpty(); mtype = MethodTypes::Method; virt = Specifier::Normal; isStatic = false; proto = false; explicitExternal = false; spec.reset(); vhdlSpec = VhdlSpecifier::UNKNOWN; lang = SrcLangExt::Unknown; hidden = false; artificial = false; subGrouping = true; protection = Protection::Public; groupDocType = GROUPDOC_NORMAL; id.clear(); metaData.clear(); m_sublist.clear(); extends.clear(); groups.clear(); anchors.clear(); argList.reset(); tArgLists.clear(); typeConstr.reset(); sli.clear(); req.clear(); m_fileDef = nullptr; qualifiers.clear(); } void Entry::setFileDef(FileDef *fd) { m_fileDef = fd; for (const auto &childNode : m_sublist) { childNode->setFileDef(fd); } } //------------------------------------------------------------------
6,184
C++
.cpp
233
23.888412
118
0.652335
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,447
definition.cpp
doxygen_doxygen/src/definition.cpp
/****************************************************************************** * * Copyright (C) 1997-2023 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 <algorithm> #include <iterator> #include <unordered_map> #include <string> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "anchor.h" #include "md5.h" #include "regex.h" #include "config.h" #include "definitionimpl.h" #include "doxygen.h" #include "language.h" #include "message.h" #include "portable.h" #include "outputlist.h" #include "code.h" #include "util.h" #include "groupdef.h" #include "pagedef.h" #include "section.h" #include "htags.h" #include "parserintf.h" #include "debug.h" #include "vhdldocgen.h" #include "memberlist.h" #include "namespacedef.h" #include "filedef.h" #include "dirdef.h" #include "pagedef.h" #include "reflist.h" #include "utf8.h" #include "indexlist.h" #include "fileinfo.h" //----------------------------------------------------------------------------------------- //! Helper class add copy/assignment support to std::unique_ptr by making a deep copy //! Note that T may not be a polymorphic type template<class T> class DeepCopyUniquePtr : public std::unique_ptr<T> { public: using std::unique_ptr<T>::unique_ptr; DeepCopyUniquePtr(const DeepCopyUniquePtr &other) : std::unique_ptr<T>(other ? new T(*other) : nullptr) { } DeepCopyUniquePtr &operator=(const DeepCopyUniquePtr &other) { if (*this!=other) this->reset(other ? new T(*other) : nullptr); return *this; } DeepCopyUniquePtr(DeepCopyUniquePtr &&other) : std::unique_ptr<T>(std::move(other)) {} DeepCopyUniquePtr &operator=(DeepCopyUniquePtr &&other) { std::unique_ptr<T>::operator=(std::move(other)); return *this; } ~DeepCopyUniquePtr() = default; }; //! Helper to create an object wrapped in a DeepCopyUniquePtr. template<typename T, typename... Args> DeepCopyUniquePtr<T> make_DeepCopyUnique(Args&&... args) { return DeepCopyUniquePtr<T>(new T(std::forward<Args>(args)...)); } /** Private data associated with a Symbol DefinitionImpl object. */ class DefinitionImpl::IMPL { public: void init(const QCString &df, const QCString &n); void setDefFileName(const QCString &df); Definition *def = nullptr; SectionRefs sectionRefs; std::unordered_map<std::string,MemberDef *> sourceRefByDict; std::unordered_map<std::string,MemberDef *> sourceRefsDict; RefItemVector xrefListItems; GroupList partOfGroups; DeepCopyUniquePtr<DocInfo> details; // not exported DeepCopyUniquePtr<DocInfo> inbodyDocs; // not exported DeepCopyUniquePtr<BriefInfo> brief; // not exported DeepCopyUniquePtr<BodyInfo> body; // not exported QCString briefSignatures; QCString docSignatures; QCString localName; // local (unqualified) name of the definition // in the future m_name should become m_localName QCString qualifiedName; QCString ref; // reference to external documentation bool hidden = FALSE; bool isArtificial = FALSE; bool isAnonymous = FALSE; bool isExported = FALSE; Definition *outerScope = nullptr; // not owner // where the item was defined QCString defFileName; QCString defFileExt; SrcLangExt lang = SrcLangExt::Unknown; QCString id; // clang unique id QCString name; bool isSymbol; QCString symbolName; int defLine; int defColumn; MemberVector referencesMembers; // cache for getReferencesMembers() MemberVector referencedByMembers; // cache for getReferencedByMembers() }; void DefinitionImpl::IMPL::setDefFileName(const QCString &df) { defFileName = df; int lastDot = defFileName.findRev('.'); if (lastDot!=-1) { defFileExt = defFileName.mid(lastDot); } } void DefinitionImpl::IMPL::init(const QCString &df, const QCString &n) { setDefFileName(df); QCString lname = n; if (lname!="<globalScope>") { //extractNamespaceName(m_name,m_localName,ns); localName=stripScope(n); } else { localName=n; } //printf("localName=%s\n",qPrint(localName)); brief.reset(); details.reset(); body.reset(); inbodyDocs.reset(); sourceRefByDict.clear(); sourceRefsDict.clear(); outerScope = Doxygen::globalScope; hidden = FALSE; isArtificial = FALSE; isExported = FALSE; lang = SrcLangExt::Unknown; } void DefinitionImpl::setDefFile(const QCString &df,int defLine,int defCol) { m_impl->setDefFileName(df); m_impl->defLine = defLine; m_impl->defColumn = defCol; } //----------------------------------------------------------------------------------------- static bool matchExcludedSymbols(const QCString &name) { const StringVector &exclSyms = Config_getList(EXCLUDE_SYMBOLS); if (exclSyms.empty()) return FALSE; // nothing specified std::string symName = name.str(); for (const auto &pat : exclSyms) { QCString pattern = pat.c_str(); bool forceStart=FALSE; bool forceEnd=FALSE; if (pattern.at(0)=='^') pattern=pattern.mid(1),forceStart=TRUE; if (pattern.at(pattern.length()-1)=='$') pattern=pattern.left(pattern.length()-1),forceEnd=TRUE; if (pattern.find('*')!=-1) // wildcard mode { const reg::Ex re(substitute(pattern,"*",".*").str()); reg::Match match; if (reg::search(symName,match,re)) // wildcard match { size_t ui = match.position(); size_t pl = match.length(); size_t sl = symName.length(); if ((ui==0 || pattern.at(0)=='*' || (!isId(symName.at(ui-1)) && !forceStart)) && (ui+pl==sl || pattern.at(pattern.length()-1)=='*' || (!isId(symName.at(ui+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d\n",qPrint(symName),qPrint(pattern),i); return TRUE; } } } else if (!pattern.isEmpty()) // match words { size_t i = symName.find(pattern.str()); if (i!=std::string::npos) // we have a match! { size_t ui=i; size_t pl=pattern.length(); size_t sl=symName.length(); // check if it is a whole word match if ((ui==0 || (!isId(symName.at(ui-1)) && !forceStart)) && (ui+pl==sl || (!isId(symName.at(ui+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d\n",qPrint(symName),qPrint(pattern),i); return TRUE; } } } } //printf("--> name=%s: no match\n",name); return FALSE; } static void addToMap(const QCString &name,Definition *d) { bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); QCString symbolName = name; int index=computeQualifiedIndex(symbolName); if (!vhdlOpt && index!=-1) symbolName=symbolName.mid(index+2); if (!symbolName.isEmpty()) { //printf("adding symbol %s\n",qPrint(symbolName)); Doxygen::symbolMap->add(symbolName,d); d->_setSymbolName(symbolName); } } static void removeFromMap(const QCString &name,Definition *d) { Doxygen::symbolMap->remove(name,d); } DefinitionImpl::DefinitionImpl(Definition *def, const QCString &df,int dl,int dc, const QCString &name,const char *b, const char *d,bool isSymbol) : m_impl(std::make_unique<DefinitionImpl::IMPL>()) { setName(name); m_impl->def = def; m_impl->defLine = dl; m_impl->defColumn = dc; m_impl->init(df,name); m_impl->isSymbol = isSymbol; if (isSymbol) addToMap(name,def); _setBriefDescription(b,df,dl); _setDocumentation(d,df,dl,TRUE,FALSE); if (matchExcludedSymbols(name)) { m_impl->hidden = TRUE; } } DefinitionImpl::DefinitionImpl(const DefinitionImpl &d) : m_impl(std::make_unique<DefinitionImpl::IMPL>(*d.m_impl)) { if (m_impl->isSymbol) addToMap(m_impl->name,m_impl->def); } DefinitionImpl &DefinitionImpl::operator=(const DefinitionImpl &other) { if (this!=&other) { m_impl = std::make_unique<DefinitionImpl::IMPL>(*other.m_impl); } return *this; } DefinitionImpl::~DefinitionImpl() { if (m_impl->isSymbol) { removeFromMap(m_impl->symbolName,m_impl->def); } } void DefinitionImpl::setName(const QCString &name) { if (name.isEmpty()) return; m_impl->name = name; m_impl->isAnonymous = m_impl->name.isEmpty() || m_impl->name.at(0)=='@' || m_impl->name.find("::@")!=-1; } void DefinitionImpl::setId(const QCString &id) { if (id.isEmpty()) return; m_impl->id = id; if (Doxygen::clangUsrMap) { //printf("DefinitionImpl::setId '%s'->'%s'\n",id,qPrint(m_impl->name)); Doxygen::clangUsrMap->emplace(id.str(),m_impl->def); } } QCString DefinitionImpl::id() const { return m_impl->id; } void DefinitionImpl::addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList) { //printf("%s: addSectionsToDefinition(%d)\n",qPrint(name()),anchorList->count()); for (const SectionInfo *si : anchorList) { //printf("Add section '%s' to definition '%s'\n", // qPrint(si->label()),qPrint(name())); SectionManager &sm = SectionManager::instance(); SectionInfo *gsi=sm.find(si->label()); //printf("===== label=%s gsi=%p\n",qPrint(si->label),gsi); if (gsi==nullptr) { gsi = sm.add(*si); } if (m_impl->sectionRefs.find(gsi->label())==nullptr) { m_impl->sectionRefs.add(gsi); gsi->setDefinition(m_impl->def); } } } bool DefinitionImpl::hasSections() const { //printf("DefinitionImpl::hasSections(%s) #sections=%d\n",qPrint(name()), // m_impl->sectionRefs.size()); if (m_impl->sectionRefs.empty()) return FALSE; for (const SectionInfo *si : m_impl->sectionRefs) { if (si->type().isSection()) { return TRUE; } } return FALSE; } void DefinitionImpl::writeDocAnchorsToTagFile(TextStream &tagFile) const { if (!m_impl->sectionRefs.empty()) { //printf("%s: writeDocAnchorsToTagFile(%d)\n",qPrint(name()),m_impl->sectionRef.size()); for (const SectionInfo *si : m_impl->sectionRefs) { if (!si->generated() && si->ref().isEmpty() && !AnchorGenerator::instance().isGenerated(si->label().str())) { //printf("write an entry!\n"); if (m_impl->def->definitionType()==Definition::TypeMember) tagFile << " "; QCString fn = si->fileName(); addHtmlExtensionIfMissing(fn); tagFile << " <docanchor file=\"" << fn << "\""; if (!si->title().isEmpty()) { tagFile << " title=\"" << convertToXML(si->title()) << "\""; } tagFile << ">" << si->label() << "</docanchor>\n"; } } } } bool DefinitionImpl::_docsAlreadyAdded(const QCString &doc,QCString &sigList) { uint8_t md5_sig[16]; char sigStr[33]; // to avoid mismatches due to differences in indenting, we first remove // double whitespaces... QCString docStr = doc.simplifyWhiteSpace(); MD5Buffer(docStr.data(),static_cast<unsigned int>(docStr.length()),md5_sig); MD5SigToString(md5_sig,sigStr); //printf("%s:_docsAlreadyAdded doc='%s' sig='%s' docSigs='%s'\n", // qPrint(name()),qPrint(doc),qPrint(sigStr),qPrint(sigList)); if (sigList.find(sigStr)==-1) // new docs, add signature to prevent re-adding it { sigList+=QCString(":")+sigStr; return FALSE; } else { return TRUE; } } void DefinitionImpl::_setDocumentation(const QCString &d,const QCString &docFile,int docLine, bool stripWhiteSpace,bool atTop) { //printf("%s::setDocumentation(%s,%s,%d,%d)\n",qPrint(name()),d,docFile,docLine,stripWhiteSpace); if (d.isEmpty()) return; QCString doc = d; if (stripWhiteSpace) { doc = stripLeadingAndTrailingEmptyLines(doc,docLine); } else // don't strip whitespace { doc=d; } if (!_docsAlreadyAdded(doc,m_impl->docSignatures)) { //printf("setting docs for %s: '%s'\n",qPrint(name()),qPrint(m_doc)); if (!m_impl->details) { m_impl->details = make_DeepCopyUnique<DocInfo>(); } if (m_impl->details->doc.isEmpty()) // fresh detailed description { m_impl->details->doc = doc; } else if (atTop) // another detailed description, append it to the start { m_impl->details->doc = doc+"\n\n"+m_impl->details->doc; } else // another detailed description, append it to the end { m_impl->details->doc += "\n\n"+doc; } if (docLine!=-1) // store location if valid { m_impl->details->file = docFile; m_impl->details->line = docLine; } else { m_impl->details->file = docFile; m_impl->details->line = 1; } } } void DefinitionImpl::setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace) { if (d.isEmpty()) return; _setDocumentation(d,docFile,docLine,stripWhiteSpace,FALSE); } void DefinitionImpl::_setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) { QCString brief = b; brief = brief.stripWhiteSpace(); brief = stripLeadingAndTrailingEmptyLines(brief,briefLine); brief = brief.stripWhiteSpace(); if (brief.isEmpty()) return; size_t bl = brief.length(); if (bl>0) { if (!theTranslator || theTranslator->needsPunctuation()) // add punctuation if needed { int c = brief.at(bl-1); switch(c) { case '.': case '!': case '?': case '>': case ':': case ')': break; default: if (isUTF8CharUpperCase(brief.str(),0) && !lastUTF8CharIsMultibyte(brief.str())) brief+='.'; break; } } } if (!_docsAlreadyAdded(brief,m_impl->briefSignatures)) { if (m_impl->brief && !m_impl->brief->doc.isEmpty()) { //printf("adding to details\n"); _setDocumentation(brief,briefFile,briefLine,FALSE,TRUE); } else { //fprintf(stderr,"DefinitionImpl::setBriefDescription(%s,%s,%d)\n",b,briefFile,briefLine); if (!m_impl->brief) { m_impl->brief = make_DeepCopyUnique<BriefInfo>(); } m_impl->brief->doc=brief; if (briefLine!=-1) { m_impl->brief->file = briefFile; m_impl->brief->line = briefLine; } else { m_impl->brief->file = briefFile; m_impl->brief->line = 1; } } } else { //printf("do nothing!\n"); } } void DefinitionImpl::setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) { if (b.isEmpty()) return; _setBriefDescription(b,briefFile,briefLine); } void DefinitionImpl::_setInbodyDocumentation(const QCString &doc,const QCString &inbodyFile,int inbodyLine) { if (!m_impl->inbodyDocs) { m_impl->inbodyDocs = make_DeepCopyUnique<DocInfo>(); } if (m_impl->inbodyDocs->doc.isEmpty()) // fresh inbody docs { m_impl->inbodyDocs->doc = doc; m_impl->inbodyDocs->file = inbodyFile; m_impl->inbodyDocs->line = inbodyLine; } else // another inbody documentation fragment, append this to the end { m_impl->inbodyDocs->doc += QCString("\n\n")+doc; } } void DefinitionImpl::setInbodyDocumentation(const QCString &d,const QCString &inbodyFile,int inbodyLine) { if (d.isEmpty()) return; _setInbodyDocumentation(d,inbodyFile,inbodyLine); } //--------------------------------------- /*! Cache for storing the result of filtering a file */ class FilterCache { private: struct FilterCacheItem { size_t filePos; size_t fileSize; }; using LineOffsets = std::vector<size_t>; public: static FilterCache &instance(); //! collects the part of file \a fileName starting at \a startLine and ending at \a endLine into //! buffer \a str. Applies filtering if FILTER_SOURCE_FILES is enabled and the file extension //! matches a filter. Caches file information so that subsequent extraction of blocks from //! the same file can be performed efficiently bool getFileContents(const QCString &fileName,size_t startLine,size_t endLine, std::string &str) { bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); QCString filter = getFileFilter(fileName,TRUE); bool usePipe = !filter.isEmpty() && filterSourceFiles; return usePipe ? getFileContentsPipe(fileName,filter,startLine,endLine,str) : getFileContentsDisk(fileName,startLine,endLine,str); } private: bool getFileContentsPipe(const QCString &fileName,const QCString &filter, size_t startLine,size_t endLine,std::string &str) { std::unique_lock<std::mutex> lock(m_mutex); auto it = m_cache.find(fileName.str()); if (it!=m_cache.end()) // cache hit: reuse stored result { lock.unlock(); auto item = it->second; //printf("getFileContents(%s): cache hit\n",qPrint(fileName)); // file already processed, get the results after filtering from the tmp file Debug::print(Debug::FilterOutput,0,"Reusing filter result for %s from %s at offset=%lld size=%zu\n", qPrint(fileName),qPrint(Doxygen::filterDBFileName),item.filePos,item.fileSize); auto it_off = m_lineOffsets.find(fileName.str()); assert(it_off!=m_lineOffsets.end()); auto [ startLineOffset, fragmentSize] = getFragmentLocation(it_off->second,startLine,endLine); //printf("%s: existing file [%zu-%zu]->[%zu-%zu] size=%zu\n", // qPrint(fileName),startLine,endLine,startLineOffset,endLineOffset,fragmentSize); readFragmentFromFile(str, Doxygen::filterDBFileName.data(), item.filePos+startLineOffset, fragmentSize); return true; } else // cache miss: filter active but file not previously processed { //printf("getFileContents(%s): cache miss\n",qPrint(fileName)); // filter file QCString cmd=filter+" \""+fileName+"\""; Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",qPrint(cmd)); FILE *f = Portable::popen(cmd,"r"); if (f==nullptr) { // handle error err("Error opening filter pipe command '%s'\n",qPrint(cmd)); return false; } FILE *bf = Portable::fopen(Doxygen::filterDBFileName,"a+b"); FilterCacheItem item; item.filePos = m_endPos; if (bf==nullptr) { // handle error err("Error opening filter database file %s\n",qPrint(Doxygen::filterDBFileName)); Portable::pclose(f); return false; } // append the filtered output to the database file size_t size=0; while (!feof(f)) { const int blockSize = 4096; char buf[blockSize]; size_t bytesRead = fread(buf,1,blockSize,f); size_t bytesWritten = fwrite(buf,1,bytesRead,bf); if (bytesRead!=bytesWritten) { // handle error err("Failed to write to filter database %s. Wrote %zu out of %zu bytes\n", qPrint(Doxygen::filterDBFileName),bytesWritten,bytesRead); Portable::pclose(f); fclose(bf); return false; } size+=bytesWritten; str+=std::string_view(buf,bytesWritten); } item.fileSize = size; // add location entry to the dictionary m_cache.emplace(fileName.str(),item); Debug::print(Debug::FilterOutput,0,"Storing new filter result for %s in %s at offset=%lld size=%zu\n", qPrint(fileName),qPrint(Doxygen::filterDBFileName),item.filePos,item.fileSize); // update end of file position m_endPos += size; Portable::pclose(f); fclose(bf); // shrink buffer to [startLine..endLine] part shrinkBuffer(str,fileName,startLine,endLine); } return true; } //! reads the fragment start at \a startLine and ending at \a endLine from file \a fileName //! into buffer \a str bool getFileContentsDisk(const QCString &fileName,size_t startLine,size_t endLine,std::string &str) { std::unique_lock<std::mutex> lock(m_mutex); // normal file //printf("getFileContents(%s): no filter\n",qPrint(fileName)); auto it = m_lineOffsets.find(fileName.str()); if (it == m_lineOffsets.end()) // new file { // read file completely into str buffer readFragmentFromFile(str,fileName,0); // shrink buffer to [startLine..endLine] part shrinkBuffer(str,fileName,startLine,endLine); } else // file already processed before { lock.unlock(); auto [ startLineOffset, fragmentSize] = getFragmentLocation(it->second,startLine,endLine); //printf("%s: existing file [%zu-%zu] -> start=%zu size=%zu\n", // qPrint(fileName),startLine,endLine,startLineOffset,fragmentSize); readFragmentFromFile(str,fileName,startLineOffset,fragmentSize); } return true; } //! computes the starting offset for each line for file \a fileName, whose contents should //! already be stored in buffer \a str. void compileLineOffsets(const QCString &fileName,const std::string &str) { // line 1 (index 0) is at offset 0 auto it = m_lineOffsets.emplace(fileName.data(),LineOffsets{0}).first; const char *p=str.data(); while (*p) { char c=0; while ((c=*p)!='\n' && c!=0) p++; // search until end of the line if (c!=0) p++; it->second.push_back(p-str.data()); } } //! Returns the byte offset and size within a file of a fragment given the array of //! line offsets and the start and end line of the fragment. auto getFragmentLocation(const LineOffsets &lineOffsets, size_t startLine,size_t endLine) -> std::tuple<size_t,size_t> { assert(startLine > 0); assert(startLine <= endLine); const size_t startLineOffset = lineOffsets[std::min(startLine-1,lineOffsets.size()-1)]; const size_t endLineOffset = lineOffsets[std::min(endLine, lineOffsets.size()-1)]; assert(startLineOffset <= endLineOffset); const size_t fragmentSize = endLineOffset-startLineOffset; return std::tie(startLineOffset,fragmentSize); }; //! Shrinks buffer \a str which should hold the contents of \a fileName to the //! fragment starting a line \a startLine and ending at line \a endLine void shrinkBuffer(std::string &str,const QCString &fileName,size_t startLine,size_t endLine) { // compute offsets from start for each line compileLineOffsets(fileName,str); auto it = m_lineOffsets.find(fileName.str()); assert(it!=m_lineOffsets.end()); const LineOffsets &lineOffsets = it->second; auto [ startLineOffset, fragmentSize] = getFragmentLocation(lineOffsets,startLine,endLine); //printf("%s: new file [%zu-%zu]->[%zu-%zu] size=%zu\n", // qPrint(fileName),startLine,endLine,startLineOffset,endLineOffset,fragmentSize); str.erase(0,startLineOffset); str.resize(fragmentSize); } //! Reads the fragment start at byte offset \a startOffset of file \a fileName into buffer \a str. //! Result will be a null terminated. If size==0 the whole file will be read and startOffset is ignored. //! If size>0, size bytes will be read. void readFragmentFromFile(std::string &str,const QCString &fileName,size_t startOffset,size_t size=0) { std::ifstream ifs = Portable::openInputStream(fileName,true,true); if (size==0) { startOffset=0; size = static_cast<size_t>(ifs.tellg()); } ifs.seekg(startOffset, std::ios::beg); str.resize(size); ifs.read(str.data(), size); } FilterCache() : m_endPos(0) { } std::unordered_map<std::string,FilterCacheItem> m_cache; std::unordered_map<std::string,LineOffsets> m_lineOffsets; std::mutex m_mutex; size_t m_endPos; }; FilterCache &FilterCache::instance() { static FilterCache theInstance; return theInstance; } //----------------------------------------- /*! Reads a fragment of code from file \a fileName starting at * line \a startLine and ending at line \a endLine (inclusive). The fragment is * stored in \a result. If FALSE is returned the code fragment could not be * found. * * The file is scanned for a opening bracket ('{') from \a startLine onward * The line actually containing the bracket is returned via startLine. * The file is scanned for a closing bracket ('}') from \a endLine backward. * The line actually containing the bracket is returned via endLine. * Note that for VHDL code the bracket search is not done. */ bool readCodeFragment(const QCString &fileName,bool isMacro, int &startLine,int &endLine,QCString &result) { bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); QCString filter = getFileFilter(fileName,TRUE); bool usePipe = !filter.isEmpty() && filterSourceFiles; int tabSize = Config_getInt(TAB_SIZE); SrcLangExt lang = getLanguageFromFileName(fileName); const int blockSize = 4096; std::string str; FilterCache::instance().getFileContents(fileName, static_cast<size_t>(std::max(1,startLine)), static_cast<size_t>(std::max({1,startLine,endLine})),str); //printf("readCodeFragment(%s,startLine=%d,endLine=%d)=\n[[[\n%s]]]\n",qPrint(fileName),startLine,endLine,qPrint(str)); bool found = lang==SrcLangExt::VHDL || lang==SrcLangExt::Python || lang==SrcLangExt::Fortran || isMacro; // for VHDL, Python, and Fortran no bracket search is possible char *p=str.data(); if (p && *p) { char c=0; int col=0; int lineNr=startLine; // skip until the opening bracket or lonely : is found char cn=0; while (*p && !found) { int pc=0; while ((c=*p++)!='{' && c!=':' && c!=0) { //printf("parsing char '%c'\n",c); if (c=='\n') { lineNr++,col=0; } else if (c=='\t') { col+=tabSize - (col%tabSize); } else if (pc=='/' && c=='/') // skip single line comment { while ((c=*p++)!='\n' && c!=0); if (c=='\n') lineNr++,col=0; } else if (pc=='/' && c=='*') // skip C style comment { while (((c=*p++)!='/' || pc!='*') && c!=0) { if (c=='\n') lineNr++,col=0; pc=c; } } else { col++; } pc = c; } if (c==':') { cn=*p++; if (cn!=':') found=TRUE; } else if (c=='{') { found=TRUE; } else if (c==0) { break; } } //printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr); if (found) { // For code with more than one line, // fill the line with spaces until we are at the right column // so that the opening brace lines up with the closing brace if (endLine!=startLine) { QCString spaces; spaces.fill(' ',col); result+=spaces; } // copy until end of line if (c) result+=c; startLine=lineNr; if (c==':') { result+=cn; if (cn=='\n') lineNr++; } char lineStr[blockSize]; do { //printf("reading line %d in range %d-%d\n",lineNr,startLine,endLine); int size_read=0; do { // read up to blockSize-1 non-zero characters int i=0; while ((c=*p) && i<blockSize-1) { lineStr[i++]=c; p++; if (c=='\n') break; // stop at end of the line } lineStr[i]=0; size_read=i; result+=lineStr; // append line to the output } while (size_read == (blockSize-1)); // append more if line does not fit in buffer lineNr++; } while (*p); // strip stuff after closing bracket int newLineIndex = result.findRev('\n'); int braceIndex = result.findRev('}'); if (braceIndex > newLineIndex) { result.resize(static_cast<size_t>(braceIndex+1)); } endLine=lineNr-1; } if (usePipe) { Debug::print(Debug::FilterOutput, 0, "Filter output\n"); Debug::print(Debug::FilterOutput,0,"-------------\n%s\n-------------\n",qPrint(result)); } } QCString encoding = getEncoding(FileInfo(fileName.str())); if (encoding!="UTF-8") { std::string encBuf = result.str(); bool ok = transcodeCharacterStringToUTF8(encBuf,encoding.data()); if (ok) { result = QCString(encBuf); } else { err("failed to transcode characters in code fragment in file %s lines %d to %d, from input encoding %s to UTF-8\n", qPrint(fileName),startLine,endLine,qPrint(encoding)); } } if (!result.isEmpty() && result.at(result.length()-1)!='\n') result += "\n"; //printf("readCodeFragment(%d-%d)=%s\n",startLine,endLine,qPrint(result)); return found; } QCString DefinitionImpl::getSourceFileBase() const { ASSERT(m_impl->def->definitionType()!=Definition::TypeFile); // file overloads this method QCString fn; bool sourceBrowser = Config_getBool(SOURCE_BROWSER); if (sourceBrowser && m_impl->body && m_impl->body->startLine!=-1 && m_impl->body->fileDef) { fn = m_impl->body->fileDef->getSourceFileBase(); } return fn; } QCString DefinitionImpl::getSourceAnchor() const { const int maxAnchorStrLen = 20; char anchorStr[maxAnchorStrLen]; anchorStr[0]='\0'; if (m_impl->body && m_impl->body->startLine!=-1) { if (Htags::useHtags) { qsnprintf(anchorStr,maxAnchorStrLen,"L%d",m_impl->body->defLine); } else { qsnprintf(anchorStr,maxAnchorStrLen,"l%05d",m_impl->body->defLine); } } return anchorStr; } /*! Write a reference to the source code defining this definition */ void DefinitionImpl::writeSourceDef(OutputList &ol) const { //printf("DefinitionImpl::writeSourceRef %d %p\n",bodyLine,bodyDef); QCString fn = getSourceFileBase(); if (!fn.isEmpty()) { QCString refText = theTranslator->trDefinedAtLineInSourceFile(); int lineMarkerPos = refText.find("@0"); int fileMarkerPos = refText.find("@1"); if (lineMarkerPos!=-1 && fileMarkerPos!=-1) // should always pass this. { QCString lineStr; lineStr.sprintf("%d",m_impl->body->defLine); QCString anchorStr = getSourceAnchor(); ol.startParagraph("definition"); if (lineMarkerPos<fileMarkerPos) // line marker before file marker { // write text left from linePos marker ol.parseText(refText.left(lineMarkerPos)); ol.writeObjectLink(QCString(),fn,anchorStr,lineStr); // write text between markers ol.parseText(refText.mid(lineMarkerPos+2,fileMarkerPos-lineMarkerPos-2)); // write file link ol.writeObjectLink(QCString(),fn,QCString(),m_impl->body->fileDef->name()); // write text right from file marker ol.parseText(refText.right(refText.length()-static_cast<size_t>(fileMarkerPos)-2)); } else // file marker before line marker { // write text left from file marker ol.parseText(refText.left(fileMarkerPos)); // write file link ol.writeObjectLink(QCString(),fn,QCString(),m_impl->body->fileDef->name()); // write text between markers ol.parseText(refText.mid(fileMarkerPos+2,lineMarkerPos-fileMarkerPos-2)); // write line link ol.writeObjectLink(QCString(),fn,anchorStr,lineStr); // write text right from linePos marker ol.parseText(refText.right(refText.length()-static_cast<size_t>(lineMarkerPos)-2)); } ol.endParagraph(); } else { err("translation error: invalid markers in trDefinedAtLineInSourceFile()\n"); } } } void DefinitionImpl::setBodySegment(int defLine, int bls,int ble) { if (!m_impl->body) m_impl->body = make_DeepCopyUnique<BodyInfo>(); m_impl->body->defLine = defLine; m_impl->body->startLine = bls; m_impl->body->endLine = ble; } void DefinitionImpl::setBodyDef(const FileDef *fd) { if (!m_impl->body) m_impl->body = make_DeepCopyUnique<BodyInfo>(); m_impl->body->fileDef=fd; } bool DefinitionImpl::hasSources() const { return m_impl->body && m_impl->body->startLine!=-1 && m_impl->body->endLine>=m_impl->body->startLine && m_impl->body->fileDef; } /*! Write code of this definition into the documentation */ void DefinitionImpl::writeInlineCode(OutputList &ol,const QCString &scopeName) const { const MemberDef *thisMd = nullptr; if (m_impl->def->definitionType()==Definition::TypeMember) { thisMd = toMemberDef(m_impl->def); } bool inlineSources = thisMd && thisMd->hasInlineSource(); //printf("Source Fragment %s: %d-%d\n",qPrint(name()), // m_impl->body->startLine,m_impl->body->endLine); if (inlineSources && hasSources()) { ol.pushGeneratorState(); QCString codeFragment; bool isMacro = thisMd && thisMd->memberType()==MemberType::Define; int actualStart=m_impl->body->startLine,actualEnd=m_impl->body->endLine; if (readCodeFragment(m_impl->body->fileDef->absFilePath(),isMacro, actualStart,actualEnd,codeFragment) ) { //printf("Adding code fragment '%s' ext='%s' range=%d-%d\n", // qPrint(codeFragment),qPrint(m_impl->defFileExt),actualStart,actualEnd); auto intf = Doxygen::parserManager->getCodeParser(m_impl->defFileExt); intf->resetCodeParserState(); //printf("Read:\n'%s'\n\n",qPrint(codeFragment)); auto &codeOL = ol.codeGenerators(); codeOL.startCodeFragment("DoxyCode"); intf->parseCode(codeOL, // codeOutIntf scopeName, // scope codeFragment, // input m_impl->lang, // lang Config_getBool(STRIP_CODE_COMMENTS), FALSE, // isExample QCString(), // exampleName m_impl->body->fileDef, // fileDef actualStart, // startLine actualEnd, // endLine TRUE, // inlineFragment thisMd, // memberDef TRUE // show line numbers ); codeOL.endCodeFragment("DoxyCode"); } ol.popGeneratorState(); } } static inline MemberVector refMapToVector(const std::unordered_map<std::string,MemberDef *> &map) { // convert map to a vector of values MemberVector result; std::transform(map.begin(),map.end(), // iterate over map std::back_inserter(result), // add results to vector [](const auto &item) { return item.second; } // extract value to add from map Key,Value pair ); // and sort it std::stable_sort(result.begin(),result.end(), [](const auto &m1,const auto &m2) { return genericCompareMembers(m1,m2)<0; }); return result; } /*! Write a reference to the source code fragments in which this * definition is used. */ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const QCString &scopeName, const QCString &text,const std::unordered_map<std::string,MemberDef *> &membersMap, bool /*funcOnly*/) const { if (!membersMap.empty()) { auto members = refMapToVector(membersMap); auto replaceFunc = [this,&members,scopeName,&ol](size_t entryIndex) { bool sourceBrowser = Config_getBool(SOURCE_BROWSER); bool refLinkSource = Config_getBool(REFERENCES_LINK_SOURCE); const MemberDef *md=members[entryIndex]; if (md) { QCString scope=md->getScopeString(); QCString name=md->name(); //printf("class=%p scope=%s scopeName=%s\n",md->getClassDef(),qPrint(scope),scopeName); if (!scope.isEmpty() && scope!=scopeName) { name.prepend(scope+getLanguageSpecificSeparator(m_impl->lang)); } if (!md->isObjCMethod() && (md->isFunction() || md->isSlot() || md->isPrototype() || md->isSignal() ) ) { name+="()"; } if (sourceBrowser && !(md->isLinkable() && !refLinkSource) && md->getStartBodyLine()!=-1 && md->getBodyDef() ) { const int maxLineNrStr = 10; char anchorStr[maxLineNrStr]; qsnprintf(anchorStr,maxLineNrStr,"l%05d",md->getStartBodyLine()); //printf("Write object link to %s\n",qPrint(md->getBodyDef()->getSourceFileBase())); ol.writeObjectLink(QCString(),md->getBodyDef()->getSourceFileBase(),anchorStr,name); } else if (md->isLinkable()) { ol.writeObjectLink(md->getReference(), md->getOutputFileBase(), md->anchor(),name); } else { ol.docify(name); } } }; ol.startParagraph("reference"); ol.parseText(text); ol.docify(" "); writeMarkerList(ol, theTranslator->trWriteList(static_cast<int>(members.size())).str(), members.size(), replaceFunc); ol.writeString("."); ol.endParagraph(); } } void DefinitionImpl::writeSourceReffedBy(OutputList &ol,const QCString &scopeName) const { _writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),m_impl->sourceRefByDict,FALSE); } void DefinitionImpl::writeSourceRefs(OutputList &ol,const QCString &scopeName) const { _writeSourceRefList(ol,scopeName,theTranslator->trReferences(),m_impl->sourceRefsDict,TRUE); } bool DefinitionImpl::hasSourceReffedBy() const { return !m_impl->sourceRefByDict.empty(); } bool DefinitionImpl::hasSourceRefs() const { return !m_impl->sourceRefsDict.empty(); } bool DefinitionImpl::hasDocumentation() const { bool extractAll = Config_getBool(EXTRACT_ALL); //bool sourceBrowser = Config_getBool(SOURCE_BROWSER); bool hasDocs = (m_impl->details && !m_impl->details->doc.isEmpty()) || // has detailed docs (m_impl->brief && !m_impl->brief->doc.isEmpty()) || // has brief description (m_impl->inbodyDocs && !m_impl->inbodyDocs->doc.isEmpty()) || // has inbody docs extractAll //|| // extract everything // (sourceBrowser && m_impl->body && // m_impl->body->startLine!=-1 && m_impl->body->fileDef) ; // link to definition return hasDocs; } bool DefinitionImpl::hasUserDocumentation() const { bool hasDocs = (m_impl->details && !m_impl->details->doc.isEmpty()) || (m_impl->brief && !m_impl->brief->doc.isEmpty()) || (m_impl->inbodyDocs && !m_impl->inbodyDocs->doc.isEmpty()); return hasDocs; } void DefinitionImpl::addSourceReferencedBy(MemberDef *md,const QCString &sourceRefName) { if (md) { m_impl->sourceRefByDict.emplace(sourceRefName.str(),md); } } void DefinitionImpl::addSourceReferences(MemberDef *md,const QCString &sourceRefName) { if (md) { m_impl->sourceRefsDict.emplace(sourceRefName.str(),md); } } const Definition *DefinitionImpl::findInnerCompound(const QCString &) const { return nullptr; } void DefinitionImpl::addInnerCompound(Definition *) { err("DefinitionImpl::addInnerCompound() called\n"); } static std::recursive_mutex g_qualifiedNameMutex; QCString DefinitionImpl::qualifiedName() const { std::lock_guard<std::recursive_mutex> lock(g_qualifiedNameMutex); if (!m_impl->qualifiedName.isEmpty()) { return m_impl->qualifiedName; } //printf("start %s::qualifiedName() localName=%s\n",qPrint(name()),qPrint(m_impl->localName)); if (m_impl->outerScope==nullptr) { if (m_impl->localName=="<globalScope>") { return ""; } else { return m_impl->localName; } } if (m_impl->outerScope->name()=="<globalScope>") { m_impl->qualifiedName = m_impl->localName; } else { m_impl->qualifiedName = m_impl->outerScope->qualifiedName()+ getLanguageSpecificSeparator(getLanguage())+ m_impl->localName; } //printf("end %s::qualifiedName()=%s\n",qPrint(name()),qPrint(m_impl->qualifiedName)); //count--; return m_impl->qualifiedName; } void DefinitionImpl::setOuterScope(Definition *d) { std::lock_guard<std::recursive_mutex> lock(g_qualifiedNameMutex); //printf("%s::setOuterScope(%s)\n",qPrint(name()),d?qPrint(d->name()):"<none>"); Definition *p = m_impl->outerScope; bool found=false; // make sure that we are not creating a recursive scope relation. while (p && !found) { found = (p==d); p = p->getOuterScope(); } if (!found) { m_impl->qualifiedName.clear(); // flush cached scope name m_impl->outerScope = d; } m_impl->hidden = m_impl->hidden || d->isHidden(); assert(m_impl->def!=m_impl->outerScope); } const QCString &DefinitionImpl::localName() const { return m_impl->localName; } void DefinitionImpl::makePartOfGroup(GroupDef *gd) { m_impl->partOfGroups.push_back(gd); } void DefinitionImpl::setRefItems(const RefItemVector &sli) { m_impl->xrefListItems.insert(m_impl->xrefListItems.end(), sli.cbegin(), sli.cend()); } void DefinitionImpl::mergeRefItems(Definition *d) { auto otherXrefList = d->xrefListItems(); // append vectors m_impl->xrefListItems.reserve(m_impl->xrefListItems.size()+otherXrefList.size()); m_impl->xrefListItems.insert (m_impl->xrefListItems.end(), otherXrefList.begin(),otherXrefList.end()); // sort results on itemId std::stable_sort(m_impl->xrefListItems.begin(),m_impl->xrefListItems.end(), [](RefItem *left,RefItem *right) { return left->id() <right->id() || (left->id()==right->id() && left->list()->listName() < right->list()->listName()); }); // filter out duplicates auto last = std::unique(m_impl->xrefListItems.begin(),m_impl->xrefListItems.end(), [](const RefItem *left,const RefItem *right) { return left->id()==right->id() && left->list()->listName()==right->list()->listName(); }); m_impl->xrefListItems.erase(last, m_impl->xrefListItems.end()); } int DefinitionImpl::_getXRefListId(const QCString &listName) const { for (const RefItem *item : m_impl->xrefListItems) { if (item->list()->listName()==listName) { return item->id(); } } return -1; } const RefItemVector &DefinitionImpl::xrefListItems() const { return m_impl->xrefListItems; } QCString DefinitionImpl::pathFragment() const { QCString result; if (m_impl->outerScope && m_impl->outerScope!=Doxygen::globalScope) { result = m_impl->outerScope->pathFragment(); } if (m_impl->def->isLinkable()) { if (!result.isEmpty()) result+="/"; if (m_impl->def->definitionType()==Definition::TypeGroup && !toGroupDef(m_impl->def)->groupTitle().isEmpty()) { result+=toGroupDef(m_impl->def)->groupTitle(); } else if (m_impl->def->definitionType()==Definition::TypePage && toPageDef(m_impl->def)->hasTitle()) { result+=toPageDef(m_impl->def)->title(); } else { result+=m_impl->localName; } } else { result+=m_impl->localName; } return result; } //---------------------------------------------------------------------------------------- // TODO: move to htmlgen /*! Returns the string used in the footer for $navpath when * GENERATE_TREEVIEW is enabled */ QCString DefinitionImpl::navigationPathAsString() const { QCString result; Definition *outerScope = getOuterScope(); QCString locName = localName(); if (outerScope && outerScope!=Doxygen::globalScope) { result+=outerScope->navigationPathAsString(); } else if (m_impl->def->definitionType()==Definition::TypeFile && toFileDef(m_impl->def)->getDirDef()) { result+=(toFileDef(m_impl->def))->getDirDef()->navigationPathAsString(); } result+="<li class=\"navelem\">"; if (m_impl->def->isLinkableInProject()) { QCString fn = m_impl->def->getOutputFileBase(); addHtmlExtensionIfMissing(fn); if (m_impl->def->definitionType()==Definition::TypeGroup && !toGroupDef(m_impl->def)->groupTitle().isEmpty()) { result+="<a class=\"el\" href=\"$relpath^"+fn+"\">"+ convertToHtml(toGroupDef(m_impl->def)->groupTitle())+"</a>"; } else if (m_impl->def->definitionType()==Definition::TypePage && toPageDef(m_impl->def)->hasTitle()) { result+="<a class=\"el\" href=\"$relpath^"+fn+"\">"+ convertToHtml((toPageDef(m_impl->def))->title())+"</a>"; } else if (m_impl->def->definitionType()==Definition::TypeClass) { QCString name = locName; if (name.endsWith("-p")) { name = name.left(name.length()-2); } result+="<a class=\"el\" href=\"$relpath^"+fn; if (!m_impl->def->anchor().isEmpty()) result+="#"+m_impl->def->anchor(); result+="\">"+convertToHtml(name)+"</a>"; } else { result+="<a class=\"el\" href=\"$relpath^"+fn+"\">"+ convertToHtml(locName)+"</a>"; } } else { result+="<b>"+convertToHtml(locName)+"</b>"; } result+="</li>"; return result; } // TODO: move to htmlgen void DefinitionImpl::writeNavigationPath(OutputList &ol) const { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); QCString navPath; navPath += "<div id=\"nav-path\" class=\"navpath\">\n" " <ul>\n"; navPath += navigationPathAsString(); navPath += " </ul>\n" "</div>\n"; ol.writeNavigationPath(navPath); ol.popGeneratorState(); } void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const { if (m_impl->sectionRefs.empty()) return; ol.writeLocalToc(m_impl->sectionRefs,localToc); } //---------------------------------------------------------------------------------------- const SectionRefs &DefinitionImpl::getSectionRefs() const { return m_impl->sectionRefs; } QCString DefinitionImpl::symbolName() const { return m_impl->symbolName; } //---------------------- QCString DefinitionImpl::documentation() const { return m_impl->details ? m_impl->details->doc : QCString(""); } int DefinitionImpl::docLine() const { return m_impl->details ? m_impl->details->line : m_impl->brief ? m_impl->brief->line : 1; } QCString DefinitionImpl::docFile() const { if (m_impl->details && !m_impl->details->file.isEmpty()) return m_impl->details->file; else if (m_impl->brief && !m_impl->brief->file.isEmpty()) return m_impl->brief->file; else return "<" + m_impl->name + ">"; } //---------------------------------------------------------------------------- // 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; } //---------------------------------------------------------------------------- // some quasi intelligent brief description abbreviator :^) static QCString abbreviate(const QCString &s,const QCString &name) { QCString scopelessName=name; int i=scopelessName.findRev("::"); if (i!=-1) scopelessName=scopelessName.mid(i+2); QCString result=s; result=result.stripWhiteSpace(); // strip trailing . if (!result.isEmpty() && result.at(result.length()-1)=='.') result=result.left(result.length()-1); // strip any predefined prefix const StringVector &briefDescAbbrev = Config_getList(ABBREVIATE_BRIEF); for (const auto &p : briefDescAbbrev) { QCString str = substitute(p.c_str(),"$name",scopelessName); // replace $name with entity name str += " "; stripWord(result,str); } // capitalize first word if (!result.isEmpty()) { char c=result[0]; if (c>='a' && c<='z') c+='A'-'a'; result[0]=c; } return result; } //---------------------- QCString DefinitionImpl::briefDescription(bool abbr) const { //printf("%s::briefDescription(%d)='%s'\n",qPrint(name()),abbr,m_impl->brief?qPrint(m_impl->brief->doc):"<none>"); return m_impl->brief ? (abbr ? abbreviate(m_impl->brief->doc,m_impl->def->displayName()) : m_impl->brief->doc) : QCString(""); } void DefinitionImpl::computeTooltip() { if (m_impl->brief && m_impl->brief->tooltip.isEmpty() && !m_impl->brief->doc.isEmpty()) { const MemberDef *md = m_impl->def->definitionType()==Definition::TypeMember ? toMemberDef(m_impl->def) : nullptr; const Definition *scope = m_impl->def->definitionType()==Definition::TypeMember ? m_impl->def->getOuterScope() : m_impl->def; m_impl->brief->tooltip = parseCommentAsText(scope,md, m_impl->brief->doc, m_impl->brief->file, m_impl->brief->line); } } QCString DefinitionImpl::briefDescriptionAsTooltip() const { return m_impl->brief ? m_impl->brief->tooltip : QCString(); } int DefinitionImpl::briefLine() const { return m_impl->brief ? m_impl->brief->line : 1; } QCString DefinitionImpl::briefFile() const { return m_impl->brief && !m_impl->brief->file.isEmpty() ? m_impl->brief->file : QCString("<"+m_impl->name+">"); } //---------------------- QCString DefinitionImpl::inbodyDocumentation() const { return m_impl->inbodyDocs ? m_impl->inbodyDocs->doc : QCString(""); } int DefinitionImpl::inbodyLine() const { return m_impl->inbodyDocs ? m_impl->inbodyDocs->line : 1; } QCString DefinitionImpl::inbodyFile() const { return m_impl->inbodyDocs && !m_impl->inbodyDocs->file.isEmpty() ? m_impl->inbodyDocs->file : QCString("<"+m_impl->name+">"); } //---------------------- QCString DefinitionImpl::getDefFileName() const { return m_impl->defFileName; } QCString DefinitionImpl::getDefFileExtension() const { return m_impl->defFileExt; } bool DefinitionImpl::isHidden() const { return m_impl->hidden; } bool DefinitionImpl::isVisibleInProject() const { return m_impl->def->isLinkableInProject() && !m_impl->hidden; } bool DefinitionImpl::isVisible() const { return m_impl->def->isLinkable() && !m_impl->hidden; } bool DefinitionImpl::isArtificial() const { return m_impl->isArtificial; } bool DefinitionImpl::isExported() const { return m_impl->isExported; } QCString DefinitionImpl::getReference() const { return m_impl->ref; } bool DefinitionImpl::isReference() const { return !m_impl->ref.isEmpty(); } int DefinitionImpl::getStartDefLine() const { return m_impl->body ? m_impl->body->defLine : -1; } int DefinitionImpl::getStartBodyLine() const { return m_impl->body ? m_impl->body->startLine : -1; } int DefinitionImpl::getEndBodyLine() const { return m_impl->body ? m_impl->body->endLine : -1; } const FileDef *DefinitionImpl::getBodyDef() const { return m_impl->body ? m_impl->body->fileDef : nullptr; } const GroupList &DefinitionImpl::partOfGroups() const { return m_impl->partOfGroups; } bool DefinitionImpl::isLinkableViaGroup() const { for (const auto &gd : partOfGroups()) { if (gd->isLinkable()) return true; } return false; } Definition *DefinitionImpl::getOuterScope() const { return m_impl->outerScope; } static std::mutex g_memberReferenceMutex; const MemberVector &DefinitionImpl::getReferencesMembers() const { std::lock_guard<std::mutex> lock(g_memberReferenceMutex); if (m_impl->referencesMembers.empty() && !m_impl->sourceRefsDict.empty()) { m_impl->referencesMembers = refMapToVector(m_impl->sourceRefsDict); } return m_impl->referencesMembers; } const MemberVector &DefinitionImpl::getReferencedByMembers() const { std::lock_guard<std::mutex> lock(g_memberReferenceMutex); if (m_impl->referencedByMembers.empty() && !m_impl->sourceRefByDict.empty()) { m_impl->referencedByMembers = refMapToVector(m_impl->sourceRefByDict); } return m_impl->referencedByMembers; } void DefinitionImpl::mergeReferences(const Definition *other) { const DefinitionImpl *defImpl = other->toDefinitionImpl_(); if (defImpl) { for (const auto &kv : defImpl->m_impl->sourceRefsDict) { auto it = m_impl->sourceRefsDict.find(kv.first); if (it != m_impl->sourceRefsDict.end()) { m_impl->sourceRefsDict.insert(kv); } } } } void DefinitionImpl::mergeReferencedBy(const Definition *other) { const DefinitionImpl *defImpl = other->toDefinitionImpl_(); if (defImpl) { for (const auto &kv : defImpl->m_impl->sourceRefByDict) { auto it = m_impl->sourceRefByDict.find(kv.first); if (it != m_impl->sourceRefByDict.end()) { m_impl->sourceRefByDict.emplace(kv.first,kv.second); } } } } void DefinitionImpl::setReference(const QCString &r) { m_impl->ref=r; } SrcLangExt DefinitionImpl::getLanguage() const { return m_impl->lang; } void DefinitionImpl::setHidden(bool b) { m_impl->hidden = m_impl->hidden || b; } void DefinitionImpl::setArtificial(bool b) { m_impl->isArtificial = b; } void DefinitionImpl::setExported(bool b) { m_impl->isExported = b; } void DefinitionImpl::setLocalName(const QCString &name) { m_impl->localName=name; } void DefinitionImpl::setLanguage(SrcLangExt lang) { m_impl->lang=lang; } void DefinitionImpl::_setSymbolName(const QCString &name) { m_impl->symbolName=name; } QCString DefinitionImpl::_symbolName() const { return m_impl->symbolName; } bool DefinitionImpl::hasBriefDescription() const { bool briefMemberDesc = Config_getBool(BRIEF_MEMBER_DESC); return !briefDescription().isEmpty() && briefMemberDesc; } QCString DefinitionImpl::externalReference(const QCString &relPath) const { QCString ref = getReference(); if (!ref.isEmpty()) { auto it = Doxygen::tagDestinationMap.find(ref.str()); if (it!=Doxygen::tagDestinationMap.end()) { QCString result(it->second); size_t l = result.length(); if (!relPath.isEmpty() && l>0 && result.at(0)=='.') { // relative path -> prepend relPath. result.prepend(relPath); l+=relPath.length(); } if (l>0 && result.at(l-1)!='/') result+='/'; return result; } } return relPath; } const QCString &DefinitionImpl::name() const { return m_impl->name; } bool DefinitionImpl::isAnonymous() const { return m_impl->isAnonymous; } int DefinitionImpl::getDefLine() const { return m_impl->defLine; } int DefinitionImpl::getDefColumn() const { return m_impl->defColumn; } void DefinitionImpl::writeQuickMemberLinks(OutputList &,const MemberDef *) const { } void DefinitionImpl::writeSummaryLinks(OutputList &) const { } //--------------------------------------------------------------------------------- DefinitionAliasImpl::DefinitionAliasImpl(Definition *def,const Definition *scope, const Definition *alias) : m_def(def), m_scope(scope), m_symbolName(alias->_symbolName()) { } DefinitionAliasImpl::~DefinitionAliasImpl() { } void DefinitionAliasImpl::init() { //printf("%s::addToMap(%s)\n",qPrint(name()),qPrint(alias->name())); addToMap(m_symbolName,m_def); if (m_scope==nullptr) { m_qualifiedName = m_def->localName(); } else { m_qualifiedName = m_scope->qualifiedName()+ getLanguageSpecificSeparator(m_scope->getLanguage())+ m_def->localName(); } } void DefinitionAliasImpl::deinit() { removeFromMap(m_symbolName,m_def); } QCString DefinitionAliasImpl::qualifiedName() const { return m_qualifiedName; } const QCString &DefinitionAliasImpl::name() const { return m_qualifiedName; } //--------------------------------------------------------------------------------- Definition *toDefinition(DefinitionMutable *dm) { if (dm==nullptr) return nullptr; return dm->toDefinition_(); } DefinitionMutable *toDefinitionMutable(Definition *d) { if (d==nullptr) return nullptr; return d->toDefinitionMutable_(); }
56,796
C++
.cpp
1,716
28.030303
129
0.637187
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,448
anchor.cpp
doxygen_doxygen/src/anchor.cpp
/****************************************************************************** * * Copyright (C) 1997-2023 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 <mutex> #include <algorithm> #include <string> #include <unordered_map> #include "anchor.h" #include "containers.h" #include "utf8.h" #include "config.h" struct AnchorGenerator::Private { StringUnorderedSet anchorsUsed; int anchorCount=0; std::mutex mutex; std::unordered_map<std::string,int> idCount; }; AnchorGenerator::AnchorGenerator() : p(std::make_unique<Private>()) {} AnchorGenerator::~AnchorGenerator() = default; AnchorGenerator &AnchorGenerator::instance() { static AnchorGenerator am; return am; } constexpr auto prefix = "autotoc_md"; std::string AnchorGenerator::addPrefixIfNeeded(const std::string &anchor) { if (Config_getEnum(MARKDOWN_ID_STYLE)==MARKDOWN_ID_STYLE_t::GITHUB && (anchor.empty() || anchor.front() == '-' || std::isdigit(anchor.front()))) { return prefix+anchor; } else { return anchor; } } std::string AnchorGenerator::generate(const std::string &label) { std::lock_guard lock(p->mutex); std::string result; auto createDoxygenStyleAnchor = [&]() { // overwrite result with the doxygen style anchor result = prefix+std::to_string(p->anchorCount++); }; auto createGitHubStyleAnchor = [&]() { result.clear(); size_t pos=0; while (pos<label.length()) { uint8_t bytes = getUTF8CharNumBytes(label[pos]); std::string charStr = getUTF8CharAt(label,pos); uint32_t cUnicode = getUnicodeForUTF8CharAt(label,pos); char c = charStr[0]; if (qisspace(c) || c=='-') { result+='-'; } else if (c!='_' && isUTF8PunctuationCharacter(cUnicode)) { // skip punctuation characters } else // normal UTF8 character { result+=convertUTF8ToLower(charStr); } pos+=bytes; } //printf("label='%s' result='%s'\n",qPrint(label),qPrint(result)); if (result.empty()) // fallback use doxygen style anchor { createDoxygenStyleAnchor(); } else { result = addPrefixIfNeeded(result); int &count = p->idCount[result]; // Add end digits if an identical header already exists if (count>0) { result+="-"+std::to_string(count); } count++; } }; switch (Config_getEnum(MARKDOWN_ID_STYLE)) { case MARKDOWN_ID_STYLE_t::DOXYGEN: createDoxygenStyleAnchor(); break; case MARKDOWN_ID_STYLE_t::GITHUB: createGitHubStyleAnchor(); break; } p->anchorsUsed.insert(result); return result; } bool AnchorGenerator::isGenerated(const std::string &anchor) const { std::lock_guard lock(p->mutex); return p->anchorsUsed.find(anchor)!=p->anchorsUsed.end(); } int AnchorGenerator::reserve(const std::string &anchor) { std::lock_guard lock(p->mutex); return p->idCount[anchor]++; } bool AnchorGenerator::looksGenerated(const std::string &anchor) { return Config_getEnum(MARKDOWN_ID_STYLE)==MARKDOWN_ID_STYLE_t::DOXYGEN && QCString(anchor).startsWith("autotoc_md"); }
3,656
C++
.cpp
126
25.103175
80
0.671604
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,449
outputgen.cpp
doxygen_doxygen/src/outputgen.cpp
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 <stdexcept> #include <stdlib.h> #include "doxygen.h" #include "outputgen.h" #include "message.h" #include "portable.h" OutputGenerator::OutputGenerator(const QCString &dir) : m_t(nullptr), m_dir(dir) { //printf("OutputGenerator::OutputGenerator()\n"); } void OutputGenerator::startPlainFile(const QCString &name) { //printf("startPlainFile(%s)\n",qPrint(name)); m_fileName=m_dir+"/"+name; m_file = Portable::fopen(m_fileName.data(),"wb"); if (m_file==nullptr) { term("Could not open file %s for writing\n",qPrint(m_fileName)); } m_t.setFile(m_file); } void OutputGenerator::endPlainFile() { m_t.flush(); m_t.setStream(nullptr); Portable::fclose(m_file); m_fileName.clear(); } QCString OutputGenerator::dir() const { return m_dir; } QCString OutputGenerator::fileName() const { return m_fileName; }
1,510
C++
.cpp
52
26.961538
80
0.701173
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,450
diagram.cpp
doxygen_doxygen/src/diagram.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 <stdlib.h> #include <algorithm> #include "diagram.h" #include "image.h" #include "classdef.h" #include "config.h" #include "message.h" #include "util.h" #include "doxygen.h" #include "portable.h" #include "indexlist.h" #include "classlist.h" #include "textstream.h" #include "growbuf.h" #include "dir.h" //----------------------------------------------------------------------------- class TreeDiagram; class DiagramItem; using DiagramItemList = std::vector<DiagramItem*>; /** Class representing a single node in the built-in class diagram */ class DiagramItem { public: DiagramItem(DiagramItem *p,uint32_t number,const ClassDef *cd, Protection prot,Specifier virt,const QCString &ts); QCString label() const; QCString fileName() const; DiagramItem *parentItem() { return m_parent; } DiagramItemList getChildren() { return m_children; } void move(int dx,int dy) { m_x=static_cast<uint32_t>(m_x+dx); m_y=static_cast<uint32_t>(m_y+dy); } uint32_t xPos() const { return m_x; } uint32_t yPos() const { return m_y; } float xfPos() const { return static_cast<float>(m_x); } float yfPos() const { return static_cast<float>(m_y); } uint32_t avgChildPos() const; uint32_t numChildren() const; void addChild(DiagramItem *di); uint32_t number() const { return m_num; } Protection protection() const { return m_prot; } Specifier virtualness() const { return m_virt; } void putInList() { m_inList=TRUE; } bool isInList() const { return m_inList; } const ClassDef *getClassDef() const { return m_classDef; } private: DiagramItemList m_children; DiagramItem *m_parent; uint32_t m_x = 0; uint32_t m_y = 0; uint32_t m_num; Protection m_prot; Specifier m_virt; QCString m_templSpec; bool m_inList = false; const ClassDef *m_classDef; }; /** Class representing a row in the built-in class diagram */ class DiagramRow { public: using Ptr = std::unique_ptr<DiagramItem>; using Vec = std::vector<Ptr>; using iterator = typename Vec::iterator; using reverse_iterator = typename Vec::reverse_iterator; DiagramRow(TreeDiagram *d,uint32_t l) : m_diagram(d), m_level(l) {} void insertClass(DiagramItem *parent,const ClassDef *cd,bool doBases, Protection prot,Specifier virt,const QCString &ts); uint32_t number() { return m_level; } DiagramItem *item(int index) { return m_items.at(index).get(); } uint32_t numItems() const { return static_cast<uint32_t>(m_items.size()); } iterator begin() { return m_items.begin(); } iterator end() { return m_items.end(); } reverse_iterator rbegin() { return m_items.rbegin(); } reverse_iterator rend() { return m_items.rend(); } private: TreeDiagram *m_diagram; uint32_t m_level; Vec m_items; }; /** Class representing the tree layout for the built-in class diagram. */ class TreeDiagram { public: using Ptr = std::unique_ptr<DiagramRow>; using Vec = std::vector<Ptr>; using iterator = typename Vec::iterator; TreeDiagram(const ClassDef *root,bool doBases); void computeLayout(); uint32_t computeRows(); void moveChildren(DiagramItem *root,int dx); void computeExtremes(uint32_t *labelWidth,uint32_t *xpos); void drawBoxes(TextStream &t,Image *image, bool doBase,bool bitmap, uint32_t baseRows,uint32_t superRows, uint32_t cellWidth,uint32_t cellHeight, QCString relPath="", bool generateMap=TRUE); void drawConnectors(TextStream &t,Image *image, bool doBase,bool bitmap, uint32_t baseRows,uint32_t superRows, uint32_t cellWidth,uint32_t cellheight); DiagramRow *row(int index) { return m_rows.at(index).get(); } uint32_t numRows() const { return static_cast<uint32_t>(m_rows.size()); } DiagramRow *addRow(uint32_t l) { m_rows.push_back(std::make_unique<DiagramRow>(this,l)); return m_rows.back().get(); } iterator begin() { return m_rows.begin(); } iterator end() { return m_rows.end(); } private: bool layoutTree(DiagramItem *root,uint32_t row); Vec m_rows; }; //----------------------------------------------------------------------------- const uint32_t maxTreeWidth = 8; const uint32_t gridWidth = 100; const uint32_t gridHeight = 100; const uint32_t labelHorSpacing = 10; // horizontal distance between labels const uint32_t labelVertSpacing = 32; // vertical distance between labels const uint32_t labelHorMargin = 6; // horiz. spacing between label and box const uint32_t fontHeight = 12; // height of a character static uint32_t protToMask(Protection p) { switch(p) { case Protection::Public: return 0xffffffff; case Protection::Package: // package is not possible! case Protection::Protected: return 0xcccccccc; case Protection::Private: return 0xaaaaaaaa; } return 0; } static uint8_t protToColor(Protection p) { switch(p) { case Protection::Public: return 6; case Protection::Package: // package is not possible! case Protection::Protected: return 5; case Protection::Private: return 4; } return 0; } static QCString protToString(Protection p) { switch(p) { case Protection::Public: return "solid"; case Protection::Package: // package is not possible! case Protection::Protected: return "dashed"; case Protection::Private: return "dotted"; } return QCString(); } static uint32_t virtToMask(Specifier p) { switch(p) { case Specifier::Normal: return 0xffffffff; case Specifier::Virtual: return 0xf0f0f0f0; default: break; } return 0; } static QCString convertToPSString(const QCString &s) { if (s.isEmpty()) return s; GrowBuf growBuf; const char *p=s.data(); char c=0; while ((c=*p++)) { switch (c) { case '(': growBuf.addStr("\\("); break; case ')': growBuf.addStr("\\)"); break; default: growBuf.addChar(c); break; } } growBuf.addChar(0); return growBuf.get(); } // pre: dil is not empty static Protection getMinProtectionLevel(const DiagramItemList &dil) { auto it = dil.begin(); Protection result = Protection::Private; if (it!=dil.end()) { result=(*it)->protection(); for (++it;it!=dil.end();++it) { Protection p=(*it)->protection(); if (p!=result) { if (result==Protection::Protected && p==Protection::Public) result=p; else if (result==Protection::Private) result=p; } } } return result; } static void writeBitmapBox(DiagramItem *di,Image *image, uint32_t x,uint32_t y,uint32_t w,uint32_t h,bool firstRow, bool hasDocs,bool children=FALSE) { uint8_t colFill = hasDocs ? (firstRow ? 8 : 2) : 7; uint8_t colBorder = (firstRow || !hasDocs) ? 1 : 3; uint32_t l = Image::stringLength(di->label()); uint32_t mask=virtToMask(di->virtualness()); image->fillRect(x+1,y+1,w-2,h-2,colFill,mask); image->drawRect(x,y,w,h,colBorder,mask); image->writeString(x+(w-l)/2, y+(h-fontHeight)/2, di->label(),1); if (children) { for (uint32_t i=0;i<5;i++) { image->drawHorzLine(y+h+i-6,x+w-2-i,x+w-2,firstRow?1:3,0xffffffff); } } } static void writeVectorBox(TextStream &t,DiagramItem *di, float x,float y,bool children=FALSE) { if (di->virtualness()==Specifier::Virtual) t << "dashed\n"; t << " (" << convertToPSString(di->label()) << ") " << x << " " << y << " box\n"; if (children) t << x << " " << y << " mark\n"; if (di->virtualness()==Specifier::Virtual) t << "solid\n"; } static void writeMapArea(TextStream &t,const ClassDef *cd,QCString relPath, uint32_t x,uint32_t y,uint32_t w,uint32_t h) { if (cd->isLinkable()) { QCString ref=cd->getReference(); t << "<area "; if (!ref.isEmpty()) { t << externalLinkTarget(true); } t << "href=\""; t << externalRef(relPath,ref,TRUE); QCString fn = cd->getOutputFileBase(); addHtmlExtensionIfMissing(fn); t << fn; if (!cd->anchor().isEmpty()) { t << "#" << cd->anchor(); } t << "\" "; QCString tooltip = cd->briefDescriptionAsTooltip(); if (!tooltip.isEmpty()) { t << "title=\"" << convertToHtml(tooltip) << "\" "; } t << "alt=\"" << convertToXML(cd->displayName()); t << "\" shape=\"rect\" coords=\"" << x << "," << y << ","; t << (x+w) << "," << (y+h) << "\"/>\n"; } } //----------------------------------------------------------------------------- DiagramItem::DiagramItem(DiagramItem *p,uint32_t number,const ClassDef *cd, Protection pr,Specifier vi,const QCString &ts) : m_parent(p), m_num(number), m_prot(pr), m_virt(vi), m_templSpec(ts), m_classDef(cd) { } QCString DiagramItem::label() const { QCString result; if (!m_templSpec.isEmpty()) { // we use classDef->name() here and not displayName() in order // to get the name used in the inheritance relation. QCString n = m_classDef->name(); if (n.endsWith("-p")) { n = n.left(n.length()-2); } result=insertTemplateSpecifierInScope(n,m_templSpec); } else { result=m_classDef->displayName(); } if (Config_getBool(HIDE_SCOPE_NAMES)) result=stripScope(result); return result; } QCString DiagramItem::fileName() const { return m_classDef->getOutputFileBase(); } uint32_t DiagramItem::avgChildPos() const { DiagramItem *di = nullptr; size_t c=m_children.size(); if (c==0) // no children -> don't move return xPos(); if ((di=m_children.front())->isInList()) // children should be in a list return di->xPos(); if (c&1) // odd number of children -> get pos of middle child return m_children.at(c/2)->xPos(); else // even number of children -> get middle of most middle children return (m_children.at(c/2-1)->xPos()+m_children.at(c/2)->xPos())/2; } uint32_t DiagramItem::numChildren() const { return static_cast<uint32_t>(m_children.size()); } void DiagramItem::addChild(DiagramItem *di) { m_children.push_back(di); } //--------------------------------------------------------------------------- void DiagramRow::insertClass(DiagramItem *parent,const ClassDef *cd,bool doBases, Protection prot,Specifier virt,const QCString &ts) { auto di = std::make_unique<DiagramItem>(parent, m_diagram->row(m_level)->numItems(), cd,prot,virt,ts); DiagramItem *di_ptr = di.get(); if (parent) parent->addChild(di_ptr); di->move(static_cast<int>(m_items.size()*gridWidth),static_cast<int>(m_level*gridHeight)); m_items.push_back(std::move(di)); int count=0; for (const auto &bcd : doBases ? cd->baseClasses() : cd->subClasses()) { /* there are base/sub classes */ ClassDef *ccd=bcd.classDef; if (ccd && ccd->isVisibleInHierarchy()) count++; } if (count>0 && (prot!=Protection::Private || !doBases)) { DiagramRow *row=nullptr; if (m_diagram->numRows()<=m_level+1) /* add new row */ { row=m_diagram->addRow(m_level+1); } else /* get next row */ { row=m_diagram->row(m_level+1); } for (const auto &bcd : doBases ? cd->baseClasses() : cd->subClasses()) { ClassDef *ccd=bcd.classDef; if (ccd && ccd->isVisibleInHierarchy()) { row->insertClass(di_ptr,ccd,doBases,bcd.prot, doBases ? bcd.virt : Specifier::Normal, doBases ? bcd.templSpecifiers : QCString()); } } } } //--------------------------------------------------------------------------- TreeDiagram::TreeDiagram(const ClassDef *root,bool doBases) { auto row = std::make_unique<DiagramRow>(this,0); DiagramRow *row_ptr = row.get(); m_rows.push_back(std::move(row)); row_ptr->insertClass(nullptr,root,doBases,Protection::Public,Specifier::Normal,QCString()); } void TreeDiagram::moveChildren(DiagramItem *root,int dx) { for (const auto &di : root->getChildren()) { di->move(dx,0); moveChildren(di,dx); } } bool TreeDiagram::layoutTree(DiagramItem *root,uint32_t r) { bool moved=FALSE; //printf("layoutTree(%s,%d)\n",qPrint(root->label()),r); if (root->numChildren()>0) { auto children = root->getChildren(); uint32_t pPos=root->xPos(); uint32_t cPos=root->avgChildPos(); if (pPos>cPos) // move children { const auto &row=m_rows.at(r+1); //printf("Moving children %d-%d in row %d\n", // dil->getFirst()->number(),row->count()-1,r+1); for (uint32_t k=children.front()->number();k<row->numItems();k++) { row->item(k)->move(static_cast<int>(pPos-cPos),0); } moved=TRUE; } else if (pPos<cPos) // move parent { const auto &row=m_rows.at(r); //printf("Moving parents %d-%d in row %d\n", // root->number(),row->count()-1,r); for (uint32_t k=root->number();k<row->numItems();k++) { row->item(k)->move(static_cast<int>(cPos-pPos),0); } moved=TRUE; } // recurse to children auto it = children.begin(); for (;it!=children.end() && !moved && !(*it)->isInList();++it) { moved = layoutTree(*it,r+1); } } return moved; } void TreeDiagram::computeLayout() { auto it = m_rows.begin(); while (it!=m_rows.end() && (*it)->numItems()<maxTreeWidth) ++it; if (it!=m_rows.end()) { const auto &row = *it; //printf("computeLayout() list row at %d\n",row->number()); DiagramItem *opi=nullptr; int delta=0; bool first=TRUE; for (const auto &di : *row) { DiagramItem *pi=di->parentItem(); if (pi==opi && !first) { delta-=gridWidth; } first = pi!=opi; opi=pi; di->move(delta,0); // collapse all items in the same // list (except the first) di->putInList(); } } // re-organize the diagram items DiagramItem *root=m_rows.front()->item(0); while (layoutTree(root,0)) { } // move first items of the lists if (it!=m_rows.end()) { const auto &row = *it; auto rit = row->begin(); while (rit!=row->end()) { DiagramItem *pi=(*rit)->parentItem(); if (pi->numChildren()>1) { (*rit)->move(gridWidth,0); while (rit!=row->end() && (*rit)->parentItem()==pi) { ++rit; } } else { ++rit; } } } } uint32_t TreeDiagram::computeRows() { //printf("TreeDiagram::computeRows()=%d\n",count()); uint32_t count=0; auto it = m_rows.begin(); while (it!=m_rows.end() && !(*it)->item(0)->isInList()) { ++it; ++count; } //printf("count=%d row=%p\n",count,row); if (it!=m_rows.end()) { const auto &row = *it; uint32_t maxListLen=0; uint32_t curListLen=0; DiagramItem *opi=nullptr; for (const auto &di : *row) // for each item in a row { if (di->parentItem()!=opi) curListLen=1; else curListLen++; if (curListLen>maxListLen) maxListLen=curListLen; opi=di->parentItem(); } //printf("maxListLen=%d\n",maxListLen); count+=maxListLen; } return count; } void TreeDiagram::computeExtremes(uint32_t *maxLabelLen,uint32_t *maxXPos) { uint32_t ml=0,mx=0; for (const auto &dr : m_rows) // for each row { bool done=FALSE; for (const auto &di : *dr) // for each item in a row { if (di->isInList()) done=TRUE; if (maxXPos) mx=std::max(mx,di->xPos()); if (maxLabelLen) ml=std::max(ml,Image::stringLength(di->label())); } if (done) break; } if (maxLabelLen) *maxLabelLen=ml; if (maxXPos) *maxXPos=mx; } //! helper class representing an iterator that can iterate forwards or backwards template<class C,class I> class DualDirIterator { public: DualDirIterator(C &container,bool fwd) : m_container(container), m_forward(fwd) { if (fwd) m_it = container.begin(); else m_rit = container.rbegin(); } void operator++() { if (m_forward) ++m_it++; else ++m_rit; } I &operator*() { return m_forward ? *m_it : *m_rit; } bool atEnd() { if (m_forward) return m_it==m_container.end(); else return m_rit==m_container.rend(); } private: C &m_container; bool m_forward; typename C::iterator m_it; typename C::reverse_iterator m_rit; }; void TreeDiagram::drawBoxes(TextStream &t,Image *image, bool doBase,bool bitmap, uint32_t baseRows,uint32_t superRows, uint32_t cellWidth,uint32_t cellHeight, QCString relPath, bool generateMap) { auto it = m_rows.begin(); if (it!=m_rows.end() && !doBase) ++it; bool firstRow = doBase; bool done=FALSE; float superRowsF = static_cast<float>(superRows); for (;it!=m_rows.end() && !done;++it) // for each row { const auto &dr = *it; uint32_t x=0,y=0; float xf=0.0f,yf=0.0f; DiagramItem *firstDi = dr->item(0); if (firstDi->isInList()) // put boxes in a list { DiagramItem *opi=nullptr; DualDirIterator<DiagramRow,const std::unique_ptr<DiagramItem>&> dit(*dr,!doBase); while (!dit.atEnd()) { DiagramItem *di = (*dit).get(); if (di->parentItem()==opi) { if (bitmap) { if (doBase) y -= cellHeight+labelVertSpacing; else y += cellHeight+labelVertSpacing; } else { if (doBase) yf += 1.0f; else yf -= 1.0f; } } else { if (bitmap) { x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth; if (doBase) { y = image->height()- superRows*cellHeight- (superRows-1)*labelVertSpacing- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; } else { y = (baseRows-1)*(cellHeight+labelVertSpacing)+ di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; } } else { xf = di->xfPos()/gridWidth; if (doBase) { yf = di->yfPos()/gridHeight+superRowsF-1.0f; } else { yf = superRowsF-1.0f-di->yfPos()/gridHeight; } } } opi=di->parentItem(); if (bitmap) { bool hasDocs=di->getClassDef()->isLinkable(); writeBitmapBox(di,image,x,y,cellWidth,cellHeight,firstRow, hasDocs,di->numChildren()>0); if (!firstRow && generateMap) writeMapArea(t,di->getClassDef(),relPath,x,y,cellWidth,cellHeight); } else { writeVectorBox(t,di,xf,yf,di->numChildren()>0); } ++dit; } done=TRUE; } else // draw a tree of boxes { for (const auto &di : *dr) { if (bitmap) { x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth; if (doBase) { y = image->height()- superRows*cellHeight- (superRows-1)*labelVertSpacing- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; } else { y = (baseRows-1)*(cellHeight+labelVertSpacing)+ di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; } bool hasDocs=di->getClassDef()->isLinkable(); writeBitmapBox(di.get(),image,x,y,cellWidth,cellHeight,firstRow,hasDocs); if (!firstRow && generateMap) writeMapArea(t,di->getClassDef(),relPath,x,y,cellWidth,cellHeight); } else { xf=di->xfPos()/gridWidth; if (doBase) { yf = di->yfPos()/gridHeight+superRowsF-1.0f; } else { yf = superRowsF-1.0f-di->yfPos()/gridHeight; } writeVectorBox(t,di.get(),xf,yf); } } } firstRow=FALSE; } } void TreeDiagram::drawConnectors(TextStream &t,Image *image, bool doBase,bool bitmap, uint32_t baseRows,uint32_t superRows, uint32_t cellWidth,uint32_t cellHeight) { bool done=FALSE; auto it = m_rows.begin(); float superRowsF = static_cast<float>(superRows); for (;it!=m_rows.end() && !done;++it) // for each row { const auto &dr = *it; DiagramItem *rootDi = dr->item(0); if (rootDi->isInList()) // row consists of list connectors { uint32_t x=0,y=0,ys=0; float xf=0.0f,yf=0.0f,ysf=0.0f; auto rit = dr->begin(); while (rit!=dr->end()) { DiagramItem *di=(*rit).get(); DiagramItem *pi=di->parentItem(); DiagramItemList dil=pi->getChildren(); DiagramItem *last=dil.back(); if (di==last) // single child { if (bitmap) // draw pixels { x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; image->drawVertArrow(x,y,y+labelVertSpacing/2, protToColor(di->protection()), protToMask(di->protection())); } else // super classes { y = (baseRows-1)*(cellHeight+labelVertSpacing)- labelVertSpacing/2+ di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; image->drawVertLine(x,y,y+labelVertSpacing/2, protToColor(di->protection()), protToMask(di->protection())); } } else // draw vectors { t << protToString(di->protection()) << "\n"; if (doBase) { t << "1 " << (di->xfPos()/gridWidth) << " " << (di->yfPos()/gridHeight+superRowsF-1.0f) << " in\n"; } else { t << "0 " << (di->xfPos()/gridWidth) << " " << (superRowsF-0.25f-di->yfPos()/gridHeight) << " in\n"; } } } else // multiple children, put them in a vertical list { if (bitmap) { x = di->parentItem()->xPos()* (cellWidth+labelHorSpacing)/gridWidth+cellWidth/2; if (doBase) // base classes { ys = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; y = ys - cellHeight/2; } else // super classes { ys = (baseRows-1)*(cellHeight+labelVertSpacing)+ di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; y = ys + cellHeight/2; } } else { xf = di->parentItem()->xfPos()/gridWidth; if (doBase) { ysf = di->yfPos()/gridHeight+superRowsF-1.0f; yf = ysf + 0.5f; } else { ysf = superRowsF-0.25f-di->yfPos()/gridHeight; yf = ysf - 0.25f; } } while (di!=last) // more children to add { if (bitmap) { if (doBase) // base classes { image->drawHorzArrow(y,x,x+cellWidth/2+labelHorSpacing, protToColor(di->protection()), protToMask(di->protection())); y -= cellHeight+labelVertSpacing; } else // super classes { image->drawHorzLine(y,x,x+cellWidth/2+labelHorSpacing, protToColor(di->protection()), protToMask(di->protection())); y += cellHeight+labelVertSpacing; } } else { t << protToString(di->protection()) << "\n"; if (doBase) { t << "1 " << xf << " " << yf << " hedge\n"; yf += 1.0f; } else { t << "0 " << xf << " " << yf << " hedge\n"; yf -= 1.0f; } } ++rit; if (rit!=dr->end()) di = (*rit).get(); else di=nullptr; } // add last horizontal line and a vertical connection line if (bitmap) { if (doBase) // base classes { image->drawHorzArrow(y,x,x+cellWidth/2+labelHorSpacing, protToColor(di->protection()), protToMask(di->protection())); image->drawVertLine(x,y,ys+labelVertSpacing/2, protToColor(getMinProtectionLevel(dil)), protToMask(getMinProtectionLevel(dil))); } else // super classes { image->drawHorzLine(y,x,x+cellWidth/2+labelHorSpacing, protToColor(di->protection()), protToMask(di->protection())); image->drawVertLine(x,ys-labelVertSpacing/2,y, protToColor(getMinProtectionLevel(dil)), protToMask(getMinProtectionLevel(dil))); } } else { t << protToString(di->protection()) << "\n"; if (doBase) { t << "1 " << xf << " " << yf << " hedge\n"; } else { t << "0 " << xf << " " << yf << " hedge\n"; } t << protToString(getMinProtectionLevel(dil)) << "\n"; if (doBase) { t << xf << " " << ysf << " " << yf << " vedge\n"; } else { t << xf << " " << (ysf + 0.25f) << " " << yf << " vedge\n"; } } } if (rit!=dr->end()) ++rit; } done=TRUE; // the tree is drawn now } else // normal tree connector { for (const auto &di : *dr) { uint32_t x=0,y=0; DiagramItemList dil = di->getChildren(); DiagramItem *parent = di->parentItem(); if (parent) // item has a parent -> connect to it { if (bitmap) // draw pixels { x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; /* write input line */ image->drawVertArrow(x,y,y+labelVertSpacing/2, protToColor(di->protection()), protToMask(di->protection())); } else // super classes { y = (baseRows-1)*(cellHeight+labelVertSpacing)- labelVertSpacing/2+ di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; /* write output line */ image->drawVertLine(x,y,y+labelVertSpacing/2, protToColor(di->protection()), protToMask(di->protection())); } } else // draw pixels { t << protToString(di->protection()) << "\n"; if (doBase) { t << "1 " << di->xfPos()/gridWidth << " " << (di->yfPos()/gridHeight+superRowsF-1.0f) << " in\n"; } else { t << "0 " << di->xfPos()/gridWidth << " " << (superRowsF-0.25f-di->yfPos()/gridHeight) << " in\n"; } } } if (!dil.empty()) { Protection p=getMinProtectionLevel(dil); uint32_t mask=protToMask(p); uint8_t col=protToColor(p); if (bitmap) { x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- cellHeight-labelVertSpacing/2- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; image->drawVertLine(x,y,y+labelVertSpacing/2-1,col,mask); } else // super classes { y = (baseRows-1)*(cellHeight+labelVertSpacing)+ cellHeight+ di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; image->drawVertArrow(x,y,y+labelVertSpacing/2-1,col,mask); } } else { t << protToString(p) << "\n"; if (doBase) { t << "0 " << di->xfPos()/gridWidth << " " << (di->yfPos()/gridHeight+superRowsF-1.0f) << " out\n"; } else { t << "1 " << di->xfPos()/gridWidth << " " << (superRowsF-1.75f-di->yfPos()/gridHeight) << " out\n"; } } /* write input line */ DiagramItem *first = dil.front(); DiagramItem *last = dil.back(); if (first!=last && !first->isInList()) /* connect with all base classes */ { if (bitmap) { uint32_t xs = first->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; uint32_t xe = last->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { image->drawHorzLine(y,xs,xe,col,mask); } else // super classes { image->drawHorzLine(y+labelVertSpacing/2,xs,xe,col,mask); } } else { t << protToString(p) << "\n"; if (doBase) { t << first->xfPos()/gridWidth << " " << last->xfPos()/gridWidth << " " << (first->yfPos()/gridHeight+superRowsF-1.0f) << " conn\n"; } else { t << first->xfPos()/gridWidth << " " << last->xfPos()/gridWidth << " " << (superRowsF-first->yfPos()/gridHeight) << " conn\n"; } } } } } } } } //----------------------------------------------------------------- struct ClassDiagram::Private { Private(const ClassDef *root) : base(root,true), super(root,false) {} TreeDiagram base; TreeDiagram super; }; //----------------------------------------------------------------- ClassDiagram::ClassDiagram(const ClassDef *root) : p(std::make_unique<Private>(root)) { p->base.computeLayout(); p->super.computeLayout(); DiagramItem *baseItem = p->base.row(0)->item(0); DiagramItem *superItem = p->super.row(0)->item(0); uint32_t xbase = baseItem->xPos(); uint32_t xsuper = superItem->xPos(); if (xbase>xsuper) { int dist=static_cast<int>(xbase-xsuper); superItem->move(dist,0); p->super.moveChildren(superItem,dist); } else if (xbase<xsuper) { int dist=static_cast<int>(xsuper-xbase); baseItem->move(dist,0); p->base.moveChildren(baseItem,dist); } } ClassDiagram::~ClassDiagram() = default; void ClassDiagram::writeFigure(TextStream &output,const QCString &path, const QCString &fileName) const { uint32_t baseRows=p->base.computeRows(); uint32_t superRows=p->super.computeRows(); uint32_t baseMaxX = 0, baseMaxLabelWidth = 0, superMaxX = 0, superMaxLabelWidth = 0; p->base.computeExtremes(&baseMaxLabelWidth,&baseMaxX); p->super.computeExtremes(&superMaxLabelWidth,&superMaxX); uint32_t rows=std::max(1u,baseRows+superRows-1); uint32_t cols=(std::max(baseMaxX,superMaxX)+gridWidth*2-1)/gridWidth; // Estimate the image aspect width and height in pixels. float estHeight = static_cast<float>(rows)*40.0f; float estWidth = static_cast<float>(cols)*(20+static_cast<float>(std::max(baseMaxLabelWidth,superMaxLabelWidth))); //printf("Estimated size %d x %d\n",estWidth,estHeight); const float pageWidth = 14.0f; // estimated page width in cm. // Somewhat lower to deal with estimation // errors. // compute the image height in centimeters based on the estimates float realHeight = static_cast<float>(std::min(rows,12u)); // real height in cm float realWidth = realHeight * estWidth/estHeight; if (realWidth>pageWidth) // assume that the page width is about 15 cm { realHeight*=pageWidth/realWidth; } //output << "}\n"; output << "\\begin{figure}[H]\n" "\\begin{center}\n" "\\leavevmode\n"; output << "\\includegraphics[height=" << realHeight << "cm]{" << fileName << "}\n"; output << "\\end{center}\n" "\\end{figure}\n"; //printf("writeFigure rows=%d cols=%d\n",rows,cols); QCString epsBaseName=QCString(path)+"/"+fileName; QCString epsName=epsBaseName+".eps"; std::ofstream f = Portable::openOutputStream(epsName); if (!f.is_open()) { term("Could not open file %s for writing\n",qPrint(epsName)); } else { TextStream t(&f); //printf("writeEPS() rows=%d cols=%d\n",rows,cols); // generate EPS header and postscript variables and procedures t << "%!PS-Adobe-2.0 EPSF-2.0\n"; t << "%%Title: ClassName\n"; t << "%%Creator: Doxygen\n"; t << "%%CreationDate: Time\n"; t << "%%For: \n"; t << "%Magnification: 1.00\n"; t << "%%Orientation: Portrait\n"; t << "%%BoundingBox: 0 0 500 " << estHeight*500.0f/estWidth << "\n"; t << "%%Pages: 0\n"; t << "%%BeginSetup\n"; t << "%%EndSetup\n"; t << "%%EndComments\n"; t << "\n"; t << "% ----- variables -----\n"; t << "\n"; t << "/boxwidth 0 def\n"; t << "/boxheight 40 def\n"; t << "/fontheight 24 def\n"; t << "/marginwidth 10 def\n"; t << "/distx 20 def\n"; t << "/disty 40 def\n"; t << "/boundaspect " << estWidth/estHeight << " def % aspect ratio of the BoundingBox (width/height)\n"; t << "/boundx 500 def\n"; t << "/boundy boundx boundaspect div def\n"; t << "/xspacing 0 def\n"; t << "/yspacing 0 def\n"; t << "/rows " << rows << " def\n"; t << "/cols " << cols << " def\n"; t << "/scalefactor 0 def\n"; t << "/boxfont /Times-Roman findfont fontheight scalefont def\n"; t << "\n"; t << "% ----- procedures -----\n"; t << "\n"; t << "/dotted { [1 4] 0 setdash } def\n"; t << "/dashed { [5] 0 setdash } def\n"; t << "/solid { [] 0 setdash } def\n"; t << "\n"; t << "/max % result = MAX(arg1,arg2)\n"; t << "{\n"; t << " /a exch def\n"; t << " /b exch def\n"; t << " a b gt {a} {b} ifelse\n"; t << "} def\n"; t << "\n"; t << "/xoffset % result = MAX(0,(scalefactor-(boxwidth*cols+distx*(cols-1)))/2)\n"; t << "{\n"; t << " 0 scalefactor boxwidth cols mul distx cols 1 sub mul add sub 2 div max\n"; t << "} def\n"; t << "\n"; t << "/cw % boxwidth = MAX(boxwidth, stringwidth(arg1))\n"; t << "{\n"; t << " /str exch def\n"; t << " /boxwidth boxwidth str stringwidth pop max def\n"; t << "} def\n"; t << "\n"; t << "/box % draws a box with text 'arg1' at grid pos (arg2,arg3)\n"; t << "{ gsave\n"; t << " 2 setlinewidth\n"; t << " newpath\n"; t << " exch xspacing mul xoffset add\n"; t << " exch yspacing mul\n"; t << " moveto\n"; t << " boxwidth 0 rlineto \n"; t << " 0 boxheight rlineto \n"; t << " boxwidth neg 0 rlineto \n"; t << " 0 boxheight neg rlineto \n"; t << " closepath\n"; t << " dup stringwidth pop neg boxwidth add 2 div\n"; t << " boxheight fontheight 2 div sub 2 div\n"; t << " rmoveto show stroke\n"; t << " grestore\n"; t << "} def \n"; t << "\n"; t << "/mark\n"; t << "{ newpath\n"; t << " exch xspacing mul xoffset add boxwidth add\n"; t << " exch yspacing mul\n"; t << " moveto\n"; t << " 0 boxheight 4 div rlineto\n"; t << " boxheight neg 4 div boxheight neg 4 div rlineto\n"; t << " closepath\n"; t << " eofill\n"; t << " stroke\n"; t << "} def\n"; t << "\n"; t << "/arrow\n"; t << "{ newpath\n"; t << " moveto\n"; t << " 3 -8 rlineto\n"; t << " -6 0 rlineto\n"; t << " 3 8 rlineto\n"; t << " closepath\n"; t << " eofill\n"; t << " stroke\n"; t << "} def\n"; t << "\n"; t << "/out % draws an output connector for the block at (arg1,arg2)\n"; t << "{\n"; t << " newpath\n"; t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; t << " exch yspacing mul boxheight add\n"; t << " /y exch def\n"; t << " /x exch def\n"; t << " x y moveto\n"; t << " 0 disty 2 div rlineto \n"; t << " stroke\n"; t << " 1 eq { x y disty 2 div add arrow } if\n"; t << "} def\n"; t << "\n"; t << "/in % draws an input connector for the block at (arg1,arg2)\n"; t << "{\n"; t << " newpath\n"; t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; t << " exch yspacing mul disty 2 div sub\n"; t << " /y exch def\n"; t << " /x exch def\n"; t << " x y moveto\n"; t << " 0 disty 2 div rlineto\n"; t << " stroke\n"; t << " 1 eq { x y disty 2 div add arrow } if\n"; t << "} def\n"; t << "\n"; t << "/hedge\n"; t << "{\n"; t << " exch xspacing mul xoffset add boxwidth 2 div add\n"; t << " exch yspacing mul boxheight 2 div sub\n"; t << " /y exch def\n"; t << " /x exch def\n"; t << " newpath\n"; t << " x y moveto\n"; t << " boxwidth 2 div distx add 0 rlineto\n"; t << " stroke\n"; t << " 1 eq\n"; t << " { newpath x boxwidth 2 div distx add add y moveto\n"; t << " -8 3 rlineto\n"; t << " 0 -6 rlineto\n"; t << " 8 3 rlineto\n"; t << " closepath\n"; t << " eofill\n"; t << " stroke\n"; t << " } if\n"; t << "} def\n"; t << "\n"; t << "/vedge\n"; t << "{\n"; t << " /ye exch def\n"; t << " /ys exch def\n"; t << " /xs exch def\n"; t << " newpath\n"; t << " xs xspacing mul xoffset add boxwidth 2 div add dup\n"; t << " ys yspacing mul boxheight 2 div sub\n"; t << " moveto\n"; t << " ye yspacing mul boxheight 2 div sub\n"; t << " lineto\n"; t << " stroke\n"; t << "} def\n"; t << "\n"; t << "/conn % connections the blocks from col 'arg1' to 'arg2' of row 'arg3'\n"; t << "{\n"; t << " /ys exch def\n"; t << " /xe exch def\n"; t << " /xs exch def\n"; t << " newpath\n"; t << " xs xspacing mul xoffset add boxwidth 2 div add\n"; t << " ys yspacing mul disty 2 div sub\n"; t << " moveto\n"; t << " xspacing xe xs sub mul 0\n"; t << " rlineto\n"; t << " stroke\n"; t << "} def\n"; t << "\n"; t << "% ----- main ------\n"; t << "\n"; t << "boxfont setfont\n"; t << "1 boundaspect scale\n"; for (const auto &dr : p->base) { bool done=FALSE; for (const auto &di : *dr) { done=di->isInList(); t << "(" << convertToPSString(di->label()) << ") cw\n"; } if (done) break; } auto it = p->super.begin(); if (it!=p->super.end()) ++it; for (;it!=p->super.end();++it) { const auto &dr = *it; bool done=FALSE; for (const auto &di : *dr) { done=di->isInList(); t << "(" << convertToPSString(di->label()) << ") cw\n"; } if (done) break; } t << "/boxwidth boxwidth marginwidth 2 mul add def\n" << "/xspacing boxwidth distx add def\n" << "/yspacing boxheight disty add def\n" << "/scalefactor \n" << " boxwidth cols mul distx cols 1 sub mul add\n" << " boxheight rows mul disty rows 1 sub mul add boundaspect mul \n" << " max def\n" << "boundx scalefactor div boundy scalefactor div scale\n"; t << "\n% ----- classes -----\n\n"; p->base.drawBoxes(t,nullptr,TRUE,FALSE,baseRows,superRows,0,0); p->super.drawBoxes(t,nullptr,FALSE,FALSE,baseRows,superRows,0,0); t << "\n% ----- relations -----\n\n"; p->base.drawConnectors(t,nullptr,TRUE,FALSE,baseRows,superRows,0,0); p->super.drawConnectors(t,nullptr,FALSE,FALSE,baseRows,superRows,0,0); } f.close(); if (Config_getBool(USE_PDFLATEX)) { QCString epstopdfArgs(4096, QCString::ExplicitSize); epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"", qPrint(epsBaseName),qPrint(epsBaseName)); //printf("Converting eps using '%s'\n",qPrint(epstopdfArgs)); if (Portable::system("epstopdf",epstopdfArgs)!=0) { err("Problems running epstopdf. Check your TeX installation!\n"); return; } else { Dir().remove(epsBaseName.str()+".eps"); } } } void ClassDiagram::writeImage(TextStream &t,const QCString &path, const QCString &relPath,const QCString &fileName, bool generateMap) const { uint32_t baseRows=p->base.computeRows(); uint32_t superRows=p->super.computeRows(); uint32_t rows=baseRows+superRows-1; uint32_t lb=0,ls=0,xb=0,xs=0; p->base.computeExtremes(&lb,&xb); p->super.computeExtremes(&ls,&xs); uint32_t cellWidth = std::max(lb,ls)+labelHorMargin*2; uint32_t maxXPos = std::max(xb,xs); uint32_t labelVertMargin = 6; //std::max(6,(cellWidth-fontHeight)/6); // aspect at least 1:3 uint32_t cellHeight = labelVertMargin*2+fontHeight; uint32_t imageWidth = (maxXPos+gridWidth)*cellWidth/gridWidth+ (maxXPos*labelHorSpacing)/gridWidth; uint32_t imageHeight = rows*cellHeight+(rows-1)*labelVertSpacing; Image image(imageWidth,imageHeight); p->base.drawBoxes(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight,relPath,generateMap); p->super.drawBoxes(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight,relPath,generateMap); p->base.drawConnectors(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight); p->super.drawConnectors(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight); #define IMAGE_EXT ".png" image.save(QCString(path)+"/"+fileName+IMAGE_EXT); Doxygen::indexList->addImageFile(QCString(fileName)+IMAGE_EXT); }
44,079
C++
.cpp
1,318
25.89302
117
0.543429
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,451
mandocvisitor.cpp
doxygen_doxygen/src/mandocvisitor.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 "mandocvisitor.h" #include "docparser.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" #include "code.h" #include "dot.h" #include "util.h" #include "message.h" #include "parserintf.h" #include "filedef.h" #include "htmlentity.h" #include "emoji.h" #include "fileinfo.h" #include "codefragment.h" ManDocVisitor::ManDocVisitor(TextStream &t,OutputCodeList &ci, const QCString &langExt) : m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_firstCol(FALSE), m_indent(0), m_langExt(langExt) { } //-------------------------------------- // visitor functions for leaf nodes //-------------------------------------- void ManDocVisitor::operator()(const DocWord &w) { if (m_hide) return; filter(w.word()); m_firstCol=FALSE; } void ManDocVisitor::operator()(const DocLinkedWord &w) { if (m_hide) return; m_t << "\\fB"; filter(w.word()); m_t << "\\fP"; m_firstCol=FALSE; } void ManDocVisitor::operator()(const DocWhiteSpace &w) { if (m_hide) return; if (m_insidePre) { m_t << w.chars(); m_firstCol=w.chars().at(w.chars().length()-1)=='\n'; } else { m_t << " "; m_firstCol=FALSE; } } void ManDocVisitor::operator()(const DocSymbol &s) { if (m_hide) return; const char *res = HtmlEntityMapper::instance().man(s.symbol()); if (res) { m_t << res; } else { // no error or warning to be supplied // err("man: non supported HTML-entity found: &%s;\n",get_symbol_item(s->symbol())); } m_firstCol=FALSE; } void ManDocVisitor::operator()(const DocEmoji &s) { if (m_hide) return; const char *res = EmojiEntityMapper::instance().name(s.index()); if (res) { m_t << res; } else { m_t << s.name(); } m_firstCol=FALSE; } void ManDocVisitor::operator()(const DocURL &u) { if (m_hide) return; m_t << u.url(); m_firstCol=FALSE; } void ManDocVisitor::operator()(const DocLineBreak &) { if (m_hide) return; m_t << "\n.br\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocHorRuler &) { if (m_hide) return; if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocStyleChange &s) { if (m_hide) return; switch (s.style()) { case DocStyleChange::Bold: if (s.enable()) m_t << "\\fB"; else m_t << "\\fP"; m_firstCol=FALSE; break; case DocStyleChange::S: case DocStyleChange::Strike: case DocStyleChange::Del: /* not supported */ break; case DocStyleChange::Underline: //underline is shown as emphasis case DocStyleChange::Ins: if (s.enable()) m_t << "\\fI"; else m_t << "\\fP"; m_firstCol=FALSE; break; case DocStyleChange::Italic: if (s.enable()) m_t << "\\fI"; else m_t << "\\fP"; m_firstCol=FALSE; break; case DocStyleChange::Kbd: case DocStyleChange::Code: if (s.enable()) m_t << "\\fR"; else m_t << "\\fP"; m_firstCol=FALSE; break; case DocStyleChange::Subscript: if (s.enable()) m_t << "\\*<"; else m_t << "\\*> "; m_firstCol=FALSE; break; case DocStyleChange::Superscript: if (s.enable()) m_t << "\\*{"; else m_t << "\\*} "; m_firstCol=FALSE; break; case DocStyleChange::Center: /* not supported */ break; case DocStyleChange::Small: /* not supported */ break; case DocStyleChange::Cite: /* not supported */ break; case DocStyleChange::Preformatted: if (s.enable()) { if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_t << ".nf\n"; m_insidePre=TRUE; } else { m_insidePre=FALSE; if (!m_firstCol) m_t << "\n"; m_t << ".fi\n"; m_t << ".PP\n"; m_firstCol=TRUE; } break; case DocStyleChange::Div: /* HTML only */ break; case DocStyleChange::Span: /* HTML only */ break; } } void ManDocVisitor::operator()(const DocVerbatim &s) { if (m_hide) return; QCString lang = m_langExt; if (!s.language().isEmpty()) // explicit language setting { lang = s.language(); } SrcLangExt langExt = getLanguageFromCodeLang(lang); switch (s.type()) { case DocVerbatim::Code: if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_t << ".nf\n"; getCodeParser(lang).parseCode(m_ci,s.context(),s.text(), langExt, Config_getBool(STRIP_CODE_COMMENTS), s.isExample(),s.exampleFile()); if (!m_firstCol) m_t << "\n"; m_t << ".fi\n"; m_t << ".PP\n"; m_firstCol=TRUE; break; case DocVerbatim::JavaDocLiteral: filter(s.text()); break; case DocVerbatim::JavaDocCode: m_t << "\\fR\n"; filter(s.text()); m_t << "\\fP\n"; break; case DocVerbatim::Verbatim: if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_t << ".nf\n"; filter(s.text()); if (!m_firstCol) m_t << "\n"; m_t << ".fi\n"; m_t << ".PP\n"; m_firstCol=TRUE; break; case DocVerbatim::ManOnly: m_t << s.text(); break; case DocVerbatim::HtmlOnly: case DocVerbatim::XmlOnly: case DocVerbatim::LatexOnly: case DocVerbatim::RtfOnly: case DocVerbatim::DocbookOnly: case DocVerbatim::Dot: case DocVerbatim::Msc: case DocVerbatim::PlantUML: /* nothing */ break; } } void ManDocVisitor::operator()(const DocAnchor &) { /* no support for anchors in man pages */ } void ManDocVisitor::operator()(const DocInclude &inc) { if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(inc.extension()); switch(inc.type()) { case DocInclude::IncWithLines: { if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_t << ".nf\n"; FileInfo cfi( inc.file().str() ); auto fd = createFileDef( cfi.dirPath(), cfi.fileName() ); getCodeParser(inc.extension()).parseCode(m_ci,inc.context(), inc.text(), langExt, inc.stripCodeComments(), inc.isExample(), inc.exampleFile(), fd.get(), // fileDef, -1, // start line -1, // end line FALSE, // inline fragment nullptr, // memberDef TRUE ); m_t << ".fi\n"; m_t << ".PP\n"; m_firstCol=TRUE; } break; case DocInclude::Include: if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_t << ".nf\n"; getCodeParser(inc.extension()).parseCode(m_ci,inc.context(), inc.text(), langExt, inc.stripCodeComments(), inc.isExample(), inc.exampleFile(), nullptr, // fileDef -1, // startLine -1, // endLine TRUE, // inlineFragment nullptr, // memberDef FALSE ); m_t << ".fi\n"; m_t << ".PP\n"; m_firstCol=TRUE; break; case DocInclude::DontInclude: case DocInclude::DontIncWithLines: case DocInclude::HtmlInclude: case DocInclude::LatexInclude: case DocInclude::RtfInclude: case DocInclude::XmlInclude: case DocInclude::DocbookInclude: break; case DocInclude::ManInclude: m_t << inc.text(); break; case DocInclude::VerbInclude: if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_t << ".nf\n"; m_t << inc.text(); if (!m_firstCol) m_t << "\n"; m_t << ".fi\n"; m_t << ".PP\n"; m_firstCol=TRUE; break; case DocInclude::Snippet: case DocInclude::SnippetWithLines: if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_t << ".nf\n"; CodeFragmentManager::instance().parseCodeFragment(m_ci, inc.file(), inc.blockId(), inc.context(), inc.type()==DocInclude::SnippetWithLines, inc.trimLeft(), inc.stripCodeComments() ); m_t << ".fi\n"; m_t << ".PP\n"; m_firstCol=TRUE; break; } } void ManDocVisitor::operator()(const DocIncOperator &op) { QCString locLangExt = getFileNameExtension(op.includeFileName()); if (locLangExt.isEmpty()) locLangExt = m_langExt; SrcLangExt langExt = getLanguageFromFileName(locLangExt); //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n", // op.type(),op.isFirst(),op.isLast(),qPrint(op.text())); if (op.isFirst()) { if (!m_hide) { if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_t << ".nf\n"; } pushHidden(m_hide); m_hide = TRUE; } if (op.type()!=DocIncOperator::Skip) { m_hide = popHidden(); if (!m_hide) { std::unique_ptr<FileDef> fd; if (!op.includeFileName().isEmpty()) { FileInfo cfi( op.includeFileName().str() ); fd = createFileDef( cfi.dirPath(), cfi.fileName() ); } getCodeParser(locLangExt).parseCode(m_ci,op.context(),op.text(),langExt, op.stripCodeComments(), op.isExample(),op.exampleFile(), fd.get(), // fileDef op.line(), // startLine -1, // endLine FALSE, // inline fragment nullptr, // memberDef op.showLineNo() // show line numbers ); } pushHidden(m_hide); m_hide=TRUE; } if (op.isLast()) { m_hide = popHidden(); if (!m_hide) { if (!m_firstCol) m_t << "\n"; m_t << ".fi\n"; m_t << ".PP\n"; m_firstCol=TRUE; } } else { if (!m_hide) m_t << "\n"; } } void ManDocVisitor::operator()(const DocFormula &f) { if (m_hide) return; m_t << f.text(); } void ManDocVisitor::operator()(const DocIndexEntry &) { } void ManDocVisitor::operator()(const DocSimpleSectSep &) { } void ManDocVisitor::operator()(const DocCite &cite) { if (m_hide) return; m_t << "\\fB"; if (cite.file().isEmpty()) m_t << "["; filter(cite.text()); if (cite.file().isEmpty()) m_t << "]"; m_t << "\\fP"; } void ManDocVisitor::operator()(const DocSeparator &s) { if (m_hide) return; m_t << s.chars(); } //-------------------------------------- // visitor functions for compound nodes //-------------------------------------- void ManDocVisitor::operator()(const DocAutoList &l) { if (m_hide) return; m_indent++; visitChildren(l); m_indent--; m_t << ".PP\n"; } void ManDocVisitor::operator()(const DocAutoListItem &li) { if (m_hide) return; QCString ws; if (m_indent>0) ws.fill(' ',2*(m_indent-1)); if (!m_firstCol) m_t << "\n"; m_t << ".IP \"" << ws; const DocAutoList *list = std::get_if<DocAutoList>(li.parent()); if (list && list->isEnumList()) { m_t << li.itemNumber() << ".\" " << (2*(m_indent+1)); } else // bullet list { switch (li.itemNumber()) { case DocAutoList::Unchecked: // unchecked m_t << "[ ]\" " << (2*m_indent) + 2; break; case DocAutoList::Checked_x: // checked with x m_t << "[x]\" " << (2*m_indent) + 2; break; case DocAutoList::Checked_X: // checked with X m_t << "[X]\" " << (2*m_indent) + 2; break; default: m_t << "\\(bu\" " << (2*m_indent); break; } } m_t << "\n"; m_firstCol=TRUE; visitChildren(li); m_t << "\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocPara &p) { if (m_hide) return; visitChildren(p); if (!p.isLast() && // omit <p> for last paragraph !(p.parent() && // and for parameter sections std::get_if<DocParamSect>(p.parent()) ) ) { if (!m_firstCol) m_t << "\n"; m_t << "\n.PP\n"; m_firstCol=TRUE; } } void ManDocVisitor::operator()(const DocRoot &r) { visitChildren(r); } void ManDocVisitor::operator()(const DocSimpleSect &s) { if (m_hide) return; if (!m_firstCol) { m_t << "\n"; m_t << ".PP\n"; } m_t << "\\fB"; switch(s.type()) { case DocSimpleSect::See: m_t << theTranslator->trSeeAlso(); break; case DocSimpleSect::Return: m_t << theTranslator->trReturns(); break; case DocSimpleSect::Author: m_t << theTranslator->trAuthor(TRUE,TRUE); break; case DocSimpleSect::Authors: m_t << theTranslator->trAuthor(TRUE,FALSE); break; case DocSimpleSect::Version: m_t << theTranslator->trVersion(); break; case DocSimpleSect::Since: m_t << theTranslator->trSince(); break; case DocSimpleSect::Date: m_t << theTranslator->trDate(); break; case DocSimpleSect::Note: m_t << theTranslator->trNote(); break; case DocSimpleSect::Warning: m_t << theTranslator->trWarning(); break; case DocSimpleSect::Pre: m_t << theTranslator->trPrecondition(); break; case DocSimpleSect::Post: m_t << theTranslator->trPostcondition(); break; case DocSimpleSect::Copyright: m_t << theTranslator->trCopyright(); break; case DocSimpleSect::Invar: m_t << theTranslator->trInvariant(); break; case DocSimpleSect::Remark: m_t << theTranslator->trRemarks(); break; case DocSimpleSect::Attention: m_t << theTranslator->trAttention(); break; case DocSimpleSect::Important: m_t << theTranslator->trImportant(); break; case DocSimpleSect::User: break; case DocSimpleSect::Rcs: break; case DocSimpleSect::Unknown: break; } // special case 1: user defined title if (s.title()) { std::visit(*this,*s.title()); } m_t << "\\fP\n"; m_t << ".RS 4\n"; visitChildren(s); if (!m_firstCol) m_t << "\n"; m_t << ".RE\n"; m_t << ".PP\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocTitle &t) { if (m_hide) return; visitChildren(t); } void ManDocVisitor::operator()(const DocSimpleList &l) { if (m_hide) return; m_indent++; if (!m_firstCol) m_t << "\n"; m_t << ".PD 0\n"; m_firstCol=true; visitChildren(l); m_indent--; m_t << ".PP\n"; } void ManDocVisitor::operator()(const DocSimpleListItem &li) { if (m_hide) return; QCString ws; if (m_indent>0) ws.fill(' ',2*(m_indent-1)); if (!m_firstCol) m_t << "\n"; m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << "\n"; m_firstCol=TRUE; if (li.paragraph()) { visit(*this,*li.paragraph()); } m_t << "\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocSection &s) { if (m_hide) return; if (!m_firstCol) m_t << "\n"; if (s.level()==1) m_t << ".SH"; else m_t << ".SS"; m_t << " \""; if (s.title()) { std::visit(*this,*s.title()); } m_t << "\"\n"; if (s.level()==1) m_t << ".PP\n"; m_firstCol=TRUE; visitChildren(s); } void ManDocVisitor::operator()(const DocHtmlList &l) { if (m_hide) return; m_indent++; if (!m_firstCol) m_t << "\n"; m_t << ".PD 0\n"; m_firstCol=true; int indent = std::min(m_indent,maxIndentLevels-1); m_listItemInfo[indent].number = 1; m_listItemInfo[indent].type = '1'; for (const auto &opt : l.attribs()) { if (opt.name=="type") { m_listItemInfo[indent].type = opt.value[0]; } if (opt.name=="start") { bool ok = false; int val = opt.value.toInt(&ok); if (ok) m_listItemInfo[indent].number = val; } } visitChildren(l); m_indent--; if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; } void ManDocVisitor::operator()(const DocHtmlListItem &li) { if (m_hide) return; QCString ws; if (m_indent>0) ws.fill(' ',2*(m_indent-1)); if (!m_firstCol) m_t << "\n"; m_t << ".IP \"" << ws; const DocHtmlList *list = std::get_if<DocHtmlList>(li.parent()); if (list && list->type()==DocHtmlList::Ordered) { int indent = std::min(m_indent,maxIndentLevels-1); for (const auto &opt : li.attribs()) { if (opt.name=="value") { bool ok = false; int val = opt.value.toInt(&ok); if (ok) m_listItemInfo[indent].number = val; } } switch (m_listItemInfo[indent].type) { case '1': m_t << m_listItemInfo[indent].number; break; case 'a': m_t << integerToAlpha(m_listItemInfo[indent].number,false); break; case 'A': m_t << integerToAlpha(m_listItemInfo[indent].number); break; case 'i': m_t << integerToRoman(m_listItemInfo[indent].number,false); break; case 'I': m_t << integerToRoman(m_listItemInfo[indent].number); break; default: m_t << m_listItemInfo[indent].number; break; } m_t << ".\" " << ((m_indent+1)*2); m_listItemInfo[indent].number++; } else // bullet list { m_t << "\\(bu\" " << (m_indent*2); } m_t << "\n"; m_firstCol=TRUE; visitChildren(li); m_t << "\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocHtmlDescList &dl) { if (m_hide) return; m_indent+=2; visitChildren(dl); m_indent-=2; if (!m_firstCol) m_t << "\n"; m_t << "\n.PP\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocHtmlDescTitle &dt) { if (m_hide) return; if (!m_firstCol) m_t << "\n"; m_t << "\n.PP"; m_t << "\n.IP \"\\fB"; m_firstCol=FALSE; visitChildren(dt); } void ManDocVisitor::operator()(const DocHtmlDescData &dd) { if (!m_firstCol) m_t << "\n"; m_t << ".IP \"\" 1c\n"; m_firstCol=TRUE; visitChildren(dd); } void ManDocVisitor::operator()(const DocHtmlTable &t) { visitChildren(t); } void ManDocVisitor::operator()(const DocHtmlCaption &c) { visitChildren(c); } void ManDocVisitor::operator()(const DocHtmlRow &r) { visitChildren(r); } void ManDocVisitor::operator()(const DocHtmlCell &c) { visitChildren(c); } void ManDocVisitor::operator()(const DocInternal &i) { visitChildren(i); } void ManDocVisitor::operator()(const DocHRef &href) { if (m_hide) return; m_t << "\\fR"; visitChildren(href); m_t << "\\fP"; } void ManDocVisitor::operator()(const DocHtmlSummary &s) { m_t << "\\fB"; visitChildren(s); m_t << "\\fP\n.PP\n"; } void ManDocVisitor::operator()(const DocHtmlDetails &d) { if (m_hide) return; if (!m_firstCol) { m_t << "\n"; m_t << ".PP\n"; } auto summary = d.summary(); if (summary) { std::visit(*this,*summary); m_t << ".PP\n"; m_t << ".RS 4\n"; } visitChildren(d); if (!m_firstCol) m_t << "\n"; if (summary) { m_t << ".RE\n"; } m_t << ".PP\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocHtmlHeader &header) { if (m_hide) return; if (!m_firstCol) m_t << "\n"; if (header.level()==1) m_t << ".SH"; else m_t << ".SS"; m_t << " \""; visitChildren(header); m_t << "\"\n"; if (header.level()==1) m_t << ".PP\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocImage &) { } void ManDocVisitor::operator()(const DocDotFile &) { } void ManDocVisitor::operator()(const DocMscFile &) { } void ManDocVisitor::operator()(const DocDiaFile &) { } void ManDocVisitor::operator()(const DocPlantUmlFile &) { } void ManDocVisitor::operator()(const DocLink &dl) { if (m_hide) return; m_t << "\\fB"; visitChildren(dl); m_t << "\\fP"; } void ManDocVisitor::operator()(const DocRef &ref) { if (m_hide) return; m_t << "\\fB"; if (!ref.hasLinkText()) filter(ref.targetTitle()); visitChildren(ref); m_t << "\\fP"; } void ManDocVisitor::operator()(const DocSecRefItem &ref) { if (m_hide) return; QCString ws; if (m_indent>0) ws.fill(' ',2*(m_indent-1)); if (!m_firstCol) m_t << "\n"; m_t << ".IP \"" << ws << "\\(bu\" " << (2*m_indent) << "\n"; m_firstCol=TRUE; visitChildren(ref); m_t << "\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocSecRefList &l) { if (m_hide) return; m_indent++; visitChildren(l); m_indent--; if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; } void ManDocVisitor::operator()(const DocParamSect &s) { if (m_hide) return; if (!m_firstCol) { m_t << "\n"; m_t << ".PP\n"; } m_t << "\\fB"; switch(s.type()) { case DocParamSect::Param: m_t << theTranslator->trParameters(); break; case DocParamSect::RetVal: m_t << theTranslator->trReturnValues(); break; case DocParamSect::Exception: m_t << theTranslator->trExceptions(); break; case DocParamSect::TemplateParam: m_t << theTranslator->trTemplateParameters(); break; default: ASSERT(0); } m_t << "\\fP\n"; m_t << ".RS 4\n"; visitChildren(s); if (!m_firstCol) m_t << "\n"; m_t << ".RE\n"; m_t << ".PP\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocParamList &pl) { if (m_hide) return; m_t << "\\fI"; bool first=TRUE; for (const auto &param : pl.parameters()) { if (!first) m_t << ","; else first=FALSE; std::visit(*this,param); } m_t << "\\fP "; for (const auto &par : pl.paragraphs()) { std::visit(*this,par); } if (!pl.isLast()) { if (!m_firstCol) m_t << "\n"; m_t << ".br\n"; } } void ManDocVisitor::operator()(const DocXRefItem &x) { if (m_hide) return; if (x.title().isEmpty()) return; if (!m_firstCol) { m_t << "\n"; m_t << ".PP\n"; } m_t << "\\fB"; filter(x.title()); m_t << "\\fP\n"; m_t << ".RS 4\n"; visitChildren(x); if (x.title().isEmpty()) return; if (!m_firstCol) m_t << "\n"; m_t << ".RE\n"; m_t << ".PP\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocInternalRef &ref) { if (m_hide) return; m_t << "\\fB"; visitChildren(ref); m_t << "\\fP"; } void ManDocVisitor::operator()(const DocText &t) { visitChildren(t); } void ManDocVisitor::operator()(const DocHtmlBlockQuote &q) { if (m_hide) return; if (!m_firstCol) { m_t << "\n"; m_t << ".PP\n"; } m_t << ".RS 4\n"; // TODO: add support for nested block quotes visitChildren(q); if (!m_firstCol) m_t << "\n"; m_t << ".RE\n"; m_t << ".PP\n"; m_firstCol=TRUE; } void ManDocVisitor::operator()(const DocVhdlFlow &) { } void ManDocVisitor::operator()(const DocParBlock &pb) { visitChildren(pb); } void ManDocVisitor::filter(const QCString &str) { if (!str.isEmpty()) { const char *p=str.data(); char c=0; while ((c=*p++)) { switch(c) { case '.': m_t << "\\&."; break; // see bug652277 case '\\': m_t << "\\\\"; break; case '"': c = '\''; // fall through default: m_t << c; break; } } } }
24,291
C++
.cpp
938
20.254797
88
0.54376
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,452
namespacedef.cpp
doxygen_doxygen/src/namespacedef.cpp
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 "namespacedef.h" #include "outputlist.h" #include "util.h" #include "language.h" #include "classdef.h" #include "classlist.h" #include "memberlist.h" #include "doxygen.h" #include "message.h" #include "docparser.h" #include "searchindex.h" #include "vhdldocgen.h" #include "layout.h" #include "membergroup.h" #include "config.h" #include "definitionimpl.h" #include "membername.h" #include "conceptdef.h" //------------------------------------------------------------------ static QCString makeDisplayName(const NamespaceDef *nd,bool includeScope) { QCString result=includeScope ? nd->name() : nd->localName(); SrcLangExt lang = nd->getLanguage(); QCString sep = getLanguageSpecificSeparator(lang); if (sep!="::") { result = substitute(result,"::",sep); } if (nd->isAnonymous()) { result = removeAnonymousScopes(result); } //printf("makeDisplayName() %s->%s lang=%d\n",qPrint(name()),qPrint(result),lang); return result; } //------------------------------------------------------------------ class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable> { public: NamespaceDefImpl(const QCString &defFileName,int defLine,int defColumn, const QCString &name,const QCString &ref=QCString(), const QCString &refFile=QCString(),const QCString &type=QCString(), bool isPublished=false); ~NamespaceDefImpl() override; NON_COPYABLE(NamespaceDefImpl) DefType definitionType() const override { return TypeNamespace; } CodeSymbolType codeSymbolType() const override { return getLanguage()==SrcLangExt::Java ? CodeSymbolType::Package : CodeSymbolType::Namespace; } QCString getOutputFileBase() const override; QCString anchor() const override { return QCString(); } void insertUsedFile(FileDef *fd) override; void writeDocumentation(OutputList &ol) override; void writeMemberPages(OutputList &ol) override; void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const override; void writeTagFile(TextStream &) override; void insertClass(ClassDef *cd) override; void insertConcept(ConceptDef *cd) override; void insertNamespace(NamespaceDef *nd) override; void insertMember(MemberDef *md) override; void computeAnchors() override; void countMembers() override; int numDocMembers() const override; void addUsingDirective(NamespaceDef *nd) override; const LinkedRefMap<NamespaceDef> &getUsedNamespaces() const override { return m_usingDirList; } void addUsingDeclaration(const Definition *cd) override; const LinkedRefMap<const Definition> &getUsedDefinitions() const override { return m_usingDeclList; } void combineUsingRelations(NamespaceDefSet &visitedNamespace) override; QCString displayName(bool=TRUE) const override; void setInline(bool isInline) override { m_inline = isInline; } bool isConstantGroup() const override { return CONSTANT_GROUP == m_type; } bool isModule() const override { return NAMESPACE == m_type || MODULE == m_type; } bool isLibrary() const override { return LIBRARY == m_type; } bool isInline() const override { return m_inline; } bool isLinkableInProject() const override; bool isLinkable() const override; bool isVisibleInHierarchy() const override; bool hasDetailedDescription() const override; void addMembersToMemberGroup() override; void distributeMemberGroupDocumentation() override; void findSectionsInDocumentation() override; void sortMemberLists() override; const Definition *findInnerCompound(const QCString &name) const override; void addInnerCompound(Definition *d) override; void addListReferences() override; void setFileName(const QCString &fn) override; bool subGrouping() const override { return m_subGrouping; } MemberList *getMemberList(MemberListType lt) const override; const MemberLists &getMemberLists() const override { return m_memberLists; } const MemberDef *getMemberByName(const QCString &) const override; const MemberGroupList &getMemberGroups() const override { return m_memberGroups; } ClassLinkedRefMap getClasses() const override { return classes; } ClassLinkedRefMap getInterfaces() const override { return interfaces; } ClassLinkedRefMap getStructs() const override { return structs; } ClassLinkedRefMap getExceptions() const override { return exceptions; } NamespaceLinkedRefMap getNamespaces() const override { return namespaces; } ConceptLinkedRefMap getConcepts() const override { return m_concepts; } void setName(const QCString &name) override; QCString title() const override; QCString compoundTypeString() const override; void setMetaData(const QCString &m) override; int countVisibleMembers() const override; void writeSummaryLinks(OutputList &ol) const override; private: void addMemberToList(MemberListType lt,MemberDef *md); void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); void writeDetailedDescription(OutputList &ol,const QCString &title); void writeBriefDescription(OutputList &ol); void startMemberDeclarations(OutputList &ol); void endMemberDeclarations(OutputList &ol); void writeClassDeclarations(OutputList &ol,const QCString &title,const ClassLinkedRefMap &d); void writeConcepts(OutputList &ol,const QCString &title); void writeInlineClasses(OutputList &ol); void writeMemberGroups(OutputList &ol); void writeAuthorSection(OutputList &ol); void startMemberDocumentation(OutputList &ol); void endMemberDocumentation(OutputList &ol); void addNamespaceAttributes(OutputList &ol); void writeClassesToTagFile(TextStream &,const ClassLinkedRefMap &d); void writeConceptsToTagFile(TextStream &); void setFileNameLocal(const QCString &fn); void writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool isConstantGroup=false); void updateLocalName(); QCString fileName; FileList files; LinkedRefMap<NamespaceDef> m_usingDirList; LinkedRefMap<const Definition> m_usingDeclList; LinkedRefMap<const Definition> m_innerCompounds; MemberLinkedRefMap m_allMembers; MemberLists m_memberLists; MemberGroupList m_memberGroups; ClassLinkedRefMap classes; ClassLinkedRefMap interfaces; ClassLinkedRefMap structs; ClassLinkedRefMap exceptions; ConceptLinkedRefMap m_concepts; NamespaceLinkedRefMap namespaces; bool m_subGrouping = false; enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type; bool m_isPublished = false; QCString metaData; bool m_inline = false; }; std::unique_ptr<NamespaceDef> createNamespaceDef(const QCString &defFileName,int defLine,int defColumn, const QCString &name,const QCString &ref, const QCString &refFile,const QCString &type, bool isPublished) { //printf("createNamespaceDef(%s)\n",qPrint(name)); return std::make_unique<NamespaceDefImpl>(defFileName,defLine,defColumn,name,ref,refFile,type,isPublished); } //------------------------------------------------------------------ class NamespaceDefAliasImpl : public DefinitionAliasMixin<NamespaceDef> { public: NamespaceDefAliasImpl(const Definition *newScope,const NamespaceDef *nd) : DefinitionAliasMixin(newScope,nd) { init(); } ~NamespaceDefAliasImpl() override { deinit(); } NON_COPYABLE(NamespaceDefAliasImpl) DefType definitionType() const override { return TypeNamespace; } const NamespaceDef *getNSAlias() const { return toNamespaceDef(getAlias()); } // ---- getters CodeSymbolType codeSymbolType() const override { return getNSAlias()->codeSymbolType(); } QCString getOutputFileBase() const override { return getNSAlias()->getOutputFileBase(); } QCString anchor() const override { return getNSAlias()->anchor(); } int numDocMembers() const override { return getNSAlias()->numDocMembers(); } const LinkedRefMap<NamespaceDef> &getUsedNamespaces() const override { return getNSAlias()->getUsedNamespaces(); } const LinkedRefMap<const Definition> &getUsedDefinitions() const override { return getNSAlias()->getUsedDefinitions(); } QCString displayName(bool b=TRUE) const override { return makeDisplayName(this,b); } const QCString &localName() const override { return getNSAlias()->localName(); } bool isConstantGroup() const override { return getNSAlias()->isConstantGroup(); } bool isModule() const override { return getNSAlias()->isModule(); } bool isLibrary() const override { return getNSAlias()->isLibrary(); } bool isInline() const override { return getNSAlias()->isInline(); } bool isLinkableInProject() const override { return getNSAlias()->isLinkableInProject(); } bool isLinkable() const override { return getNSAlias()->isLinkable(); } bool isVisibleInHierarchy() const override { return getNSAlias()->isVisibleInHierarchy(); } bool hasDetailedDescription() const override { return getNSAlias()->hasDetailedDescription(); } const Definition *findInnerCompound(const QCString &name) const override { return getNSAlias()->findInnerCompound(name); } bool subGrouping() const override { return getNSAlias()->subGrouping(); } MemberList *getMemberList(MemberListType lt) const override { return getNSAlias()->getMemberList(lt); } const MemberLists &getMemberLists() const override { return getNSAlias()->getMemberLists(); } const MemberDef *getMemberByName(const QCString &name) const override { return getNSAlias()->getMemberByName(name); } const MemberGroupList &getMemberGroups() const override { return getNSAlias()->getMemberGroups(); } ClassLinkedRefMap getClasses() const override { return getNSAlias()->getClasses(); } ClassLinkedRefMap getInterfaces() const override { return getNSAlias()->getInterfaces(); } ClassLinkedRefMap getStructs() const override { return getNSAlias()->getStructs(); } ClassLinkedRefMap getExceptions() const override { return getNSAlias()->getExceptions(); } NamespaceLinkedRefMap getNamespaces() const override { return getNSAlias()->getNamespaces(); } ConceptLinkedRefMap getConcepts() const override { return getNSAlias()->getConcepts(); } QCString title() const override { return getNSAlias()->title(); } QCString compoundTypeString() const override { return getNSAlias()->compoundTypeString(); } int countVisibleMembers() const override { return getNSAlias()->countVisibleMembers(); } }; std::unique_ptr<NamespaceDef> createNamespaceDefAlias(const Definition *newScope,const NamespaceDef *nd) { auto alnd = std::make_unique<NamespaceDefAliasImpl>(newScope,nd); //printf("alnd name=%s localName=%s qualifiedName=%s displayName()=%s\n", // qPrint(alnd->name()),qPrint(alnd->localName()),qPrint(alnd->qualifiedName()), // qPrint(alnd->displayName())); return alnd; } //------------------------------------------------------------------ NamespaceDefImpl::NamespaceDefImpl(const QCString &df,int dl,int dc, const QCString &name,const QCString &lref, const QCString &fName, const QCString &type, bool isPublished) : DefinitionMixin(df,dl,dc,name) ,m_isPublished(isPublished) { if (!fName.isEmpty()) { if (!lref.isEmpty()) { fileName = stripExtension(fName); } else { fileName = convertNameToFile(stripExtension(fName)); } } else { setFileNameLocal(name); } setReference(lref); m_inline=FALSE; m_subGrouping=Config_getBool(SUBGROUPING); if (type=="module") { m_type = MODULE; } else if (type=="constants") { m_type = CONSTANT_GROUP; } else if (type=="library") { m_type = LIBRARY; } else { m_type = NAMESPACE; } updateLocalName(); } void NamespaceDefImpl::updateLocalName() { QCString locName=name(); int i=locName.findRev("::"); if (i!=-1) { locName=locName.mid(i+2); } setLocalName(locName); } void NamespaceDefImpl::setName(const QCString &name) { DefinitionMixin<NamespaceDefMutable>::setName(name); updateLocalName(); } NamespaceDefImpl::~NamespaceDefImpl() { } void NamespaceDefImpl::setFileNameLocal(const QCString &fn) { if (isReference()) { fileName = "namespace"+fn; } else { fileName = convertNameToFile("namespace"+fn); } } void NamespaceDefImpl::setFileName(const QCString &fn) { setFileNameLocal(fn); } void NamespaceDefImpl::distributeMemberGroupDocumentation() { for (const auto &mg : m_memberGroups) { mg->distributeMemberGroupDocumentation(); } } void NamespaceDefImpl::findSectionsInDocumentation() { docFindSections(briefDescription(),this,docFile()); docFindSections(documentation(),this,docFile()); docFindSections(inbodyDocumentation(),this,docFile()); for (const auto &mg : m_memberGroups) { mg->findSectionsInDocumentation(this); } for (auto &ml : m_memberLists) { if (ml->listType().isDeclaration()) { ml->findSectionsInDocumentation(this); } } } void NamespaceDefImpl::insertUsedFile(FileDef *fd) { if (fd==nullptr) return; auto it = std::find(files.begin(),files.end(),fd); if (it==files.end()) { files.push_back(fd); } } void NamespaceDefImpl::addInnerCompound(Definition *d) { //printf("%s:NamespaceDefImpl::addInnerCompound(%s)\n",qPrint(name()),qPrint(d->name())); m_innerCompounds.add(d->localName(),d); if (d->definitionType()==Definition::TypeNamespace) { insertNamespace(toNamespaceDef(d)); } else if (d->definitionType()==Definition::TypeClass) { insertClass(toClassDef(d)); } else if (d->definitionType()==Definition::TypeConcept) { insertConcept(toConceptDef(d)); } } void NamespaceDefImpl::insertClass(ClassDef *cd) { ClassLinkedRefMap *d = &classes; if (Config_getBool(OPTIMIZE_OUTPUT_SLICE)) { if (cd->compoundType()==ClassDef::Interface) { d = &interfaces; } else if (cd->compoundType()==ClassDef::Struct) { d = &structs; } else if (cd->compoundType()==ClassDef::Exception) { d = &exceptions; } } d->add(cd->name(),cd); } void NamespaceDefImpl::insertConcept(ConceptDef *cd) { m_concepts.add(cd->name(),cd); } void NamespaceDefImpl::insertNamespace(NamespaceDef *nd) { namespaces.add(nd->name(),nd); } void NamespaceDefImpl::addMembersToMemberGroup() { for (auto &ml : m_memberLists) { if (ml->listType().isDeclaration()) { ::addMembersToMemberGroup(ml.get(),&m_memberGroups,this); } } // add members inside sections to their groups for (const auto &mg : m_memberGroups) { if (mg->allMembersInSameSection() && m_subGrouping) { //printf("----> addToDeclarationSection(%s)\n",qPrint(mg->header())); mg->addToDeclarationSection(); } } } void NamespaceDefImpl::insertMember(MemberDef *md) { //printf("%s::insertMember(%s) isInline=%d hasDocs=%d\n",qPrint(name()),qPrint(md->name()), // isInline(),hasDocumentation()); if (md->isHidden()) return; MemberDefMutable *mdm = toMemberDefMutable(md); // if this is an inline namespace that is not documented, then insert the // member in the parent scope instead if (isInline() && !hasDocumentation()) { Definition *outerScope = getOuterScope(); if (outerScope) { if (outerScope->definitionType()==Definition::TypeNamespace) { NamespaceDefMutable *nd = toNamespaceDefMutable(outerScope); if (nd && nd!=Doxygen::globalScope) { nd->insertMember(md); if (mdm) { mdm->setNamespace(nd); } } } else if (outerScope->definitionType()==Definition::TypeFile) { FileDef *fd = toFileDef(outerScope); fd->insertMember(md); if (mdm) { mdm->setFileDef(fd); mdm->setOuterScope(fd); } } } } else // member is a non-inline namespace or a documented inline namespace { MemberList *allMemberList = getMemberList(MemberListType::AllMembersList()); if (allMemberList==nullptr) { m_memberLists.emplace_back(std::make_unique<MemberList>(MemberListType::AllMembersList(),MemberListContainer::Namespace)); allMemberList = m_memberLists.back().get(); } allMemberList->push_back(md); //printf("%s::m_allMembersDict->append(%s)\n",qPrint(name()),qPrint(md->localName())); m_allMembers.add(md->localName(),md); switch(md->memberType()) { case MemberType::Variable: addMemberToList(MemberListType::DecVarMembers(),md); addMemberToList(MemberListType::DocVarMembers(),md); break; case MemberType::Function: addMemberToList(MemberListType::DecFuncMembers(),md); addMemberToList(MemberListType::DocFuncMembers(),md); break; case MemberType::Typedef: addMemberToList(MemberListType::DecTypedefMembers(),md); addMemberToList(MemberListType::DocTypedefMembers(),md); break; case MemberType::Sequence: addMemberToList(MemberListType::DecSequenceMembers(),md); addMemberToList(MemberListType::DocSequenceMembers(),md); break; case MemberType::Dictionary: addMemberToList(MemberListType::DecDictionaryMembers(),md); addMemberToList(MemberListType::DocDictionaryMembers(),md); break; case MemberType::Enumeration: addMemberToList(MemberListType::DecEnumMembers(),md); addMemberToList(MemberListType::DocEnumMembers(),md); break; case MemberType::EnumValue: break; case MemberType::Define: addMemberToList(MemberListType::DecDefineMembers(),md); addMemberToList(MemberListType::DocDefineMembers(),md); break; case MemberType::Property: if (md->getLanguage() == SrcLangExt::Python) { addMemberToList(MemberListType::PropertyMembers(),md); addMemberToList(MemberListType::Properties(),md); break; } // fallthrough, explicitly no break here default: err("NamespaceDefImpl::insertMembers(): " "member '%s' with unexpected type '%s' and class scope '%s' inserted in namespace scope '%s'!\n", qPrint(md->name()), qPrint(md->memberTypeName()), md->getClassDef() ? qPrint(md->getClassDef()->name()) : "", qPrint(name())); } // if this is an inline namespace, then insert an alias of this member in the outer scope. if (isInline()) { Definition *outerScope = getOuterScope(); if (outerScope) { std::unique_ptr<MemberDef> aliasMd = createMemberDefAlias(outerScope,md); if (outerScope->definitionType()==Definition::TypeNamespace) { NamespaceDefMutable *ndm = toNamespaceDefMutable(outerScope); if (ndm) { ndm->insertMember(aliasMd.get()); } } else if (outerScope->definitionType()==Definition::TypeFile) { toFileDef(outerScope)->insertMember(aliasMd.get()); } if (aliasMd) { QCString name = md->name(); MemberName *mn = Doxygen::functionNameLinkedMap->add(name); mn->push_back(std::move(aliasMd)); } } } } } void NamespaceDefImpl::computeAnchors() { MemberList *allMemberList = getMemberList(MemberListType::AllMembersList()); if (allMemberList) allMemberList->setAnchors(); } bool NamespaceDefImpl::hasDetailedDescription() const { bool repeatBrief = Config_getBool(REPEAT_BRIEF); return ((!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty()); } void NamespaceDefImpl::writeTagFile(TextStream &tagFile) { QCString fn = getOutputFileBase(); addHtmlExtensionIfMissing(fn); tagFile << " <compound kind=\"namespace\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; tagFile << " <filename>" << fn << "</filename>\n"; QCString idStr = id(); if (!idStr.isEmpty()) { tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>\n"; } for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)) { switch (lde->kind()) { case LayoutDocEntry::NamespaceNestedNamespaces: { for (const auto &nd : namespaces) { if (nd->isLinkableInProject()) { tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>\n"; } } } break; case LayoutDocEntry::NamespaceClasses: { writeClassesToTagFile(tagFile, classes); } break; case LayoutDocEntry::NamespaceInterfaces: { writeClassesToTagFile(tagFile, interfaces); } break; case LayoutDocEntry::NamespaceStructs: { writeClassesToTagFile(tagFile, structs); } break; case LayoutDocEntry::NamespaceExceptions: { writeClassesToTagFile(tagFile, exceptions); } break; case LayoutDocEntry::NamespaceConcepts: { writeConceptsToTagFile(tagFile); } break; case LayoutDocEntry::MemberDecl: { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) { MemberList * ml = getMemberList(lmd->type); if (ml) { ml->writeTagFile(tagFile); } } } break; case LayoutDocEntry::MemberGroups: { for (const auto &mg : m_memberGroups) { mg->writeTagFile(tagFile); } } break; default: break; } } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>\n"; } void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { if (hasDetailedDescription()) { ol.pushGeneratorState(); ol.disable(OutputType::Html); ol.writeRuler(); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); ol.endGroupHeader(); ol.startTextBlock(); if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,nullptr,briefDescription(),FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputType::Man); ol.disable(OutputType::RTF); ol.enableAll(); ol.disableAllBut(OutputType::Man); ol.enable(OutputType::Latex); ol.writeString("\n\n"); ol.popGeneratorState(); } if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,nullptr,documentation()+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } ol.endTextBlock(); } } void NamespaceDefImpl::writeBriefDescription(OutputList &ol) { if (hasBriefDescription()) { auto parser { createDocParser() }; auto ast { validatingParseDoc(*parser.get(), briefFile(),briefLine(),this,nullptr, briefDescription(),TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) }; if (!ast->isEmpty()) { ol.startParagraph(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.writeString(" - "); ol.popGeneratorState(); ol.writeDoc(ast.get(),this,nullptr); ol.pushGeneratorState(); ol.disable(OutputType::RTF); ol.writeString(" \n"); ol.enable(OutputType::RTF); if (hasDetailedDescription()) { ol.disableAllBut(OutputType::Html); ol.startTextLink(getOutputFileBase(),"details"); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } ol.popGeneratorState(); ol.endParagraph(); } } // Write a summary of the Slice definition including metadata. if (getLanguage() == SrcLangExt::Slice) { ol.startParagraph(); ol.startTypewriter(); if (!metaData.isEmpty()) { ol.docify(metaData); ol.lineBreak(); } ol.docify("module "); ol.docify(stripScope(name())); ol.docify(" { ... }"); ol.endTypewriter(); ol.endParagraph(); } ol.writeSynopsis(); } void NamespaceDefImpl::startMemberDeclarations(OutputList &ol) { ol.startMemberSections(); } void NamespaceDefImpl::endMemberDeclarations(OutputList &ol) { ol.endMemberSections(); } void NamespaceDefImpl::startMemberDocumentation(OutputList &ol) { if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.disable(OutputType::Html); Doxygen::suppressDocWarnings = TRUE; } } void NamespaceDefImpl::endMemberDocumentation(OutputList &ol) { if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.enable(OutputType::Html); Doxygen::suppressDocWarnings = FALSE; } } void NamespaceDefImpl::writeClassDeclarations(OutputList &ol,const QCString &title,const ClassLinkedRefMap &d) { d.writeDeclaration(ol,nullptr,title,TRUE); } void NamespaceDefImpl::writeConcepts(OutputList &ol,const QCString &title) { m_concepts.writeDeclaration(ol,title,TRUE); } void NamespaceDefImpl::writeInlineClasses(OutputList &ol) { classes.writeDocumentation(ol,this); } void NamespaceDefImpl::writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool const isConstantGroup) { namespaces.writeDeclaration(ol,title,isConstantGroup,TRUE); } void NamespaceDefImpl::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ for (const auto &mg : m_memberGroups) { if (!mg->allMembersInSameSection() || !m_subGrouping) { mg->writeDeclarations(ol,nullptr,this,nullptr,nullptr,nullptr); } } } void NamespaceDefImpl::writeAuthorSection(OutputList &ol) { // write Author section (Man only) ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.startGroupHeader(); ol.parseText(theTranslator->trAuthor(TRUE,TRUE)); ol.endGroupHeader(); ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString(PROJECT_NAME))); ol.popGeneratorState(); } void NamespaceDefImpl::writeSummaryLinks(OutputList &ol) const { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); bool first=TRUE; SrcLangExt lang = getLanguage(); for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)) { const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get()); if (lde->kind()==LayoutDocEntry::NamespaceClasses && classes.declVisible() && ls) { QCString label = "nested-classes"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceInterfaces && interfaces.declVisible() && ls) { QCString label = "interfaces"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceStructs && structs.declVisible() && ls) { QCString label = "structs"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceExceptions && exceptions.declVisible() && ls) { QCString label = "exceptions"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceNestedNamespaces && namespaces.declVisible(false) && ls) { QCString label = "namespaces"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceNestedConstantGroups && namespaces.declVisible(true) && ls) { QCString label = "constantgroups"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::NamespaceConcepts && m_concepts.declVisible() && ls) { QCString label = "concepts"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()== LayoutDocEntry::MemberDecl) { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) { MemberList * ml = getMemberList(lmd->type); if (ml && ml->declVisible()) { ol.writeSummaryLink(QCString(),ml->listType().toLabel(),lmd->title(lang),first); first=FALSE; } } } } if (!first) { ol.writeString(" </div>\n"); } ol.popGeneratorState(); } void NamespaceDefImpl::addNamespaceAttributes(OutputList &ol) { // UNO IDL constant groups may be published if (getLanguage()==SrcLangExt::IDL && isConstantGroup() && m_isPublished) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.startLabels(); ol.writeLabel("published",false); ol.endLabels(); ol.popGeneratorState(); } else if (isExported()) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.startLabels(); ol.writeLabel("export",false); ol.endLabels(); ol.popGeneratorState(); } } void NamespaceDefImpl::writeClassesToTagFile(TextStream &tagFile,const ClassLinkedRefMap &list) { for (const auto &cd : list) { if (cd->isLinkableInProject()) { tagFile << " <class kind=\"" << cd->compoundTypeString() << "\">" << convertToXML(cd->name()) << "</class>\n"; } } } void NamespaceDefImpl::writeConceptsToTagFile(TextStream &tagFile) { for (const auto &cd : m_concepts) { if (cd->isLinkableInProject()) { tagFile << " <concept>" << convertToXML(cd->name()) << "</concept>\n"; } } } void NamespaceDefImpl::writeDocumentation(OutputList &ol) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); //bool outputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); QCString pageTitle = title(); startFile(ol,getOutputFileBase(),name(),pageTitle,HighlightedItem::NamespaceVisible,!generateTreeView); if (!generateTreeView) { if (getOuterScope()!=Doxygen::globalScope) { writeNavigationPath(ol); } ol.endQuickIndices(); } startTitle(ol,getOutputFileBase(),this); ol.parseText(pageTitle); addGroupListToTitle(ol,this); addNamespaceAttributes(ol); endTitle(ol,getOutputFileBase(),displayName()); ol.startContents(); //---------------------------------------- start flexible part ------------------------------- SrcLangExt lang = getLanguage(); for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)) { const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get()); switch (lde->kind()) { case LayoutDocEntry::BriefDesc: writeBriefDescription(ol); break; case LayoutDocEntry::MemberDeclStart: startMemberDeclarations(ol); break; case LayoutDocEntry::NamespaceClasses: { if (ls) writeClassDeclarations(ol,ls->title(lang),classes); } break; case LayoutDocEntry::NamespaceInterfaces: { if (ls) writeClassDeclarations(ol,ls->title(lang),interfaces); } break; case LayoutDocEntry::NamespaceStructs: { if (ls) writeClassDeclarations(ol,ls->title(lang),structs); } break; case LayoutDocEntry::NamespaceExceptions: { if (ls) writeClassDeclarations(ol,ls->title(lang),exceptions); } break; case LayoutDocEntry::NamespaceConcepts: { if (ls) writeConcepts(ol,ls->title(lang)); } break; case LayoutDocEntry::NamespaceNestedNamespaces: { if (ls) writeNamespaceDeclarations(ol,ls->title(lang),false); } break; case LayoutDocEntry::NamespaceNestedConstantGroups: { if (ls) writeNamespaceDeclarations(ol,ls->title(lang),true); } break; case LayoutDocEntry::MemberGroups: writeMemberGroups(ol); break; case LayoutDocEntry::MemberDecl: { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) writeMemberDeclarations(ol,lmd->type,lmd->title(lang)); } break; case LayoutDocEntry::MemberDeclEnd: endMemberDeclarations(ol); break; case LayoutDocEntry::DetailedDesc: { if (ls) writeDetailedDescription(ol,ls->title(lang)); } break; case LayoutDocEntry::MemberDefStart: startMemberDocumentation(ol); break; case LayoutDocEntry::NamespaceInlineClasses: writeInlineClasses(ol); break; case LayoutDocEntry::MemberDef: { const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get()); if (lmd) writeMemberDocumentation(ol,lmd->type,lmd->title(lang)); } break; case LayoutDocEntry::MemberDefEnd: endMemberDocumentation(ol); break; case LayoutDocEntry::AuthorSection: writeAuthorSection(ol); break; case LayoutDocEntry::ClassIncludes: case LayoutDocEntry::ClassInheritanceGraph: case LayoutDocEntry::ClassNestedClasses: case LayoutDocEntry::ClassCollaborationGraph: case LayoutDocEntry::ClassAllMembersLink: case LayoutDocEntry::ClassUsedFiles: case LayoutDocEntry::ClassInlineClasses: case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::FileClasses: case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: case LayoutDocEntry::FileNamespaces: case LayoutDocEntry::FileConstantGroups: case LayoutDocEntry::FileIncludes: case LayoutDocEntry::FileIncludeGraph: case LayoutDocEntry::FileIncludedByGraph: case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: case LayoutDocEntry::GroupClasses: case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupModules: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: case LayoutDocEntry::GroupNestedGroups: case LayoutDocEntry::GroupFiles: case LayoutDocEntry::GroupGraph: case LayoutDocEntry::GroupPageDocs: case LayoutDocEntry::ModuleExports: case LayoutDocEntry::ModuleClasses: case LayoutDocEntry::ModuleConcepts: case LayoutDocEntry::ModuleUsedFiles: case LayoutDocEntry::DirSubDirs: case LayoutDocEntry::DirFiles: case LayoutDocEntry::DirGraph: err("Internal inconsistency: member %d should not be part of " "LayoutDocManager::Namespace entry list\n",lde->kind()); break; } } //---------------------------------------- end flexible part ------------------------------- ol.endContents(); endFileWithNavPath(ol,this); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { MemberList *allMemberList = getMemberList(MemberListType::AllMembersList()); if (allMemberList) allMemberList->sort(); writeMemberPages(ol); } } void NamespaceDefImpl::writeMemberPages(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); for (const auto &ml : m_memberLists) { if (ml->listType().isDocumentation()) { ml->writeDocumentationPage(ol,displayName(),this); } } ol.popGeneratorState(); } void NamespaceDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const { bool createSubDirs=Config_getBool(CREATE_SUBDIRS); ol.writeString(" <div class=\"navtab\">\n"); ol.writeString(" <table>\n"); MemberList *allMemberList = getMemberList(MemberListType::AllMembersList()); if (allMemberList) { for (const auto &md : *allMemberList) { if (md->getNamespaceDef()==this && md->isLinkable() && !md->isEnumValue()) { if (md->isLinkableInProject()) { QCString fn = md->getOutputFileBase(); addHtmlExtensionIfMissing(fn); if (md==currentMd) // selected item => highlight { ol.writeString(" <tr><td class=\"navtabHL\">"); } else { ol.writeString(" <tr><td class=\"navtab\">"); } ol.writeString("<a class=\"navtab\" "); ol.writeString("href=\""); if (createSubDirs) ol.writeString("../../"); ol.writeString(fn+"#"+md->anchor()); ol.writeString("\">"); ol.writeString(convertToHtml(md->localName())); ol.writeString("</a>"); ol.writeString("</td></tr>\n"); } } } } ol.writeString(" </table>\n"); ol.writeString(" </div>\n"); } void NamespaceDefImpl::countMembers() { for (auto &ml : m_memberLists) { ml->countDecMembers(); ml->countDocMembers(); } for (const auto &mg : m_memberGroups) { mg->countDecMembers(); mg->countDocMembers(); } } int NamespaceDefImpl::numDocMembers() const { MemberList *allMemberList = getMemberList(MemberListType::AllMembersList()); return (allMemberList ? allMemberList->numDocMembers() : 0) + static_cast<int>(m_innerCompounds.size()); } void NamespaceDefImpl::addUsingDirective(NamespaceDef *nd) { m_usingDirList.add(nd->qualifiedName(),nd); //printf("%s: NamespaceDefImpl::addUsingDirective: %s:%zu\n",qPrint(name()),qPrint(nd->qualifiedName()),m_usingDirList.size()); } void NamespaceDefImpl::addUsingDeclaration(const Definition *d) { m_usingDeclList.add(d->qualifiedName(),d); } QCString NamespaceDefImpl::getOutputFileBase() const { return fileName; } const Definition *NamespaceDefImpl::findInnerCompound(const QCString &n) const { if (n==nullptr) return nullptr; const Definition *d = m_innerCompounds.find(n); if (d==nullptr) { if (!m_usingDirList.empty()) { d = m_usingDirList.find(n); } if (d==nullptr && !m_usingDeclList.empty()) { d = m_usingDeclList.find(n); } } return d; } void NamespaceDefImpl::addListReferences() { //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); { const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, qualifiedName(), getLanguage()==SrcLangExt::Fortran ? theTranslator->trModule(TRUE,TRUE) : theTranslator->trNamespace(TRUE,TRUE), getOutputFileBase(),displayName(), QCString(), this ); } for (const auto &mg : m_memberGroups) { mg->addListReferences(this); } for (auto &ml : m_memberLists) { if (ml->listType().isDocumentation()) { ml->addListReferences(this); } } } QCString NamespaceDefImpl::displayName(bool includeScope) const { return makeDisplayName(this,includeScope); } void NamespaceDefImpl::combineUsingRelations(NamespaceDefSet &visitedNamespaces) { if (visitedNamespaces.find(this)!=visitedNamespaces.end()) return; // already processed visitedNamespaces.insert(this); LinkedRefMap<NamespaceDef> usingDirList = m_usingDirList; for (auto &nd : usingDirList) { NamespaceDefMutable *ndm = toNamespaceDefMutable(nd); if (ndm) { ndm->combineUsingRelations(visitedNamespaces); } } for (auto &nd : usingDirList) { // add used namespaces of namespace nd to this namespace for (const auto &und : nd->getUsedNamespaces()) { addUsingDirective(und); } // add used classes of namespace nd to this namespace for (const auto &ud : nd->getUsedDefinitions()) { addUsingDeclaration(ud); } } } int NamespaceDefImpl::countVisibleMembers() const { int count=0; for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)) { if (lde->kind()==LayoutDocEntry::MemberDef) { const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get()); if (lmd) { MemberList *ml = getMemberList(lmd->type); if (ml) { for (const auto &md : *ml) { if (md->visibleInIndex()) { count++; } } } } } } return count; } //------------------------------------------------------------------------------- bool NamespaceLinkedRefMap::declVisible(bool isConstantGroup) const { bool found=false; for (const auto &nd : *this) { if (nd->isLinkable() && nd->hasDocumentation()) { SrcLangExt lang = nd->getLanguage(); if (SrcLangExt::IDL==lang) { if (isConstantGroup == nd->isConstantGroup()) { found=true; break; } } else if (!isConstantGroup) // ensure we only get extra section in IDL { if (nd->isConstantGroup()) { err("Internal inconsistency: constant group but not IDL?\n"); } found=true; break; } } } return found; } void NamespaceLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &title, bool const isConstantGroup,bool localName) { if (empty()) return; // no namespaces in the list if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) return; if (!declVisible(isConstantGroup)) return; // write list of namespaces ol.startMemberHeader(isConstantGroup ? "constantgroups" : "namespaces"); //bool javaOpt = Config_getBool(OPTIMIZE_OUTPUT_JAVA); //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); for (const auto &nd : *this) { if (nd->isLinkable() && nd->hasDocumentation()) { SrcLangExt lang = nd->getLanguage(); if (lang==SrcLangExt::IDL && (isConstantGroup != nd->isConstantGroup())) continue; // will be output in another pass, see layout_default.xml ol.startMemberDeclaration(); ol.startMemberItem(nd->anchor(),OutputGenerator::MemberItemType::Normal); QCString ct = nd->compoundTypeString(); ol.docify(ct); ol.docify(" "); ol.insertMemberAlign(); QCString name; if (localName) { name = nd->localName(); } else { name = nd->displayName(); } ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),QCString(),name); ol.endMemberItem(OutputGenerator::MemberItemType::Normal); if (!nd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(nd->getOutputFileBase()); ol.generateDoc(nd->briefFile(),nd->briefLine(),nd,nullptr,nd->briefDescription(),FALSE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } ol.endMemberDeclaration(QCString(),QCString()); } } ol.endMemberList(); } //------------------------------------------------------------------------------- void NamespaceDefImpl::addMemberToList(MemberListType lt,MemberDef *md) { bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS); const auto &ml = m_memberLists.get(lt,MemberListContainer::Namespace); ml->setNeedsSorting( (ml->listType().isDeclaration() && sortBriefDocs) || (ml->listType().isDocumentation() && sortMemberDocs)); ml->push_back(md); if (ml->listType().isDeclaration()) { MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm) { mdm->setSectionList(this,ml.get()); } } } void NamespaceDefImpl::sortMemberLists() { for (auto &ml : m_memberLists) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } } auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2) { return Config_getBool(SORT_BY_SCOPE_NAME) ? qstricmp_sort(c1->name(), c2->name())<0 : qstricmp_sort(c1->className(), c2->className())<0; }; std::stable_sort(classes.begin(), classes.end(), classComp); std::stable_sort(interfaces.begin(),interfaces.end(),classComp); std::stable_sort(structs.begin(), structs.end(), classComp); std::stable_sort(exceptions.begin(),exceptions.end(),classComp); auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2) { return qstricmp_sort(n1->name(),n2->name())<0; }; std::stable_sort(namespaces.begin(),namespaces.end(),namespaceComp); } MemberList *NamespaceDefImpl::getMemberList(MemberListType lt) const { for (auto &ml : m_memberLists) { if (ml->listType()==lt) { return ml.get(); } } return nullptr; } void NamespaceDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); if (ml) ml->writeDeclarations(ol,nullptr,this,nullptr,nullptr,nullptr,title,QCString()); } void NamespaceDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,displayName(),this,title); } static bool hasNonReferenceNestedNamespaceRec(const NamespaceDef *nd,int level) { if (level>30) { err("Possible recursive namespace relation while inside %s\n",qPrint(nd->name())); return false; } bool found=nd->isLinkableInProject(); if (found) { return true; } else { for (const auto &ind : nd->getNamespaces()) { found = found || hasNonReferenceNestedNamespaceRec(ind,level+1); if (found) break; } } return found; } bool NamespaceDefImpl::isVisibleInHierarchy() const { bool allExternals = Config_getBool(ALLEXTERNALS); return allExternals || hasNonReferenceNestedNamespaceRec(this,0) || isLinkable(); } bool NamespaceDefImpl::isLinkableInProject() const { int i = name().findRev("::"); if (i==-1) i=0; else i+=2; bool extractAnonNs = Config_getBool(EXTRACT_ANON_NSPACES); bool hideUndoc = Config_getBool(HIDE_UNDOC_NAMESPACES); if (extractAnonNs && // extract anonymous ns name().mid(i,20)=="anonymous_namespace{" // correct prefix ) // not disabled by config { return TRUE; } return !name().isEmpty() && name().at(i)!='@' && // not anonymous (hasDocumentation() || !hideUndoc || getLanguage()==SrcLangExt::CSharp) && // documented !isReference() && // not an external reference !isHidden() && // not hidden !isArtificial(); // or artificial } bool NamespaceDefImpl::isLinkable() const { return isLinkableInProject() || isReference(); } const MemberDef * NamespaceDefImpl::getMemberByName(const QCString &n) const { return m_allMembers.find(n); } QCString NamespaceDefImpl::title() const { SrcLangExt lang = getLanguage(); QCString pageTitle; if (lang==SrcLangExt::Java) { pageTitle = theTranslator->trPackage(displayName()); } else if (lang==SrcLangExt::Fortran || lang==SrcLangExt::Slice) { pageTitle = theTranslator->trModuleReference(displayName()); } else if (lang==SrcLangExt::IDL) { pageTitle = isConstantGroup() ? theTranslator->trConstantGroupReference(displayName()) : theTranslator->trModuleReference(displayName()); } else { pageTitle = theTranslator->trNamespaceReference(displayName()); } return pageTitle; } QCString NamespaceDefImpl::compoundTypeString() const { SrcLangExt lang = getLanguage(); if (lang==SrcLangExt::Java) { return "package"; } else if(lang==SrcLangExt::CSharp) { return "namespace"; } else if (lang==SrcLangExt::Fortran) { return "module"; } else if (lang==SrcLangExt::IDL) { if (isModule()) { return "module"; } else if (isConstantGroup()) { return "constants"; } else if (isLibrary()) { return "library"; } else { err_full(getDefFileName(),getDefLine(),"Internal inconsistency: namespace in IDL not module, library or constant group"); } } return "namespace"; } void NamespaceDefImpl::setMetaData(const QCString &m) { metaData = m; } // --- Cast functions // NamespaceDef *toNamespaceDef(Definition *d) { if (d && (typeid(*d)==typeid(NamespaceDefImpl) || typeid(*d)==typeid(NamespaceDefAliasImpl))) { return static_cast<NamespaceDef*>(d); } else { return nullptr; } } NamespaceDef *toNamespaceDef(DefinitionMutable *md) { Definition *d = toDefinition(md); if (d && typeid(*d)==typeid(NamespaceDefImpl)) { return static_cast<NamespaceDef*>(d); } else { return nullptr; } } const NamespaceDef *toNamespaceDef(const Definition *d) { if (d && (typeid(*d)==typeid(NamespaceDefImpl) || typeid(*d)==typeid(NamespaceDefAliasImpl))) { return static_cast<const NamespaceDef*>(d); } else { return nullptr; } } NamespaceDefMutable *toNamespaceDefMutable(Definition *d) { if (d && typeid(*d)==typeid(NamespaceDefImpl)) { return static_cast<NamespaceDefMutable*>(d); } else { return nullptr; } } // --- Helpers static NamespaceDef *getResolvedNamespaceRec(StringSet &namespacesTried,const NamespaceAliasInfo &aliasInfo); static QCString replaceNamespaceAliasesRec(StringSet &namespacesTried,const QCString &name) { QCString result = name; //printf("> replaceNamespaceAliasesRec(%s)\n",qPrint(name)); if (namespacesTried.find(name.str())==namespacesTried.end()) { namespacesTried.insert(name.str()); size_t p = 0; for (;;) { size_t i = name.str().find("::",p); if (i==std::string::npos) { auto it = Doxygen::namespaceAliasMap.find(name.str()); if (it != Doxygen::namespaceAliasMap.end()) { //printf("found map %s->%s\n",qPrint(name),qPrint(it->second.alias)); auto ns = getResolvedNamespaceRec(namespacesTried,it->second); if (ns) { result = replaceNamespaceAliasesRec(namespacesTried,ns->qualifiedName()); } } break; } else { auto it = Doxygen::namespaceAliasMap.find(name.left(i).str()); if (it != Doxygen::namespaceAliasMap.end()) { //printf("found map %s|%s->%s\n",qPrint(name.left(i)),qPrint(name.mid(i)),qPrint(it->second.alias)); auto ns = getResolvedNamespaceRec(namespacesTried,it->second); if (ns) { result = replaceNamespaceAliasesRec(namespacesTried,ns->qualifiedName()+name.mid(i)); break; } } } p = i+2; } } //printf("< replaceNamespaceAliasesRec(%s)=%s\n",qPrint(name),qPrint(result)); return result; } static NamespaceDef *getResolvedNamespaceRec(StringSet &namespacesTried,const NamespaceAliasInfo &aliasInfo) { size_t j = aliasInfo.context.length(); for (;;) { if (j>0) { //printf("candidate %s|::%s\n",qPrint(aliasInfo.context.substr(0,j)),qPrint(aliasInfo.alias)); auto candidate = replaceNamespaceAliasesRec(namespacesTried,aliasInfo.context.substr(0,j)+"::"+aliasInfo.alias); auto nd = Doxygen::namespaceLinkedMap->find(candidate); if (nd) { return nd; } } if (j>0) // strip one level from context, i.e. given N1::N2::N3 // j==10 -> j==6 (N1::N2::N3->N1::N2), and then // j==6 -> j==2 (N1::N2->N1), and then // j==2 -> j==std::string::npos (N1->"") { j = aliasInfo.context.rfind("::",j-1); } else { j = std::string::npos; } if (j==std::string::npos) { //printf("candidate %s\n",qPrint(aliasInfo.alias)); auto candidate = replaceNamespaceAliasesRec(namespacesTried,QCString(aliasInfo.alias)); auto nd = Doxygen::namespaceLinkedMap->find(candidate); if (nd) { return nd; } break; } } return nullptr; } void replaceNamespaceAliases(QCString &name) { //printf("> replaceNamespaceAliases(%s)\n",qPrint(name)); StringSet namespacesTried; name = replaceNamespaceAliasesRec(namespacesTried,name); //printf("< replaceNamespaceAliases: result=%s\n",qPrint(name)); } NamespaceDef *getResolvedNamespace(const QCString &name) { //printf("> getResolvedNamespace(%s)\n",qPrint(name)); if (name.isEmpty()) return nullptr; StringSet namespacesTried; auto ns = getResolvedNamespaceRec(namespacesTried,NamespaceAliasInfo(name.str())); //printf("< getResolvedNamespace(%s)=%s\n",qPrint(name),ns?qPrint(ns->qualifiedName()):"nullptr"); return ns; } //-------------------------------------------------------------------------------------- // bool namespaceHasNestedNamespace(const NamespaceDef *nd) { for (const auto &cnd : nd->getNamespaces()) { if (cnd->isLinkableInProject() && !cnd->isAnonymous()) { return true; } } return false; } bool namespaceHasNestedConcept(const NamespaceDef *nd) { //printf(">namespaceHasNestedConcept(%s)\n",qPrint(nd->name())); for (const auto &cnd : nd->getNamespaces()) { if (namespaceHasNestedConcept(cnd)) { //printf("<namespaceHasNestedConcept(%s): case1\n",qPrint(nd->name())); return true; } } for (const auto &cnd : nd->getConcepts()) { //printf("candidate %s isLinkableInProject()=%d\n",qPrint(cnd->name()),cnd->isLinkableInProject()); if (cnd->isLinkableInProject()) { //printf("<namespaceHasNestedConcept(%s): case2\n",qPrint(nd->name())); return true; } } //printf("<namespaceHasNestedConcept(%s): case3\n",qPrint(nd->name())); return false; } bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct) { //printf(">namespaceHasNestedClass(%s,filterClasses=%d)\n",qPrint(nd->name()),filterClasses); for (const auto &cnd : nd->getNamespaces()) { if (namespaceHasNestedClass(cnd,filterClasses,ct)) { //printf("<namespaceHasNestedClass(%s,filterClasses=%d): case1\n",qPrint(nd->name()),filterClasses); return true; } } ClassLinkedRefMap list = nd->getClasses(); if (filterClasses) { switch (ct) { case ClassDef::Interface: list = nd->getInterfaces(); break; case ClassDef::Struct: list = nd->getStructs(); break; case ClassDef::Exception: list = nd->getExceptions(); break; default: break; } } for (const auto &cd : list) { //printf("candidate %s isLinkableInProject()=%d\n",qPrint(cd->name()),cd->isLinkableInProject()); if (cd->isLinkableInProject()) { //printf("<namespaceHasNestedClass(%s,filterClasses=%d): case2\n",qPrint(nd->name()),filterClasses); return true; } } //printf("<namespaceHasNestedClass(%s,filterClasses=%d): case3\n",qPrint(nd->name()),filterClasses); return false; }
56,883
C++
.cpp
1,733
27.586267
129
0.66763
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,453
docsets.cpp
doxygen_doxygen/src/docsets.cpp
/****************************************************************************** * * Copyright (C) 1997-2021 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 <unordered_set> #include <stack> #include "docsets.h" #include "config.h" #include "message.h" #include "doxygen.h" #include "groupdef.h" #include "classdef.h" #include "filedef.h" #include "memberdef.h" #include "namespacedef.h" #include "util.h" #include "textstream.h" #include "portable.h" struct DocSets::Private { QCString indent(); std::ofstream ntf; TextStream nts; std::ofstream ttf; TextStream tts; std::stack<bool> indentStack; std::unordered_set<std::string> scopes; }; DocSets::DocSets() : p(std::make_unique<Private>()) {} DocSets::~DocSets() = default; void DocSets::initialize() { // -- get config options QCString projectName = Config_getString(PROJECT_NAME); if (projectName.isEmpty()) projectName="root"; QCString bundleId = Config_getString(DOCSET_BUNDLE_ID); if (bundleId.isEmpty()) bundleId="org.doxygen.Project"; QCString feedName = Config_getString(DOCSET_FEEDNAME); if (feedName.isEmpty()) feedName="FeedName"; QCString feedURL = Config_getString(DOCSET_FEEDURL); if (feedURL.isEmpty()) feedURL="FeedUrl"; QCString publisherId = Config_getString(DOCSET_PUBLISHER_ID); if (publisherId.isEmpty()) publisherId="PublisherId"; QCString publisherName = Config_getString(DOCSET_PUBLISHER_NAME); if (publisherName.isEmpty()) publisherName="PublisherName"; QCString projectNumber = Config_getString(PROJECT_NUMBER); if (projectNumber.isEmpty()) projectNumber="ProjectNumber"; // -- write Makefile { QCString mfName = Config_getString(HTML_OUTPUT) + "/Makefile"; std::ofstream ts = Portable::openOutputStream(mfName); if (!ts.is_open()) { term("Could not open file %s for writing\n",qPrint(mfName)); } ts << "DOCSET_NAME=" << bundleId << ".docset\n" "DOCSET_CONTENTS=$(DOCSET_NAME)/Contents\n" "DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources\n" "DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents\n" "DESTDIR=~/Library/Developer/Shared/Documentation/DocSets\n" "XCODE_INSTALL=\"$(shell xcode-select -print-path)\"\n" "\n" "all: docset\n" "\n" "docset:\n" "\tmkdir -p $(DOCSET_DOCUMENTS)\n" "\tcp Nodes.xml $(DOCSET_RESOURCES)\n" "\tcp Tokens.xml $(DOCSET_RESOURCES)\n" "\tcp Info.plist $(DOCSET_CONTENTS)\n" "\ttar --exclude $(DOCSET_NAME) \\\n" "\t --exclude Nodes.xml \\\n" "\t --exclude Tokens.xml \\\n" "\t --exclude Info.plist \\\n" "\t --exclude Makefile -c -f - . \\\n" "\t | (cd $(DOCSET_DOCUMENTS); tar xvf -)\n" "\t$(XCODE_INSTALL)/usr/bin/docsetutil index $(DOCSET_NAME)\n" "\trm -f $(DOCSET_DOCUMENTS)/Nodes.xml\n" "\trm -f $(DOCSET_DOCUMENTS)/Info.plist\n" "\trm -f $(DOCSET_DOCUMENTS)/Makefile\n" "\trm -f $(DOCSET_RESOURCES)/Nodes.xml\n" "\trm -f $(DOCSET_RESOURCES)/Tokens.xml\n" "\n" "clean:\n" "\trm -rf $(DOCSET_NAME)\n" "\n" "install: docset\n" "\tmkdir -p $(DESTDIR)\n" "\tcp -R $(DOCSET_NAME) $(DESTDIR)\n" "\n" "uninstall:\n" "\trm -rf $(DESTDIR)/$(DOCSET_NAME)\n" "\n" "always:\n"; } // -- write Info.plist { QCString plName = Config_getString(HTML_OUTPUT) + "/Info.plist"; std::ofstream ts = Portable::openOutputStream(plName); if (!ts.is_open()) { term("Could not open file %s for writing\n",qPrint(plName)); } ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n" "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" "<plist version=\"1.0\">\n" "<dict>\n" " <key>CFBundleName</key>\n" " <string>" << projectName << "</string>\n" " <key>CFBundleIdentifier</key>\n" " <string>" << bundleId << "</string>\n" " <key>CFBundleVersion</key>\n" " <string>" << projectNumber << "</string>\n" " <key>DocSetFeedName</key>\n" " <string>" << feedName << "</string>\n" " <key>DocSetFeedUrl</key>\n" " <string>" << feedURL << "</string>\n" " <key>DocSetPublisherIdentifier</key>\n" " <string>" << publisherId << "</string>\n" " <key>DocSetPublisherName</key>\n" " <string>" << publisherName << "</string>\n" // markers for Dash " <key>DashDocSetFamily</key>\n" " <string>doxy</string>\n" " <key>DocSetPlatformFamily</key>\n" " <string>doxygen</string>\n" "</dict>\n" "</plist>\n"; } // -- start Nodes.xml QCString notes = Config_getString(HTML_OUTPUT) + "/Nodes.xml"; p->ntf = Portable::openOutputStream(notes); if (!p->ntf.is_open()) { term("Could not open file %s for writing\n",qPrint(notes)); } p->nts.setStream(&p->ntf); //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; p->nts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; p->nts << "<DocSetNodes version=\"1.0\">\n"; p->nts << " <TOC>\n"; p->nts << " <Node>\n"; p->nts << " <Name>Root</Name>\n"; p->nts << " <Path>" << indexName << Doxygen::htmlFileExtension << "</Path>\n"; p->nts << " <Subnodes>\n"; p->indentStack.push(true); QCString tokens = Config_getString(HTML_OUTPUT) + "/Tokens.xml"; p->ttf = Portable::openOutputStream(tokens); if (!p->ttf.is_open()) { term("Could not open file %s for writing\n",qPrint(tokens)); } p->tts.setStream(&p->ttf); p->tts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; p->tts << "<Tokens version=\"1.0\">\n"; } void DocSets::finalize() { if (!p->indentStack.top()) { p->nts << p->indent() << " </Node>\n"; } p->indentStack.pop(); p->nts << " </Subnodes>\n"; p->nts << " </Node>\n"; p->nts << " </TOC>\n"; p->nts << "</DocSetNodes>\n"; p->nts.flush(); p->ntf.close(); p->tts << "</Tokens>\n"; p->tts.flush(); p->ttf.close(); } QCString DocSets::Private::indent() { QCString result; result.fill(' ',static_cast<int>(indentStack.size()+2)*2); return result; } void DocSets::incContentsDepth() { //printf("DocSets::incContentsDepth() depth=%zu\n",p->indentStack.size()); p->nts << p->indent() << "<Subnodes>\n"; p->indentStack.push(true); } void DocSets::decContentsDepth() { if (!p->indentStack.top()) { p->nts << p->indent() << " </Node>\n"; } p->nts << p->indent() << "</Subnodes>\n"; p->indentStack.pop(); //printf("DocSets::decContentsDepth() depth=%zu\n",p->indentStack.size()); } void DocSets::addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool /* separateIndex */, bool /* addToNavIndex */, const Definition * /*def*/) { (void)isDir; //printf("DocSets::addContentsItem(%s) depth=%zu\n",name,p->indentStack.size()); if (ref==nullptr) { if (!p->indentStack.top()) { p->nts << p->indent() << " </Node>\n"; } p->indentStack.top()=false; p->nts << p->indent() << " <Node>\n"; p->nts << p->indent() << " <Name>" << convertToXML(name) << "</Name>\n"; if (!file.isEmpty() && file[0]=='^') // URL marker { p->nts << p->indent() << " <URL>" << convertToXML(&file[1]) << "</URL>\n"; } else // relative file { p->nts << p->indent() << " <Path>"; if (!file.isEmpty() && file[0]=='!') // user specified file { p->nts << convertToXML(&file[1]); } else if (!file.isEmpty()) // doxygen generated file { QCString fn = file; addHtmlExtensionIfMissing(fn); p->nts << fn; } p->nts << "</Path>\n"; if (!file.isEmpty() && !anchor.isEmpty()) { p->nts << p->indent() << " <Anchor>" << anchor << "</Anchor>\n"; } } } } void DocSets::addIndexItem(const Definition *context,const MemberDef *md, const QCString &,const QCString &) { if (md==nullptr && context==nullptr) return; const FileDef *fd = nullptr; const ClassDef *cd = nullptr; const NamespaceDef *nd = nullptr; if (md) { fd = md->getFileDef(); cd = md->getClassDef(); nd = md->getNamespaceDef(); if (!md->isLinkable()) return; // internal symbol } QCString scope; QCString type; QCString decl; // determine language QCString lang; SrcLangExt langExt = SrcLangExt::Cpp; if (md) { langExt = md->getLanguage(); } else if (context) { langExt = context->getLanguage(); } switch (langExt) { case SrcLangExt::Cpp: case SrcLangExt::ObjC: { if (md && (md->isObjCMethod() || md->isObjCProperty())) lang="occ"; // Objective C/C++ else if (fd && fd->name().lower().endsWith(".c")) lang="c"; // Plain C else if (cd==nullptr && nd==nullptr) lang="c"; // Plain C symbol outside any class or namespace else lang="cpp"; // C++ } break; case SrcLangExt::IDL: lang="idl"; break; // IDL case SrcLangExt::CSharp: lang="csharp"; break; // C# case SrcLangExt::PHP: lang="php"; break; // PHP4/5 case SrcLangExt::D: lang="d"; break; // D case SrcLangExt::Java: lang="java"; break; // Java case SrcLangExt::JS: lang="javascript"; break; // JavaScript case SrcLangExt::Python: lang="python"; break; // Python case SrcLangExt::Fortran: lang="fortran"; break; // Fortran case SrcLangExt::VHDL: lang="vhdl"; break; // VHDL case SrcLangExt::XML: lang="xml"; break; // DBUS XML case SrcLangExt::SQL: lang="sql"; break; // Sql case SrcLangExt::Markdown:lang="markdown"; break; // Markdown case SrcLangExt::Slice: lang="slice"; break; // Slice case SrcLangExt::Lex: lang="lex"; break; // Lex case SrcLangExt::Unknown: lang="unknown"; break; // should not happen! } if (context && md) { switch (md->memberType()) { case MemberType::Define: type="macro"; break; case MemberType::Function: if (cd && (cd->compoundType()==ClassDef::Interface || cd->compoundType()==ClassDef::Class)) { if (md->isStatic()) type="clm"; // class member else type="instm"; // instance member } else if (cd && cd->compoundType()==ClassDef::Protocol) { if (md->isStatic()) type="intfcm"; // interface class member else type="intfm"; // interface member } else type="func"; break; case MemberType::Variable: type="data"; break; case MemberType::Typedef: type="tdef"; break; case MemberType::Enumeration: type="enum"; break; case MemberType::EnumValue: type="econst"; break; //case MemberDef::Prototype: // type="prototype"; break; case MemberType::Signal: type="signal"; break; case MemberType::Slot: type="slot"; break; case MemberType::Friend: type="ffunc"; break; case MemberType::DCOP: type="dcop"; break; case MemberType::Property: if (cd && cd->compoundType()==ClassDef::Protocol) type="intfp"; // interface property else type="instp"; // instance property break; case MemberType::Event: type="event"; break; case MemberType::Interface: type="ifc"; break; case MemberType::Service: type="svc"; break; case MemberType::Sequence: type="sequence"; break; case MemberType::Dictionary: type="dictionary"; break; } scope = md->getScopeString(); fd = md->getFileDef(); if (fd) { decl = fd->name(); } writeToken(p->tts,md,type,lang,scope,md->anchor(),decl); } else if (context && context->isLinkable()) { if (fd==nullptr && context->definitionType()==Definition::TypeFile) { fd = toFileDef(context); } if (cd==nullptr && context->definitionType()==Definition::TypeClass) { cd = toClassDef(context); } if (nd==nullptr && context->definitionType()==Definition::TypeNamespace) { nd = toNamespaceDef(context); } if (fd) { type="file"; } else if (cd) { scope = cd->qualifiedName(); if (cd->isTemplate()) { type="tmplt"; } else if (cd->compoundType()==ClassDef::Protocol) { type="intf"; if (scope.endsWith("-p")) scope=scope.left(scope.length()-2); } else if (cd->compoundType()==ClassDef::Interface) { type="cl"; } else if (cd->compoundType()==ClassDef::Category) { type="cat"; } else { type = "cl"; } const IncludeInfo *ii = cd->includeInfo(); if (ii) { decl=ii->includeName; } } else if (nd) { scope = nd->name(); type = "ns"; } if (p->scopes.find(context->getOutputFileBase().str())==p->scopes.end()) { writeToken(p->tts,context,type,lang,scope,QCString(),decl); p->scopes.insert(context->getOutputFileBase().str()); } } } void DocSets::writeToken(TextStream &t, const Definition *d, const QCString &type, const QCString &lang, const QCString &scope, const QCString &anchor, const QCString &decl) { t << " <Token>\n"; t << " <TokenIdentifier>\n"; QCString name = d->name(); if (name.endsWith("-p")) name=name.left(name.length()-2); t << " <Name>" << convertToXML(name) << "</Name>\n"; if (!lang.isEmpty()) { t << " <APILanguage>" << lang << "</APILanguage>\n"; } if (!type.isEmpty()) { t << " <Type>" << type << "</Type>\n"; } if (!scope.isEmpty()) { t << " <Scope>" << convertToXML(scope) << "</Scope>\n"; } t << " </TokenIdentifier>\n"; QCString fn = d->getOutputFileBase(); addHtmlExtensionIfMissing(fn); t << " <Path>" << fn << "</Path>\n"; if (!anchor.isEmpty()) { t << " <Anchor>" << anchor << "</Anchor>\n"; } QCString tooltip = d->briefDescriptionAsTooltip(); if (!tooltip.isEmpty()) { t << " <Abstract>" << convertToXML(tooltip) << "</Abstract>\n"; } if (!decl.isEmpty()) { t << " <DeclaredIn>" << convertToXML(decl) << "</DeclaredIn>\n"; } t << " </Token>\n"; } void DocSets::addIndexFile(const QCString &name) { (void)name; }
15,899
C++
.cpp
487
26.342916
85
0.556191
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,454
memberlist.cpp
doxygen_doxygen/src/memberlist.cpp
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 "memberlist.h" #include "classdef.h" #include "message.h" #include "util.h" #include "language.h" #include "doxygen.h" #include "outputlist.h" #include "groupdef.h" #include "vhdldocgen.h" #include "namespacedef.h" #include "filedef.h" #include "membergroup.h" #include "config.h" #include "docparser.h" #include "moduledef.h" MemberList::MemberList(MemberListType lt,MemberListContainer con) : m_container(con), m_listType(lt) { //printf("%p: MemberList::MemberList(%d)\n",this,lt); m_numDecMembers=-1; // special value indicating that value needs to be computed m_numDecEnumValues=0; m_numDocMembers=-1; // special value indicating that value needs to be computed m_numDocEnumValues=0; m_needsSorting=FALSE; } MemberList::~MemberList() { } int genericCompareMembers(const MemberDef *c1,const MemberDef *c2) { bool sortConstructorsFirst = Config_getBool(SORT_MEMBERS_CTORS_1ST); if (sortConstructorsFirst) { int ord1 = c1->isConstructor() ? 2 : (c1->isDestructor() ? 1 : 0); int ord2 = c2->isConstructor() ? 2 : (c2->isDestructor() ? 1 : 0); if (ord1 > ord2) return -1; else if (ord2 > ord1) return 1; } // sort on name, first case in-sensitive int cmp = qstricmp_sort(c1->name(),c2->name()); // then on qualified name if (cmp==0) { cmp = qstricmp_sort(c1->qualifiedName(),c2->qualifiedName()); } // then on argument list if (cmp==0 && !c1->argsString().isEmpty() && !c2->argsString().isEmpty()) { cmp = qstricmp_sort(c1->argsString(),c2->argsString()); } // then on file in which the item is defined if (cmp==0) { cmp = qstricmp_sort(c1->getDefFileName(),c2->getDefFileName()); } // then on line number at which the member is defined if (cmp==0) { cmp = c1->getDefLine()-c2->getDefLine(); } return cmp; } int MemberList::countInheritableMembers(const ClassDef *inheritedFrom) const { int count=0; for (const auto &md : m_members) { if (md->isBriefSectionVisible()) { if (md->memberType()!=MemberType::Friend && md->memberType()!=MemberType::EnumValue) { //printf("member %s: isReimplementedBy(%s)=%d\n",qPrint(md->name()), // qPrint(inheritedFrom->name()), // md->isReimplementedBy(inheritedFrom)); if (md->memberType()==MemberType::Function) { if (!md->isReimplementedBy(inheritedFrom)) count++; } else { count++; } } } } for (const auto &mg : m_memberGroupRefList) { count+=mg->countInheritableMembers(inheritedFrom); } //printf("%s::countInheritableMembers(%s)=%d\n", // qPrint(m_listType.toLabel()), // qPrint(inheritedFrom->name()),count); return count; } /*! Count the number of members in this list that are visible in * the declaration part of a compound's documentation page. */ void MemberList::countDecMembers() { if (m_numDecMembers!=-1) return; //printf("----- countDecMembers count=%d ----\n",count()); /* m_varCnt=m_funcCnt=m_enumCnt=m_enumValCnt=0; m_typeCnt=m_seqCnt=m_dictCnt=m_protoCnt=m_defCnt=m_friendCnt=0; */ m_numDecMembers=0; for (const auto &md : m_members) { //printf("MemberList::countDecMembers(md=%s,%d)\n",qPrint(md->name()),md->isBriefSectionVisible()); if (md->isBriefSectionVisible()) { switch(md->memberType()) { case MemberType::Variable: // fall through case MemberType::Event: // fall through case MemberType::Property: /*m_varCnt++,*/ m_numDecMembers++; break; // apparently necessary to get this to show up in declarations section? case MemberType::Interface: // fall through case MemberType::Service: // fall through case MemberType::Function: // fall through case MemberType::Signal: // fall through case MemberType::DCOP: // fall through case MemberType::Slot: if (!md->isRelated() || md->getClassDef()) /*m_funcCnt++,*/ m_numDecMembers++; break; case MemberType::Enumeration: /*m_enumCnt++,*/ m_numDecMembers++; break; case MemberType::EnumValue: m_numDecEnumValues++; m_numDecMembers++; break; case MemberType::Typedef: /*m_typeCnt++,*/ m_numDecMembers++; break; case MemberType::Sequence: /*m_seqCnt++,*/ m_numDecMembers++; break; case MemberType::Dictionary: /*m_dictCnt++,*/ m_numDecMembers++; break; //case MemberType::Prototype: m_protoCnt++,m_numDecMembers++; break; case MemberType::Define: if (Config_getBool(EXTRACT_ALL) || !md->argsString().isEmpty() || !md->initializer().isEmpty() || md->hasDocumentation() ) /*m_defCnt++,*/ m_numDecMembers++; break; case MemberType::Friend: /*m_friendCnt++,*/ m_numDecMembers++; break; default: err("Unknown member type found for member '%s'!\n",qPrint(md->name())); } } } for (const auto &mg : m_memberGroupRefList) { mg->countDecMembers(); /* m_varCnt+=mg->varCount(); m_funcCnt+=mg->funcCount(); m_enumCnt+=mg->enumCount(); m_enumValCnt+=mg->enumValueCount(); m_typeCnt+=mg->typedefCount(); m_seqCnt+=mg->sequenceCount(); m_dictCnt+=mg->dictionaryCount(); m_protoCnt+=mg->protoCount(); m_defCnt+=mg->defineCount(); m_friendCnt+=mg->friendCount(); */ m_numDecMembers+=mg->numDecMembers(); m_numDecEnumValues+=mg->numDecEnumValues(); } //printf("----- end countDecMembers ----\n"); //printf("MemberList::countDecMembers()=%d\n",m_numDecMembers); } void MemberList::countDocMembers() { if (m_numDocMembers!=-1) return; // used cached value m_numDocMembers=0; for (const auto &md : m_members) { if (md->isDetailedSectionVisible(m_container) && !md->isAlias()) { // do not count enum values, since they do not produce entries of their own if (md->memberType()==MemberType::EnumValue) { m_numDocEnumValues++; } m_numDocMembers++; } } for (const auto &mg : m_memberGroupRefList) { mg->countDocMembers(); m_numDocMembers+=mg->numDocMembers(); m_numDocEnumValues+=mg->numDocEnumValues(); } //printf("MemberList::countDocMembers()=%d memberGroupList=%p\n",m_numDocMembers,memberGroupList); } void MemberList::setAnonymousEnumType() { //printf("MemberList(%p)::setAnonymousEnumType()\n",this); for (const auto &md : m_members) { if (md->isBriefSectionVisible()) { QCString name(md->name()); int i=name.findRev("::"); if (i!=-1) name=name.right(name.length()-i-2); if (md->memberType()==MemberType::Enumeration && name[0]=='@') { for (const auto &vmd : md->enumFieldList()) { MemberDefMutable *vmdm = toMemberDefMutable(vmd); if (vmdm) { QCString vtype=vmd->typeString(); if ((vtype.find(name))!=-1) { vmdm->setAnonymousEnumType(md); } } } } } } for (const auto &mg : m_memberGroupRefList) { mg->setAnonymousEnumType(); } } int MemberList::countEnumValues(const MemberDef *md) const { int numEnumValues=0; QCString name(md->name()); int i=name.findRev("::"); if (i!=-1) name=name.right(name.length()-i-2); if (name[0]=='@') { for (const auto &vmd : m_members) { QCString vtype=vmd->typeString(); if ((vtype.find(name))!=-1) { numEnumValues++; } } } return numEnumValues; } bool MemberList::declVisible() const { for (const auto &md : m_members) { if (md->isBriefSectionVisible()) { switch (md->memberType()) { case MemberType::Define: // fall through case MemberType::Typedef: // fall through case MemberType::Variable: // fall through case MemberType::Function: // fall through case MemberType::Signal: // fall through case MemberType::Slot: // fall through case MemberType::DCOP: // fall through case MemberType::Property: // fall through case MemberType::Interface: // fall through case MemberType::Service: // fall through case MemberType::Sequence: // fall through case MemberType::Dictionary: // fall through case MemberType::Event: return TRUE; case MemberType::Enumeration: { // if this is an anonymous enum and there are variables of this // enum type (i.e. enumVars>0), then we do not show the enum here. if (countEnumValues(md)==0) // show enum here { return TRUE; } } break; case MemberType::Friend: return TRUE; case MemberType::EnumValue: { if (m_container==MemberListContainer::Group) { return TRUE; } } break; } } } return FALSE; } void MemberList::writePlainDeclarations(OutputList &ol, bool inGroup, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd, const GroupDef *gd,const ModuleDef *mod, int indentLevel, const ClassDef *inheritedFrom,const QCString &inheritId ) const { //printf("----- writePlainDeclaration() ----\n"); if (numDecMembers()==-1) { err("MemberList::numDecMembers()==-1, so the members of this list have not been counted. Please report as a bug.\n"); abort(); } if (numDecMembers()<=numDecEnumValues()) { //printf(" --> no members!\n"); return; // no members in this list } //printf(" --> writePlainDeclaration() numDecMembers()=%d\n", // numDecMembers()); ol.pushGeneratorState(); bool first=TRUE; for (const auto &md : m_members) { //printf(">>> Member '%s' type=%d visible=%d inheritedFrom=%p inheritId=%s\n", // qPrint(md->name()),md->memberType(),md->isBriefSectionVisible(),(void*)inheritedFrom,qPrint(inheritId)); if ((inheritedFrom==nullptr || !md->isReimplementedBy(inheritedFrom)) && md->isBriefSectionVisible()) { //printf(">>> rendering\n"); switch(md->memberType()) { case MemberType::Define: // fall through //case MemberType::Prototype: // fall through case MemberType::Typedef: // fall through case MemberType::Variable: // fall through case MemberType::Function: // fall through case MemberType::Signal: // fall through case MemberType::Slot: // fall through case MemberType::DCOP: // fall through case MemberType::Property: // fall through case MemberType::Interface: // fall through case MemberType::Service: // fall through case MemberType::Sequence: // fall through case MemberType::Dictionary: // fall through case MemberType::Event: { if (first) ol.startMemberList(),first=FALSE; md->writeDeclaration(ol,cd,nd,fd,gd,mod,inGroup,indentLevel,inheritedFrom,inheritId); break; } case MemberType::Enumeration: { // if this is an anonymous enum and there are variables of this // enum type (i.e. enumVars>0), then we do not show the enum here. if (countEnumValues(md)==0) // show enum here { //printf("Enum!!\n"); if (first) { ol.startMemberList(); first=FALSE; } ol.startMemberDeclaration(); ol.startMemberItem(md->anchor(),OutputGenerator::MemberItemType::Normal,inheritId); bool detailsLinkable = md->hasDetailedDescription(); if (!detailsLinkable) { ol.startDoxyAnchor(md->getOutputFileBase(),QCString(),md->anchor(),md->name(),QCString()); ol.addLabel(md->getOutputFileBase(),md->anchor()); } if (md->isSliceLocal()) { ol.writeString("local "); } ol.writeString("enum "); if (md->getLanguage()==SrcLangExt::Cpp && md->isStrong()) { if (md->isEnumStruct()) { ol.writeString("struct "); } else { ol.writeString("class "); } } ol.insertMemberAlign(); md->writeEnumDeclaration(ol,cd,nd,fd,gd,mod); if (!detailsLinkable) { ol.endDoxyAnchor(md->getOutputFileBase(),md->anchor()); } ol.endMemberItem(OutputGenerator::MemberItemType::Normal); if (!md->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { auto parser { createDocParser() }; auto ast { validatingParseDoc(*parser.get(), md->briefFile(),md->briefLine(), cd,md, md->briefDescription(), TRUE,FALSE, QCString(),TRUE,FALSE, Config_getBool(MARKDOWN_SUPPORT)) }; if (!ast->isEmpty()) { ol.startMemberDescription(md->anchor()); ol.writeDoc(ast.get(),cd,md); if (md->hasDetailedDescription()) { ol.disableAllBut(OutputType::Html); ol.docify(" "); ol.startTextLink(md->getOutputFileBase(), md->anchor()); ol.parseText(theTranslator->trMore()); ol.endTextLink(); ol.enableAll(); } ol.endMemberDescription(); } } ol.endMemberDeclaration(md->anchor(),inheritId); } md->warnIfUndocumented(); break; } case MemberType::Friend: if (inheritedFrom==nullptr) { if (first) { ol.startMemberList(); first=FALSE; } md->writeDeclaration(ol,cd,nd,fd,gd,mod,inGroup,indentLevel,inheritedFrom,inheritId); break; } case MemberType::EnumValue: { if (inGroup) { //printf("EnumValue!\n"); if (first) ol.startMemberList(),first=FALSE; md->writeDeclaration(ol,cd,nd,fd,gd,mod,true,indentLevel,inheritedFrom,inheritId); } } break; } } } if (!first) { ol.endMemberList(); } ol.popGeneratorState(); //printf("----- end writePlainDeclaration() ----\n"); } /** Writes the list of members to the output. * @param ol Output list to write to * @param cd non-null if this list is part of class documentation. * @param nd non-null if this list is part of namespace documentation. * @param fd non-null if this list is part of file documentation. * @param gd non-null if this list is part of group documentation. * @param mod non-null if this list is part of module documentation. * @param title Title to use for the member list. * @param subtitle Sub title to use for the member list. * @param showEnumValues Obsolete, always set to FALSE. * @param showInline if set to TRUE if title is rendered differently * @param inheritedFrom if not 0, the list is shown inside the * given class as inherited members, parameter cd points to the * class containing the members. * @param lt Type of list that is inherited from. * @param showSectionTitle do we show the "additional members" header or not? * When combining public and protected inherited members under a single header only for the first list it should be shown */ void MemberList::writeDeclarations(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, const QCString &title,const QCString &subtitle, bool showEnumValues, bool showInline,const ClassDef *inheritedFrom,MemberListType lt,bool showSectionTitle) const { (void)showEnumValues; // unused //printf("----- writeDeclaration() this=%p ---- inheritedFrom=%p\n",this,inheritedFrom); bool optimizeVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL); QCString inheritId; const Definition *ctx = cd; if (ctx==nullptr && nd) ctx = nd; if (ctx==nullptr && gd) ctx = gd; if (ctx==nullptr && mod) ctx = mod; if (ctx==nullptr && fd) ctx = fd; //printf("%p: MemberList::writeDeclaration(title='%s',subtitle='%s')=%d inheritedFrom=%p\n", // (void*)this,qPrint(title),qPrint(subtitle),numDecMembers(),(void*)inheritedFrom); int num = numDecMembers(); int numEnumValues = numDecEnumValues(); if (inheritedFrom) { if (cd && !optimizeVhdl) { inheritId = substitute(lt.toLabel(),"-","_")+"_"+ stripPath(cd->getOutputFileBase()); if (showSectionTitle && !title.isEmpty()) { ol.writeInheritedSectionTitle(inheritId,cd->getReference(), cd->getOutputFileBase(), cd->anchor(),title,cd->displayName()); } } } else if (num>numEnumValues) { if (!title.isEmpty()) { if (showInline) { ol.startInlineHeader(); } else { ol.startMemberHeader(m_listType.toLabel()); } ol.parseText(title); if (showInline) { ol.endInlineHeader(); } else { ol.endMemberHeader(); } } if (!subtitle.stripWhiteSpace().isEmpty()) { ol.startMemberSubtitle(); ol.generateDoc("[generated]",-1,ctx,nullptr,subtitle,FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberSubtitle(); } } if (num>numEnumValues) { bool inGroup = m_container==MemberListContainer::Group; // TODO: Two things need to be worked out for proper VHDL output: // 1. Signals and types under the group need to be // formatted to associate them with the group somehow // indentation, or at the very least, extra space after // the group is done // 2. This might need to be repeated below for memberGroupLists if (optimizeVhdl) // use specific declarations function { VhdlDocGen::writeVhdlDeclarations(this,ol,nullptr,cd,nullptr,nullptr,nullptr); } else { writePlainDeclarations(ol,inGroup,cd,nd,fd,gd,mod,0,inheritedFrom,inheritId); } //printf("memberGroupList=%p\n",memberGroupList); for (const auto &mg : m_memberGroupRefList) { bool hasHeader=!mg->header().isEmpty(); if (inheritId.isEmpty()) { //printf("mg->header=%s hasHeader=%d\n",qPrint(mg->header()),hasHeader); ol.startMemberGroupHeader(hasHeader); if (hasHeader) { ol.parseText(mg->header()); } ol.endMemberGroupHeader(); if (!mg->documentation().isEmpty()) { //printf("Member group has docs!\n"); ol.startMemberGroupDocs(); ol.generateDoc(mg->docFile(),mg->docLine(),mg->memberContainer(),nullptr,mg->documentation()+"\n",FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberGroupDocs(); } ol.startMemberGroup(); } //printf("--- mg->writePlainDeclarations ---\n"); mg->writePlainDeclarations(ol,inGroup,cd,nd,fd,gd,mod,0,inheritedFrom,inheritId); if (inheritId.isEmpty()) { ol.endMemberGroup(hasHeader); } } } if (inheritedFrom && cd) { // also add members that of this list type, that are grouped together // in a separate list in class 'inheritedFrom' cd->addGroupedInheritedMembers(ol,m_listType,inheritedFrom,inheritId); } //printf("----- end writeDeclaration() ----\n"); } void MemberList::writeDocumentation(OutputList &ol, const QCString &scopeName, const Definition *container, const QCString &title,bool showEnumValues,bool showInline) const { if (numDocMembers()==-1) { err("MemberList::numDocMembers()==-1, so the members of this list have not been counted. Please report as a bug.\n"); abort(); } if (numDocMembers()==0) return; if (!showEnumValues && numDocMembers()<=numDocEnumValues()) return; if (!title.isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputType::Html); ol.writeRuler(); ol.popGeneratorState(); ol.startGroupHeader(showInline ? 2 : 0); ol.parseText(title); ol.endGroupHeader(showInline ? 2 : 0); } ol.startMemberDocList(); struct OverloadInfo { uint32_t count = 1; uint32_t total = 0; }; std::unordered_map<std::string,OverloadInfo> overloadInfo; // count the number of overloaded members for (const auto &md : m_members) { if (md->isDetailedSectionVisible(m_container) && !(md->isEnumValue() && !showInline)) { auto it = overloadInfo.emplace(md->name().str(),OverloadInfo()).first; it->second.total++; } } for (const auto &md : m_members) { if (md->isDetailedSectionVisible(m_container) && !(md->isEnumValue() && !showInline)) { auto it = overloadInfo.find(md->name().str()); uint32_t overloadCount = it->second.total; uint32_t &count = it->second.count; MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm) { mdm->writeDocumentation(this,count++,overloadCount,ol,scopeName,container, m_container==MemberListContainer::Group,showEnumValues,showInline); } } } //printf("MemberList::writeDocumentation() -- member groups %d\n",memberGroupList->count()); for (const auto &mg : m_memberGroupRefList) { mg->writeDocumentation(ol,scopeName,container,showEnumValues,showInline); } ol.endMemberDocList(); } // members in a table void MemberList::writeSimpleDocumentation(OutputList &ol, const Definition *container) const { //printf("MemberList count=%d enumValues=%d\n",numDocMembers(),numDocEnumValues()); if (numDocMembers()<=numDocEnumValues()) return; // only enum values and they should be excluded const ClassDef *cd = nullptr; if (container && container->definitionType()==Definition::TypeClass) { cd = toClassDef(container); } ol.startMemberDocSimple(cd && cd->isJavaEnum()); for (const auto &md : m_members) { MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm) { mdm->writeMemberDocSimple(ol,container); } } ol.endMemberDocSimple(cd && cd->isJavaEnum()); } // separate member pages void MemberList::writeDocumentationPage(OutputList &ol, const QCString &scopeName, const DefinitionMutable *container, int hierarchyLevel) const { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); struct OverloadInfo { uint32_t count = 1; uint32_t total = 0; }; std::unordered_map<std::string,OverloadInfo> overloadInfo; // count the number of overloaded members for (const auto &imd : m_members) { MemberDefMutable *md = toMemberDefMutable(imd); if (md && md->hasDetailedDescription()) { auto it = overloadInfo.emplace(md->name().str(),OverloadInfo()).first; it->second.total++; } } for (const auto &imd : m_members) { Definition *container_d = toDefinition(const_cast<DefinitionMutable*>(container)); MemberDefMutable *md = toMemberDefMutable(imd); if (md && md->hasDetailedDescription()) { auto it = overloadInfo.find(md->name().str()); uint32_t overloadCount = it->second.total; uint32_t &count = it->second.count; QCString diskName=md->getOutputFileBase(); QCString title=md->qualifiedName(); startFile(ol,diskName,md->name(),title,HighlightedItem::None,!generateTreeView,diskName, hierarchyLevel); if (!generateTreeView) { container->writeNavigationPath(ol); ol.endQuickIndices(); } ol.startContents(); if (generateTreeView) { md->writeDocumentation(this,count++,overloadCount,ol,scopeName,container_d,m_container==MemberListContainer::Group); ol.endContents(); endFileWithNavPath(ol,container_d); } else { ol.writeString("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n" " <tr>\n" " <td valign=\"top\">\n"); container->writeQuickMemberLinks(ol,md); ol.writeString(" </td>\n"); ol.writeString(" <td valign=\"top\" class=\"mempage\">\n"); md->writeDocumentation(this,count++,overloadCount,ol,scopeName,container_d,m_container==MemberListContainer::Group); ol.writeString(" </td>\n"); ol.writeString(" </tr>\n"); ol.writeString("</table>\n"); endFile(ol); } } } for (const auto &mg : m_memberGroupRefList) { mg->writeDocumentationPage(ol,scopeName,container); } } void MemberList::addMemberGroup(MemberGroup *mg) { m_memberGroupRefList.push_back(mg); } void MemberList::addListReferences(Definition *def) { for (const auto &imd : m_members) { MemberDefMutable *md = toMemberDefMutable(imd); if (md && !md->isAlias() && (md->getGroupDef()==nullptr || def->definitionType()==Definition::TypeGroup)) { md->addListReference(def); const MemberVector &enumFields = md->enumFieldList(); if (md->memberType()==MemberType::Enumeration && !enumFields.empty()) { //printf(" Adding enum values!\n"); for (const auto &vmd : enumFields) { MemberDefMutable *vmdm = toMemberDefMutable(vmd); if (vmdm) { //printf(" adding %s\n",qPrint(vmd->name())); vmdm->addListReference(def); } } } } } for (const auto &mg : m_memberGroupRefList) { mg->addListReferences(def); } } void MemberList::findSectionsInDocumentation(const Definition *d) { for (const auto &imd : m_members) { MemberDefMutable *md = toMemberDefMutable(imd); if (md) { md->findSectionsInDocumentation(); } } for (const auto &mg : m_memberGroupRefList) { mg->findSectionsInDocumentation(d); } } void MemberList::setNeedsSorting(bool b) { m_needsSorting = b; } void MemberList::writeTagFile(TextStream &tagFile,bool useQualifiedName,bool showNamespaceMembers) { for (const auto &imd : m_members) { MemberDefMutable *md = toMemberDefMutable(imd); if (md) { if (md->getLanguage()!=SrcLangExt::VHDL) { md->writeTagFile(tagFile,useQualifiedName,showNamespaceMembers); if (md->memberType()==MemberType::Enumeration && !md->isStrong()) { for (const auto &ivmd : md->enumFieldList()) { MemberDefMutable *vmd = toMemberDefMutable(ivmd); if (vmd) { vmd->writeTagFile(tagFile,useQualifiedName,showNamespaceMembers); } } } } else { VhdlDocGen::writeTagFile(md,tagFile); } } } for (const auto &mg : m_memberGroupRefList) { mg->writeTagFile(tagFile,useQualifiedName); } } // compute the HTML anchors for a list of members void MemberList::setAnchors() { //int count=0; for (const auto &md : m_members) { MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm && !md->isReference()) { mdm->setAnchor(); } } }
29,556
C++
.cpp
857
26.616103
129
0.592251
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,455
symbolresolver.cpp
doxygen_doxygen/src/symbolresolver.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 <unordered_map> #include <string> #include <vector> #include <cassert> #include "symbolresolver.h" #include "util.h" #include "doxygen.h" #include "namespacedef.h" #include "config.h" #include "defargs.h" #include "trace.h" #if !ENABLE_SYMBOLRESOLVER_TRACING #undef AUTO_TRACE #undef AUTO_TRACE_ADD #undef AUTO_TRACE_EXIT #define AUTO_TRACE(...) (void)0 #define AUTO_TRACE_ADD(...) (void)0 #define AUTO_TRACE_EXIT(...) (void)0 #endif static std::mutex g_cacheMutex; static std::recursive_mutex g_cacheTypedefMutex; static std::mutex g_substMapMutex; static std::unordered_map<std::string, std::pair<QCString,const MemberDef *> > g_substMap; //-------------------------------------------------------------------------------------- /** Helper class representing the stack of items considered while resolving * the scope. */ class AccessStack { /** Element in the stack. */ struct AccessElem { AccessElem(const Definition *d,const FileDef *f,const Definition *i) : scope(d), fileScope(f), item(i) {} AccessElem(const Definition *d,const FileDef *f,const Definition *i,const QCString &e) : scope(d), fileScope(f), item(i), expScope(e) {} const Definition *scope; const FileDef *fileScope; const Definition *item; QCString expScope; }; public: void push(const Definition *scope,const FileDef *fileScope,const Definition *item) { m_elements.emplace_back(scope,fileScope,item); } void push(const Definition *scope,const FileDef *fileScope,const Definition *item,const QCString &expScope) { m_elements.emplace_back(scope,fileScope,item,expScope); } void pop() { if (!m_elements.empty()) m_elements.pop_back(); } bool find(const Definition *scope,const FileDef *fileScope, const Definition *item) { auto it = std::find_if(m_elements.begin(),m_elements.end(), [&](const AccessElem &e) { return e.scope==scope && e.fileScope==fileScope && e.item==item; }); return it!=m_elements.end(); } bool find(const Definition *scope,const FileDef *fileScope, const Definition *item,const QCString &expScope) { auto it = std::find_if(m_elements.begin(),m_elements.end(), [&](const AccessElem &e) { return e.scope==scope && e.fileScope==fileScope && e.item==item && e.expScope==expScope; }); return it!=m_elements.end(); } void clear() { m_elements.clear(); } private: std::vector<AccessElem> m_elements; }; //-------------------------------------------------------------------------------------- using VisitedKeys = StringVector; using VisitedNamespaceKeys = StringVector; using VisitedNamespaces = std::unordered_map<std::string,const Definition *>; //-------------------------------------------------------------------------------------- struct SymbolResolver::Private { public: Private(const FileDef *f) : m_fileScope(f) {} void reset() { m_resolvedTypedefs.clear(); resolvedType.clear(); typeDef = nullptr; templateSpec.clear(); } void setFileScope(const FileDef *fileScope) { m_fileScope = fileScope; } QCString resolvedType; const MemberDef *typeDef = nullptr; QCString templateSpec; const ClassDef *getResolvedTypeRec( VisitedKeys &visitedKeys, // in const Definition *scope, // in const QCString &n, // in const MemberDef **pTypeDef, // out QCString *pTemplSpec, // out QCString *pResolvedType); // out const Definition *getResolvedSymbolRec( VisitedKeys &visitedKeys, // in const Definition *scope, // in const QCString &n, // in const QCString &args, // in bool checkCV, // in bool insideCode, // in const MemberDef **pTypeDef, // out QCString *pTemplSpec, // out QCString *pResolvedType); // out int isAccessibleFrom( VisitedKeys &visitedKeys, // in AccessStack &accessStack, const Definition *scope, const Definition *item); int isAccessibleFromWithExpScope( VisitedKeys &visitedKeys, // in VisitedNamespaces &visitedNamespaces, AccessStack &accessStack, const Definition *scope, const Definition *item, const QCString &explicitScopePart); private: void getResolvedType( VisitedKeys &visitedKeys, const Definition *scope, // in const Definition *d, // in const QCString &explicitScopePart, // in const ArgumentList *actTemplParams, // in int &minDistance, // input const ClassDef *&bestMatch, // out const MemberDef *&bestTypedef, // out QCString &bestTemplSpec, // out QCString &bestResolvedType // out ); void getResolvedSymbol(VisitedKeys &visitedKeys, // in const Definition *scope, // in const Definition *d, // in const QCString &args, // in bool checkCV, // in bool insideCode, // in const QCString &explicitScopePart, // in bool forceCallable, // in int &minDistance, // inout const Definition *&bestMatch, // out const MemberDef *&bestTypedef, // out QCString &bestTemplSpec, // out QCString &bestResolvedType // out ); const ClassDef *newResolveTypedef( VisitedKeys &visitedKeys, // in const Definition *scope, // in const MemberDef *md, // in const MemberDef **pMemType, // out QCString *pTemplSpec, // out QCString *pResolvedType, // out const ArgumentList *actTemplParams = nullptr ); const Definition *followPath(VisitedKeys &visitedKeys, const Definition *start,const QCString &path); const Definition *endOfPathIsUsedClass(const LinkedRefMap<const Definition> &dl,const QCString &localName); bool accessibleViaUsingNamespace(VisitedKeys &visitedKeys, VisitedNamespaceKeys &visitedNamespaces, const LinkedRefMap<NamespaceDef> &nl, const Definition *item, const QCString &explicitScopePart="", int level=0); bool accessibleViaUsingDefinition(VisitedKeys &visitedKeys, const LinkedRefMap<const Definition> &dl, const Definition *item, const QCString &explicitScopePart="" ); QCString substTypedef(VisitedKeys &visitedKeys, const Definition *scope,const QCString &name, const MemberDef **pTypeDef=nullptr); const FileDef *m_fileScope; std::unordered_map<std::string,const MemberDef*> m_resolvedTypedefs; }; const ClassDef *SymbolResolver::Private::getResolvedTypeRec( VisitedKeys &visitedKeys, const Definition *scope, const QCString &n, const MemberDef **pTypeDef, QCString *pTemplSpec, QCString *pResolvedType) { AUTO_TRACE("scope={} name={}",scope->name(),n); if (n.isEmpty()) return nullptr; QCString explicitScopePart; QCString strippedTemplateParams; QCString scopeName=scope!=Doxygen::globalScope ? scope->name() : QCString(); QCString name=stripTemplateSpecifiersFromScope(n,TRUE,&strippedTemplateParams,scopeName); std::unique_ptr<ArgumentList> actTemplParams; if (!strippedTemplateParams.isEmpty()) // template part that was stripped { actTemplParams = stringToArgumentList(scope->getLanguage(),strippedTemplateParams); } int qualifierIndex = computeQualifiedIndex(name); //printf("name=%s qualifierIndex=%d\n",qPrint(name),qualifierIndex); if (qualifierIndex!=-1) // qualified name { // split off the explicit scope part explicitScopePart=name.left(qualifierIndex); // todo: improve namespace alias substitution replaceNamespaceAliases(explicitScopePart); name=name.mid(qualifierIndex+2); } if (name.isEmpty()) { AUTO_TRACE_EXIT("empty name"); return nullptr; // empty name } auto &range = Doxygen::symbolMap->find(name); if (range.empty()) { AUTO_TRACE_EXIT("no symbol with this name"); return nullptr; } bool hasUsingStatements = (m_fileScope && (!m_fileScope->getUsedNamespaces().empty() || !m_fileScope->getUsedDefinitions().empty()) ); // Since it is often the case that the same name is searched in the same // scope over an over again (especially for the linked source code generation) // we use a cache to collect previous results. This is possible since the // result of a lookup is deterministic. As the key we use the concatenated // scope, the name to search for and the explicit scope prefix. The speedup // achieved by this simple cache can be enormous. size_t scopeNameLen = scope->name().length()+1; size_t nameLen = name.length()+1; size_t explicitPartLen = explicitScopePart.length(); size_t fileScopeLen = hasUsingStatements ? 1+m_fileScope->absFilePath().length() : 0; // below is a more efficient coding of // QCString key=scope->name()+"+"+name+"+"+explicitScopePart+args+typesOnly?'T':'F'; QCString key(scopeNameLen+nameLen+explicitPartLen+fileScopeLen, QCString::ExplicitSize); char *pk=key.rawData(); qstrcpy(pk,scope->name().data()); *(pk+scopeNameLen-1)='+'; pk+=scopeNameLen; qstrcpy(pk,name.data()); *(pk+nameLen-1)='+'; pk+=nameLen; qstrcpy(pk,explicitScopePart.data()); pk+=explicitPartLen; // if a file scope is given and it contains using statements we should // also use the file part in the key (as a class name can be in // two different namespaces and a using statement in a file can select // one of them). if (hasUsingStatements) { // below is a more efficient coding of // key+="+"+m_fileScope->name(); *pk++='+'; qstrcpy(pk,m_fileScope->absFilePath().data()); pk+=fileScopeLen-1; } *pk='\0'; const ClassDef *bestMatch=nullptr; { if (std::find(visitedKeys.begin(),visitedKeys.end(),key.str())!=std::end(visitedKeys)) { // we are already in the middle of find the definition for this key. // avoid recursion AUTO_TRACE_EXIT("recursion detected"); return nullptr; } // remember the key visitedKeys.push_back(key.str()); LookupInfo *pval = nullptr; { std::lock_guard lock(g_cacheMutex); pval = Doxygen::typeLookupCache->find(key.str()); } AUTO_TRACE_ADD("key={} found={}",key,pval!=nullptr); if (pval) { if (pTemplSpec) *pTemplSpec=pval->templSpec; if (pTypeDef) *pTypeDef=pval->typeDef; if (pResolvedType) *pResolvedType=pval->resolvedType; AUTO_TRACE_EXIT("found cached name={} templSpec={} typeDef={} resolvedTypedef={}", pval->definition?pval->definition->name():QCString(), pval->templSpec, pval->typeDef?pval->typeDef->name():QCString(), pval->resolvedType); return toClassDef(pval->definition); } const MemberDef *bestTypedef=nullptr; QCString bestTemplSpec; QCString bestResolvedType; int minDistance=10000; // init at "infinite" for (Definition *d : range) { getResolvedType(visitedKeys,scope,d,explicitScopePart,actTemplParams.get(), minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType); if (minDistance==0) break; // we can stop reaching if we already reached distance 0 } if (pTypeDef) { *pTypeDef = bestTypedef; } if (pTemplSpec) { *pTemplSpec = bestTemplSpec; } if (pResolvedType) { *pResolvedType = bestResolvedType; } { std::lock_guard lock(g_cacheMutex); Doxygen::typeLookupCache->insert(key.str(), LookupInfo(bestMatch,bestTypedef,bestTemplSpec,bestResolvedType)); } visitedKeys.erase(std::remove(visitedKeys.begin(), visitedKeys.end(), key.str()), visitedKeys.end()); AUTO_TRACE_EXIT("found name={} templSpec={} typeDef={} resolvedTypedef={}", bestMatch?bestMatch->name():QCString(), bestTemplSpec, bestTypedef?bestTypedef->name():QCString(), bestResolvedType); } return bestMatch; } const Definition *SymbolResolver::Private::getResolvedSymbolRec( VisitedKeys &visitedKeys, const Definition *scope, const QCString &n, const QCString &args, bool checkCV, bool insideCode, const MemberDef **pTypeDef, QCString *pTemplSpec, QCString *pResolvedType) { AUTO_TRACE("scope={} name={} args={} checkCV={} insideCode={}", scope->name(),n,args,checkCV,insideCode); if (n.isEmpty()) return nullptr; QCString explicitScopePart; QCString strippedTemplateParams; QCString scopeName=scope!=Doxygen::globalScope ? scope->name() : QCString(); QCString name=stripTemplateSpecifiersFromScope(n,TRUE,&strippedTemplateParams,scopeName); std::unique_ptr<ArgumentList> actTemplParams; if (!strippedTemplateParams.isEmpty()) // template part that was stripped { actTemplParams = stringToArgumentList(scope->getLanguage(),strippedTemplateParams); } int qualifierIndex = computeQualifiedIndex(name); //printf("name=%s qualifierIndex=%d\n",qPrint(name),qualifierIndex); if (qualifierIndex!=-1) // qualified name { // split off the explicit scope part explicitScopePart=name.left(qualifierIndex); // todo: improve namespace alias substitution replaceNamespaceAliases(explicitScopePart); name=name.mid(qualifierIndex+2); } AUTO_TRACE_ADD("qualifierIndex={} name={} explicitScopePart={}",qualifierIndex,name,explicitScopePart); if (name.isEmpty()) { AUTO_TRACE_EXIT("empty name qualifierIndex={}",qualifierIndex); return nullptr; // empty name } int i=0; const auto &range1 = Doxygen::symbolMap->find(name); const auto &range = (range1.empty() && (i=name.find('<'))!=-1) ? Doxygen::symbolMap->find(name.left(i)) : range1; if (range.empty()) { AUTO_TRACE_ADD("no symbols with name '{}' (including unspecialized)",name); return nullptr; } AUTO_TRACE_ADD("{} -> {} candidates",name,range.size()); bool hasUsingStatements = (m_fileScope && (!m_fileScope->getUsedNamespaces().empty() || !m_fileScope->getUsedDefinitions().empty()) ); // Since it is often the case that the same name is searched in the same // scope over an over again (especially for the linked source code generation) // we use a cache to collect previous results. This is possible since the // result of a lookup is deterministic. As the key we use the concatenated // scope, the name to search for and the explicit scope prefix. The speedup // achieved by this simple cache can be enormous. size_t scopeNameLen = scope!=Doxygen::globalScope ? scope->name().length()+1 : 0; size_t nameLen = name.length()+1; size_t explicitPartLen = explicitScopePart.length(); size_t fileScopeLen = hasUsingStatements ? 1+m_fileScope->absFilePath().length() : 0; size_t argsLen = args.length()+1; // below is a more efficient coding of // QCString key=scope->name()+"+"+name+"+"+explicitScopePart+args+typesOnly?'T':'F'; std::string key; key.reserve(scopeNameLen+nameLen+explicitPartLen+fileScopeLen+argsLen); if (scope!=Doxygen::globalScope) { key+=scope->name().str(); key+='+'; } key+=name.str(); key+='+'; key+=explicitScopePart.str(); // if a file scope is given and it contains using statements we should // also use the file part in the key (as a class name can be in // two different namespaces and a using statement in a file can select // one of them). if (hasUsingStatements) { // below is a more efficient coding of // key+="+"+m_fileScope->name(); key+='+'; key+=m_fileScope->absFilePath().str(); } if (argsLen>0) { key+='+'; key+=args.str(); } const Definition *bestMatch=nullptr; { if (std::find(visitedKeys.begin(),visitedKeys.end(),key)!=std::end(visitedKeys)) { // we are already in the middle of find the definition for this key. // avoid recursion return nullptr; } // remember the key visitedKeys.push_back(key); LookupInfo *pval = nullptr; { std::lock_guard lock(g_cacheMutex); pval = Doxygen::symbolLookupCache->find(key); } AUTO_TRACE_ADD("key={} found={}",key,pval!=nullptr); if (pval) { if (pTemplSpec) *pTemplSpec=pval->templSpec; if (pTypeDef) *pTypeDef=pval->typeDef; if (pResolvedType) *pResolvedType=pval->resolvedType; AUTO_TRACE_EXIT("found cached name={} templSpec={} typeDef={} resolvedTypedef={}", pval->definition?pval->definition->name():QCString(), pval->templSpec, pval->typeDef?pval->typeDef->name():QCString(), pval->resolvedType); return pval->definition; } const MemberDef *bestTypedef=nullptr; QCString bestTemplSpec; QCString bestResolvedType; int minDistance=10000; // init at "infinite" for (Definition *d : range) { getResolvedSymbol(visitedKeys,scope,d,args,checkCV,insideCode,explicitScopePart,false, minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType); if (minDistance==0) break; // we can stop reaching if we already reached distance 0 } // in case we are looking for e.g. func() and the real function is func(int x) we also // accept func(), see example 036 in the test set. if (bestMatch==nullptr && args=="()") { for (Definition *d : range) { getResolvedSymbol(visitedKeys,scope,d,QCString(),false,insideCode,explicitScopePart,true, minDistance,bestMatch,bestTypedef,bestTemplSpec,bestResolvedType); if (minDistance==0) break; // we can stop reaching if we already reached distance 0 } } if (pTypeDef) { *pTypeDef = bestTypedef; } if (pTemplSpec) { *pTemplSpec = bestTemplSpec; } if (pResolvedType) { *pResolvedType = bestResolvedType; } { LookupInfo lookupInfo(bestMatch,bestTypedef,bestTemplSpec,bestResolvedType); std::lock_guard lock(g_cacheMutex); // we need to insert the item in the cache again, as it could be removed in the meantime Doxygen::symbolLookupCache->insert(key,std::move(lookupInfo)); } visitedKeys.erase(std::remove(visitedKeys.begin(),visitedKeys.end(),key),visitedKeys.end()); AUTO_TRACE_EXIT("found name={} templSpec={} typeDef={} resolvedTypedef={}", bestMatch?bestMatch->name():QCString(), bestTemplSpec, bestTypedef?bestTypedef->name():QCString(), bestResolvedType); } return bestMatch; } void SymbolResolver::Private::getResolvedType( VisitedKeys &visitedKeys, // in const Definition *scope, // in const Definition *d, // in const QCString &explicitScopePart, // in const ArgumentList *actTemplParams, // in int &minDistance, // inout const ClassDef *&bestMatch, // out const MemberDef *&bestTypedef, // out QCString &bestTemplSpec, // out QCString &bestResolvedType // out ) { AUTO_TRACE("scope={} sym={} explicitScope={}",scope->name(),d->qualifiedName(),explicitScopePart); // only look at classes and members that are enums or typedefs if (d->definitionType()==Definition::TypeClass || (d->definitionType()==Definition::TypeMember && ((toMemberDef(d))->isTypedef() || (toMemberDef(d))->isEnumerate()) ) ) { VisitedNamespaces visitedNamespaces; AccessStack accessStack; // test accessibility of definition within scope. int distance = isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces, accessStack,scope,d,explicitScopePart); AUTO_TRACE_ADD("distance={}",distance); if (distance!=-1) // definition is accessible { // see if we are dealing with a class or a typedef if (d->definitionType()==Definition::TypeClass) // d is a class { const ClassDef *cd = toClassDef(d); //printf("cd=%s\n",qPrint(cd->name())); if (!cd->isTemplateArgument()) // skip classes that // are only there to // represent a template // argument { //printf("is not a templ arg\n"); if (distance<minDistance) // found a definition that is "closer" { AUTO_TRACE_ADD("found symbol={} at distance={} minDistance={}",cd->name(),distance,minDistance); minDistance=distance; bestMatch = cd; bestTypedef = nullptr; bestTemplSpec.clear(); bestResolvedType = cd->qualifiedName(); } else if (distance==minDistance && m_fileScope && bestMatch && !m_fileScope->getUsedNamespaces().empty() && d->getOuterScope()->definitionType()==Definition::TypeNamespace && bestMatch->getOuterScope()==Doxygen::globalScope ) { // in case the distance is equal it could be that a class X // is defined in a namespace and in the global scope. When searched // in the global scope the distance is 0 in both cases. We have // to choose one of the definitions: we choose the one in the // namespace if the fileScope imports namespaces and the definition // found was in a namespace while the best match so far isn't. // Just a non-perfect heuristic but it could help in some situations // (kdecore code is an example). AUTO_TRACE_ADD("found symbol={} at distance={} minDistance={}",cd->name(),distance,minDistance); minDistance=distance; bestMatch = cd; bestTypedef = nullptr; bestTemplSpec.clear(); bestResolvedType = cd->qualifiedName(); } } else { //printf(" is a template argument!\n"); } } else if (d->definitionType()==Definition::TypeMember) { const MemberDef *md = toMemberDef(d); AUTO_TRACE_ADD("member={} isTypeDef={}",md->name(),md->isTypedef()); if (md->isTypedef()) // d is a typedef { QCString args=md->argsString(); if (args.isEmpty()) // do not expand "typedef t a[4];" { // we found a symbol at this distance, but if it didn't // resolve to a class, we still have to make sure that // something at a greater distance does not match, since // that symbol is hidden by this one. if (distance<minDistance) { QCString spec; QCString type; minDistance=distance; const MemberDef *enumType = nullptr; const ClassDef *cd = newResolveTypedef(visitedKeys,scope,md,&enumType,&spec,&type,actTemplParams); if (cd) // type resolves to a class { AUTO_TRACE_ADD("found symbol={} at distance={} minDistance={}",cd->name(),distance,minDistance); bestMatch = cd; bestTypedef = md; bestTemplSpec = spec; bestResolvedType = type; } else if (enumType) // type resolves to a member type { AUTO_TRACE_ADD("found enum"); bestMatch = nullptr; bestTypedef = enumType; bestTemplSpec = ""; bestResolvedType = enumType->qualifiedName(); } else if (md->isReference()) // external reference { AUTO_TRACE_ADD("found external reference"); bestMatch = nullptr; bestTypedef = md; bestTemplSpec = spec; bestResolvedType = type; } else { AUTO_TRACE_ADD("no match"); bestMatch = nullptr; bestTypedef = md; bestTemplSpec.clear(); bestResolvedType.clear(); } } else { //printf(" not the best match %d min=%d\n",distance,minDistance); } } else { AUTO_TRACE_ADD("skipping complex typedef"); } } else if (md->isEnumerate()) { if (distance<minDistance) { AUTO_TRACE_ADD("found enum={} at distance={} minDistance={}",md->name(),distance,minDistance); minDistance=distance; bestMatch = nullptr; bestTypedef = md; bestTemplSpec = ""; bestResolvedType = md->qualifiedName(); } } } } // if definition accessible else { AUTO_TRACE_ADD("not accessible"); } } // if definition is a class or member AUTO_TRACE_EXIT("bestMatch sym={} type={}", bestMatch?bestMatch->name():QCString("<none>"),bestResolvedType); } void SymbolResolver::Private::getResolvedSymbol( VisitedKeys &visitedKeys, // in const Definition *scope, // in const Definition *d, // in const QCString &args, // in bool checkCV, // in bool insideCode, // in const QCString &explicitScopePart, // in bool forceCallable, // in int &minDistance, // inout const Definition *&bestMatch, // out const MemberDef *&bestTypedef, // out QCString &bestTemplSpec, // out QCString &bestResolvedType // out ) { AUTO_TRACE("scope={} sym={}",scope->name(),d->qualifiedName()); // only look at classes and members that are enums or typedefs VisitedNamespaces visitedNamespaces; AccessStack accessStack; // test accessibility of definition within scope. int distance = isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,d,explicitScopePart); AUTO_TRACE_ADD("distance={}",distance); if (distance!=-1) // definition is accessible { // see if we are dealing with a class or a typedef if (args.isEmpty() && !forceCallable && d->definitionType()==Definition::TypeClass) // d is a class { const ClassDef *cd = toClassDef(d); if (!cd->isTemplateArgument()) // skip classes that // are only there to // represent a template // argument { if (distance<minDistance) // found a definition that is "closer" { AUTO_TRACE_ADD("found symbol={} at distance={} minDistance={}",d->name(),distance,minDistance); minDistance=distance; bestMatch = d; bestTypedef = nullptr; bestTemplSpec.clear(); bestResolvedType = cd->qualifiedName(); } else if (distance==minDistance && m_fileScope && bestMatch && !m_fileScope->getUsedNamespaces().empty() && d->getOuterScope()->definitionType()==Definition::TypeNamespace && bestMatch->getOuterScope()==Doxygen::globalScope ) { // in case the distance is equal it could be that a class X // is defined in a namespace and in the global scope. When searched // in the global scope the distance is 0 in both cases. We have // to choose one of the definitions: we choose the one in the // namespace if the fileScope imports namespaces and the definition // found was in a namespace while the best match so far isn't. // Just a non-perfect heuristic but it could help in some situations // (kdecore code is an example). AUTO_TRACE_ADD("found symbol={} at distance={} minDistance={}",d->name(),distance,minDistance); minDistance=distance; bestMatch = d; bestTypedef = nullptr; bestTemplSpec.clear(); bestResolvedType = cd->qualifiedName(); } } else { AUTO_TRACE_ADD("class with template arguments"); } } else if (d->definitionType()==Definition::TypeMember) { const MemberDef *md = toMemberDef(d); bool match = true; AUTO_TRACE_ADD("member={} args={} isCallable()={}",md->name(),argListToString(md->argumentList()),md->isCallable()); if (md->isCallable() && !args.isEmpty()) { QCString actArgs; if (md->isArtificial() && md->formalTemplateArguments()) // for members of an instantiated template we need to replace // the formal arguments by the actual ones before matching // See issue #10640 { actArgs = substituteTemplateArgumentsInString(args,md->formalTemplateArguments().value(),&md->argumentList()); } else { actArgs = args; } std::unique_ptr<ArgumentList> argList = stringToArgumentList(md->getLanguage(),actArgs); const ArgumentList &mdAl = md->argumentList(); match = matchArguments2(md->getOuterScope(),md->getFileDef(),&mdAl, scope, md->getFileDef(),argList.get(), checkCV,md->getLanguage()); AUTO_TRACE_ADD("match={}",match); } if (match && distance<minDistance) { AUTO_TRACE_ADD("found symbol={} at distance={} minDistance={}",md->name(),distance,minDistance); minDistance=distance; bestMatch = md; bestTypedef = md; bestTemplSpec = ""; bestResolvedType = md->qualifiedName(); } } else if ((d->definitionType()==Definition::TypeNamespace || d->definitionType()==Definition::TypeFile)) { if (distance<minDistance) // found a definition that is "closer" { AUTO_TRACE_ADD("found symbol={} at distance={} minDistance={}",d->name(),distance,minDistance); minDistance=distance; bestMatch = d; bestTypedef = nullptr; bestTemplSpec.clear(); bestResolvedType.clear(); } } } // if definition accessible else { AUTO_TRACE_ADD("not accessible"); } AUTO_TRACE_EXIT("bestMatch sym={} distance={}", bestMatch?bestMatch->name():QCString("<none>"),bestResolvedType); } const ClassDef *SymbolResolver::Private::newResolveTypedef( VisitedKeys &visitedKeys, // in const Definition * /* scope */, // in const MemberDef *md, // in const MemberDef **pMemType, // out QCString *pTemplSpec, // out QCString *pResolvedType, // out const ArgumentList *actTemplParams) // in { AUTO_TRACE("md={}",md->qualifiedName()); std::lock_guard<std::recursive_mutex> lock(g_cacheTypedefMutex); bool isCached = md->isTypedefValCached(); // value already cached if (isCached) { AUTO_TRACE_EXIT("cached typedef={} resolvedTypedef={} templSpec={}", md->getCachedTypedefVal() ? md->getCachedTypedefVal()->name() : QCString(), md->getCachedResolvedTypedef(), md->getCachedTypedefTemplSpec()); if (pTemplSpec) *pTemplSpec = md->getCachedTypedefTemplSpec(); if (pResolvedType) *pResolvedType = md->getCachedResolvedTypedef(); return md->getCachedTypedefVal(); } QCString qname = md->qualifiedName(); if (m_resolvedTypedefs.find(qname.str())!=m_resolvedTypedefs.end()) { AUTO_TRACE_EXIT("already being processed"); return nullptr; // typedef already done } auto typedef_it = m_resolvedTypedefs.emplace(qname.str(),md).first; // put on the trace list const ClassDef *typeClass = md->getClassDef(); QCString type = md->typeString(); // get the "value" of the typedef if (typeClass && typeClass->isTemplate() && actTemplParams && !actTemplParams->empty()) { type = substituteTemplateArgumentsInString(type, typeClass->templateArguments(),actTemplParams); } QCString typedefValue = type; int tl=static_cast<int>(type.length()); int ip=tl-1; // remove * and & at the end while (ip>=0 && (type.at(ip)=='*' || type.at(ip)=='&' || type.at(ip)==' ')) { ip--; } type=type.left(ip+1); type.stripPrefix("const "); // strip leading "const" type.stripPrefix("volatile "); // strip leading "volatile" type.stripPrefix("struct "); // strip leading "struct" type.stripPrefix("union "); // strip leading "union" int sp=0; tl=static_cast<int>(type.length()); // length may have been changed while (sp<tl && type.at(sp)==' ') sp++; const MemberDef *memTypeDef = nullptr; const ClassDef *result = getResolvedTypeRec(visitedKeys,md->getOuterScope(),type, &memTypeDef,nullptr,pResolvedType); // if type is a typedef then return what it resolves to. if (memTypeDef && memTypeDef->isTypedef()) { AUTO_TRACE_ADD("resolving typedef"); result=newResolveTypedef(visitedKeys,m_fileScope,memTypeDef,pMemType,pTemplSpec,nullptr); goto done; } else if (memTypeDef && memTypeDef->isEnumerate() && pMemType) { *pMemType = memTypeDef; } if (result==nullptr) { // try unspecialized version if type is template int si=type.findRev("::"); int i=type.find('<'); if (si==-1 && i!=-1) // typedef of a template => try the unspecialized version { if (pTemplSpec) *pTemplSpec = type.mid(i); result = getResolvedTypeRec(visitedKeys,md->getOuterScope(),type.left(i),nullptr,nullptr,pResolvedType); } else if (si!=-1) // A::B { i=type.find('<',si); if (i==-1) // Something like A<T>::B => lookup A::B { i=static_cast<int>(type.length()); } else // Something like A<T>::B<S> => lookup A::B, spec=<S> { if (pTemplSpec) *pTemplSpec = type.mid(i); } result = getResolvedTypeRec(visitedKeys,md->getOuterScope(), stripTemplateSpecifiersFromScope(type.left(i),FALSE),nullptr,nullptr,pResolvedType); } } done: if (pResolvedType) { if (result && result->definitionType()==Definition::TypeClass) { *pResolvedType = result->qualifiedName(); if (sp>0) pResolvedType->prepend(typedefValue.left(sp)); if (ip<tl-1) pResolvedType->append(typedefValue.right(tl-ip-1)); } else { *pResolvedType = typedefValue; } } // remember computed value for next time if (result && result->getDefFileName()!="<code>") // this check is needed to prevent that temporary classes that are // introduced while parsing code fragments are being cached here. { AUTO_TRACE_ADD("caching typedef relation {}->{}",md->name(),result->name()); MemberDefMutable *mdm = toMemberDefMutable(const_cast<MemberDef*>(md)); if (mdm) { mdm->cacheTypedefVal(result, pTemplSpec ? *pTemplSpec : QCString(), pResolvedType ? *pResolvedType : QCString() ); } } m_resolvedTypedefs.erase(typedef_it); // remove from the trace list AUTO_TRACE_EXIT("result={} pTemplSpec={} pResolvedType={}", result ? result->name() : QCString(), pTemplSpec ? *pTemplSpec : "<nullptr>", pResolvedType ? *pResolvedType : "<nullptr>" ); return result; } #if 0 static bool isParentScope(const Definition *parent,const Definition *item) { if (parent==item || item==0 || item==Doxygen::globalScope) return false; if (parent==0 || parent==Doxygen::globalScope) return true; return isParentScope(parent->getOuterScope(),item); } #endif int SymbolResolver::Private::isAccessibleFromWithExpScope( VisitedKeys &visitedKeys, VisitedNamespaces &visitedNamespaces, AccessStack &accessStack, const Definition *scope, const Definition *item, const QCString &explicitScopePart) { int result=0; // assume we found it AUTO_TRACE("scope={} item={} explictScopePart={}", scope?scope->name():QCString(), item?item->name():QCString(), explicitScopePart); if (explicitScopePart.isEmpty()) { // handle degenerate case where there is no explicit scope. result = isAccessibleFrom(visitedKeys,accessStack,scope,item); AUTO_TRACE_EXIT("result={}",result); return result; } if (accessStack.find(scope,m_fileScope,item,explicitScopePart)) { AUTO_TRACE_EXIT("already found"); return -1; } accessStack.push(scope,m_fileScope,item,explicitScopePart); const Definition *newScope = followPath(visitedKeys,scope,explicitScopePart); if (newScope) // explicitScope is inside scope => newScope is the result { Definition *itemScope = item->getOuterScope(); AUTO_TRACE_ADD("scope traversal successful newScope={}",newScope->name()); bool nestedClassInsideBaseClass = itemScope && itemScope->definitionType()==Definition::TypeClass && newScope->definitionType()==Definition::TypeClass && (toClassDef(newScope))->isBaseClass(toClassDef(itemScope),TRUE); bool enumValueWithinEnum = item->definitionType()==Definition::TypeMember && toMemberDef(item)->isEnumValue() && toMemberDef(item)->getEnumScope()==newScope; if (itemScope==newScope) // exact match of scopes => distance==0 { AUTO_TRACE_ADD("found scope match"); } else if (nestedClassInsideBaseClass) { // inheritance is also ok. Example: looking for B::I, where // class A { public: class I {} }; // class B : public A {} // but looking for B::I, where // class A { public: class I {} }; // class B { public: class I {} }; // will find A::I, so we still prefer a direct match and give this one a distance of 1 result=1; AUTO_TRACE_ADD("{} is a bass class of {}",scope->name(),newScope->name()); } else if (enumValueWithinEnum) { AUTO_TRACE_ADD("found enum value inside enum"); result=1; } else { int i=-1; if (newScope->definitionType()==Definition::TypeNamespace) { visitedNamespaces.emplace(newScope->name().str(),newScope); // this part deals with the case where item is a class // A::B::C but is explicit referenced as A::C, where B is imported // in A via a using directive. //printf("newScope is a namespace: %s!\n",qPrint(newScope->name())); const NamespaceDef *nscope = toNamespaceDef(newScope); for (const auto &ud : nscope->getUsedDefinitions()) { if (ud==item) { AUTO_TRACE_ADD("found in used definition {}",ud->name()); goto done; } } for (const auto &nd : nscope->getUsedNamespaces()) { if (visitedNamespaces.find(nd->name().str())==visitedNamespaces.end()) { i = isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,item,nd->name()); if (i!=-1) { AUTO_TRACE_ADD("found in used namespace {}",nd->name()); goto done; } } } } #if 0 // this caused problems resolving A::f() in the docs when there was a A::f(int) but also a // global function f() that exactly matched the argument list. else if (isParentScope(scope,newScope) && newScope->definitionType()==Definition::TypeClass) { // if we a look for a type B and have explicit scope A, then it is also fine if B // is found at the global scope. result = 1; goto done; } #endif // repeat for the parent scope if (scope!=Doxygen::globalScope) { i = isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope->getOuterScope(),item,explicitScopePart); } result = (i==-1) ? -1 : i+2; } } else // failed to resolve explicitScope { AUTO_TRACE_ADD("failed to resolve explicitScope"); if (scope->definitionType()==Definition::TypeNamespace) { const NamespaceDef *nscope = toNamespaceDef(scope); VisitedNamespaceKeys locVisitedNamespaceKeys; if (accessibleViaUsingNamespace(visitedKeys,locVisitedNamespaceKeys,nscope->getUsedNamespaces(),item,explicitScopePart)) { AUTO_TRACE_ADD("found in used class"); goto done; } } if (scope==Doxygen::globalScope) { if (m_fileScope) { VisitedNamespaceKeys locVisitedNamespaceKeys; if (accessibleViaUsingNamespace(visitedKeys,locVisitedNamespaceKeys,m_fileScope->getUsedNamespaces(),item,explicitScopePart)) { AUTO_TRACE_ADD("found in used namespace"); goto done; } } AUTO_TRACE_ADD("not found in this scope"); result=-1; } else // continue by looking into the parent scope { int i=isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope->getOuterScope(),item,explicitScopePart); result= (i==-1) ? -1 : i+2; } } done: AUTO_TRACE_EXIT("result={}",result); accessStack.pop(); return result; } const Definition *SymbolResolver::Private::followPath(VisitedKeys &visitedKeys, const Definition *start,const QCString &path) { AUTO_TRACE("start={},path={}",start?start->name():QCString(), path); int is=0,ps=0,l=0; const Definition *current=start; // for each part of the explicit scope while ((is=getScopeFragment(path,ps,&l))!=-1) { // try to resolve the part if it is a typedef const MemberDef *memTypeDef=nullptr; QCString qualScopePart = substTypedef(visitedKeys,current,path.mid(is,l),&memTypeDef); AUTO_TRACE_ADD("qualScopePart={}",qualScopePart); if (memTypeDef) { const ClassDef *type = newResolveTypedef(visitedKeys,m_fileScope,memTypeDef,nullptr,nullptr,nullptr); if (type) { AUTO_TRACE_EXIT("type={}",type->name()); return type; } } const Definition *next = current->findInnerCompound(qualScopePart); AUTO_TRACE_ADD("Looking for {} inside {} result={}", qualScopePart, current->name(), next?next->name():QCString()); if (next==nullptr) { next = current->findInnerCompound(qualScopePart+"-p"); } if (current->definitionType()==Definition::TypeClass) { const MemberDef *classMember = toClassDef(current)->getMemberByName(qualScopePart); if (classMember && classMember->isEnumerate()) { next = classMember; } } else if (current!=Doxygen::globalScope && current->definitionType()==Definition::TypeNamespace) { const MemberDef *namespaceMember = toNamespaceDef(current)->getMemberByName(qualScopePart); if (namespaceMember && namespaceMember->isEnumerate()) { next = namespaceMember; } } else if (current==Doxygen::globalScope || current->definitionType()==Definition::TypeFile) { auto &range = Doxygen::symbolMap->find(qualScopePart); for (Definition *def : range) { const Definition *outerScope = def->getOuterScope(); if ( (outerScope==Doxygen::globalScope || // global scope or (outerScope && // anonymous namespace in the global scope outerScope->name().startsWith("anonymous_namespace{") && outerScope->getOuterScope()==Doxygen::globalScope ) ) && (def->definitionType()==Definition::TypeClass || def->definitionType()==Definition::TypeMember || def->definitionType()==Definition::TypeNamespace ) ) { next=def; break; } } } if (next==nullptr) // failed to follow the path { if (current->definitionType()==Definition::TypeNamespace) { next = endOfPathIsUsedClass( (toNamespaceDef(current))->getUsedDefinitions(),qualScopePart); } else if (current->definitionType()==Definition::TypeFile) { next = endOfPathIsUsedClass( (toFileDef(current))->getUsedDefinitions(),qualScopePart); } current = next; if (current==nullptr) break; } else // continue to follow scope { current = next; AUTO_TRACE_ADD("current={}",current->name()); } ps=is+l; } AUTO_TRACE_EXIT("result={}",current?current->name():QCString()); return current; // path could be followed } const Definition *SymbolResolver::Private::endOfPathIsUsedClass(const LinkedRefMap<const Definition> &dl,const QCString &localName) { for (const auto &d : dl) { if (d->localName()==localName) { return d; } } return nullptr; } bool SymbolResolver::Private::accessibleViaUsingNamespace( VisitedKeys &visitedKeys, VisitedNamespaceKeys &visitedNamespaces, const LinkedRefMap<NamespaceDef> &nl, const Definition *item, const QCString &explicitScopePart, int level) { AUTO_TRACE("item={} explicitScopePart={} level={}",item?item->name():QCString(), explicitScopePart, level); for (const auto &und : nl) // check used namespaces for the class { AUTO_TRACE_ADD("trying via used namespace '{}'",und->name()); const Definition *sc = explicitScopePart.isEmpty() ? und : followPath(visitedKeys,und,explicitScopePart); if (sc && item->getOuterScope()==sc) { AUTO_TRACE_EXIT("true"); return true; } if (item->getLanguage()==SrcLangExt::Cpp) { QCString key=und->qualifiedName(); if (!und->getUsedNamespaces().empty() && std::find(visitedNamespaces.begin(),visitedNamespaces.end(),key.str())==std::end(visitedNamespaces)) { visitedNamespaces.push_back(key.str()); if (accessibleViaUsingNamespace(visitedKeys,visitedNamespaces,und->getUsedNamespaces(),item,explicitScopePart,level+1)) { AUTO_TRACE_EXIT("true"); return true; } } } } AUTO_TRACE_EXIT("false"); return false; } bool SymbolResolver::Private::accessibleViaUsingDefinition(VisitedKeys &visitedKeys, const LinkedRefMap<const Definition> &dl, const Definition *item, const QCString &explicitScopePart) { AUTO_TRACE("item={} explicitScopePart={}",item?item->name():QCString(), explicitScopePart); for (const auto &ud : dl) { AUTO_TRACE_ADD("trying via used definition '{}'",ud->name()); const Definition *sc = explicitScopePart.isEmpty() ? ud : followPath(visitedKeys,ud,explicitScopePart); if (sc && sc==item) { AUTO_TRACE_EXIT("true"); return true; } } AUTO_TRACE_EXIT("false"); return false; } int SymbolResolver::Private::isAccessibleFrom(VisitedKeys &visitedKeys, AccessStack &accessStack, const Definition *scope, const Definition *item) { AUTO_TRACE("scope={} item={}", scope?scope->name():QCString(), item?item->name():QCString()); if (accessStack.find(scope,m_fileScope,item)) { AUTO_TRACE_EXIT("already processed!"); return -1; } accessStack.push(scope,m_fileScope,item); int result=0; // assume we found it int i=0; const Definition *itemScope=item->getOuterScope(); bool itemIsMember = item->definitionType()==Definition::TypeMember; bool itemIsClass = item->definitionType()==Definition::TypeClass; // if item is a global member and scope points to a specific file // we adjust the scope so the file gets preference over members with the same name in // other files. if ((itemIsMember || itemIsClass) && (itemScope==Doxygen::globalScope || // global (itemScope && itemScope->name().startsWith("anonymous_namespace{")) // member of an anonymous namespace ) && scope->definitionType()==Definition::TypeFile) { if (itemIsMember) { itemScope = toMemberDef(item)->getFileDef(); } else if (itemIsClass) { itemScope = toClassDef(item)->getFileDef(); } AUTO_TRACE_ADD("adjusting scope to {}",itemScope?itemScope->name():QCString()); } bool memberAccessibleFromScope = (itemIsMember && // a member itemScope && itemScope->definitionType()==Definition::TypeClass && // of a class scope->definitionType()==Definition::TypeClass && // accessible (toClassDef(scope))->isAccessibleMember(toMemberDef(item)) // from scope ); bool nestedClassInsideBaseClass = (itemIsClass && // a nested class itemScope && itemScope->definitionType()==Definition::TypeClass && // inside a base scope->definitionType()==Definition::TypeClass && // class of scope (toClassDef(scope))->isBaseClass(toClassDef(itemScope),TRUE) ); bool enumValueOfStrongEnum = (itemIsMember && toMemberDef(item)->isStrongEnumValue() && scope->definitionType()==Definition::TypeMember && toMemberDef(scope)->isEnumerate() && scope==toMemberDef(item)->getEnumScope() ); if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass || enumValueOfStrongEnum) { AUTO_TRACE_ADD("memberAccessibleFromScope={} nestedClassInsideBaseClass={} enumValueOfStrongEnum={}", memberAccessibleFromScope, nestedClassInsideBaseClass, enumValueOfStrongEnum); int distanceToBase=0; if (nestedClassInsideBaseClass) { result++; // penalty for base class to prevent // this is preferred over nested class in this class // see bug 686956 } else if (memberAccessibleFromScope && itemScope && itemScope->definitionType()==Definition::TypeClass && scope->definitionType()==Definition::TypeClass && (distanceToBase=toClassDef(scope)->isBaseClass(toClassDef(itemScope),TRUE))>0 ) { result+=distanceToBase; // penalty if member is accessible via a base class } } else if (scope==Doxygen::globalScope) { if (itemScope && itemScope->definitionType()==Definition::TypeNamespace && toNamespaceDef(itemScope)->isAnonymous() && itemScope->getOuterScope()==Doxygen::globalScope) { // item is in an anonymous namespace in the global scope and we are // looking in the global scope AUTO_TRACE_ADD("found in anonymous namespace"); result++; goto done; } if (m_fileScope) { if (accessibleViaUsingDefinition(visitedKeys,m_fileScope->getUsedDefinitions(),item)) { AUTO_TRACE_ADD("found via used class"); goto done; } VisitedNamespaceKeys visitedNamespaceKeys; if (accessibleViaUsingNamespace(visitedKeys,visitedNamespaceKeys,m_fileScope->getUsedNamespaces(),item)) { AUTO_TRACE_ADD("found via used namespace"); goto done; } } AUTO_TRACE_ADD("reached global scope"); result=-1; // not found in path to globalScope } else // keep searching { // check if scope is a namespace, which is using other classes and namespaces if (scope->definitionType()==Definition::TypeNamespace) { const NamespaceDef *nscope = toNamespaceDef(scope); if (accessibleViaUsingDefinition(visitedKeys,nscope->getUsedDefinitions(),item)) { AUTO_TRACE_ADD("found via used class"); goto done; } VisitedNamespaceKeys visitedNamespaceKeys; if (accessibleViaUsingNamespace(visitedKeys,visitedNamespaceKeys,nscope->getUsedNamespaces(),item,QCString())) { AUTO_TRACE_ADD("found via used namespace"); goto done; } } else if (scope->definitionType()==Definition::TypeFile) { const FileDef *nfile = toFileDef(scope); if (accessibleViaUsingDefinition(visitedKeys,nfile->getUsedDefinitions(),item)) { AUTO_TRACE_ADD("found via used class"); goto done; } VisitedNamespaceKeys visitedNamespaceKeys; if (accessibleViaUsingNamespace(visitedKeys,visitedNamespaceKeys,nfile->getUsedNamespaces(),item,QCString())) { AUTO_TRACE_ADD("found via used namespace"); goto done; } } // repeat for the parent scope const Definition *parentScope = scope->getOuterScope(); if (parentScope==Doxygen::globalScope) { if (scope->definitionType()==Definition::TypeClass) { const FileDef *fd = toClassDef(scope)->getFileDef(); if (fd) { parentScope = fd; } } } i=isAccessibleFrom(visitedKeys,accessStack,parentScope,item); result= (i==-1) ? -1 : i+2; } done: AUTO_TRACE_EXIT("result={}",result); accessStack.pop(); return result; } QCString SymbolResolver::Private::substTypedef( VisitedKeys &visitedKeys, const Definition *scope,const QCString &name, const MemberDef **pTypeDef) { AUTO_TRACE("scope={} name={}",scope?scope->name():QCString(), name); QCString result=name; if (name.isEmpty()) return result; auto &range = Doxygen::symbolMap->find(name); if (range.empty()) return result; // no matches MemberDef *bestMatch=nullptr; int minDistance=10000; // init at "infinite" std::string key; const int maxAddrSize = 20; char ptr_str[maxAddrSize]; int num = qsnprintf(ptr_str,maxAddrSize,"%p:",(void *)scope); assert(num>0); key.reserve(num+name.length()+1); key+=ptr_str; key+=name.str(); { std::lock_guard lock(g_substMapMutex); auto it = g_substMap.find(key); if (it!=g_substMap.end()) { if (pTypeDef) *pTypeDef = it->second.second; return it->second.first; } } for (Definition *d : range) { // only look at members if (d->definitionType()==Definition::TypeMember) { // that are also typedefs MemberDef *md = toMemberDef(d); if (md->isTypedef()) // d is a typedef { VisitedNamespaces visitedNamespaces; AccessStack accessStack; // test accessibility of typedef within scope. int distance = isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,d,""); if (distance!=-1 && distance<minDistance) // definition is accessible and a better match { minDistance=distance; bestMatch = md; } } } } if (bestMatch) { result = bestMatch->typeString(); if (pTypeDef) *pTypeDef=bestMatch; } // cache the result of the computation to give a faster answers next time, especially relevant // if `range` has many arguments (i.e. there are many symbols with the same name in different contexts) { std::lock_guard lock(g_substMapMutex); g_substMap.emplace(key,std::make_pair(result,bestMatch)); } AUTO_TRACE_EXIT("result={}",result); return result; } //---------------------------------------------------------------------------------------------- SymbolResolver::SymbolResolver(const FileDef *fileScope) : p(std::make_unique<Private>(fileScope)) { } SymbolResolver::~SymbolResolver() { } const ClassDef *SymbolResolver::resolveClass(const Definition *scope, const QCString &name, bool mayBeUnlinkable, bool mayBeHidden) { AUTO_TRACE("scope={} name={} mayBeUnlinkable={} mayBeHidden={}", scope?scope->name():QCString(), name, mayBeUnlinkable, mayBeHidden); p->reset(); if (scope==nullptr || (scope->definitionType()!=Definition::TypeClass && scope->definitionType()!=Definition::TypeNamespace ) || (name.stripWhiteSpace().startsWith("::")) || (scope->getLanguage()==SrcLangExt::Java && QCString(name).find("::")!=-1) ) { scope=Doxygen::globalScope; } const ClassDef *result=nullptr; if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) { result = getClass(name); } else { VisitedKeys visitedKeys; result = p->getResolvedTypeRec(visitedKeys,scope,name,&p->typeDef,&p->templateSpec,&p->resolvedType); if (result==nullptr) // for nested classes imported via tag files, the scope may not // present, so we check the class name directly as well. // See also bug701314 { result = getClass(name); } } if (!mayBeUnlinkable && result && !result->isLinkable()) { if (!mayBeHidden || !result->isHidden()) { AUTO_TRACE_ADD("hiding symbol {}",result->name()); result=nullptr; // don't link to artificial/hidden classes unless explicitly allowed } } AUTO_TRACE_EXIT("result={}",result?result->name():QCString()); return result; } const Definition *SymbolResolver::resolveSymbol(const Definition *scope, const QCString &name, const QCString &args, bool checkCV, bool insideCode) { AUTO_TRACE("scope={} name={} args={} checkCV={} insideCode={}", scope?scope->name():QCString(), name, args, checkCV, insideCode); p->reset(); if (scope==nullptr) scope=Doxygen::globalScope; VisitedKeys visitedKeys; const Definition *result = p->getResolvedSymbolRec(visitedKeys,scope,name,args,checkCV,insideCode,&p->typeDef,&p->templateSpec,&p->resolvedType); AUTO_TRACE_EXIT("result={}{}", qPrint(result?result->qualifiedName():QCString()), qPrint(result && result->definitionType()==Definition::TypeMember ? toMemberDef(result)->argsString() : QCString())); return result; } int SymbolResolver::isAccessibleFrom(const Definition *scope,const Definition *item) { AUTO_TRACE("scope={} item={}", scope?scope->name():QCString(), item?item->name():QCString()); p->reset(); VisitedKeys visitedKeys; AccessStack accessStack; int result = p->isAccessibleFrom(visitedKeys,accessStack,scope,item); AUTO_TRACE_EXIT("result={}",result); return result; } int SymbolResolver::isAccessibleFromWithExpScope(const Definition *scope,const Definition *item, const QCString &explicitScopePart) { AUTO_TRACE("scope={} item={} explicitScopePart={}", scope?scope->name():QCString(), item?item->name():QCString(), explicitScopePart); p->reset(); VisitedKeys visitedKeys; VisitedNamespaces visitedNamespaces; AccessStack accessStack; int result = p->isAccessibleFromWithExpScope(visitedKeys,visitedNamespaces,accessStack,scope,item,explicitScopePart); AUTO_TRACE_EXIT("result={}",result); return result; } void SymbolResolver::setFileScope(const FileDef *fileScope) { p->setFileScope(fileScope); } const MemberDef *SymbolResolver::getTypedef() const { return p->typeDef; } QCString SymbolResolver::getTemplateSpec() const { return p->templateSpec; } QCString SymbolResolver::getResolvedType() const { return p->resolvedType; }
64,068
C++
.cpp
1,567
32.401404
150
0.596182
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,456
qhp.cpp
doxygen_doxygen/src/qhp.cpp
/* * Copyright (C) 1997-2022 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 <algorithm> #include <memory> #include <string.h> #include <vector> #include <cassert> #include <mutex> #include "config.h" #include "debug.h" #include "doxygen.h" #include "groupdef.h" #include "memberdef.h" #include "message.h" #include "qhp.h" #include "textstream.h" #include "util.h" #include "portable.h" #include "language.h" #include "version.h" static std::once_flag g_blankWritten; static inline void writeIndent(TextStream &t,int indent) { if (Debug::isFlagSet(Debug::Qhp)) { for (int i=0;i<indent;i++) t << " "; } } class QhpSectionTree { private: struct Node { enum class Type { Root, Dir, Section }; // constructor for root node Node() : type(Type::Root), parent(nullptr) {} // constructor for dir node Node(Node *parent_) : type(Type::Dir), parent(parent_) {} // constructor for section node Node(Node *parent_, const QCString &title_,const QCString &ref_) : type(Type::Section), parent(parent_), title(title_), ref(ref_) {} Type type; Node *parent = nullptr; QCString title; QCString ref; std::vector<std::unique_ptr<Node>> children; }; Node m_root; Node *m_current = &m_root; void traverse(const Node &root,TextStream &t,int indent) const { /* Input: Output: * ================================================= * Section1 <section title=".." ref=".."> * Dir1 * Section2 <section title=".." ref=".."> * Dir2 * Section3 <section title=".." ref=".."/> * </section> * </section> * Section4 <section title=".." ref="..> * Dir3 * Dir4 * Section5 <section title=.." ref=.."/> * </section> * Section6 <section title=".." ref=".."/> */ size_t numChildren = root.children.size(); size_t i=0; while (i<numChildren) { if (root.children[i]->type==Node::Type::Section) { i++; if (i<numChildren && root.children[i]->type==Node::Type::Dir) { // we have a dir node writeIndent(t,indent); t << "<section title=\"" << convertToXML(root.children[i-1]->title) << "\"" << " ref=\"" << convertToXML(root.children[i-1]->ref) << "\">\n"; while (i<numChildren && root.children[i]->type==Node::Type::Dir) { traverse(*root.children[i].get(),t,indent+1); i++; } writeIndent(t,indent); t << "</section>\n"; } else // we have a leaf section node { writeIndent(t,indent); t << "<section title=\"" << convertToXML(root.children[i-1]->title) << "\"" << " ref=\"" << convertToXML(root.children[i-1]->ref) << "\"/>\n"; } } else // dir without preceding section (no extra indent) { traverse(*root.children[i].get(),t,indent); i++; } } } public: void addSection(const QCString &title,const QCString &ref) { m_current->children.push_back(std::make_unique<Node>(m_current,title,ref)); } void incLevel() { auto newNode = new Node(m_current); m_current->children.push_back(std::unique_ptr<Node>(newNode)); m_current = newNode; } void decLevel() { assert(m_current->parent!=nullptr); if (m_current->parent) { m_current = m_current->parent; } } void writeToc(TextStream &t) const { writeIndent(t,2); t << "<toc>\n"; traverse(m_root,t,3); writeIndent(t,2); t << "</toc>\n"; } }; class Qhp::Private { public: std::ofstream docFile; TextStream doc; TextStream index; StringSet files; QhpSectionTree sectionTree; }; static QCString getFullProjectName() { QCString projectName = Config_getString(PROJECT_NAME); QCString versionText = Config_getString(PROJECT_NUMBER); if (projectName.isEmpty()) projectName="Root"; if (!versionText.isEmpty()) projectName+=" "+versionText; return projectName; } static QCString makeFileName(const QCString & withoutExtension) { QCString result=withoutExtension; if (!result.isEmpty()) { if (result.at(0)=='!') // relative URL -> strip marker { result=result.mid(1); } else // add specified HTML extension { addHtmlExtensionIfMissing(result); } } return result; } static QCString makeRef(const QCString & withoutExtension, const QCString & anchor) { //printf("QHP::makeRef(%s,%s)\n",withoutExtension,anchor); if (withoutExtension.isEmpty()) return QCString(); QCString result = makeFileName(withoutExtension); if (anchor.isEmpty()) return result; return result+"#"+anchor; } Qhp::Qhp() : p(std::make_unique<Private>()) {} Qhp::~Qhp() = default; void Qhp::initialize() { /* <QtHelpProject version="1.0"> <namespace>mycompany.com.myapplication.1_0</namespace> <virtualFolder>doc</virtualFolder> <customFilter name="My Application 1.0"> <filterAttribute>myapp</filterAttribute> <filterAttribute>1.0</filterAttribute> </customFilter> <filterSection> <filterAttribute>myapp</filterAttribute> <filterAttribute>1.0</filterAttribute> .. */ QCString fileName = Config_getString(HTML_OUTPUT) + "/" + qhpFileName; p->docFile = Portable::openOutputStream(fileName); if (!p->docFile.is_open()) { term("Could not open file %s for writing\n", fileName.data()); } p->doc.setStream(&p->docFile); p->doc << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; p->doc << "<QtHelpProject version=\"1.0\">\n"; writeIndent(p->doc,1); p->doc << "<namespace>" << convertToXML(Config_getString(QHP_NAMESPACE)) << "</namespace>\n"; writeIndent(p->doc,1); p->doc << "<virtualFolder>" << convertToXML(Config_getString(QHP_VIRTUAL_FOLDER)) << "</virtualFolder>\n"; // Add custom filter QCString filterName = Config_getString(QHP_CUST_FILTER_NAME); if (!filterName.isEmpty()) { writeIndent(p->doc,1); p->doc << "<customFilter name=\"" << convertToXML(filterName) << "\">\n"; StringVector customFilterAttributes = split(Config_getString(QHP_CUST_FILTER_ATTRS).str(), " "); for (const auto &attr : customFilterAttributes) { writeIndent(p->doc,2); p->doc << "<filterAttribute>" << convertToXML(QCString(attr)) << "</filterAttribute>\n"; } writeIndent(p->doc,1); p->doc << "</customFilter>\n"; } writeIndent(p->doc,1); p->doc << "<filterSection>\n"; // Add section attributes StringVector sectionFilterAttributes = split(Config_getString(QHP_SECT_FILTER_ATTRS).str(), " "); // always add doxygen as filter attribute if (std::find(sectionFilterAttributes.begin(), sectionFilterAttributes.end(), "doxygen") == sectionFilterAttributes.end()) { sectionFilterAttributes.emplace_back("doxygen"); } for (const auto &attr : sectionFilterAttributes) { writeIndent(p->doc,2); p->doc << "<filterAttribute>" << convertToXML(QCString(attr)) << "</filterAttribute>\n"; } // Add extra root node to the TOC p->sectionTree.addSection(getFullProjectName(),"index"+Doxygen::htmlFileExtension); p->sectionTree.incLevel(); writeIndent(p->index,2); p->index << "<keywords>\n"; } void Qhp::finalize() { // close root node p->sectionTree.decLevel(); // Finish TOC p->sectionTree.writeToc(p->doc); // Finish index writeIndent(p->index,2); p->index << "</keywords>\n"; p->doc << p->index.str(); // Finish files writeIndent(p->doc,2); p->doc << "<files>\n"; for (auto &s : p->files) { writeIndent(p->doc,3); p->doc << s.c_str() << "\n"; } writeIndent(p->doc,2); p->doc << "</files>\n"; writeIndent(p->doc,1); p->doc << "</filterSection>\n"; p->doc << "</QtHelpProject>\n"; p->doc.flush(); p->docFile.close(); } void Qhp::incContentsDepth() { p->sectionTree.incLevel(); } void Qhp::decContentsDepth() { p->sectionTree.decLevel(); } void Qhp::addContentsItem(bool /* isDir */, const QCString & name, const QCString & /*ref*/, const QCString & file, const QCString &anchor, bool /* separateIndex */, bool /* addToNavIndex */, const Definition * /*def*/) { /* <toc> <section title="My Application Manual" ref="index.html"> <section title="Chapter 1" ref="doc.html#chapter1"/> <section title="Chapter 2" ref="doc.html#chapter2"/> <section title="Chapter 3" ref="doc.html#chapter3"/> </section> </toc> */ QCString f = file; if (!f.isEmpty() && f.at(0)=='^') return; // absolute URL not supported if (f.isEmpty()) { f = "doxygen_blank"; addHtmlExtensionIfMissing(f); std::call_once(g_blankWritten,[this,&f]() { QCString fileName = Config_getString(HTML_OUTPUT) + "/" + f; std::ofstream blankFile = Portable::openOutputStream(fileName); // we just need an empty file if (!blankFile.is_open()) { term("Could not open file %s for writing\n", qPrint(fileName)); } TextStream blank; blank.setStream(&blankFile); blank << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; blank << "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"" + theTranslator->trISOLang() + "\">\n"; blank << "<head>\n"; blank << "<title>Validator / crawler helper</title>\n"; blank << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n"; blank << "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=11\"/>\n"; blank << "<meta name=\"generator\" content=\"Doxygen " + getDoxygenVersion() + "\"/>\n"; blank << "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\n"; blank << "</head>\n"; blank << "<body>\n"; blank << "</body>\n"; blank << "</html>\n"; blank.flush(); blankFile.close(); addFile(f); }); } QCString finalRef = makeRef(f, anchor); p->sectionTree.addSection(name,finalRef); } void Qhp::addIndexItem(const Definition *context,const MemberDef *md, const QCString &sectionAnchor,const QCString &word) { (void)word; //printf("addIndexItem(%s %s %s\n", // context?context->name().data():"<none>", // md?md->name().data():"<none>", // qPrint(word)); if (context && md) // member { QCString cfname = md->getOutputFileBase(); QCString argStr = md->argsString(); QCString level1 = context->name(); QCString level2 = !word.isEmpty() ? word : md->name(); QCString anchor = !sectionAnchor.isEmpty() ? sectionAnchor : md->anchor(); QCString ref; // <keyword name="foo" id="MyApplication::foo" ref="doc.html#foo"/> ref = makeRef(cfname, anchor); QCString id = level1+"::"+level2; writeIndent(p->index,3); p->index << "<keyword name=\"" << convertToXML(level2 + argStr) << "\"" " id=\"" << convertToXML(id + "_" + anchor) << "\"" " ref=\"" << convertToXML(ref) << "\"/>\n"; } else if (context) // container { // <keyword name="Foo" id="Foo" ref="doc.html#Foo"/> QCString contRef = context->getOutputFileBase(); QCString level1 = !word.isEmpty() ? word : context->name(); QCString ref = makeRef(contRef,sectionAnchor); writeIndent(p->index,3); p->index << "<keyword name=\"" << convertToXML(level1) << "\"" << " id=\"" << convertToXML(level1 +"_" + sectionAnchor) << "\"" << " ref=\"" << convertToXML(ref) << "\"/>\n"; } } void Qhp::addFile(const QCString & fileName) { p->files.insert(("<file>" + convertToXML(fileName) + "</file>").str()); } void Qhp::addIndexFile(const QCString & fileName) { addFile(fileName); } void Qhp::addImageFile(const QCString &fileName) { addFile(fileName); } void Qhp::addStyleSheetFile(const QCString &fileName) { addFile(fileName); } QCString Qhp::getQchFileName() { QCString const & qchFile = Config_getString(QCH_FILE); if (!qchFile.isEmpty()) { return qchFile; } QCString const & projectName = Config_getString(PROJECT_NAME); QCString const & versionText = Config_getString(PROJECT_NUMBER); return QCString("../qch/") + (projectName.isEmpty() ? QCString("index") : projectName) + (versionText.isEmpty() ? QCString("") : QCString("-") + versionText) + QCString(".qch"); }
13,350
C++
.cpp
399
28.278195
146
0.607035
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,457
dia.cpp
doxygen_doxygen/src/dia.cpp
/****************************************************************************** * * Copyright (C) 1997-2021 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 "dia.h" #include "portable.h" #include "config.h" #include "message.h" #include "util.h" #include "dir.h" static const int maxCmdLine = 40960; void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir, const QCString &outFile,DiaOutputFormat format, const QCString &srcFile,int srcLine) { QCString absOutFile = outDir; absOutFile+=Portable::pathSeparator(); absOutFile+=outFile; // chdir to the output dir, so dot can find the font file. std::string oldDir = Dir::currentDirPath(); // go to the html output directory (i.e. path) Dir::setCurrent(outDir.str()); //printf("Going to dir %s\n",Dir::currentDirPath().c_str()); QCString diaExe = Config_getString(DIA_PATH)+"dia"+Portable::commandExtension(); QCString diaArgs; QCString extension; diaArgs+="-n "; if (format==DiaOutputFormat::BITMAP) { diaArgs+="-t png-libart"; extension=".png"; } else if (format==DiaOutputFormat::EPS) { diaArgs+="-t eps"; extension=".eps"; } diaArgs+=" -e \""; diaArgs+=outFile; diaArgs+=extension+"\""; diaArgs+=" \""; diaArgs+=inFile; diaArgs+="\""; //printf("*** running: %s %s outDir:%s %s\n",qPrint(diaExe),qPrint(diaArgs),outDir,outFile); if (Portable::system(diaExe,diaArgs,FALSE)!=0) { err_full(srcFile,srcLine,"Problems running %s. Check your installation or look typos in you dia file %s", qPrint(diaExe),qPrint(inFile)); goto error; } if ( (format==DiaOutputFormat::EPS) && (Config_getBool(USE_PDFLATEX)) ) { QCString epstopdfArgs(maxCmdLine, QCString::ExplicitSize); epstopdfArgs.sprintf("\"%s.eps\" --outfile=\"%s.pdf\"", qPrint(outFile),qPrint(outFile)); if (Portable::system("epstopdf",epstopdfArgs)!=0) { err("Problems running epstopdf. Check your TeX installation!\n"); } else { Dir().remove(outFile.str()+".eps"); } } error: Dir::setCurrent(oldDir); }
2,658
C++
.cpp
77
30.376623
109
0.663555
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,458
dirdef.cpp
doxygen_doxygen/src/dirdef.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 <algorithm> #include "dirdef.h" #include "md5.h" #include "filename.h" #include "doxygen.h" #include "util.h" #include "outputlist.h" #include "language.h" #include "message.h" #include "dot.h" #include "dotdirdeps.h" #include "layout.h" #include "config.h" #include "docparser.h" #include "definitionimpl.h" #include "filedef.h" #include "trace.h" //---------------------------------------------------------------------- class DirDefImpl : public DefinitionMixin<DirDef> { public: DirDefImpl(const QCString &path); ~DirDefImpl() override; NON_COPYABLE(DirDefImpl) DefType definitionType() const override { return TypeDir; } CodeSymbolType codeSymbolType() const override { return CodeSymbolType::Default; } QCString getOutputFileBase() const override; QCString anchor() const override { return QCString(); } bool isLinkableInProject() const override; bool isLinkable() const override; QCString displayName(bool=TRUE) const override { return m_dispName; } const QCString shortName() const override { return m_shortName; } void addSubDir(DirDef *subdir) override; const FileList &getFiles() const override { return m_fileList; } void addFile(FileDef *fd) override; const DirList &subDirs() const override { return m_subdirs; } bool hasSubdirs() const override { return !m_subdirs.empty(); } int level() const override { return m_level; } DirDef *parent() const override { return m_parent; } int dirIndex() const override { return m_dirIndex; } const UsedDirLinkedMap &usedDirs() const override { return m_usedDirs; } bool isParentOf(const DirDef *dir) const override; bool depGraphIsTrivial() const override; QCString shortTitle() const override; bool hasDetailedDescription() const override; void writeDocumentation(OutputList &ol) override; void writeTagFile(TextStream &t) override; void setDiskName(const QCString &name) override { m_diskName = name; } void sort() override; void setParent(DirDef *parent) override; void setDirIndex(int index) override; void setLevel() override; void addUsesDependency(const DirDef *usedDir,const FileDef *srcFd, const FileDef *dstFd,bool srcDirect, bool dstDirect) override; void computeDependencies() override; bool hasDirectoryGraph() const override; void overrideDirectoryGraph(bool e) override; public: static DirDef *mergeDirectoryInTree(const QCString &path); private: void writeDetailedDescription(OutputList &ol,const QCString &title); void writeBriefDescription(OutputList &ol); void writeDirectoryGraph(OutputList &ol); void writeSubDirList(OutputList &ol); void writeFileList(OutputList &ol); void startMemberDeclarations(OutputList &ol); void endMemberDeclarations(OutputList &ol); static DirDef *createNewDir(const QCString &path); static bool matchPath(const QCString &path,const StringVector &l); DirList m_subdirs; QCString m_dispName; QCString m_shortName; QCString m_diskName; FileList m_fileList; // list of files in the group int m_dirIndex = -1; int m_level; DirDef *m_parent; UsedDirLinkedMap m_usedDirs; bool m_hasDirectoryGraph = false; }; DirDef *createDirDef(const QCString &path) { return new DirDefImpl(path); } //---------------------------------------------------------------------- // method implementation DirDefImpl::DirDefImpl(const QCString &path) : DefinitionMixin(path,1,1,path) { bool fullPathNames = Config_getBool(FULL_PATH_NAMES); // get display name (stripping the paths mentioned in STRIP_FROM_PATH) // get short name (last part of path) m_shortName = path; m_diskName = path; if (m_shortName.at(m_shortName.length()-1)=='/') { // strip trailing / m_shortName = m_shortName.left(m_shortName.length()-1); } int pi=m_shortName.findRev('/'); if (pi!=-1) { // remove everything till the last / m_shortName = m_shortName.mid(pi+1); } setLocalName(m_shortName); m_dispName = fullPathNames ? stripFromPath(path) : m_shortName; if (m_dispName.length()>0 && m_dispName.at(m_dispName.length()-1)=='/') { // strip trailing / m_dispName = m_dispName.left(m_dispName.length()-1); } m_level=-1; m_parent=nullptr; m_hasDirectoryGraph=Config_getBool(DIRECTORY_GRAPH); } DirDefImpl::~DirDefImpl() { } bool DirDefImpl::isLinkableInProject() const { return !isReference(); } bool DirDefImpl::isLinkable() const { return isReference() || isLinkableInProject(); } void DirDefImpl::addSubDir(DirDef *subdir) { m_subdirs.push_back(subdir); subdir->setOuterScope(this); subdir->setParent(this); } void DirDefImpl::setParent(DirDef *p) { m_parent=p; } void DirDefImpl::setDirIndex(int index) { m_dirIndex=index; } void DirDefImpl::addFile(FileDef *fd) { m_fileList.push_back(fd); fd->setDirDef(this); } void DirDefImpl::sort() { std::stable_sort(m_subdirs.begin(), m_subdirs.end(), compareDirDefs); std::stable_sort(m_fileList.begin(), m_fileList.end(), compareFileDefs); } static QCString encodeDirName(const QCString &anchor) { AUTO_TRACE(); // convert to md5 hash uint8_t md5_sig[16]; char sigStr[33]; MD5Buffer(anchor.data(),static_cast<unsigned int>(anchor.length()),md5_sig); MD5SigToString(md5_sig,sigStr); AUTO_TRACE_EXIT("result={}",sigStr); return sigStr; // old algorithm // QCString result; // int l = anchor.length(),i; // for (i=0;i<l;i++) // { // char c = anchor.at(i); // if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9')) // { // result+=c; // } // else // { // static char hexStr[]="0123456789ABCDEF"; // char escChar[]={ '_', 0, 0, 0 }; // escChar[1]=hexStr[c>>4]; // escChar[2]=hexStr[c&0xf]; // result+=escChar; // } // } // return result; } QCString DirDefImpl::getOutputFileBase() const { QCString dir = "dir_"+encodeDirName(m_diskName); AUTO_TRACE("diskName={} result={}",m_diskName,dir); return dir; } void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { AUTO_TRACE(); if ((!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) || !documentation().isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputType::Html); ol.writeRuler(); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); ol.endGroupHeader(); // repeat brief description if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,nullptr,briefDescription(),FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } // separator between brief and details if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputType::Man); ol.disable(OutputType::RTF); ol.enableAll(); ol.disableAllBut(OutputType::Man); ol.enable(OutputType::Latex); ol.writeString("\n\n"); ol.popGeneratorState(); } // write documentation if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,nullptr,documentation()+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } } } void DirDefImpl::writeBriefDescription(OutputList &ol) { AUTO_TRACE(); if (hasBriefDescription()) { auto parser { createDocParser() }; auto ast { validatingParseDoc( *parser.get(), briefFile(),briefLine(),this,nullptr,briefDescription(),TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) }; if (!ast->isEmpty()) { ol.startParagraph(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.writeString(" - "); ol.popGeneratorState(); ol.writeDoc(ast.get(),this,nullptr); ol.pushGeneratorState(); ol.disable(OutputType::RTF); ol.writeString(" \n"); ol.enable(OutputType::RTF); if (Config_getBool(REPEAT_BRIEF) || !documentation().isEmpty() ) { ol.disableAllBut(OutputType::Html); ol.startTextLink(QCString(),"details"); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } ol.popGeneratorState(); ol.endParagraph(); } } ol.writeSynopsis(); } void DirDefImpl::writeDirectoryGraph(OutputList &ol) { // write graph dependency graph if (Config_getBool(HAVE_DOT) && m_hasDirectoryGraph /*&& Config_getBool(DIRECTORY_GRAPH)*/) { DotDirDeps dirDep(this); if (!dirDep.isTrivial()) { msg("Generating dependency graph for directory %s\n",qPrint(displayName())); ol.disable(OutputType::Man); //ol.startParagraph(); ol.startDirDepGraph(); ol.parseText(theTranslator->trDirDepGraph(shortName())); ol.endDirDepGraph(dirDep); //ol.endParagraph(); ol.enableAll(); } } } void DirDefImpl::writeSubDirList(OutputList &ol) { AUTO_TRACE(); int numSubdirs = 0; for(const auto dd : m_subdirs) { if (dd->hasDocumentation() || !dd->getFiles().empty()) { numSubdirs++; } } AUTO_TRACE_ADD("numSubdirs={}",numSubdirs); // write subdir list if (numSubdirs>0) { ol.startMemberHeader("subdirs"); ol.parseText(theTranslator->trDir(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); for(const auto dd : m_subdirs) { if (dd->hasDocumentation() || !dd->getFiles().empty()) { ol.startMemberDeclaration(); ol.startMemberItem(dd->anchor(),OutputGenerator::MemberItemType::Normal); { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.writeString("<span class=\"iconfclosed\"></span>"); ol.enableAll(); ol.disable(OutputType::Html); ol.parseText(theTranslator->trDir(FALSE,TRUE)+" "); ol.popGeneratorState(); } ol.insertMemberAlign(); ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),QCString(),dd->shortName()); ol.endMemberItem(OutputGenerator::MemberItemType::Normal); if (!dd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(dd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),dd,nullptr,dd->briefDescription(), FALSE, // indexWords FALSE, // isExample QCString(), // exampleName TRUE, // single line TRUE, // link from index Config_getBool(MARKDOWN_SUPPORT) ); ol.endMemberDescription(); } ol.endMemberDeclaration(dd->anchor(),QCString()); } } ol.endMemberList(); } } void DirDefImpl::writeFileList(OutputList &ol) { AUTO_TRACE(); int numFiles = 0; for (const auto &fd : m_fileList) { bool genSourceFile=false; if (fileVisibleInIndex(fd,genSourceFile)) { numFiles++; } else if (genSourceFile) { numFiles++; } } AUTO_TRACE_ADD("numFiles={}",numFiles); // write file list if (numFiles>0) { ol.startMemberHeader("files"); ol.parseText(theTranslator->trFile(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); for (const auto &fd : m_fileList) { bool src = false; bool doc = fileVisibleInIndex(fd,src); if (doc || src) { ol.startMemberDeclaration(); ol.startMemberItem(fd->anchor(),OutputGenerator::MemberItemType::Normal); { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); bool genSrc = fd->generateSourceFile(); if (genSrc) { ol.startTextLink(fd->includeName(),QCString()); } ol.writeString("<span class=\"icondoc\"></span>"); if (genSrc) { ol.endTextLink(); } ol.enableAll(); ol.disable(OutputType::Html); ol.docify(theTranslator->trFile(FALSE,TRUE)+" "); ol.popGeneratorState(); } ol.insertMemberAlign(); if (fd->isLinkable()) { ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fd->displayName()); } else { ol.startBold(); ol.docify(fd->displayName()); ol.endBold(); } ol.endMemberItem(OutputGenerator::MemberItemType::Normal); if (!fd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(fd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),fd,nullptr,fd->briefDescription(), FALSE, // indexWords FALSE, // isExample QCString(), // exampleName TRUE, // single line TRUE, // link from index Config_getBool(MARKDOWN_SUPPORT) ); ol.endMemberDescription(); } ol.endMemberDeclaration(fd->anchor(),QCString()); } } ol.endMemberList(); } } void DirDefImpl::startMemberDeclarations(OutputList &ol) { ol.startMemberSections(); } void DirDefImpl::endMemberDeclarations(OutputList &ol) { ol.endMemberSections(); } QCString DirDefImpl::shortTitle() const { return theTranslator->trDirReference(m_shortName); } bool DirDefImpl::hasDetailedDescription() const { bool repeatBrief = Config_getBool(REPEAT_BRIEF); return (!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty(); } void DirDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"dir\">\n"; tagFile << " <name>" << convertToXML(displayName()) << "</name>\n"; tagFile << " <path>" << convertToXML(stripFromPath(name())) << "</path>\n"; QCString fn=getOutputFileBase(); addHtmlExtensionIfMissing(fn); tagFile << " <filename>" << fn << "</filename>\n"; for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Directory)) { switch (lde->kind()) { case LayoutDocEntry::DirSubDirs: { if (m_subdirs.size()>0) { for(const auto dd : m_subdirs) { tagFile << " <dir>" << convertToXML(dd->displayName()) << "</dir>\n"; } } } break; case LayoutDocEntry::DirFiles: { for (const auto &fd : m_fileList) { tagFile << " <file>" << convertToXML(fd->name()) << "</file>\n"; } } break; default: break; } } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>\n"; } void DirDefImpl::writeDocumentation(OutputList &ol) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); ol.pushGeneratorState(); QCString title=theTranslator->trDirReference(m_dispName); AUTO_TRACE("title={}",title); startFile(ol,getOutputFileBase(),name(),title,HighlightedItem::Files,!generateTreeView); if (!generateTreeView) { // write navigation path writeNavigationPath(ol); ol.endQuickIndices(); } startTitle(ol,getOutputFileBase()); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.parseText(shortTitle()); ol.enableAll(); ol.disable(OutputType::Html); ol.parseText(title); ol.popGeneratorState(); endTitle(ol,getOutputFileBase(),title); ol.startContents(); //---------------------------------------- start flexible part ------------------------------- SrcLangExt lang = getLanguage(); for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Directory)) { switch (lde->kind()) { case LayoutDocEntry::BriefDesc: writeBriefDescription(ol); break; case LayoutDocEntry::DirGraph: writeDirectoryGraph(ol); break; case LayoutDocEntry::MemberDeclStart: startMemberDeclarations(ol); break; case LayoutDocEntry::DirSubDirs: writeSubDirList(ol); break; case LayoutDocEntry::DirFiles: writeFileList(ol); break; case LayoutDocEntry::MemberDeclEnd: endMemberDeclarations(ol); break; case LayoutDocEntry::DetailedDesc: { const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get()); if (ls) { writeDetailedDescription(ol,ls->title(lang)); } } break; case LayoutDocEntry::ClassIncludes: case LayoutDocEntry::ClassInlineClasses: case LayoutDocEntry::ClassInheritanceGraph: case LayoutDocEntry::ClassNestedClasses: case LayoutDocEntry::ClassCollaborationGraph: case LayoutDocEntry::ClassAllMembersLink: case LayoutDocEntry::ClassUsedFiles: case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::NamespaceClasses: case LayoutDocEntry::NamespaceConcepts: case LayoutDocEntry::NamespaceInterfaces: case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::FileClasses: case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: case LayoutDocEntry::FileNamespaces: case LayoutDocEntry::FileConstantGroups: case LayoutDocEntry::FileIncludes: case LayoutDocEntry::FileIncludeGraph: case LayoutDocEntry::FileIncludedByGraph: case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: case LayoutDocEntry::GroupClasses: case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupModules: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: case LayoutDocEntry::GroupNestedGroups: case LayoutDocEntry::GroupFiles: case LayoutDocEntry::GroupGraph: case LayoutDocEntry::GroupPageDocs: case LayoutDocEntry::ModuleExports: case LayoutDocEntry::ModuleClasses: case LayoutDocEntry::ModuleConcepts: case LayoutDocEntry::ModuleUsedFiles: case LayoutDocEntry::AuthorSection: case LayoutDocEntry::MemberGroups: case LayoutDocEntry::MemberDecl: case LayoutDocEntry::MemberDef: case LayoutDocEntry::MemberDefStart: case LayoutDocEntry::MemberDefEnd: err("Internal inconsistency: member %d should not be part of " "LayoutDocManager::Directory entry list\n",lde->kind()); break; } } //---------------------------------------- end flexible part ------------------------------- ol.endContents(); endFileWithNavPath(ol,this); ol.popGeneratorState(); } void DirDefImpl::setLevel() { if (m_level==-1) // level not set before { DirDef *p = parent(); if (p) { p->setLevel(); m_level = p->level()+1; } else { m_level = 0; } } } /** Add as "uses" dependency between \a this dir and \a dir, * that was caused by a dependency on file \a fd. * srcDirect and dstDirect indicate if it is a direct dependencies (true) or if * the dependencies was indirect (e.g. a parent dir that has a child dir that has the dependencies) */ void DirDefImpl::addUsesDependency(const DirDef *dir,const FileDef *srcFd, const FileDef *dstFd,bool srcDirect, bool dstDirect) { if (this==dir) return; // do not add self-dependencies AUTO_TRACE("add dependency {}->{} due to {}->{}", qPrint(shortName()), qPrint(dir->shortName()), qPrint(srcFd->name()), qPrint(dstFd->name())); // levels match => add direct dependency bool added=FALSE; UsedDir *usedDir = m_usedDirs.find(dir->getOutputFileBase()); if (usedDir) // dir dependency already present { const FilePair *usedPair = usedDir->findFilePair(FilePair::key(srcFd,dstFd)); if (usedPair==nullptr) // new file dependency { AUTO_TRACE_ADD("{} => {} new file dependency",srcFd->name(),dstFd->name()); usedDir->addFileDep(srcFd,dstFd, srcDirect, dstDirect); added=TRUE; } else { // dir & file dependency already added } } else // new directory dependency { AUTO_TRACE_ADD("{} => {} new file dependency",srcFd->name(),dstFd->name()); auto newUsedDir = std::make_unique<UsedDir>(dir); newUsedDir->addFileDep(srcFd,dstFd, srcDirect, dstDirect); m_usedDirs.add(dir->getOutputFileBase(),std::move(newUsedDir)); added=TRUE; } if (added) { if (dir->parent()) { // add relation to parent of used dir addUsesDependency(dir->parent(), srcFd, dstFd, srcDirect, false); // indirect dependency on dest dir } if (parent()) { // add relation for the parent of this dir as well parent()->addUsesDependency(dir, srcFd, dstFd, false, // indirect dependency from source dir dstDirect); } } } /** Computes the dependencies between directories */ void DirDefImpl::computeDependencies() { AUTO_TRACE(); for (const auto &fd : m_fileList) { AUTO_TRACE_ADD("dir={} file={}",shortName(),fd->name()); for (const auto &ii : fd->includeFileList()) { AUTO_TRACE_ADD("#include {}",ii.includeName); if (ii.fileDef && ii.fileDef->isLinkable()) // linkable file { DirDef *usedDir = ii.fileDef->getDirDef(); if (usedDir) { // add dependency: thisDir->usedDir AUTO_TRACE_ADD("add dependency {}->{}",name(),usedDir->name()); addUsesDependency(usedDir,fd,ii.fileDef,true,true); } } } } std::stable_sort(m_usedDirs.begin(),m_usedDirs.end(), [](const auto &u1,const auto &u2) { return qstricmp_sort(u1->dir()->getOutputFileBase(),u2->dir()->getOutputFileBase())<0; }); for (const auto& usedDirectory : m_usedDirs) { usedDirectory->sort(); } } bool DirDefImpl::isParentOf(const DirDef *dir) const { if (dir->parent()==this) // this is a parent of dir return TRUE; else if (dir->parent()) // repeat for the parent of dir return isParentOf(dir->parent()); else return FALSE; } bool DirDefImpl::depGraphIsTrivial() const { return m_usedDirs.empty() && m_parent==nullptr; } //---------------------------------------------------------------------- UsedDir::UsedDir(const DirDef *dir) : m_dir(dir) { } void UsedDir::addFileDep(const FileDef *srcFd,const FileDef *dstFd, bool srcDirect, bool dstDirect) { m_filePairs.add(FilePair::key(srcFd,dstFd),std::make_unique<FilePair>(srcFd,dstFd)); m_hasDirectDeps = m_hasDirectDeps || (srcDirect && dstDirect); m_hasDirectSrcDeps = m_hasDirectSrcDeps || srcDirect; m_hasDirectDstDeps = m_hasDirectDstDeps || dstDirect; } void UsedDir::sort() { std::stable_sort(m_filePairs.begin(), m_filePairs.end(), [](const auto &left,const auto &right) { int orderHi = qstricmp_sort(left->source()->name(),right->source()->name()); if (orderHi!=0) return orderHi<0; int orderLo = qstricmp_sort(left->destination()->name(),right->destination()->name()); return orderLo<0; }); } FilePair *UsedDir::findFilePair(const QCString &name) { return m_filePairs.find(name); } DirDef *DirDefImpl::createNewDir(const QCString &path) { AUTO_TRACE(); ASSERT(path!=nullptr); DirDef *dir = Doxygen::dirLinkedMap->find(path); if (dir==nullptr) // new dir { dir = Doxygen::dirLinkedMap->add(path, std::unique_ptr<DirDef>( createDirDef(path))); AUTO_TRACE_ADD("Adding new dir {} shortName {}",path,dir->shortName()); } return dir; } bool DirDefImpl::matchPath(const QCString &path,const StringVector &l) { for (const auto &s : l) { std::string prefix = s.substr(0,path.length()); if (qstricmp_sort(prefix.c_str(),path)==0) // case insensitive compare { return TRUE; } } return FALSE; } /*! strip part of \a path if it matches * one of the paths in the Config_getList(STRIP_FROM_PATH) list */ DirDef *DirDefImpl::mergeDirectoryInTree(const QCString &path) { AUTO_TRACE("path={}",path); int p=0,i=0; DirDef *dir=nullptr; while ((i=path.find('/',p))!=-1) { QCString part=path.left(i+1); if (!matchPath(part,Config_getList(STRIP_FROM_PATH)) && (part!="/" && part!="//" && part!="//?/")) { dir=createNewDir(removeLongPathMarker(part)); } p=i+1; } return dir; } void DirDefImpl::overrideDirectoryGraph(bool e) { m_hasDirectoryGraph=e; } bool DirDefImpl::hasDirectoryGraph() const { return m_hasDirectoryGraph; } //---------------------------------------------------------------------- QCString FilePair::key(const FileDef *srcFd,const FileDef *dstFd) { return srcFd->getOutputFileBase()+";"+dstFd->getOutputFileBase(); } //---------------------------------------------------------------------- static void writePartialDirPath(OutputList &ol,const DirDef *root,const DirDef *target) { if (target->parent()!=root) { writePartialDirPath(ol,root,target->parent()); ol.writeString("&#160;/&#160;"); } ol.writeObjectLink(target->getReference(),target->getOutputFileBase(),QCString(),target->shortName()); } static void writePartialFilePath(OutputList &ol,const DirDef *root,const FileDef *fd) { if (fd->getDirDef() && fd->getDirDef()!=root) { writePartialDirPath(ol,root,fd->getDirDef()); ol.writeString("&#160;/&#160;"); } if (fd->isLinkable()) { ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fd->name()); } else { ol.startBold(); ol.docify(fd->name()); ol.endBold(); } } void DirRelation::writeDocumentation(OutputList &ol) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); QCString shortTitle=theTranslator->trDirRelation( (m_src->shortName()+" &rarr; "+m_dst->dir()->shortName())); QCString title=theTranslator->trDirRelation( (m_src->displayName()+" -> "+m_dst->dir()->shortName())); AUTO_TRACE("title={}",title); startFile(ol,getOutputFileBase(),getOutputFileBase(), title,HighlightedItem::None,!generateTreeView,m_src->getOutputFileBase()); if (!generateTreeView) { // write navigation path m_src->writeNavigationPath(ol); ol.endQuickIndices(); } ol.startContents(); ol.writeString("<h3>"+shortTitle+"</h3>"); ol.writeString("<table class=\"dirtab\">"); ol.writeString("<tr class=\"dirtab\">"); ol.writeString("<th class=\"dirtab\">"); ol.parseText(theTranslator->trFileIn(m_src->pathFragment())); ol.writeString("</th>"); ol.writeString("<th class=\"dirtab\">"); ol.parseText(theTranslator->trIncludesFileIn(m_dst->dir()->pathFragment())); ol.writeString("</th>"); ol.writeString("</tr>"); for (const auto &fp : m_dst->filePairs()) { ol.writeString("<tr class=\"dirtab\">"); ol.writeString("<td class=\"dirtab\">"); writePartialFilePath(ol,m_src,fp->source()); ol.writeString("</td>"); ol.writeString("<td class=\"dirtab\">"); writePartialFilePath(ol,m_dst->dir(),fp->destination()); ol.writeString("</td>"); ol.writeString("</tr>"); } ol.writeString("</table>"); ol.endContents(); endFileWithNavPath(ol,m_src); ol.popGeneratorState(); } //---------------------------------------------------------------------- // external functions /** In order to create stable, but unique directory names, * we compute the common part of the path shared by all directories. */ static void computeCommonDirPrefix() { AUTO_TRACE(); QCString path; auto it = Doxygen::dirLinkedMap->begin(); if (!Doxygen::dirLinkedMap->empty()) // we have at least one dir { // start will full path of first dir path=removeLongPathMarker((*it)->name()); int i=path.findRev('/',static_cast<int>(path.length())-2); path=path.left(i+1); bool done=FALSE; if (i==-1) { path=""; } else { while (!done) { int l = static_cast<int>(path.length()); size_t count=0; for (const auto &dir : *Doxygen::dirLinkedMap) { QCString dirName = removeLongPathMarker(dir->name()); //printf("dirName='%s' (l=%d) path='%s' (l=%d)\n",qPrint(dirName),dirName.length(),qPrint(path),path.length()); if (dirName.length()>path.length()) { if (dirName.left(l)!=path) // dirName does not start with path { i = l>=2 ? path.findRev('/',l-2) : -1; if (i==-1) // no unique prefix -> stop { path=""; done=TRUE; } else // restart with shorter path { path=path.left(i+1); break; } } } else // dir is shorter than path -> take path of dir as new start { path=dir->name(); l=static_cast<int>(path.length()); i=path.findRev('/',l-2); if (i==-1) // no unique prefix -> stop { path=""; done=TRUE; } else // restart with shorter path { path=path.left(i+1); } break; } count++; } if (count==Doxygen::dirLinkedMap->size()) // path matches for all directories -> found the common prefix { done=TRUE; } } } } for (const auto &dir : *Doxygen::dirLinkedMap) { QCString diskName = dir->name().right(dir->name().length()-path.length()); dir->setDiskName(diskName); AUTO_TRACE_ADD("set disk name: {} -> {}",dir->name(),diskName); } } void buildDirectories() { AUTO_TRACE(); // for each input file for (const auto &fn : *Doxygen::inputNameLinkedMap) { for (const auto &fd : *fn) { if (fd->getReference().isEmpty()) { DirDef *dir=Doxygen::dirLinkedMap->find(fd->getPath()); if (dir==nullptr) // new directory { dir = DirDefImpl::mergeDirectoryInTree(fd->getPath()); } if (dir && !fd->isDocumentationFile()) dir->addFile(fd.get()); } else { // do something for file imported via tag files. } } } // compute relations between directories => introduce container dirs. for (const auto &dir : *Doxygen::dirLinkedMap) { QCString name = dir->name(); int i=name.findRev('/',static_cast<int>(name.length())-2); if (i>0) { DirDef *parent = Doxygen::dirLinkedMap->find(name.left(i+1)); //if (parent==0) parent=root; if (parent) { parent->addSubDir(dir.get()); AUTO_TRACE_ADD("DirDefImpl::addSubdir(): Adding subdir {} to {}", dir->displayName(), parent->displayName()); } } } // sort the directory contents for (const auto &dir : *Doxygen::dirLinkedMap) { dir->sort(); } // short the directories themselves std::stable_sort(Doxygen::dirLinkedMap->begin(), Doxygen::dirLinkedMap->end(), [](const auto &d1,const auto &d2) { QCString s1 = d1->shortName(), s2 = d2->shortName(); int i = qstricmp_sort(s1,s2); if (i==0) // if sort name are equal, sort on full path { QCString n1 = d1->name(), n2 = d2->name(); int n = qstricmp_sort(n1,n2); return n < 0; } return i < 0; }); // set the directory index identifier int dirIndex=0; for (const auto &dir : *Doxygen::dirLinkedMap) { dir->setDirIndex(dirIndex++); } computeCommonDirPrefix(); } void computeDirDependencies() { AUTO_TRACE(); // compute nesting level for each directory for (const auto &dir : *Doxygen::dirLinkedMap) { dir->setLevel(); } // compute uses dependencies between directories for (const auto &dir : *Doxygen::dirLinkedMap) { AUTO_TRACE_ADD("computeDependencies for {}: #dirs={}",dir->name(),Doxygen::dirLinkedMap->size()); dir->computeDependencies(); } } void generateDirDocs(OutputList &ol) { AUTO_TRACE(); for (const auto &dir : *Doxygen::dirLinkedMap) { ol.pushGeneratorState(); if (!dir->hasDocumentation()) { ol.disableAllBut(OutputType::Html); } dir->writeDocumentation(ol); ol.popGeneratorState(); } //if (Config_getBool(DIRECTORY_GRAPH)) { for (const auto &dr : Doxygen::dirRelations) { dr->writeDocumentation(ol); } } } bool compareDirDefs(const DirDef *item1, const DirDef *item2) { return qstricmp_sort(item1->shortName(),item2->shortName()) < 0; } // --- Cast functions DirDef *toDirDef(Definition *d) { if (d==nullptr) return nullptr; if (d && typeid(*d)==typeid(DirDefImpl)) { return static_cast<DirDef*>(d); } else { return nullptr; } } const DirDef *toDirDef(const Definition *d) { if (d==nullptr) return nullptr; if (d && typeid(*d)==typeid(DirDefImpl)) { return static_cast<const DirDef*>(d); } else { return nullptr; } }
34,770
C++
.cpp
1,097
26.036463
121
0.629074
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,459
eclipsehelp.cpp
doxygen_doxygen/src/eclipsehelp.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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 "eclipsehelp.h" #include "util.h" #include "config.h" #include "message.h" #include "doxygen.h" #include "portable.h" struct EclipseHelp::Private { int depth = 0; bool endtag = false; int openTags = 0; std::ofstream tocstream; QCString pathprefix; /* -- formatting helpers */ void indent() { for (int i=0; i<depth; i++) { tocstream << " "; } } void closedTag() { if (endtag) { tocstream << "/>\n"; endtag = FALSE; } } void openedTag() { if (endtag) { tocstream << ">\n"; endtag = FALSE; ++openTags; } } }; EclipseHelp::EclipseHelp() : p(std::make_unique<Private>()) {} EclipseHelp::~EclipseHelp() = default; /*! * \brief Initialize the Eclipse generator * * This method opens the XML TOC file and writes headers of the files. * \sa finalize() */ void EclipseHelp::initialize() { // -- open the contents file QCString name = Config_getString(HTML_OUTPUT) + "/toc.xml"; p->tocstream = Portable::openOutputStream(name); if (!p->tocstream.is_open()) { term("Could not open file %s for writing\n", qPrint(name)); } // -- write the opening tag QCString title = Config_getString(PROJECT_NAME); if (title.isEmpty()) { title = "Doxygen generated documentation"; } p->tocstream << "<toc label=\"" << convertToXML(title) << "\" topic=\"" << convertToXML(p->pathprefix) << "index" << Doxygen::htmlFileExtension << "\">\n"; ++ p->depth; } /*! * \brief Finish generation of the Eclipse specific help files * * This method writes footers of the files and closes them. * \sa initialize() */ void EclipseHelp::finalize() { p->closedTag(); // -- close previous tag // -- write ending tag --p->depth; p->tocstream << "</toc>\n"; // -- close the content file p->tocstream.close(); QCString name = Config_getString(HTML_OUTPUT) + "/plugin.xml"; std::ofstream t = Portable::openOutputStream(name); if (t.is_open()) { QCString docId = Config_getString(ECLIPSE_DOC_ID); t << "<plugin name=\"" << docId << "\" id=\"" << docId << "\"\n"; t << " version=\"1.0.0\" provider-name=\"Doxygen\">\n"; t << " <extension point=\"org.eclipse.help.toc\">\n"; t << " <toc file=\"toc.xml\" primary=\"true\" />\n"; t << " </extension>\n"; t << "</plugin>\n"; } } /*! * \brief Increase the level of content hierarchy */ void EclipseHelp::incContentsDepth() { p->openedTag(); ++p->depth; } /*! * \brief Decrease the level of content hierarchy * * It closes currently opened topic tag. */ void EclipseHelp::decContentsDepth() { // -- end of the opened topic p->closedTag(); --p->depth; if (p->openTags==p->depth) { --p->openTags; p->indent(); p->tocstream << "</topic>\n"; } } /*! * \brief Add an item to the content * * @param isDir Flag whether the argument \a file is a directory or a file entry * @param name Name of the item * @param ref URL of the item * @param file Name of a file which the item is defined in (without extension) * @param anchor Name of an anchor of the item. * @param separateIndex not used. * @param addToNavIndex not used. * @param def not used. */ void EclipseHelp::addContentsItem( bool /* isDir */, const QCString &name, const QCString & /* ref */, const QCString &file, const QCString &anchor, bool /* separateIndex */, bool /* addToNavIndex */, const Definition * /*def*/) { // -- write the topic tag p->closedTag(); if (!file.isEmpty()) { QCString fn = file; addHtmlExtensionIfMissing(fn); switch (file[0]) // check for special markers (user defined URLs) { case '^': // URL not supported by eclipse toc.xml break; case '!': p->indent(); p->tocstream << "<topic label=\"" << convertToXML(name) << "\""; p->tocstream << " href=\"" << convertToXML(p->pathprefix) << &file[1] << "\""; p->endtag = TRUE; break; default: p->indent(); p->tocstream << "<topic label=\"" << convertToXML(name) << "\""; p->tocstream << " href=\"" << convertToXML(p->pathprefix) << fn; if (!anchor.isEmpty()) { p->tocstream << "#" << anchor; } p->tocstream << "\""; p->endtag = TRUE; break; } } else { p->indent(); p->tocstream << "<topic label=\"" << convertToXML(name) << "\""; p->endtag = TRUE; } } void EclipseHelp::addIndexItem( const Definition * /* context */, const MemberDef * /* md */, const QCString & /* sectionAnchor */, const QCString & /* title */) { } void EclipseHelp::addIndexFile(const QCString & /* name */) { } void EclipseHelp::addImageFile(const QCString & /* name */) { } void EclipseHelp::addStyleSheetFile(const QCString & /* name */) { }
5,529
C++
.cpp
208
23.009615
86
0.61521
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,460
markdown.cpp
doxygen_doxygen/src/markdown.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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. * */ /* Note: part of the code below is inspired by libupskirt written by * Natacha Porté. Original copyright message follows: * * Copyright (c) 2008, Natacha Porté * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <stdio.h> #include <unordered_map> #include <functional> #include <atomic> #include <array> #include <string_view> #include "markdown.h" #include "debug.h" #include "util.h" #include "doxygen.h" #include "commentscan.h" #include "entry.h" #include "config.h" #include "message.h" #include "portable.h" #include "regex.h" #include "fileinfo.h" #include "trace.h" #include "anchor.h" #include "stringutil.h" #if !ENABLE_MARKDOWN_TRACING #undef AUTO_TRACE #undef AUTO_TRACE_ADD #undef AUTO_TRACE_EXIT #define AUTO_TRACE(...) (void)0 #define AUTO_TRACE_ADD(...) (void)0 #define AUTO_TRACE_EXIT(...) (void)0 #endif enum class ExplicitPageResult { explicitPage, /**< docs start with a page command */ explicitMainPage, /**< docs start with a mainpage command */ explicitDirPage, /**< docs start with a dir command */ notExplicit /**< docs doesn't start with either page or mainpage */ }; //----------- // is character c part of an identifier? #define isIdChar(c) \ ((c>='a' && c<='z') || \ (c>='A' && c<='Z') || \ (c>='0' && c<='9') || \ (static_cast<unsigned char>(c)>=0x80)) // unicode characters // is character allowed right at the beginning of an emphasis section #define extraChar(c) \ (c=='-' || c=='+' || c=='!' || \ c=='?' || c=='$' || c=='@' || \ c=='&' || c=='*' || c=='%' || \ c=='[' || c=='(' || c=='.' || \ c=='>' || c==':' || c==',' || \ c==';' || c=='\'' || c=='"' || c=='`') // is character at position i in data allowed before an emphasis section #define isOpenEmphChar(c) \ (c=='\n' || c==' ' || c=='\'' || c=='<' || \ c=='>' || c=='{' || c=='(' || c=='[' || \ c==',' || c==':' || c==';') // is character at position i in data an escape that prevents ending an emphasis section // so for example *bla (*.txt) is cool* #define ignoreCloseEmphChar(c,cn) \ (c=='(' || c=='{' || c=='[' || (c=='<' && cn!='/') || \ c=='\\' || \ c=='@') //---------- struct TableCell { TableCell() : colSpan(false) {} QCString cellText; bool colSpan; }; struct Markdown::Private { Private(const QCString &fn,int line,int indent) : fileName(fn), lineNr(line), indentLevel(indent) { // setup callback table for special characters actions[static_cast<unsigned int>('_')] = [this](std::string_view data,size_t offset) { return processEmphasis (data,offset); }; actions[static_cast<unsigned int>('*')] = [this](std::string_view data,size_t offset) { return processEmphasis (data,offset); }; actions[static_cast<unsigned int>('~')] = [this](std::string_view data,size_t offset) { return processEmphasis (data,offset); }; actions[static_cast<unsigned int>('`')] = [this](std::string_view data,size_t offset) { return processCodeSpan (data,offset); }; actions[static_cast<unsigned int>('\\')]= [this](std::string_view data,size_t offset) { return processSpecialCommand(data,offset); }; actions[static_cast<unsigned int>('@')] = [this](std::string_view data,size_t offset) { return processSpecialCommand(data,offset); }; actions[static_cast<unsigned int>('[')] = [this](std::string_view data,size_t offset) { return processLink (data,offset); }; actions[static_cast<unsigned int>('!')] = [this](std::string_view data,size_t offset) { return processLink (data,offset); }; actions[static_cast<unsigned int>('<')] = [this](std::string_view data,size_t offset) { return processHtmlTag (data,offset); }; actions[static_cast<unsigned int>('-')] = [this](std::string_view data,size_t offset) { return processNmdash (data,offset); }; actions[static_cast<unsigned int>('"')] = [this](std::string_view data,size_t offset) { return processQuoted (data,offset); }; } QCString processQuotations(std::string_view data,size_t refIndent); QCString processBlocks(std::string_view data,size_t indent); QCString isBlockCommand(std::string_view data,size_t offset); size_t isSpecialCommand(std::string_view data,size_t offset); size_t findEndOfLine(std::string_view data,size_t offset); int processHtmlTagWrite(std::string_view data,size_t offset,bool doWrite); int processHtmlTag(std::string_view data,size_t offset); int processEmphasis(std::string_view data,size_t offset); int processEmphasis1(std::string_view data,char c); int processEmphasis2(std::string_view data,char c); int processEmphasis3(std::string_view data,char c); int processNmdash(std::string_view data,size_t offset); int processQuoted(std::string_view data,size_t offset); int processCodeSpan(std::string_view data,size_t offset); int processSpecialCommand(std::string_view data,size_t offset); int processLink(std::string_view data,size_t offset); size_t findEmphasisChar(std::string_view, char c, size_t c_size); void addStrEscapeUtf8Nbsp(std::string_view data); void processInline(std::string_view data); void writeMarkdownImage(std::string_view fmt, bool inline_img, bool explicitTitle, const QCString &title, const QCString &content, const QCString &link, const QCString &attributes, const FileDef *fd); int isHeaderline(std::string_view data, bool allowAdjustLevel); int isAtxHeader(std::string_view data, QCString &header,QCString &id,bool allowAdjustLevel, bool *pIsIdGenerated=nullptr); void writeOneLineHeaderOrRuler(std::string_view data); void writeFencedCodeBlock(std::string_view data, std::string_view lang, size_t blockStart,size_t blockEnd); size_t writeBlockQuote(std::string_view data); size_t writeCodeBlock(std::string_view,size_t refIndent); size_t writeTableBlock(std::string_view data); QCString extractTitleId(QCString &title, int level,bool *pIsIdGenerated=nullptr); struct LinkRef { LinkRef(const QCString &l,const QCString &t) : link(l), title(t) {} QCString link; QCString title; }; using Action_t = std::function<int(std::string_view,size_t)>; std::unordered_map<std::string,LinkRef> linkRefs; QCString fileName; int lineNr = 0; int indentLevel=0; // 0 is outside markdown, -1=page level QCString out; std::array<Action_t,256> actions; }; Markdown::Markdown(const QCString &fileName,int lineNr,int indentLevel) : prv(std::make_unique<Private>(fileName,lineNr,indentLevel)) { using namespace std::placeholders; (void)lineNr; // not used yet } Markdown::~Markdown() = default; void Markdown::setIndentLevel(int level) { prv->indentLevel = level; } enum Alignment { AlignNone, AlignLeft, AlignCenter, AlignRight }; //---------- constants ------- // const char *g_utf8_nbsp = "\xc2\xa0"; // UTF-8 nbsp const char *g_doxy_nbsp = "&_doxy_nbsp;"; // doxygen escape command for UTF-8 nbsp const size_t codeBlockIndent = 4; //---------- helpers ------- // test if the next characters in data represent a new line (which can be character \n or string \ilinebr). // returns 0 if no newline is found, or the number of characters that make up the newline if found. inline size_t isNewline(std::string_view data) { // normal newline if (data[0] == '\n') return 1; // artificial new line from ^^ in ALIASES if (data[0] == '\\' && qstrncmp(data.data()+1,"ilinebr ",7)==0) return data[8]==' ' ? 9 : 8; return 0; } // escape double quotes in string static QCString escapeDoubleQuotes(const QCString &s) { AUTO_TRACE("s={}",Trace::trunc(s)); if (s.isEmpty()) return s; QCString result; const char *p=s.data(); char c=0, pc='\0'; while ((c=*p++)) { if (c=='"' && pc!='\\') result+='\\'; result+=c; pc=c; } AUTO_TRACE_EXIT("result={}",result); return result; } // escape characters that have a special meaning later on. static QCString escapeSpecialChars(const QCString &s) { AUTO_TRACE("s={}",Trace::trunc(s)); if (s.isEmpty()) return s; bool insideQuote=FALSE; QCString result; const char *p=s.data(); char c=0, pc='\0'; while ((c=*p++)) { switch (c) { case '"': if (pc!='\\') { insideQuote=!insideQuote; } result+=c; break; case '<': // fall through case '>': if (!insideQuote) { result+='\\'; result+=c; if ((p[0]==':') && (p[1]==':')) { result+='\\'; result+=':'; p++; } } else { result+=c; } break; case '\\': if (!insideQuote) { result+='\\'; } result+='\\'; break; case '@': if (!insideQuote) { result+='\\'; } result+='@'; break; // commented out next line due to regression when using % to suppress a link //case '%': if (!insideQuote) { result+='\\'; } result+='%'; break; case '#': if (!insideQuote) { result+='\\'; } result+='#'; break; case '$': if (!insideQuote) { result+='\\'; } result+='$'; break; case '&': if (!insideQuote) { result+='\\'; } result+='&'; break; default: result+=c; break; } pc=c; } AUTO_TRACE_EXIT("result={}",result); return result; } /** helper function to convert presence of left and/or right alignment markers * to a alignment value */ static Alignment markersToAlignment(bool leftMarker,bool rightMarker) { if (leftMarker && rightMarker) { return AlignCenter; } else if (leftMarker) { return AlignLeft; } else if (rightMarker) { return AlignRight; } else { return AlignNone; } } /** parse the image attributes and return attributes for given format */ static QCString getFilteredImageAttributes(std::string_view fmt, const QCString &attrs) { AUTO_TRACE("fmt={} attrs={}",fmt,attrs); StringVector attrList = split(attrs.str(),","); for (const auto &attr_ : attrList) { QCString attr = QCString(attr_).stripWhiteSpace(); int i = attr.find(':'); if (i>0) // has format { QCString format = attr.left(i).stripWhiteSpace().lower(); if (format == fmt) // matching format { AUTO_TRACE_EXIT("result={}",attr.mid(i+1)); return attr.mid(i+1); // keep part after : } } else // option that applies to all formats { AUTO_TRACE_EXIT("result={}",attr); return attr; } } return QCString(); } // Check if data contains a block command. If so returned the command // that ends the block. If not an empty string is returned. // Note When offset>0 character position -1 will be inspected. // // Checks for and skip the following block commands: // {@code .. { .. } .. } // \dot .. \enddot // \code .. \endcode // \msc .. \endmsc // \f$..\f$ // \f(..\f) // \f[..\f] // \f{..\f} // \verbatim..\endverbatim // \iliteral..\endiliteral // \latexonly..\endlatexonly // \htmlonly..\endhtmlonly // \xmlonly..\endxmlonly // \rtfonly..\endrtfonly // \manonly..\endmanonly // \startuml..\enduml QCString Markdown::Private::isBlockCommand(std::string_view data,size_t offset) { AUTO_TRACE("data='{}' offset={}",Trace::trunc(data),offset); using EndBlockFunc = QCString (*)(const std::string &,bool,char); static const auto getEndBlock = [](const std::string &blockName,bool,char) -> QCString { return "end"+blockName; }; static const auto getEndCode = [](const std::string &blockName,bool openBracket,char) -> QCString { return openBracket ? QCString("}") : "end"+blockName; }; static const auto getEndUml = [](const std::string &/* blockName */,bool,char) -> QCString { return "enduml"; }; static const auto getEndFormula = [](const std::string &/* blockName */,bool,char nextChar) -> QCString { switch (nextChar) { case '$': return "f$"; case '(': return "f)"; case '[': return "f]"; case '{': return "f}"; } return ""; }; // table mapping a block start command to a function that can return the matching end block string static const std::unordered_map<std::string,EndBlockFunc> blockNames = { { "dot", getEndBlock }, { "code", getEndCode }, { "icode", getEndBlock }, { "msc", getEndBlock }, { "verbatim", getEndBlock }, { "iverbatim", getEndBlock }, { "iliteral", getEndBlock }, { "latexonly", getEndBlock }, { "htmlonly", getEndBlock }, { "xmlonly", getEndBlock }, { "rtfonly", getEndBlock }, { "manonly", getEndBlock }, { "docbookonly", getEndBlock }, { "startuml", getEndUml }, { "f", getEndFormula } }; const size_t size = data.size(); bool openBracket = offset>0 && data.data()[-1]=='{'; bool isEscaped = offset>0 && (data.data()[-1]=='\\' || data.data()[-1]=='@'); if (isEscaped) return QCString(); size_t end=1; while (end<size && (data[end]>='a' && data[end]<='z')) end++; if (end==1) return QCString(); std::string blockName(data.substr(1,end-1)); auto it = blockNames.find(blockName); QCString result; if (it!=blockNames.end()) // there is a function assigned { result = it->second(blockName, openBracket, end<size ? data[end] : 0); } AUTO_TRACE_EXIT("result={}",result); return result; } size_t Markdown::Private::isSpecialCommand(std::string_view data,size_t offset) { AUTO_TRACE("data='{}' offset={}",Trace::trunc(data),offset); using EndCmdFunc = size_t (*)(std::string_view,size_t); static const auto endOfLine = [](std::string_view data_,size_t offset_) -> size_t { // skip until the end of line (allowing line continuation characters) char lc = 0; char c = 0; while (offset_<data_.size() && ((c=data_[offset_])!='\n' || lc=='\\')) { if (c=='\\') lc='\\'; // last character was a line continuation else if (c!=' ') lc=0; // rest line continuation offset_++; } return offset_; }; static const auto endOfLabel = [](std::string_view data_,size_t offset_) -> size_t { if (offset_<data_.size() && data_[offset_]==' ') // we expect a space before the label { char c = 0; offset_++; // skip over spaces while (offset_<data_.size() && data_[offset_]==' ') offset_++; // skip over label while (offset_<data_.size() && (c=data_[offset_])!=' ' && c!='\\' && c!='@' && c!='\n') offset_++; return offset_; } return 0; }; static const auto endOfLabelOpt = [](std::string_view data_,size_t offset_) -> size_t { size_t index=offset_; if (index<data_.size() && data_[index]==' ') // skip over optional spaces { index++; while (index<data_.size() && data_[index]==' ') index++; } if (index<data_.size() && data_[index]=='{') // find matching '}' { index++; char c = 0; while (index<data_.size() && (c=data_[index])!='}' && c!='\\' && c!='@' && c!='\n') index++; if (index==data_.size() || data_[index]!='}') return 0; // invalid option offset_=index+1; // part after {...} is the option } return endOfLabel(data_,offset_); }; static const auto endOfParam = [](std::string_view data_,size_t offset_) -> size_t { size_t index=offset_; if (index<data_.size() && data_[index]==' ') // skip over optional spaces { index++; while (index<data_.size() && data_[index]==' ') index++; } if (index<data_.size() && data_[index]=='[') // find matching ']' { index++; char c = 0; while (index<data_.size() && (c=data_[index])!=']' && c!='\n') index++; if (index==data_.size() || data_[index]!=']') return 0; // invalid parameter offset_=index+1; // part after [...] is the parameter name } return endOfLabel(data_,offset_); }; static const auto endOfFuncLike = [](std::string_view data_,size_t offset_,bool allowSpaces) -> size_t { if (offset_<data_.size() && data_[offset_]==' ') // we expect a space before the name { char c=0; offset_++; // skip over spaces while (offset_<data_.size() && data_[offset_]==' ') { offset_++; } // skip over name (and optionally type) while (offset_<data_.size() && (c=data_[offset_])!='\n' && (allowSpaces || c!=' ') && c!='(') { offset_++; } if (c=='(') // find the end of the function { int count=1; offset_++; while (offset_<data_.size() && (c=data_[offset_++])) { if (c=='(') count++; else if (c==')') count--; if (count==0) return offset_; } } return offset_; } return 0; }; static const auto endOfFunc = [](std::string_view data_,size_t offset_) -> size_t { return endOfFuncLike(data_,offset_,true); }; static const auto endOfGuard = [](std::string_view data_,size_t offset_) -> size_t { return endOfFuncLike(data_,offset_,false); }; static const std::unordered_map<std::string,EndCmdFunc> cmdNames = { { "a", endOfLabel }, { "addindex", endOfLine }, { "addtogroup", endOfLabel }, { "anchor", endOfLabel }, { "b", endOfLabel }, { "c", endOfLabel }, { "category", endOfLine }, { "cite", endOfLabel }, { "class", endOfLine }, { "concept", endOfLine }, { "copybrief", endOfFunc }, { "copydetails", endOfFunc }, { "copydoc", endOfFunc }, { "def", endOfFunc }, { "defgroup", endOfLabel }, { "diafile", endOfLine }, { "dir", endOfLine }, { "dockbookinclude",endOfLine }, { "dontinclude", endOfLine }, { "dotfile", endOfLine }, { "e", endOfLabel }, { "elseif", endOfGuard }, { "em", endOfLabel }, { "emoji", endOfLabel }, { "enum", endOfLabel }, { "example", endOfLine }, { "exception", endOfLine }, { "extends", endOfLabel }, { "file", endOfLine }, { "fn", endOfFunc }, { "headerfile", endOfLine }, { "htmlinclude", endOfLine }, { "ianchor", endOfLabelOpt }, { "idlexcept", endOfLine }, { "if", endOfGuard }, { "ifnot", endOfGuard }, { "image", endOfLine }, { "implements", endOfLine }, { "include", endOfLine }, { "includedoc", endOfLine }, { "includelineno", endOfLine }, { "ingroup", endOfLabel }, { "interface", endOfLine }, { "latexinclude", endOfLine }, { "maninclude", endOfLine }, { "memberof", endOfLabel }, { "mscfile", endOfLine }, { "namespace", endOfLabel }, { "noop", endOfLine }, { "overload", endOfLine }, { "p", endOfLabel }, { "package", endOfLabel }, { "page", endOfLabel }, { "paragraph", endOfLabel }, { "param", endOfParam }, { "property", endOfLine }, { "protocol", endOfLine }, { "qualifier", endOfLine }, { "ref", endOfLabel }, { "refitem", endOfLine }, { "related", endOfLabel }, { "relatedalso", endOfLabel }, { "relates", endOfLabel }, { "relatesalso", endOfLabel }, { "retval", endOfLabel }, { "rtfinclude", endOfLine }, { "section", endOfLabel }, { "skip", endOfLine }, { "skipline", endOfLine }, { "snippet", endOfLine }, { "snippetdoc", endOfLine }, { "snippetlineno", endOfLine }, { "struct", endOfLine }, { "subpage", endOfLabel }, { "subparagraph", endOfLabel }, { "subsubparagraph",endOfLabel }, { "subsection", endOfLabel }, { "subsubsection", endOfLabel }, { "throw", endOfLabel }, { "throws", endOfLabel }, { "tparam", endOfLabel }, { "typedef", endOfLine }, { "plantumlfile", endOfLine }, { "union", endOfLine }, { "until", endOfLine }, { "var", endOfLine }, { "verbinclude", endOfLine }, { "weakgroup", endOfLabel }, { "xmlinclude", endOfLine }, { "xrefitem", endOfLabel } }; bool isEscaped = offset>0 && (data.data()[-1]=='\\' || data.data()[-1]=='@'); if (isEscaped) return 0; const size_t size = data.size(); size_t end=1; while (end<size && (data[end]>='a' && data[end]<='z')) end++; if (end==1) return 0; std::string cmdName(data.substr(1,end-1)); size_t result=0; auto it = cmdNames.find(cmdName); if (it!=cmdNames.end()) // command with parameters that should be ignored by markdown { // find the end of the parameters result = it->second(data,end); } AUTO_TRACE_EXIT("result={}",result); return result; } /** looks for the next emph char, skipping other constructs, and * stopping when either it is found, or we are at the end of a paragraph. */ size_t Markdown::Private::findEmphasisChar(std::string_view data, char c, size_t c_size) { AUTO_TRACE("data='{}' c={} c_size={}",Trace::trunc(data),c,c_size); size_t i = 1; const size_t size = data.size(); while (i<size) { while (i<size && data[i]!=c && data[i]!='\\' && data[i]!='@' && !(data[i]=='/' && data[i-1]=='<') && // html end tag also ends emphasis data[i]!='\n') i++; // avoid overflow (unclosed emph token) if (i==size) { return 0; } //printf("findEmphasisChar: data=[%s] i=%d c=%c\n",data,i,data[i]); // not counting escaped chars or characters that are unlikely // to appear as the end of the emphasis char if (ignoreCloseEmphChar(data[i-1],data[i])) { i++; continue; } else { // get length of emphasis token size_t len = 0; while (i+len<size && data[i+len]==c) { len++; } if (len>0) { if (len!=c_size || (i+len<size && isIdChar(data[i+len]))) // to prevent touching some_underscore_identifier { i+=len; continue; } AUTO_TRACE_EXIT("result={}",i); return static_cast<int>(i); // found it } } // skipping a code span if (data[i]=='`') { int snb=0; while (i<size && data[i]=='`') snb++,i++; // find same pattern to end the span int enb=0; while (i<size && enb<snb) { if (data[i]=='`') enb++; if (snb==1 && data[i]=='\'') break; // ` ended by ' i++; } } else if (data[i]=='@' || data[i]=='\\') { // skip over blocks that should not be processed QCString endBlockName = isBlockCommand(data.substr(i),i); if (!endBlockName.isEmpty()) { i++; size_t l = endBlockName.length(); while (i+l<size) { if ((data[i]=='\\' || data[i]=='@') && // command data[i-1]!='\\' && data[i-1]!='@') // not escaped { if (qstrncmp(&data[i+1],endBlockName.data(),l)==0) { break; } } i++; } } else if (i+1<size && isIdChar(data[i+1])) // @cmd, stop processing, see bug 690385 { return 0; } else { i++; } } else if (data[i-1]=='<' && data[i]=='/') // html end tag invalidates emphasis { return 0; } else if (data[i]=='\n') // end * or _ at paragraph boundary { i++; while (i<size && data[i]==' ') i++; if (i>=size || data[i]=='\n') { return 0; } // empty line -> paragraph } else // should not get here! { i++; } } return 0; } /** process single emphasis */ int Markdown::Private::processEmphasis1(std::string_view data, char c) { AUTO_TRACE("data='{}' c={}",Trace::trunc(data),c); size_t i = 0; const size_t size = data.size(); /* skipping one symbol if coming from emph3 */ if (size>1 && data[0]==c && data[1]==c) { i=1; } while (i<size) { size_t len = findEmphasisChar(data.substr(i), c, 1); if (len==0) { return 0; } i+=len; if (i>=size) { return 0; } if (i+1<size && data[i+1]==c) { i++; continue; } if (data[i]==c && data[i-1]!=' ' && data[i-1]!='\n') { out+="<em>"; processInline(data.substr(0,i)); out+="</em>"; AUTO_TRACE_EXIT("result={}",i+1); return static_cast<int>(i+1); } } return 0; } /** process double emphasis */ int Markdown::Private::processEmphasis2(std::string_view data, char c) { AUTO_TRACE("data='{}' c={}",Trace::trunc(data),c); size_t i = 0; const size_t size = data.size(); while (i<size) { size_t len = findEmphasisChar(data.substr(i), c, 2); if (len==0) { return 0; } i += len; if (i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=' ' && data[i-1]!='\n') { if (c == '~') out+="<strike>"; else out+="<strong>"; processInline(data.substr(0,i)); if (c == '~') out+="</strike>"; else out+="</strong>"; AUTO_TRACE_EXIT("result={}",i+2); return static_cast<int>(i+2); } i++; } return 0; } /** Parsing triple emphasis. * Finds the first closing tag, and delegates to the other emph */ int Markdown::Private::processEmphasis3(std::string_view data,char c) { AUTO_TRACE("data='{}' c={}",Trace::trunc(data),c); size_t i = 0; const size_t size = data.size(); while (i<size) { size_t len = findEmphasisChar(data.substr(i), c, 3); if (len==0) { return 0; } i+=len; /* skip whitespace preceded symbols */ if (data[i]!=c || data[i-1]==' ' || data[i-1]=='\n') { continue; } if (i+2<size && data[i+1]==c && data[i+2]==c) { out+="<em><strong>"; processInline(data.substr(0,i)); out+="</strong></em>"; AUTO_TRACE_EXIT("result={}",i+3); return static_cast<int>(i+3); } else if (i+1<size && data[i+1]==c) { // double symbol found, handing over to emph1 len = processEmphasis1(std::string_view(data.data()-2, size+2), c); if (len==0) { return 0; } else { AUTO_TRACE_EXIT("result={}",len-2); return static_cast<int>(len - 2); } } else { // single symbol found, handing over to emph2 len = processEmphasis2(std::string_view(data.data()-1, size+1), c); if (len==0) { return 0; } else { AUTO_TRACE_EXIT("result={}",len-1); return static_cast<int>(len - 1); } } } return 0; } /** Process ndash and mdashes */ int Markdown::Private::processNmdash(std::string_view data,size_t offset) { AUTO_TRACE("data='{}' offset={}",Trace::trunc(data),offset); const size_t size = data.size(); // precondition: data[0]=='-' size_t i=1; int count=1; if (i<size && data[i]=='-') // found -- { count++,i++; } if (i<size && data[i]=='-') // found --- { count++,i++; } if (i<size && data[i]=='-') // found ---- { count++; } if (count>=2 && offset>=2 && qstrncmp(data.data()-2,"<!",2)==0) { AUTO_TRACE_EXIT("result={}",1-count); return 1-count; } // start HTML comment if (count==2 && size > 2 && data[2]=='>') { return 0; } // end HTML comment if (count==3 && size > 3 && data[3]=='>') { return 0; } // end HTML comment if (count==2 && (offset<8 || qstrncmp(data.data()-8,"operator",8)!=0)) // -- => ndash { out+="&ndash;"; AUTO_TRACE_EXIT("result=2"); return 2; } else if (count==3) // --- => ndash { out+="&mdash;"; AUTO_TRACE_EXIT("result=3"); return 3; } // not an ndash or mdash return 0; } /** Process quoted section "...", can contain one embedded newline */ int Markdown::Private::processQuoted(std::string_view data,size_t) { AUTO_TRACE("data='{}'",Trace::trunc(data)); const size_t size = data.size(); size_t i=1; int nl=0; while (i<size && data[i]!='"' && nl<2) { if (data[i]=='\n') nl++; i++; } if (i<size && data[i]=='"' && nl<2) { out+=data.substr(0,i+1); AUTO_TRACE_EXIT("result={}",i+2); return static_cast<int>(i+1); } // not a quoted section return 0; } /** Process a HTML tag. Note that <pre>..</pre> are treated specially, in * the sense that all code inside is written unprocessed */ int Markdown::Private::processHtmlTagWrite(std::string_view data,size_t offset,bool doWrite) { AUTO_TRACE("data='{}' offset={} doWrite={}",Trace::trunc(data),offset,doWrite); if (offset>0 && data.data()[-1]=='\\') { return 0; } // escaped < const size_t size = data.size(); // find the end of the html tag size_t i=1; size_t l=0; // compute length of the tag name while (i<size && isIdChar(data[i])) i++,l++; QCString tagName(data.substr(1,i-1)); if (tagName.lower()=="pre") // found <pre> tag { bool insideStr=FALSE; while (i+6<size) { char c=data[i]; if (!insideStr && c=='<') // potential start of html tag { if (data[i+1]=='/' && tolower(data[i+2])=='p' && tolower(data[i+3])=='r' && tolower(data[i+4])=='e' && tolower(data[i+5])=='>') { // found </pre> tag, copy from start to end of tag if (doWrite) out+=data.substr(0,i+6); //printf("found <pre>..</pre> [%d..%d]\n",0,i+6); AUTO_TRACE_EXIT("result={}",i+6); return static_cast<int>(i+6); } } else if (insideStr && c=='"') { if (data[i-1]!='\\') insideStr=FALSE; } else if (c=='"') { insideStr=TRUE; } i++; } } else // some other html tag { if (l>0 && i<size) { if (data[i]=='/' && i<size-1 && data[i+1]=='>') // <bla/> { //printf("Found htmlTag={%s}\n",qPrint(QCString(data).left(i+2))); if (doWrite) out+=data.substr(0,i+2); AUTO_TRACE_EXIT("result={}",i+2); return static_cast<int>(i+2); } else if (data[i]=='>') // <bla> { //printf("Found htmlTag={%s}\n",qPrint(QCString(data).left(i+1))); if (doWrite) out+=data.substr(0,i+1); AUTO_TRACE_EXIT("result={}",i+1); return static_cast<int>(i+1); } else if (data[i]==' ') // <bla attr=... { i++; bool insideAttr=FALSE; while (i<size) { if (!insideAttr && data[i]=='"') { insideAttr=TRUE; } else if (data[i]=='"' && data[i-1]!='\\') { insideAttr=FALSE; } else if (!insideAttr && data[i]=='>') // found end of tag { //printf("Found htmlTag={%s}\n",qPrint(QCString(data).left(i+1))); if (doWrite) out+=data.substr(0,i+1); AUTO_TRACE_EXIT("result={}",i+1); return static_cast<int>(i+1); } i++; } } } } AUTO_TRACE_EXIT("not a valid html tag"); return 0; } int Markdown::Private::processHtmlTag(std::string_view data,size_t offset) { AUTO_TRACE("data='{}' offset={}",Trace::trunc(data),offset); return processHtmlTagWrite(data,offset,true); } int Markdown::Private::processEmphasis(std::string_view data,size_t offset) { AUTO_TRACE("data='{}' offset={}",Trace::trunc(data),offset); const size_t size = data.size(); if ((offset>0 && !isOpenEmphChar(data.data()[-1])) || // invalid char before * or _ (size>1 && data[0]!=data[1] && !(isIdChar(data[1]) || extraChar(data[1]))) || // invalid char after * or _ (size>2 && data[0]==data[1] && !(isIdChar(data[2]) || extraChar(data[2])))) // invalid char after ** or __ { AUTO_TRACE_EXIT("invalid surrounding characters"); return 0; } char c = data[0]; int ret = 0; if (size>2 && c!='~' && data[1]!=c) // _bla or *bla { // whitespace cannot follow an opening emphasis if (data[1]==' ' || data[1]=='\n' || (ret = processEmphasis1(data.substr(1), c)) == 0) { return 0; } AUTO_TRACE_EXIT("result={}",ret+1); return ret+1; } if (size>3 && data[1]==c && data[2]!=c) // __bla or **bla { if (data[2]==' ' || data[2]=='\n' || (ret = processEmphasis2(data.substr(2), c)) == 0) { return 0; } AUTO_TRACE_EXIT("result={}",ret+2); return ret+2; } if (size>4 && c!='~' && data[1]==c && data[2]==c && data[3]!=c) // ___bla or ***bla { if (data[3]==' ' || data[3]=='\n' || (ret = processEmphasis3(data.substr(3), c)) == 0) { return 0; } AUTO_TRACE_EXIT("result={}",ret+3); return ret+3; } return 0; } void Markdown::Private::writeMarkdownImage( std::string_view fmt, bool inline_img, bool explicitTitle, const QCString &title, const QCString &content, const QCString &link, const QCString &attrs, const FileDef *fd) { AUTO_TRACE("fmt={} inline_img={} explicitTitle={} title={} content={} link={} attrs={}", fmt,inline_img,explicitTitle,Trace::trunc(title),Trace::trunc(content),link,attrs); QCString attributes = getFilteredImageAttributes(fmt, attrs); out+="@image"; if (inline_img) { out+="{inline}"; } out+=" "; out+=fmt; out+=" "; out+=link.mid(fd ? 0 : 5); if (!explicitTitle && !content.isEmpty()) { out+=" \""; out+=escapeDoubleQuotes(content); out+="\""; } else if ((content.isEmpty() || explicitTitle) && !title.isEmpty()) { out+=" \""; out+=escapeDoubleQuotes(title); out+="\""; } else { out+=" ";// so the line break will not be part of the image name } if (!attributes.isEmpty()) { out+=" "; out+=attributes; out+=" "; } out+="\\ilinebr "; } int Markdown::Private::processLink(const std::string_view data,size_t offset) { AUTO_TRACE("data='{}' offset={}",Trace::trunc(data),offset); const size_t size = data.size(); QCString content; QCString link; QCString title; bool isImageLink = FALSE; bool isImageInline = FALSE; bool isToc = FALSE; size_t i=1; if (data[0]=='!') { isImageLink = TRUE; if (size<2 || data[1]!='[') { return 0; } // if there is non-whitespace before the ![ within the scope of two new lines, the image // is considered inlined, i.e. the image is not preceded by an empty line int numNLsNeeded=2; int pos = -1; while (pos>=-static_cast<int>(offset) && numNLsNeeded>0) { if (data.data()[pos]=='\n') numNLsNeeded--; else if (data.data()[pos]!=' ') // found non-whitespace, stop searching { isImageInline=true; break; } pos--; } // skip '![' i++; } size_t contentStart=i; int level=1; int nlTotal=0; int nl=0; // find the matching ] while (i<size) { if (data[i-1]=='\\') // skip escaped characters { } else if (data[i]=='[') { level++; } else if (data[i]==']') { level--; if (level<=0) break; } else if (data[i]=='\n') { nl++; if (nl>1) { return 0; } // only allow one newline in the content } i++; } nlTotal += nl; nl = 0; if (i>=size) return 0; // premature end of comment -> no link size_t contentEnd=i; content = data.substr(contentStart,contentEnd-contentStart); //printf("processLink: content={%s}\n",qPrint(content)); if (!isImageLink && content.isEmpty()) { return 0; } // no link text i++; // skip over ] bool whiteSpace = false; // skip whitespace while (i<size && data[i]==' ') { whiteSpace = true; i++; } if (i<size && data[i]=='\n') // one newline allowed here { whiteSpace = true; i++; // skip more whitespace while (i<size && data[i]==' ') i++; } if (whiteSpace && i<size && (data[i]=='(' || data[i]=='[')) return 0; bool explicitTitle=FALSE; if (i<size && data[i]=='(') // inline link { i++; while (i<size && data[i]==' ') i++; bool uriFormat=false; if (i<size && data[i]=='<') { i++; uriFormat=true; } size_t linkStart=i; int braceCount=1; while (i<size && data[i]!='\'' && data[i]!='"' && braceCount>0) { if (data[i]=='\n') // unexpected EOL { nl++; if (nl>1) { return 0; } } else if (data[i]=='(') { braceCount++; } else if (data[i]==')') { braceCount--; } if (braceCount>0) { i++; } } nlTotal += nl; nl = 0; if (i>=size || data[i]=='\n') { return 0; } link = data.substr(linkStart,i-linkStart); link = link.stripWhiteSpace(); //printf("processLink: link={%s}\n",qPrint(link)); if (link.isEmpty()) { return 0; } if (uriFormat && link.at(link.length()-1)=='>') link=link.left(link.length()-1); // optional title if (data[i]=='\'' || data[i]=='"') { char c = data[i]; i++; size_t titleStart=i; nl=0; while (i<size) { if (data[i]=='\n') { if (nl>1) { return 0; } nl++; } else if (data[i]=='\\') // escaped char in string { i++; } else if (data[i]==c) { i++; break; } i++; } if (i>=size) { return 0; } size_t titleEnd = i-1; // search back for closing marker while (titleEnd>titleStart && data[titleEnd]==' ') titleEnd--; if (data[titleEnd]==c) // found it { title = data.substr(titleStart,titleEnd-titleStart); explicitTitle=TRUE; while (i<size) { if (data[i]==' ')i++; // remove space after the closing quote and the closing bracket else if (data[i] == ')') break; // the end bracket else // illegal { return 0; } } } else { return 0; } } i++; } else if (i<size && data[i]=='[') // reference link { i++; size_t linkStart=i; nl=0; // find matching ] while (i<size && data[i]!=']') { if (data[i]=='\n') { nl++; if (nl>1) { return 0; } } i++; } if (i>=size) { return 0; } // extract link link = data.substr(linkStart,i-linkStart); //printf("processLink: link={%s}\n",qPrint(link)); link = link.stripWhiteSpace(); if (link.isEmpty()) // shortcut link { link=content; } // lookup reference QCString link_lower = link.lower(); auto lr_it=linkRefs.find(link_lower.str()); if (lr_it!=linkRefs.end()) // found it { link = lr_it->second.link; title = lr_it->second.title; //printf("processLink: ref: link={%s} title={%s}\n",qPrint(link),qPrint(title)); } else // reference not found! { //printf("processLink: ref {%s} do not exist\n",link.qPrint(lower())); return 0; } i++; } else if (i<size && data[i]!=':' && !content.isEmpty()) // minimal link ref notation [some id] { QCString content_lower = content.lower(); auto lr_it = linkRefs.find(content_lower.str()); //printf("processLink: minimal link {%s} lr=%p",qPrint(content),lr); if (lr_it!=linkRefs.end()) // found it { link = lr_it->second.link; title = lr_it->second.title; explicitTitle=TRUE; i=contentEnd; } else if (content=="TOC") { isToc=TRUE; i=contentEnd; } else { return 0; } i++; } else { return 0; } nlTotal += nl; // search for optional image attributes QCString attributes; if (isImageLink) { size_t j = i; // skip over whitespace while (j<size && data[j]==' ') { j++; } if (j<size && data[j]=='{') // we have attributes { i = j; // skip over '{' i++; size_t attributesStart=i; nl=0; // find the matching '}' while (i<size) { if (data[i-1]=='\\') // skip escaped characters { } else if (data[i]=='{') { level++; } else if (data[i]=='}') { level--; if (level<=0) break; } else if (data[i]=='\n') { nl++; if (nl>1) { return 0; } // only allow one newline in the content } i++; } nlTotal += nl; if (i>=size) return 0; // premature end of comment -> no attributes size_t attributesEnd=i; attributes = data.substr(attributesStart,attributesEnd-attributesStart); i++; // skip over '}' } if (!isImageInline) { // if there is non-whitespace after the image within the scope of two new lines, the image // is considered inlined, i.e. the image is not followed by an empty line int numNLsNeeded=2; size_t pos = i; while (pos<size && numNLsNeeded>0) { if (data[pos]=='\n') numNLsNeeded--; else if (data[pos]!=' ') // found non-whitespace, stop searching { isImageInline=true; break; } pos++; } } } if (isToc) // special case for [TOC] { int toc_level = Config_getInt(TOC_INCLUDE_HEADINGS); if (toc_level>=SectionType::MinLevel && toc_level<=SectionType::MaxLevel) { out+="@tableofcontents{html:"; out+=QCString().setNum(toc_level); out+="}"; } } else if (isImageLink) { bool ambig = false; FileDef *fd=nullptr; if (link.find("@ref ")!=-1 || link.find("\\ref ")!=-1 || (fd=findFileDef(Doxygen::imageNameLinkedMap,link,ambig))) // assume doxygen symbol link or local image link { // check if different handling is needed per format writeMarkdownImage("html", isImageInline, explicitTitle, title, content, link, attributes, fd); writeMarkdownImage("latex", isImageInline, explicitTitle, title, content, link, attributes, fd); writeMarkdownImage("rtf", isImageInline, explicitTitle, title, content, link, attributes, fd); writeMarkdownImage("docbook", isImageInline, explicitTitle, title, content, link, attributes, fd); writeMarkdownImage("xml", isImageInline, explicitTitle, title, content, link, attributes, fd); } else { out+="<img src=\""; out+=link; out+="\" alt=\""; out+=content; out+="\""; if (!title.isEmpty()) { out+=" title=\""; out+=substitute(title.simplifyWhiteSpace(),"\"","&quot;"); out+="\""; } out+="/>"; } } else { SrcLangExt lang = getLanguageFromFileName(link); int lp=-1; if ((lp=link.find("@ref "))!=-1 || (lp=link.find("\\ref "))!=-1 || (lang==SrcLangExt::Markdown && !isURL(link))) // assume doxygen symbol link { if (lp==-1) // link to markdown page { out+="@ref \""; if (!(Portable::isAbsolutePath(link) || isURL(link))) { FileInfo forg(link.str()); if (forg.exists() && forg.isReadable()) { link = forg.absFilePath(); } else if (!(forg.exists() && forg.isReadable())) { FileInfo fi(fileName.str()); QCString mdFile = fileName.left(fileName.length()-fi.fileName().length()) + link; FileInfo fmd(mdFile.str()); if (fmd.exists() && fmd.isReadable()) { link = fmd.absFilePath().data(); } } } out+=link; out+="\""; } else { out+=link; } out+=" \""; if (explicitTitle && !title.isEmpty()) { out+=substitute(title,"\"","&quot;"); } else { processInline(std::string_view(substitute(content,"\"","&quot;").str())); } out+="\""; } else if ((lp=link.find('#'))!=-1 || link.find('/')!=-1 || link.find('.')!=-1) { // file/url link if (lp==0 || (lp>0 && !isURL(link) && Config_getEnum(MARKDOWN_ID_STYLE)==MARKDOWN_ID_STYLE_t::GITHUB)) { out+="@ref \""; out+=AnchorGenerator::addPrefixIfNeeded(link.mid(lp+1).str()); out+="\" \""; out+=substitute(content.simplifyWhiteSpace(),"\"","&quot;"); out+="\""; } else { out+="<a href=\""; out+=link; out+="\""; for (int ii = 0; ii < nlTotal; ii++) out+="\n"; if (!title.isEmpty()) { out+=" title=\""; out+=substitute(title.simplifyWhiteSpace(),"\"","&quot;"); out+="\""; } out+=" "; out+=externalLinkTarget(); out+=">"; content = content.simplifyWhiteSpace(); processInline(std::string_view(content.str())); out+="</a>"; } } else // avoid link to e.g. F[x](y) { //printf("no link for '%s'\n",qPrint(link)); return 0; } } AUTO_TRACE_EXIT("result={}",i); return static_cast<int>(i); } /** `` ` `` parsing a code span (assuming codespan != 0) */ int Markdown::Private::processCodeSpan(std::string_view data,size_t) { AUTO_TRACE("data='{}'",Trace::trunc(data)); const size_t size = data.size(); /* counting the number of backticks in the delimiter */ size_t nb=0, end=0; while (nb<size && data[nb]=='`') { nb++; } /* finding the next delimiter */ size_t i = 0; char pc = '`'; for (end=nb; end<size && i<nb; end++) { if (data[end]=='`') { i++; } else if (data[end]=='\n') { // consecutive newlines if (pc == '\n') return 0; pc = '\n'; i = 0; } else if (data[end]=='\'' && nb==1 && (end==size-1 || (end<size-1 && !isIdChar(data[end+1])))) { // look for quoted strings like 'some word', but skip strings like `it's cool` out+="&lsquo;"; out+=data.substr(nb,end-nb); out+="&rsquo;"; return static_cast<int>(end+1); } else { if (data[end]!=' ') pc = data[end]; i=0; } } if (i < nb && end >= size) { return 0; // no matching delimiter } // trimming outside whitespaces size_t f_begin = nb; while (f_begin < end && data[f_begin]==' ') { f_begin++; } size_t f_end = end - nb; while (f_end > nb && data[f_end-1]==' ') { f_end--; } //printf("found code span '%s'\n",qPrint(QCString(data+f_begin).left(f_end-f_begin))); /* real code span */ if (f_begin < f_end) { QCString codeFragment = data.substr(f_begin, f_end-f_begin); out+="<tt>"; out+=escapeSpecialChars(codeFragment); out+="</tt>"; } AUTO_TRACE_EXIT("result={}",end); return static_cast<int>(end); } void Markdown::Private::addStrEscapeUtf8Nbsp(std::string_view data) { AUTO_TRACE("{}",Trace::trunc(data)); if (Portable::strnstr(data.data(),g_doxy_nbsp,data.size())==nullptr) // no escape needed -> fast { out+=data; } else // escape needed -> slow { out+=substitute(QCString(data),g_doxy_nbsp,g_utf8_nbsp); } } int Markdown::Private::processSpecialCommand(std::string_view data, size_t offset) { AUTO_TRACE("{}",Trace::trunc(data)); const size_t size = data.size(); size_t i=1; QCString endBlockName = isBlockCommand(data,offset); if (!endBlockName.isEmpty()) { AUTO_TRACE_ADD("endBlockName={}",endBlockName); size_t l = endBlockName.length(); while (i+l<size) { if ((data[i]=='\\' || data[i]=='@') && // command data[i-1]!='\\' && data[i-1]!='@') // not escaped { if (qstrncmp(&data[i+1],endBlockName.data(),l)==0) { //printf("found end at %d\n",i); addStrEscapeUtf8Nbsp(data.substr(0,i+1+l)); AUTO_TRACE_EXIT("result={}",i+1+l); return static_cast<int>(i+1+l); } } i++; } } size_t endPos = isSpecialCommand(data,offset); if (endPos>0) { out+=data.substr(0,endPos); return static_cast<int>(endPos); } if (size>1 && data[0]=='\\') // escaped characters { char c=data[1]; if (c=='[' || c==']' || c=='*' || c=='!' || c=='(' || c==')' || c=='`' || c=='_') { out+=data[1]; AUTO_TRACE_EXIT("2"); return 2; } else if (c=='\\' || c=='@') { out+=data.substr(0,2); AUTO_TRACE_EXIT("2"); return 2; } else if (c=='-' && size>3 && data[2]=='-' && data[3]=='-') // \--- { out+=data.substr(1,3); AUTO_TRACE_EXIT("2"); return 4; } else if (c=='-' && size>2 && data[2]=='-') // \-- { out+=data.substr(1,2); AUTO_TRACE_EXIT("3"); return 3; } } else if (size>1 && data[0]=='@') // escaped characters { char c=data[1]; if (c=='\\' || c=='@') { out+=data.substr(0,2); AUTO_TRACE_EXIT("2"); return 2; } } return 0; } void Markdown::Private::processInline(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); size_t i=0; size_t end=0; Action_t action; const size_t size = data.size(); while (i<size) { // skip over characters that do not trigger a specific action while (end<size && ((action=actions[static_cast<uint8_t>(data[end])])==nullptr)) end++; // and add them to the output out+=data.substr(i,end-i); if (end>=size) break; i=end; // do the action matching a special character at i int iend = action(data.substr(i),i); if (iend<=0) // update end { end=i+1-iend; } else // skip until end { i+=iend; end=i; } } } /** returns whether the line is a setext-style hdr underline */ int Markdown::Private::isHeaderline(std::string_view data, bool allowAdjustLevel) { AUTO_TRACE("data='{}' allowAdjustLevel",Trace::trunc(data),allowAdjustLevel); size_t i=0, c=0; const size_t size = data.size(); while (i<size && data[i]==' ') i++; if (i==size) return 0; // test of level 1 header if (data[i]=='=') { while (i<size && data[i]=='=') i++,c++; while (i<size && data[i]==' ') i++; int level = (c>1 && (i>=size || data[i]=='\n')) ? 1 : 0; if (allowAdjustLevel && level==1 && indentLevel==-1) { // In case a page starts with a header line we use it as title, promoting it to @page. // We set g_indentLevel to -1 to promoting the other sections if they have a deeper // nesting level than the page header, i.e. @section..@subsection becomes @page..@section. // In case a section at the same level is found (@section..@section) however we need // to undo this (and the result will be @page..@section). indentLevel=0; } AUTO_TRACE_EXIT("result={}",indentLevel+level); return indentLevel+level; } // test of level 2 header if (data[i]=='-') { while (i<size && data[i]=='-') i++,c++; while (i<size && data[i]==' ') i++; return (c>1 && (i>=size || data[i]=='\n')) ? indentLevel+2 : 0; } return 0; } /** returns true if this line starts a block quote */ static bool isBlockQuote(std::string_view data,size_t indent) { AUTO_TRACE("data='{}' indent={}",Trace::trunc(data),indent); size_t i = 0; const size_t size = data.size(); while (i<size && data[i]==' ') i++; if (i<indent+codeBlockIndent) // could be a quotation { // count >'s and skip spaces int level=0; while (i<size && (data[i]=='>' || data[i]==' ')) { if (data[i]=='>') level++; i++; } // last characters should be a space or newline, // so a line starting with >= does not match, but only when level equals 1 bool res = (level>0 && i<size && ((data[i-1]==' ') || data[i]=='\n')) || (level > 1); AUTO_TRACE_EXIT("result={}",res); return res; } else // too much indentation -> code block { AUTO_TRACE_EXIT("result=false: too much indentation"); return false; } } /** returns end of the link ref if this is indeed a link reference. */ static size_t isLinkRef(std::string_view data, QCString &refid, QCString &link, QCString &title) { AUTO_TRACE("data='{}'",Trace::trunc(data)); const size_t size = data.size(); // format: start with [some text]: size_t i = 0; while (i<size && data[i]==' ') i++; if (i>=size || data[i]!='[') { return 0; } i++; size_t refIdStart=i; while (i<size && data[i]!='\n' && data[i]!=']') i++; if (i>=size || data[i]!=']') { return 0; } refid = data.substr(refIdStart,i-refIdStart); if (refid.isEmpty()) { return 0; } AUTO_TRACE_ADD("refid found {}",refid); //printf(" isLinkRef: found refid='%s'\n",qPrint(refid)); i++; if (i>=size || data[i]!=':') { return 0; } i++; // format: whitespace* \n? whitespace* (<url> | url) while (i<size && data[i]==' ') i++; if (i<size && data[i]=='\n') { i++; while (i<size && data[i]==' ') i++; } if (i>=size) { return 0; } if (i<size && data[i]=='<') i++; size_t linkStart=i; while (i<size && data[i]!=' ' && data[i]!='\n') i++; size_t linkEnd=i; if (i<size && data[i]=='>') i++; if (linkStart==linkEnd) { return 0; } // empty link link = data.substr(linkStart,linkEnd-linkStart); AUTO_TRACE_ADD("link found {}",Trace::trunc(link)); if (link=="@ref" || link=="\\ref") { size_t argStart=i; while (i<size && data[i]!='\n' && data[i]!='"') i++; link+=data.substr(argStart,i-argStart); } title.clear(); // format: (whitespace* \n? whitespace* ( 'title' | "title" | (title) ))? size_t eol=0; while (i<size && data[i]==' ') i++; if (i<size && data[i]=='\n') { eol=i; i++; while (i<size && data[i]==' ') i++; } if (i>=size) { AUTO_TRACE_EXIT("result={}: end of isLinkRef while looking for title",i); return i; // end of buffer while looking for the optional title } char c = data[i]; if (c=='\'' || c=='"' || c=='(') // optional title present? { //printf(" start of title found! char='%c'\n",c); i++; if (c=='(') c=')'; // replace c by end character size_t titleStart=i; // search for end of the line while (i<size && data[i]!='\n') i++; eol = i; // search back to matching character size_t end=i-1; while (end>titleStart && data[end]!=c) end--; if (end>titleStart) { title = data.substr(titleStart,end-titleStart); } AUTO_TRACE_ADD("title found {}",Trace::trunc(title)); } while (i<size && data[i]==' ') i++; //printf("end of isLinkRef: i=%d size=%d data[i]='%c' eol=%d\n", // i,size,data[i],eol); if (i>=size) { AUTO_TRACE_EXIT("result={}",i); return i; } // end of buffer while ref id was found else if (eol>0) { AUTO_TRACE_EXIT("result={}",eol); return eol; } // end of line while ref id was found return 0; // invalid link ref } static bool isHRuler(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); size_t i=0; size_t size = data.size(); if (size>0 && data[size-1]=='\n') size--; // ignore newline character while (i<size && data[i]==' ') i++; if (i>=size) { AUTO_TRACE_EXIT("result=false: empty line"); return false; } // empty line char c=data[i]; if (c!='*' && c!='-' && c!='_') { AUTO_TRACE_EXIT("result=false: {} is not a hrule character",c); return false; // not a hrule character } int n=0; while (i<size) { if (data[i]==c) { n++; // count rule character } else if (data[i]!=' ') { AUTO_TRACE_EXIT("result=false: line contains non hruler characters"); return false; // line contains non hruler characters } i++; } AUTO_TRACE_EXIT("result={}",n>=3); return n>=3; // at least 3 characters needed for a hruler } QCString Markdown::Private::extractTitleId(QCString &title, int level, bool *pIsIdGenerated) { AUTO_TRACE("title={} level={}",Trace::trunc(title),level); // match e.g. '{#id-b11} ' and capture 'id-b11' static const reg::Ex r2(R"({#(\a[\w-]*)}\s*$)"); reg::Match match; std::string ti = title.str(); if (reg::search(ti,match,r2)) { std::string id = match[1].str(); title = title.left(match.position()); if (AnchorGenerator::instance().reserve(id)>0) { warn(fileName, lineNr, "An automatically generated id already has the name '%s'!", id.c_str()); } //printf("found match id='%s' title=%s\n",id.c_str(),qPrint(title)); AUTO_TRACE_EXIT("id={}",id); return id; } if ((level>0) && (level<=Config_getInt(TOC_INCLUDE_HEADINGS))) { QCString id = AnchorGenerator::instance().generate(ti); if (pIsIdGenerated) *pIsIdGenerated=true; //printf("auto-generated id='%s' title='%s'\n",qPrint(id),qPrint(title)); AUTO_TRACE_EXIT("id={}",id); return id; } //printf("no id found in title '%s'\n",qPrint(title)); return ""; } int Markdown::Private::isAtxHeader(std::string_view data, QCString &header,QCString &id,bool allowAdjustLevel,bool *pIsIdGenerated) { AUTO_TRACE("data='{}' header={} id={} allowAdjustLevel={}",Trace::trunc(data),Trace::trunc(header),id,allowAdjustLevel); size_t i = 0; int level = 0, blanks=0; const size_t size = data.size(); // find start of header text and determine heading level while (i<size && data[i]==' ') i++; if (i>=size || data[i]!='#') { return 0; } while (i<size && data[i]=='#') i++,level++; if (level>SectionType::MaxLevel) // too many #'s -> no section { return 0; } while (i<size && data[i]==' ') i++,blanks++; if (level==1 && blanks==0) { return 0; // special case to prevent #someid seen as a header (see bug 671395) } // find end of header text size_t end=i; while (end<size && data[end]!='\n') end++; while (end>i && (data[end-1]=='#' || data[end-1]==' ')) end--; // store result header = data.substr(i,end-i); id = extractTitleId(header, level, pIsIdGenerated); if (!id.isEmpty()) // strip #'s between title and id { int idx=static_cast<int>(header.length())-1; while (idx>=0 && (header.at(idx)=='#' || header.at(idx)==' ')) idx--; header=header.left(idx+1); } if (allowAdjustLevel && level==1 && indentLevel==-1) { // in case we find a `# Section` on a markdown page that started with the same level // header, we no longer need to artificially decrease the paragraph level. // So both // ------------------- // # heading 1 <-- here we set g_indentLevel to -1 // # heading 2 <-- here we set g_indentLevel back to 0 such that this will be a @section // ------------------- // and // ------------------- // # heading 1 <-- here we set g_indentLevel to -1 // ## heading 2 <-- here we keep g_indentLevel at -1 such that @subsection will be @section // ------------------- // will convert to // ------------------- // @page md_page Heading 1 // @section autotoc_md1 Heading 2 // ------------------- indentLevel=0; } int res = level+indentLevel; AUTO_TRACE_EXIT("result={}",res); return res; } static bool isEmptyLine(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); size_t i=0; while (i<data.size()) { if (data[i]=='\n') { AUTO_TRACE_EXIT("true"); return true; } if (data[i]!=' ') { AUTO_TRACE_EXIT("false"); return false; } i++; } AUTO_TRACE_EXIT("true"); return true; } #define isLiTag(i) \ (data[(i)]=='<' && \ (data[(i)+1]=='l' || data[(i)+1]=='L') && \ (data[(i)+2]=='i' || data[(i)+2]=='I') && \ (data[(i)+3]=='>')) // compute the indent from the start of the input, excluding list markers // such as -, -#, *, +, 1., and <li> static size_t computeIndentExcludingListMarkers(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); size_t i=0; const size_t size=data.size(); size_t indent=0; bool isDigit=FALSE; bool isLi=FALSE; bool listMarkerSkipped=FALSE; while (i<size && (data[i]==' ' || // space (!listMarkerSkipped && // first list marker (data[i]=='+' || data[i]=='-' || data[i]=='*' || // unordered list char (data[i]=='#' && i>0 && data[i-1]=='-') || // -# item (isDigit=(data[i]>='1' && data[i]<='9')) || // ordered list marker? (isLi=(size>=3 && i<size-3 && isLiTag(i))) // <li> tag ) ) ) ) { if (isDigit) // skip over ordered list marker '10. ' { size_t j=i+1; while (j<size && ((data[j]>='0' && data[j]<='9') || data[j]=='.')) { if (data[j]=='.') // should be end of the list marker { if (j<size-1 && data[j+1]==' ') // valid list marker { listMarkerSkipped=TRUE; indent+=j+1-i; i=j+1; break; } else // not a list marker { break; } } j++; } } else if (isLi) { i+=3; // skip over <li> indent+=3; listMarkerSkipped=TRUE; } else if (data[i]=='-' && size>=2 && i<size-2 && data[i+1]=='#' && data[i+2]==' ') { // case "-# " listMarkerSkipped=TRUE; // only a single list marker is accepted i++; // skip over # indent++; } else if (data[i]!=' ' && i<size-1 && data[i+1]==' ') { // case "- " or "+ " or "* " listMarkerSkipped=TRUE; // only a single list marker is accepted } if (data[i]!=' ' && !listMarkerSkipped) { // end of indent break; } indent++,i++; } AUTO_TRACE_EXIT("result={}",indent); return indent; } static size_t isListMarker(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); size_t normalIndent = 0; while (normalIndent<data.size() && data[normalIndent]==' ') normalIndent++; size_t listIndent = computeIndentExcludingListMarkers(data); size_t result = listIndent>normalIndent ? listIndent : 0; AUTO_TRACE_EXIT("result={}",result); return result; } static bool isEndOfList(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); int dots=0; size_t i=0; // end of list marker is an otherwise empty line with a dot. while (i<data.size()) { if (data[i]=='.') { dots++; } else if (data[i]=='\n') { break; } else if (data[i]!=' ' && data[i]!='\t') // bail out if the line is not empty { AUTO_TRACE_EXIT("result=false"); return false; } i++; } AUTO_TRACE_EXIT("result={}",dots==1); return dots==1; } static bool isFencedCodeBlock(std::string_view data,size_t refIndent, QCString &lang,size_t &start,size_t &end,size_t &offset) { AUTO_TRACE("data='{}' refIndent={}",Trace::trunc(data),refIndent); const char dot = '.'; auto isAlphaChar = [ ](char c) { return (c>='A' && c<='Z') || (c>='a' && c<='z'); }; auto isAlphaNChar = [ ](char c) { return (c>='A' && c<='Z') || (c>='a' && c<='z') || (c>='0' && c<='9'); }; auto isLangChar = [&](char c) { return c==dot || isAlphaChar(c); }; // rules: at least 3 ~~~, end of the block same amount of ~~~'s, otherwise // return FALSE size_t i=0; size_t indent=0; int startTildes=0; const size_t size = data.size(); while (i<size && data[i]==' ') indent++,i++; if (indent>=refIndent+4) { AUTO_TRACE_EXIT("result=false: content is part of code block indent={} refIndent={}",indent,refIndent); return FALSE; } // part of code block char tildaChar='~'; if (i<size && data[i]=='`') tildaChar='`'; while (i<size && data[i]==tildaChar) startTildes++,i++; if (startTildes<3) { AUTO_TRACE_EXIT("result=false: no fence marker found #tildes={}",startTildes); return FALSE; } // not enough tildes if (i<size && data[i]=='{') // extract .py from ```{.py} ... ``` { i++; // skip over { if (data[i] == dot) i++; // skip over initial dot size_t startLang=i; while (i<size && (data[i]!='\n' && data[i]!='}')) i++; // find matching } if (i<size && data[i]=='}') { lang = data.substr(startLang,i-startLang); i++; } else // missing closing bracket, treat `{` as part of the content { i=startLang-1; lang=""; } } else if (i<size && isLangChar(data[i])) /// extract python or .py from ```python...``` or ```.py...``` { if (data[i] == dot) i++; // skip over initial dot size_t startLang=i; if (i<size && isAlphaChar(data[i])) //check first character of language specifier { i++; while (i<size && isAlphaNChar(data[i])) i++; // find end of language specifier } lang = data.substr(startLang,i-startLang); } else // no language specified { lang=""; } start=i; while (i<size) { if (data[i]==tildaChar) { end=i; int endTildes=0; while (i<size && data[i]==tildaChar) endTildes++,i++; while (i<size && data[i]==' ') i++; { if (endTildes==startTildes) { offset=i; AUTO_TRACE_EXIT("result=true: found end marker at offset {} lang='{}'",offset,lang); return true; } } } i++; } AUTO_TRACE_EXIT("result=false: no end marker found lang={}'",lang); return false; } static bool isCodeBlock(std::string_view data, size_t offset,size_t &indent) { AUTO_TRACE("data='{}' offset={}",Trace::trunc(data),offset); //printf("<isCodeBlock(offset=%d,size=%d,indent=%d)\n",offset,size,indent); // determine the indent of this line size_t i=0; size_t indent0=0; const size_t size = data.size(); while (i<size && data[i]==' ') indent0++,i++; if (indent0<codeBlockIndent) { AUTO_TRACE_EXIT("result={}: line is not indented enough {}<4",false,indent0); return false; } if (indent0>=size || data[indent0]=='\n') // empty line does not start a code block { AUTO_TRACE_EXIT("result={}: only spaces at the end of a comment block",false); return false; } i=offset; int nl=0; int nl_pos[3]; int offset_i = static_cast<int>(offset); // search back 3 lines and remember the start of lines -1 and -2 while (i>0 && nl<3) // i counts down from offset to 1 { int j = static_cast<int>(i)-offset_i-1; // j counts from -1 to -offset // since j can be negative we need to rewrap data in a std::string_view size_t nl_size = isNewline(std::string_view(data.data()+j,data.size()-j)); if (nl_size>0) { nl_pos[nl++]=j+static_cast<int>(nl_size); } i--; } // if there are only 2 preceding lines, then line -2 starts at -offset if (i==0 && nl==2) nl_pos[nl++]=-offset_i; if (nl==3) // we have at least 2 preceding lines { //printf(" positions: nl_pos=[%d,%d,%d] line[-2]='%s' line[-1]='%s'\n", // nl_pos[0],nl_pos[1],nl_pos[2], // qPrint(QCString(data+nl_pos[1]).left(nl_pos[0]-nl_pos[1]-1)), // qPrint(QCString(data+nl_pos[2]).left(nl_pos[1]-nl_pos[2]-1))); // check that line -1 is empty // Note that the offset is negative so we need to rewrap the string view if (!isEmptyLine(std::string_view(data.data()+nl_pos[1],nl_pos[0]-nl_pos[1]-1))) { AUTO_TRACE_EXIT("result={}",FALSE); return FALSE; } // determine the indent of line -2 // Note that the offset is negative so we need to rewrap the string view indent=std::max(indent,computeIndentExcludingListMarkers( std::string_view(data.data()+nl_pos[2],nl_pos[1]-nl_pos[2]))); //printf(">isCodeBlock local_indent %d>=%d+%d=%d\n", // indent0,indent,codeBlockIndent,indent0>=indent+codeBlockIndent); // if the difference is >4 spaces -> code block bool res = indent0>=indent+codeBlockIndent; AUTO_TRACE_EXIT("result={}: code block if indent difference >4 spaces",res); return res; } else // not enough lines to determine the relative indent, use global indent { // check that line -1 is empty // Note that the offset is negative so we need to rewrap the string view if (nl==1 && !isEmptyLine(std::string_view(data.data()-offset,offset-1))) { AUTO_TRACE_EXIT("result=false"); return FALSE; } //printf(">isCodeBlock global indent %d>=%d+4=%d nl=%d\n", // indent0,indent,indent0>=indent+4,nl); bool res = indent0>=indent+codeBlockIndent; AUTO_TRACE_EXIT("result={}: code block if indent difference >4 spaces",res); return res; } } /** Finds the location of the table's contains in the string \a data. * Only one line will be inspected. * @param[in] data pointer to the string buffer. * @param[out] start offset of the first character of the table content * @param[out] end offset of the last character of the table content * @param[out] columns number of table columns found * @returns The offset until the next line in the buffer. */ static size_t findTableColumns(std::string_view data,size_t &start,size_t &end,size_t &columns) { AUTO_TRACE("data='{}'",Trace::trunc(data)); const size_t size = data.size(); size_t i=0,n=0; // find start character of the table line while (i<size && data[i]==' ') i++; if (i<size && data[i]=='|' && data[i]!='\n') i++,n++; // leading | does not count start = i; // find end character of the table line size_t j = 0; while (i<size && (j = isNewline(data.substr(i)))==0) i++; size_t eol=i+j; if (j>0 && i>0) i--; // move i to point before newline while (i>0 && data[i]==' ') i--; if (i>0 && data[i-1]!='\\' && data[i]=='|') i--,n++; // trailing or escaped | does not count end = i; // count columns between start and end columns=0; if (end>start) { i=start; while (i<=end) // look for more column markers { if (data[i]=='|' && (i==0 || data[i-1]!='\\')) columns++; if (columns==1) columns++; // first | make a non-table into a two column table i++; } } if (n==2 && columns==0) // table row has | ... | { columns++; } AUTO_TRACE_EXIT("eol={} start={} end={} columns={}",eol,start,end,columns); return eol; } /** Returns TRUE iff data points to the start of a table block */ static bool isTableBlock(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); size_t cc0=0, start=0, end=0; // the first line should have at least two columns separated by '|' size_t i = findTableColumns(data,start,end,cc0); if (i>=data.size() || cc0<1) { AUTO_TRACE_EXIT("result=false: no |'s in the header"); return FALSE; } size_t cc1 = 0; size_t ret = findTableColumns(data.substr(i),start,end,cc1); size_t j=i+start; // separator line should consist of |, - and : and spaces only while (j<=end+i) { if (data[j]!=':' && data[j]!='-' && data[j]!='|' && data[j]!=' ') { AUTO_TRACE_EXIT("result=false: invalid character '{}'",data[j]); return FALSE; // invalid characters in table separator } j++; } if (cc1!=cc0) // number of columns should be same as previous line { AUTO_TRACE_EXIT("result=false: different number of columns as previous line {}!={}",cc1,cc0); return FALSE; } i+=ret; // goto next line size_t cc2 = 0; findTableColumns(data.substr(i),start,end,cc2); AUTO_TRACE_EXIT("result={}",cc1==cc2); return cc1==cc2; } size_t Markdown::Private::writeTableBlock(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); const size_t size = data.size(); size_t columns=0, start=0, end=0; size_t i = findTableColumns(data,start,end,columns); size_t headerStart = start; size_t headerEnd = end; // read cell alignments size_t cc = 0; size_t ret = findTableColumns(data.substr(i),start,end,cc); size_t k=0; std::vector<int> columnAlignment(columns); bool leftMarker=false, rightMarker=false, startFound=false; size_t j=start+i; while (j<=end+i) { if (!startFound) { if (data[j]==':') { leftMarker=TRUE; startFound=TRUE; } if (data[j]=='-') startFound=TRUE; //printf(" data[%d]=%c startFound=%d\n",j,data[j],startFound); } if (data[j]=='-') rightMarker=FALSE; else if (data[j]==':') rightMarker=TRUE; if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) { if (k<columns) { columnAlignment[k] = markersToAlignment(leftMarker,rightMarker); //printf("column[%d] alignment=%d\n",k,columnAlignment[k]); leftMarker=FALSE; rightMarker=FALSE; startFound=FALSE; } k++; } j++; } if (k<columns) { columnAlignment[k] = markersToAlignment(leftMarker,rightMarker); //printf("column[%d] alignment=%d\n",k,columnAlignment[k]); } // proceed to next line i+=ret; // Store the table cell information by row then column. This // allows us to handle row spanning. std::vector<std::vector<TableCell> > tableContents; size_t m = headerStart; std::vector<TableCell> headerContents(columns); for (k=0;k<columns;k++) { while (m<=headerEnd && (data[m]!='|' || (m>0 && data[m-1]=='\\'))) { headerContents[k].cellText += data[m++]; } m++; // do the column span test before stripping white space // || is spanning columns, | | is not headerContents[k].colSpan = headerContents[k].cellText.isEmpty(); headerContents[k].cellText = headerContents[k].cellText.stripWhiteSpace(); } tableContents.push_back(headerContents); // write table cells while (i<size) { ret = findTableColumns(data.substr(i),start,end,cc); if (cc!=columns) break; // end of table j=start+i; k=0; std::vector<TableCell> rowContents(columns); while (j<=end+i) { if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) { // do the column span test before stripping white space // || is spanning columns, | | is not rowContents[k].colSpan = rowContents[k].cellText.isEmpty(); rowContents[k].cellText = rowContents[k].cellText.stripWhiteSpace(); k++; } // if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) else { rowContents[k].cellText += data[j]; } // else { if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) } j++; } // while (j<=end+i) // do the column span test before stripping white space // || is spanning columns, | | is not rowContents[k].colSpan = rowContents[k].cellText.isEmpty(); rowContents[k].cellText = rowContents[k].cellText.stripWhiteSpace(); tableContents.push_back(rowContents); // proceed to next line i+=ret; } out+="<table class=\"markdownTable\">"; QCString cellTag("th"), cellClass("class=\"markdownTableHead"); for (size_t row = 0; row < tableContents.size(); row++) { if (row) { if (row % 2) { out+="\n<tr class=\"markdownTableRowOdd\">"; } else { out+="\n<tr class=\"markdownTableRowEven\">"; } } else { out+="\n <tr class=\"markdownTableHead\">"; } for (size_t c = 0; c < columns; c++) { // save the cell text for use after column span computation QCString cellText(tableContents[row][c].cellText); // Row span handling. Spanning rows will contain a caret ('^'). // If the current cell contains just a caret, this is part of an // earlier row's span and the cell should not be added to the // output. if (tableContents[row][c].cellText == "^") { continue; } if (tableContents[row][c].colSpan) { int cr = static_cast<int>(c); while ( cr >= 0 && tableContents[row][cr].colSpan) { cr--; }; if (cr >= 0 && tableContents[row][cr].cellText == "^") continue; } size_t rowSpan = 1, spanRow = row+1; while ((spanRow < tableContents.size()) && (tableContents[spanRow][c].cellText == "^")) { spanRow++; rowSpan++; } out+=" <" + cellTag + " " + cellClass; // use appropriate alignment style switch (columnAlignment[c]) { case AlignLeft: out+="Left\""; break; case AlignRight: out+="Right\""; break; case AlignCenter: out+="Center\""; break; case AlignNone: out+="None\""; break; } if (rowSpan > 1) { QCString spanStr; spanStr.setNum(rowSpan); out+=" rowspan=\"" + spanStr + "\""; } // Column span handling, assumes that column spans will have // empty strings, which would indicate the sequence "||", used // to signify spanning columns. size_t colSpan = 1; while ((c+1 < columns) && tableContents[row][c+1].colSpan) { c++; colSpan++; } if (colSpan > 1) { QCString spanStr; spanStr.setNum(colSpan); out+=" colspan=\"" + spanStr + "\""; } // need at least one space on either side of the cell text in // order for doxygen to do other formatting out+="> " + cellText + " \\ilinebr </" + cellTag + ">"; } cellTag = "td"; cellClass = "class=\"markdownTableBody"; out+=" </tr>"; } out+="</table>\n"; AUTO_TRACE_EXIT("i={}",i); return i; } static bool hasLineBreak(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); size_t i=0; size_t j=0; // search for end of line and also check if it is not a completely blank while (i<data.size() && data[i]!='\n') { if (data[i]!=' ' && data[i]!='\t') j++; // some non whitespace i++; } if (i>=data.size()) { return 0; } // empty line if (i<2) { return 0; } // not long enough bool res = (j>0 && data[i-1]==' ' && data[i-2]==' '); // non blank line with at two spaces at the end AUTO_TRACE_EXIT("result={}",res); return res; } void Markdown::Private::writeOneLineHeaderOrRuler(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); int level=0; QCString header; QCString id; if (isHRuler(data)) { out+="<hr>\n"; } else if ((level=isAtxHeader(data,header,id,TRUE))) { QCString hTag; if (!id.isEmpty()) { switch (level) { case SectionType::Section: out+="@section "; break; case SectionType::Subsection: out+="@subsection "; break; case SectionType::Subsubsection: out+="@subsubsection "; break; case SectionType::Paragraph: out+="@paragraph "; break; case SectionType::Subparagraph: out+="@subparagraph "; break; case SectionType::Subsubparagraph: out+="@subsubparagraph "; break; } out+=id; out+=" "; out+=header; out+="\n"; } else { hTag.sprintf("h%d",level); out+="<"+hTag+">"; out+=header; out+="</"+hTag+">\n"; } } else if (data.size()>0) // nothing interesting -> just output the line { size_t tmpSize = data.size(); if (data[data.size()-1] == '\n') tmpSize--; out+=data.substr(0,tmpSize); if (hasLineBreak(data)) { out+="\\ilinebr<br>"; } if (tmpSize != data.size()) out+='\n'; } } static const std::unordered_map<std::string,std::string> g_quotationHeaderMap = { // GitHub style Doxygen command { "[!note]", "\\note" }, { "[!warning]", "\\warning" }, { "[!tip]", "\\remark" }, { "[!caution]", "\\attention" }, { "[!important]", "\\important" } }; size_t Markdown::Private::writeBlockQuote(std::string_view data) { AUTO_TRACE("data='{}'",Trace::trunc(data)); size_t i=0; int curLevel=0; size_t end=0; const size_t size = data.size(); std::string startCmd; int isGitHubAlert = false; int isGitHubFirst = false; while (i<size) { // find end of this line end=i+1; while (end<=size && data[end-1]!='\n') end++; size_t j=i; int level=0; size_t indent=i; // compute the quoting level while (j<end && (data[j]==' ' || data[j]=='>')) { if (data[j]=='>') { level++; indent=j+1; } else if (j>0 && data[j-1]=='>') indent=j+1; j++; } if (indent>0 && j>0 && data[j-1]=='>' && !(j==size || data[j]=='\n')) // disqualify last > if not followed by space { indent--; level--; j--; } AUTO_TRACE_ADD("indent={} i={} j={} end={} level={} line={}",indent,i,j,end,level,Trace::trunc(&data[i])); if (level==0 && j<end-1) { level = curLevel; // lazy } if (level==1) { QCString txt = stripWhiteSpace(data.substr(indent,end-indent)); auto it = g_quotationHeaderMap.find(txt.lower().str()); // TODO: in C++20 the std::string can be dropped if (it != g_quotationHeaderMap.end()) { isGitHubAlert = true; isGitHubFirst = true; startCmd = it->second; } } if (level>curLevel) // quote level increased => add start markers { if (level!=1 || !isGitHubAlert) // normal block quote { for (int l=curLevel;l<level-1;l++) { out+="<blockquote>"; } out += "<blockquote>&zwj;"; // empty blockquotes are also shown } else if (!startCmd.empty()) // GitHub style alert { out += startCmd + " "; } } else if (level<curLevel) // quote level decreased => add end markers { int decrLevel = curLevel; if (level==0 && isGitHubAlert) { decrLevel--; } for (int l=level;l<decrLevel;l++) { out += "</blockquote>"; } } if (level==0) { curLevel=0; break; // end of quote block } // copy line without quotation marks if (curLevel!=0 || !isGitHubAlert) { std::string_view txt = data.substr(indent,end-indent); if (stripWhiteSpace(txt).empty() && !startCmd.empty()) { if (!isGitHubFirst) out += "<br>"; out += "<br>\n"; } else { out += txt; } isGitHubFirst = false; } else // GitHub alert section { out+= "\n"; } curLevel=level; // proceed with next line i=end; } // end of comment within blockquote => add end markers if (isGitHubAlert) // GitHub alert doesn't have a blockquote { curLevel--; } for (int l=0;l<curLevel;l++) { out+="</blockquote>"; } AUTO_TRACE_EXIT("i={}",i); return i; } // For code blocks that are outputted as part of an indented include or snippet command, we need to filter out // the location string, i.e. '\ifile "..." \iline \ilinebr'. bool skipOverFileAndLineCommands(std::string_view data,size_t indent,size_t &offset,std::string &location) { size_t i = offset; size_t size = data.size(); while (i<data.size() && data[i]==' ') i++; if (i<size+8 && data[i]=='\\' && qstrncmp(&data[i+1],"ifile \"",7)==0) { size_t locStart = i; if (i>offset) locStart--; // include the space before \ifile i+=8; bool found=false; while (i<size-9 && data[i]!='\n') { if (data[i]=='\\' && qstrncmp(&data[i+1],"ilinebr ",8)==0) { found=true; break; } i++; } if (found) { i+=9; location=data.substr(locStart,i-locStart); location+='\n'; while (indent>0 && i<size && data[i]==' ') i++,indent--; if (i<size && data[i]=='\n') i++; offset = i; return true; } } return false; } size_t Markdown::Private::writeCodeBlock(std::string_view data,size_t refIndent) { AUTO_TRACE("data='{}' refIndent={}",Trace::trunc(data),refIndent); const size_t size = data.size(); size_t i=0; // no need for \ilinebr here as the previous line was empty and was skipped out+="@iverbatim\n"; int emptyLines=0; std::string location; while (i<size) { // find end of this line size_t end=i+1; while (end<=size && data[end-1]!='\n') end++; size_t j=i; size_t indent=0; while (j<end && data[j]==' ') j++,indent++; //printf("j=%d end=%d indent=%d refIndent=%d tabSize=%d data={%s}\n", // j,end,indent,refIndent,Config_getInt(TAB_SIZE),qPrint(QCString(data+i).left(end-i-1))); if (j==end-1) // empty line { emptyLines++; i=end; } else if (indent>=refIndent+codeBlockIndent) // enough indent to continue the code block { while (emptyLines>0) // write skipped empty lines { // add empty line out+="\n"; emptyLines--; } // add code line minus the indent size_t offset = i+refIndent+codeBlockIndent; std::string lineLoc; if (skipOverFileAndLineCommands(data,codeBlockIndent,offset,lineLoc)) { location = lineLoc; } out+=data.substr(offset,end-offset); i=end; } else // end of code block { break; } } out+="@endiverbatim"; if (!location.empty()) { out+=location; } else { out+="\\ilinebr "; } while (emptyLines>0) // write skipped empty lines { // add empty line out+="\n"; emptyLines--; } AUTO_TRACE_EXIT("i={}",i); return i; } // start searching for the end of the line start at offset \a i // keeping track of possible blocks that need to be skipped. size_t Markdown::Private::findEndOfLine(std::string_view data,size_t offset) { AUTO_TRACE("data='{}'",Trace::trunc(data)); // find end of the line const size_t size = data.size(); size_t nb=0, end=offset+1, j=0; while (end<=size && (j=isNewline(data.data()+end-1))==0) { // while looking for the end of the line we might encounter a block // that needs to be passed unprocessed. if ((data[end-1]=='\\' || data[end-1]=='@') && // command (end<=1 || (data[end-2]!='\\' && data[end-2]!='@')) // not escaped ) { QCString endBlockName = isBlockCommand(data.substr(end-1),end-1); end++; if (!endBlockName.isEmpty()) { size_t l = endBlockName.length(); for (;end<size-l-1;end++) // search for end of block marker { if ((data[end]=='\\' || data[end]=='@') && data[end-1]!='\\' && data[end-1]!='@' ) { if (qstrncmp(&data[end+1],endBlockName.data(),l)==0) { // found end marker, skip over this block //printf("feol.block out={%s}\n",qPrint(QCString(data+i).left(end+l+1-i))); end = end + l + 2; break; } } } } } else if (nb==0 && data[end-1]=='<' && size>=6 && end<size-6 && (end<=1 || (data[end-2]!='\\' && data[end-2]!='@')) ) { if (tolower(data[end])=='p' && tolower(data[end+1])=='r' && tolower(data[end+2])=='e' && (data[end+3]=='>' || data[end+3]==' ')) // <pre> tag { // skip part until including </pre> end = end + processHtmlTagWrite(data.substr(end-1),end-1,false); break; } else { end++; } } else if (nb==0 && data[end-1]=='`') { while (end<=size && data[end-1]=='`') end++,nb++; } else if (nb>0 && data[end-1]=='`') { size_t enb=0; while (end<=size && data[end-1]=='`') end++,enb++; if (enb==nb) nb=0; } else { end++; } } if (j>0) end+=j-1; AUTO_TRACE_EXIT("offset={} end={}",offset,end); return end; } void Markdown::Private::writeFencedCodeBlock(std::string_view data,std::string_view lang, size_t blockStart,size_t blockEnd) { AUTO_TRACE("data='{}' lang={} blockStart={} blockEnd={}",Trace::trunc(data),lang,blockStart,blockEnd); if (!lang.empty() && lang[0]=='.') lang=lang.substr(1); const size_t size=data.size(); size_t i=0; while (i<size && (data[i]==' ' || data[i]=='\t')) { out+=data[i++]; blockStart--; blockEnd--; } out+="@icode"; if (!lang.empty()) { out+="{"+lang+"}"; } out+=" "; addStrEscapeUtf8Nbsp(data.substr(blockStart+i,blockEnd-blockStart)); out+="@endicode "; } QCString Markdown::Private::processQuotations(std::string_view data,size_t refIndent) { AUTO_TRACE("data='{}' refIndex='{}'",Trace::trunc(data),refIndent); out.clear(); size_t i=0,end=0; size_t pi=std::string::npos; bool newBlock = false; bool insideList = false; size_t currentIndent = refIndent; size_t listIndent = refIndent; const size_t size = data.size(); QCString lang; while (i<size) { end = findEndOfLine(data,i); // line is now found at [i..end) size_t lineIndent=0; while (lineIndent<end && data[i+lineIndent]==' ') lineIndent++; //printf("** lineIndent=%d line=(%s)\n",lineIndent,qPrint(QCString(data+i).left(end-i))); if (newBlock) { //printf("** end of block\n"); if (insideList && lineIndent<currentIndent) // end of list { //printf("** end of list\n"); currentIndent = refIndent; insideList = false; } newBlock = false; } if ((listIndent=isListMarker(data.substr(i,end-i)))) // see if we need to increase the indent level { if (listIndent<currentIndent+4) { //printf("** start of list\n"); insideList = true; currentIndent = listIndent; } } else if (isEndOfList(data.substr(i,end-i))) { //printf("** end of list\n"); insideList = false; currentIndent = listIndent; } else if (isEmptyLine(data.substr(i,end-i))) { //printf("** new block\n"); newBlock = true; } //printf("currentIndent=%d listIndent=%d refIndent=%d\n",currentIndent,listIndent,refIndent); if (pi!=std::string::npos) { size_t blockStart=0, blockEnd=0, blockOffset=0; if (isFencedCodeBlock(data.substr(pi),currentIndent,lang,blockStart,blockEnd,blockOffset)) { auto addSpecialCommand = [&](const QCString &startCmd,const QCString &endCmd) { size_t cmdPos = pi+blockStart+1; QCString pl = data.substr(cmdPos,blockEnd-blockStart-1); size_t ii = 0; int nl = 1; // check for absence of start command, either @start<cmd>, or \\start<cmd> while (ii<pl.length() && qisspace(pl[ii])) { if (pl[ii]=='\n') nl++; ii++; // skip leading whitespace } bool addNewLines = false; if (ii+startCmd.length()>=pl.length() || // no room for start command (pl[ii]!='\\' && pl[ii]!='@') || // no @ or \ after whitespace qstrncmp(pl.data()+ii+1,startCmd.data(),startCmd.length())!=0) // no start command { // input: output: // ---------------------------------------------------- // ```{plantuml} => @startuml // A->B A->B // ``` @enduml // ---------------------------------------------------- pl = "@"+startCmd+"\n" + pl + "@"+endCmd; addNewLines = false; } else // we have a @start... command inside the code block { // input: output: // ---------------------------------------------------- // ```{plantuml} \n // \n // @startuml => @startuml // A->B A->B // @enduml @enduml // ``` \n // ---------------------------------------------------- addNewLines = true; } if (addNewLines) for (int j=0;j<nl;j++) out+='\n'; processSpecialCommand(pl.view().substr(ii),ii); if (addNewLines) out+='\n'; }; if (!Config_getString(PLANTUML_JAR_PATH).isEmpty() && lang=="plantuml") { addSpecialCommand("startuml","enduml"); } else if (Config_getBool(HAVE_DOT) && lang=="dot") { addSpecialCommand("dot","enddot"); } else if (lang=="msc") // msc is built-in { addSpecialCommand("msc","endmsc"); } else // normal code block { writeFencedCodeBlock(data.substr(pi),lang.view(),blockStart,blockEnd); } i=pi+blockOffset; pi=std::string::npos; end=i+1; continue; } else if (isBlockQuote(data.substr(pi,i-pi),currentIndent)) { i = pi+writeBlockQuote(data.substr(pi)); pi=std::string::npos; end=i+1; continue; } else { //printf("quote out={%s}\n",QCString(data+pi).left(i-pi).data()); out+=data.substr(pi,i-pi); } } pi=i; i=end; } if (pi!=std::string::npos && pi<size) // deal with the last line { if (isBlockQuote(data.substr(pi),currentIndent)) { writeBlockQuote(data.substr(pi)); } else { out+=data.substr(pi); } } //printf("Process quotations\n---- input ----\n%s\n---- output ----\n%s\n------------\n", // qPrint(s),prv->out.get()); return out; } QCString Markdown::Private::processBlocks(std::string_view data,const size_t indent) { AUTO_TRACE("data='{}' indent={}",Trace::trunc(data),indent); out.clear(); size_t pi = std::string::npos; QCString id,link,title; #if 0 // commented out, since starting with a comment block is probably a usage error // see also http://stackoverflow.com/q/20478611/784672 // special case when the documentation starts with a code block // since the first line is skipped when looking for a code block later on. if (end>codeBlockIndent && isCodeBlock(data,0,end,blockIndent)) { i=writeCodeBlock(out,data,size,blockIndent); end=i+1; pi=-1; } #endif size_t currentIndent = indent; size_t listIndent = indent; bool insideList = false; bool newBlock = false; // process each line size_t i=0; while (i<data.size()) { size_t end = findEndOfLine(data,i); // line is now found at [i..end) size_t lineIndent=0; int level = 0; while (lineIndent<end && data[i+lineIndent]==' ') lineIndent++; //printf("** lineIndent=%d line=(%s)\n",lineIndent,qPrint(QCString(data+i).left(end-i))); if (newBlock) { //printf("** end of block\n"); if (insideList && lineIndent<currentIndent) // end of list { //printf("** end of list\n"); currentIndent = indent; insideList = false; } newBlock = false; } if ((listIndent=isListMarker(data.substr(i,end-i)))) // see if we need to increase the indent level { if (listIndent<currentIndent+4) { //printf("** start of list\n"); insideList = true; currentIndent = listIndent; } } else if (isEndOfList(data.substr(i,end-i))) { //printf("** end of list\n"); insideList = false; currentIndent = listIndent; } else if (isEmptyLine(data.substr(i,end-i))) { //printf("** new block\n"); newBlock = true; } //printf("indent=%d listIndent=%d blockIndent=%d\n",indent,listIndent,blockIndent); //printf("findEndOfLine: pi=%d i=%d end=%d\n",pi,i,end); if (pi!=std::string::npos) { size_t blockStart=0, blockEnd=0, blockOffset=0; QCString lang; size_t blockIndent = currentIndent; size_t ref = 0; //printf("isHeaderLine(%s)=%d\n",QCString(data+i).left(size-i).data(),level); QCString endBlockName; if (data[i]=='@' || data[i]=='\\') endBlockName = isBlockCommand(data.substr(i),i); if (!endBlockName.isEmpty()) { // handle previous line if (isLinkRef(data.substr(pi,i-pi),id,link,title)) { linkRefs.emplace(id.lower().str(),LinkRef(link,title)); } else { writeOneLineHeaderOrRuler(data.substr(pi,i-pi)); } out+=data[i]; i++; size_t l = endBlockName.length(); while (i+l<data.size()) { if ((data[i]=='\\' || data[i]=='@') && // command data[i-1]!='\\' && data[i-1]!='@') // not escaped { if (qstrncmp(&data[i+1],endBlockName.data(),l)==0) { out+=data[i]; out+=endBlockName; i+=l+1; break; } } out+=data[i]; i++; } } else if ((level=isHeaderline(data.substr(i),TRUE))>0) { //printf("Found header at %d-%d\n",i,end); while (pi<data.size() && data[pi]==' ') pi++; QCString header = data.substr(pi,i-pi-1); id = extractTitleId(header, level); //printf("header='%s' is='%s'\n",qPrint(header),qPrint(id)); if (!header.isEmpty()) { if (!id.isEmpty()) { out+=level==1?"@section ":"@subsection "; out+=id; out+=" "; out+=header; out+="\n\n"; } else { out+=level==1?"<h1>":"<h2>"; out+=header; out+=level==1?"\n</h1>\n":"\n</h2>\n"; } } else { out+="\n<hr>\n"; } pi=std::string::npos; i=end; end=i+1; continue; } else if ((ref=isLinkRef(data.substr(pi),id,link,title))) { //printf("found link ref: id='%s' link='%s' title='%s'\n", // qPrint(id),qPrint(link),qPrint(title)); linkRefs.emplace(id.lower().str(),LinkRef(link,title)); i=ref+pi; end=i+1; } else if (isFencedCodeBlock(data.substr(pi),currentIndent,lang,blockStart,blockEnd,blockOffset)) { //printf("Found FencedCodeBlock lang='%s' start=%d end=%d code={%s}\n", // qPrint(lang),blockStart,blockEnd,QCString(data+pi+blockStart).left(blockEnd-blockStart).data()); writeFencedCodeBlock(data.substr(pi),lang.view(),blockStart,blockEnd); i=pi+blockOffset; pi=std::string::npos; end=i+1; continue; } else if (isCodeBlock(data.substr(i,end-i),i,blockIndent)) { // skip previous line (it is empty anyway) i+=writeCodeBlock(data.substr(i),blockIndent); pi=std::string::npos; end=i+1; continue; } else if (isTableBlock(data.substr(pi))) { i=pi+writeTableBlock(data.substr(pi)); pi=std::string::npos; end=i+1; continue; } else { writeOneLineHeaderOrRuler(data.substr(pi,i-pi)); } } pi=i; i=end; } //printf("last line %d size=%d\n",i,size); if (pi!=std::string::npos && pi<data.size()) // deal with the last line { if (isLinkRef(data.substr(pi),id,link,title)) { //printf("found link ref: id='%s' link='%s' title='%s'\n", // qPrint(id),qPrint(link),qPrint(title)); linkRefs.emplace(id.lower().str(),LinkRef(link,title)); } else { writeOneLineHeaderOrRuler(data.substr(pi)); } } return out; } static ExplicitPageResult isExplicitPage(const QCString &docs) { AUTO_TRACE("docs={}",Trace::trunc(docs)); size_t i=0; std::string_view data(docs.str()); const size_t size = data.size(); if (!data.empty()) { while (i<size && (data[i]==' ' || data[i]=='\n')) { i++; } if (i<size-5 && data[i]=='<' && qstrncmp(&data[i],"<!--!",5)==0) // skip over <!--! marker { i+=5; while (i<size && (data[i]==' ' || data[i]=='\n')) // skip over spaces after the <!--! marker { i++; } } if (i<size-1 && (data[i]=='\\' || data[i]=='@') && (qstrncmp(&data[i+1],"page ",5)==0 || qstrncmp(&data[i+1],"mainpage",8)==0) ) { if (qstrncmp(&data[i+1],"page ",5)==0) { AUTO_TRACE_EXIT("result=ExplicitPageResult::explicitPage"); return ExplicitPageResult::explicitPage; } else { AUTO_TRACE_EXIT("result=ExplicitPageResult::explicitMainPage"); return ExplicitPageResult::explicitMainPage; } } else if (i<size-1 && (data[i]=='\\' || data[i]=='@') && (qstrncmp(&data[i+1],"dir\n",4)==0 || qstrncmp(&data[i+1],"dir ",4)==0) ) { AUTO_TRACE_EXIT("result=ExplicitPageResult::explicitDirPage"); return ExplicitPageResult::explicitDirPage; } } AUTO_TRACE_EXIT("result=ExplicitPageResult::notExplicit"); return ExplicitPageResult::notExplicit; } QCString Markdown::extractPageTitle(QCString &docs, QCString &id, int &prepend, bool &isIdGenerated) { AUTO_TRACE("docs={} prepend={}",Trace::trunc(docs),id,prepend); // first first non-empty line prepend = 0; QCString title; size_t i=0; QCString docs_org(docs); std::string_view data(docs_org.str()); const size_t size = data.size(); docs.clear(); while (i<size && (data[i]==' ' || data[i]=='\n')) { if (data[i]=='\n') prepend++; i++; } if (i>=size) { return QCString(); } size_t end1=i+1; while (end1<size && data[end1-1]!='\n') end1++; //printf("i=%d end1=%d size=%d line='%s'\n",i,end1,size,docs.mid(i,end1-i).data()); // first line from i..end1 if (end1<size) { // second line form end1..end2 size_t end2=end1+1; while (end2<size && data[end2-1]!='\n') end2++; if (prv->isHeaderline(data.substr(end1),FALSE)) { title = data.substr(i,end1-i-1); docs+="\n\n"+docs_org.mid(end2); id = prv->extractTitleId(title, 0, &isIdGenerated); //printf("extractPageTitle(title='%s' docs='%s' id='%s')\n",title.data(),docs.data(),id.data()); AUTO_TRACE_EXIT("result={} id={} isIdGenerated={}",Trace::trunc(title),id,isIdGenerated); return title; } } if (i<end1 && prv->isAtxHeader(data.substr(i,end1-i),title,id,FALSE,&isIdGenerated)>0) { docs+="\n"; docs+=docs_org.mid(end1); } else { docs=docs_org; id = prv->extractTitleId(title, 0, &isIdGenerated); } AUTO_TRACE_EXIT("result={} id={} isIdGenerated={}",Trace::trunc(title),id,isIdGenerated); return title; } //--------------------------------------------------------------------------- QCString Markdown::process(const QCString &input, int &startNewlines, bool fromParseInput) { if (input.isEmpty()) return input; size_t refIndent=0; // for replace tabs by spaces QCString s = input; if (s.at(s.length()-1)!='\n') s += "\n"; // see PR #6766 s = detab(s,refIndent); //printf("======== DeTab =========\n---- output -----\n%s\n---------\n",qPrint(s)); // then process quotation blocks (as these may contain other blocks) s = prv->processQuotations(s.view(),refIndent); //printf("======== Quotations =========\n---- output -----\n%s\n---------\n",qPrint(s)); // then process block items (headers, rules, and code blocks, references) s = prv->processBlocks(s.view(),refIndent); //printf("======== Blocks =========\n---- output -----\n%s\n---------\n",qPrint(s)); // finally process the inline markup (links, emphasis and code spans) prv->out.clear(); prv->out.reserve(s.length()); prv->processInline(s.view()); if (fromParseInput) { Debug::print(Debug::Markdown,0,"---- output -----\n%s\n=========\n",qPrint(prv->out)); } else { Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n=========\n",qPrint(input),qPrint(prv->out)); } // post processing QCString result = substitute(prv->out,g_doxy_nbsp,"&nbsp;"); const char *p = result.data(); if (p) { while (*p==' ') p++; // skip over spaces while (*p=='\n') {startNewlines++;p++;}; // skip over newlines if (qstrncmp(p,"<br>",4)==0) p+=4; // skip over <br> } if (p>result.data()) { // strip part of the input result = result.mid(static_cast<int>(p-result.data())); } return result; } //--------------------------------------------------------------------------- QCString markdownFileNameToId(const QCString &fileName) { AUTO_TRACE("fileName={}",fileName); std::string absFileName = FileInfo(fileName.str()).absFilePath(); QCString baseFn = stripFromPath(absFileName.c_str()); int i = baseFn.findRev('.'); if (i!=-1) baseFn = baseFn.left(i); QCString baseName = escapeCharsInString(baseFn,false,false); //printf("markdownFileNameToId(%s)=md_%s\n",qPrint(fileName),qPrint(baseName)); QCString res = "md_"+baseName; AUTO_TRACE_EXIT("result={}",res); return res; } //--------------------------------------------------------------------------- struct MarkdownOutlineParser::Private { CommentScanner commentScanner; }; MarkdownOutlineParser::MarkdownOutlineParser() : p(std::make_unique<Private>()) { } MarkdownOutlineParser::~MarkdownOutlineParser() { } void MarkdownOutlineParser::parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr<Entry> &root, ClangTUParser* /*clangParser*/) { std::shared_ptr<Entry> current = std::make_shared<Entry>(); int prepend = 0; // number of empty lines in front current->lang = SrcLangExt::Markdown; current->fileName = fileName; current->docFile = fileName; current->docLine = 1; QCString docs = fileBuf; Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n",qPrint(fileBuf)); QCString id; Markdown markdown(fileName,1,0); bool isIdGenerated = false; QCString title = markdown.extractPageTitle(docs, id, prepend, isIdGenerated).stripWhiteSpace(); QCString generatedId; if (isIdGenerated) { generatedId = id; id = ""; } int indentLevel=title.isEmpty() ? 0 : -1; markdown.setIndentLevel(indentLevel); FileInfo fi(fileName.str()); QCString fn = fi.fileName(); QCString titleFn = stripExtensionGeneral(fn,getFileNameExtension(fn)); QCString mdfileAsMainPage = Config_getString(USE_MDFILE_AS_MAINPAGE); QCString mdFileNameId = markdownFileNameToId(fileName); bool wasEmpty = id.isEmpty(); if (wasEmpty) id = mdFileNameId; QCString relFileName = stripFromPath(fileName); bool isSubdirDocs = Config_getBool(IMPLICIT_DIR_DOCS) && relFileName.lower().endsWith("/readme.md"); switch (isExplicitPage(docs)) { case ExplicitPageResult::notExplicit: if (!mdfileAsMainPage.isEmpty() && (fi.absFilePath()==FileInfo(mdfileAsMainPage.str()).absFilePath()) // file reference with path ) { docs.prepend("@ianchor{" + title + "} " + id + "\\ilinebr "); docs.prepend("@mainpage "+title+"\\ilinebr "); } else if (id=="mainpage" || id=="index") { if (title.isEmpty()) title = titleFn; docs.prepend("@ianchor{" + title + "} " + id + "\\ilinebr "); docs.prepend("@mainpage "+title+"\\ilinebr "); } else if (isSubdirDocs) { docs.prepend("@dir\\ilinebr "); } else { if (title.isEmpty()) { title = titleFn; prepend = 0; } if (!wasEmpty) { docs.prepend("@ianchor{" + title + "} " + id + "\\ilinebr @ianchor{" + relFileName + "} " + mdFileNameId + "\\ilinebr "); } else if (!generatedId.isEmpty()) { docs.prepend("@ianchor " + generatedId + "\\ilinebr "); } else if (Config_getEnum(MARKDOWN_ID_STYLE)==MARKDOWN_ID_STYLE_t::GITHUB) { QCString autoId = AnchorGenerator::instance().generate(title.str()); docs.prepend("@ianchor{" + title + "} " + autoId + "\\ilinebr "); } docs.prepend("@page "+id+" "+title+"\\ilinebr "); } for (int i = 0; i < prepend; i++) docs.prepend("\n"); break; case ExplicitPageResult::explicitPage: { // look for `@page label My Title\n` and capture `label` (match[1]) and ` My Title` (match[2]) static const reg::Ex re(R"([ ]*[\\@]page\s+(\a[\w-]*)(\s*[^\n]*)\n)"); reg::Match match; std::string s = docs.str(); if (reg::search(s,match,re)) { QCString orgLabel = match[1].str(); QCString orgTitle = match[2].str(); orgTitle = orgTitle.stripWhiteSpace(); QCString newLabel = markdownFileNameToId(fileName); docs = docs.left(match[1].position())+ // part before label newLabel+ // new label match[2].str()+ // part between orgLabel and \n "\\ilinebr @ianchor{" + orgTitle + "} "+orgLabel+"\n"+ // add original anchor plus \n of above docs.right(docs.length()-match.length()); // add remainder of docs } } break; case ExplicitPageResult::explicitMainPage: break; case ExplicitPageResult::explicitDirPage: break; } int lineNr=1; p->commentScanner.enterFile(fileName,lineNr); Protection prot = Protection::Public; bool needsEntry = false; int position=0; GuardedSectionStack guards; QCString processedDocs = markdown.process(docs,lineNr,true); while (p->commentScanner.parseCommentBlock( this, current.get(), processedDocs, fileName, lineNr, FALSE, // isBrief FALSE, // javadoc autobrief FALSE, // inBodyDocs prot, // protection position, needsEntry, true, &guards )) { if (needsEntry) { QCString docFile = current->docFile; root->moveToSubEntryAndRefresh(current); current->lang = SrcLangExt::Markdown; current->docFile = docFile; current->docLine = lineNr; } } if (needsEntry) { root->moveToSubEntryAndKeep(current); } p->commentScanner.leaveFile(fileName,lineNr); } void MarkdownOutlineParser::parsePrototype(const QCString &text) { Doxygen::parserManager->getOutlineParser("*.cpp")->parsePrototype(text); } //------------------------------------------------------------------------
111,797
C++
.cpp
3,538
26.208875
158
0.559152
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,461
sitemap.cpp
doxygen_doxygen/src/sitemap.cpp
/* * Copyright (C) 1997-2023 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 <algorithm> #include <memory> #include <string.h> #include <vector> #include <cassert> #include "config.h" #include "debug.h" #include "doxygen.h" #include "groupdef.h" #include "memberdef.h" #include "message.h" #include "sitemap.h" #include "textstream.h" #include "util.h" #include "portable.h" #include "language.h" #include "version.h" #include "containers.h" //------------------------------------------------------------------------------------------- class Sitemap::Private { public: std::ofstream docFile; TextStream doc; }; Sitemap::Sitemap() : p(std::make_unique<Private>()) {} Sitemap::~Sitemap() = default; void Sitemap::initialize() { QCString fileName = Config_getString(HTML_OUTPUT) + "/" + sitemapFileName; p->docFile = Portable::openOutputStream(fileName); if (!p->docFile.is_open()) { term("Could not open file %s for writing\n", qPrint(fileName)); } p->doc.setStream(&p->docFile); p->doc << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; p->doc << "<urlset\n"; p->doc << " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n"; p->doc << " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"; p->doc << " xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\n"; p->doc << " http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n"; } void Sitemap::finalize() { p->doc << "</urlset>\n"; p->doc.flush(); p->docFile.close(); } void Sitemap::addIndexFile(const QCString & fileName) { QCString fn = fileName; QCString sidemapUrl = Config_getString(SITEMAP_URL); addHtmlExtensionIfMissing(fn); p->doc << " <url>\n"; p->doc << " <loc>" << convertToXML(sidemapUrl + fn) << "</loc>\n"; p->doc << " </url>\n"; } //------------------------------------------------------------------------------------------- // class Crawlmap::Private { public: std::ofstream crawlFile; TextStream crawl; StringVector crawlLinks; }; Crawlmap::Crawlmap() : p(std::make_unique<Private>()) {} Crawlmap::~Crawlmap() = default; void Crawlmap::initialize() { QCString fileName = Config_getString(HTML_OUTPUT) + "/" + crawlFileName; addHtmlExtensionIfMissing(fileName); p->crawlFile = Portable::openOutputStream(fileName); if (!p->crawlFile.is_open()) { term("Could not open file %s for writing\n", qPrint(fileName)); } p->crawl.setStream(&p->crawlFile); p->crawl << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; p->crawl << "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"" + theTranslator->trISOLang() + "\">\n"; p->crawl << "<head>\n"; p->crawl << "<title>Validator / crawler helper</title>\n"; p->crawl << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n"; p->crawl << "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=11\"/>\n"; p->crawl << "<meta name=\"generator\" content=\"Doxygen " + getDoxygenVersion() + "\"/>\n"; p->crawl << "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\n"; p->crawl << "</head>\n"; p->crawl << "<body>\n"; } void Crawlmap::finalize() { std::sort(p->crawlLinks.begin(),p->crawlLinks.end()); p->crawlLinks.erase(std::unique(p->crawlLinks.begin(),p->crawlLinks.end()),p->crawlLinks.end()); for (auto &s : p->crawlLinks) { p->crawl << "<a href=\"" << s << "\"/>\n"; } p->crawl << "</body>\n"; p->crawl << "</html>\n"; p->crawl.flush(); p->crawlFile.close(); } void Crawlmap::addIndexFile(const QCString & fileName) { QCString fn = fileName; addHtmlExtensionIfMissing(fn); p->crawlLinks.push_back(fn.str()); } void Crawlmap::addContentsItem(bool, const QCString &, const QCString & ref, const QCString & file, const QCString & anchor, bool ,bool , const Definition *) { if (!file.isEmpty() && ref.isEmpty()) // made file optional param and // don't place links in crawl file imported // by tags { std::string link; if (file[0]=='!' || file[0]=='^') // special markers for user defined URLs { link+=&file[1]; } else { QCString currFile = file; addHtmlExtensionIfMissing(currFile); QCString currAnc = anchor; link += currFile.data(); if (!currAnc.isEmpty()) { link += "#"; link += currAnc.str(); } } p->crawlLinks.push_back(link); } } static QCString makeFileName(const QCString & withoutExtension) { QCString result=withoutExtension; if (!result.isEmpty()) { if (result.at(0)=='!') // relative URL -> strip marker { result=result.mid(1); } else // add specified HTML extension { addHtmlExtensionIfMissing(result); } } return result; } static QCString makeRef(const QCString & withoutExtension, const QCString & anchor) { if (withoutExtension.isEmpty()) return QCString(); QCString result = makeFileName(withoutExtension); if (anchor.isEmpty()) return result; return result+"#"+anchor; } void Crawlmap::addIndexItem(const Definition *context, const MemberDef *md, const QCString &sectionAnchor, const QCString &title) { if (context && md) // member { QCString cfname = md->getOutputFileBase(); QCString anchor = !sectionAnchor.isEmpty() ? sectionAnchor : md->anchor(); QCString ref = makeRef(cfname, anchor); p->crawlLinks.push_back(ref.str()); } else if (context) // container { QCString contRef = context->getOutputFileBase(); QCString ref = makeRef(contRef,sectionAnchor); p->crawlLinks.push_back(ref.str()); } }
6,367
C++
.cpp
190
29.484211
145
0.62768
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,462
ftvhelp.cpp
doxygen_doxygen/src/ftvhelp.cpp
/****************************************************************************** * ftvhelp.cpp,v 1.0 2000/09/06 16:09:00 * * Copyright (C) 1997-2015 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. * * Original version contributed by Kenney Wong <kwong@ea.com> * Modified by Dimitri van Heesch * * Folder Tree View for offline help on browsers that do not support HTML Help. */ #include <stdio.h> #include <stdlib.h> #include <algorithm> #include "ftvhelp.h" #include "config.h" #include "message.h" #include "doxygen.h" #include "language.h" #include "htmlgen.h" #include "layout.h" #include "pagedef.h" #include "docparser.h" #include "htmldocvisitor.h" #include "filedef.h" #include "classdef.h" #include "util.h" #include "resourcemgr.h" #include "portable.h" #include "outputlist.h" #include "threadpool.h" static int folderId=1; struct FTVNode; using FTVNodePtr = std::shared_ptr<FTVNode>; using FTVNodeWeakPtr = std::weak_ptr<FTVNode>; using FTVNodes = std::vector<FTVNodePtr>; struct FTVNode { FTVNode(bool dir,const QCString &r,const QCString &f,const QCString &a, const QCString &n,bool sepIndex,bool navIndex,const Definition *df) : isLast(TRUE), isDir(dir), ref(r), file(f), anchor(a), name(n), separateIndex(sepIndex), addToNavIndex(navIndex), def(df) {} int computeTreeDepth(int level) const; int numNodesAtLevel(int level,int maxLevel) const; bool isLast; bool isDir; QCString ref; QCString file; QCString anchor; QCString name; int index = 0; FTVNodes children; FTVNodeWeakPtr parent; bool separateIndex; bool addToNavIndex; const Definition *def; }; int FTVNode::computeTreeDepth(int level) const { int maxDepth=level; for (const auto &n : children) { if (!n->children.empty()) { int d = n->computeTreeDepth(level+1); if (d>maxDepth) maxDepth=d; } } return maxDepth; } int FTVNode::numNodesAtLevel(int level,int maxLevel) const { int num=0; if (level<maxLevel) { num++; // this node for (const auto &n : children) { num+=n->numNodesAtLevel(level+1,maxLevel); } } return num; } //---------------------------------------------------------------------------- struct FTVHelp::Private { Private(bool TLI) : topLevelIndex(TLI) { indentNodes.resize(1); } std::vector<FTVNodes> indentNodes; int indent = 0; bool topLevelIndex; void generateTree(TextStream &t,const FTVNodes &nl,int level,int maxLevel,int &index); void generateLink(TextStream &t,const FTVNodePtr &n); }; /*! Constructs an ftv help object. * The object has to be \link initialize() initialized\endlink before it can * be used. */ FTVHelp::FTVHelp(bool TLI) : p(std::make_unique<Private>(TLI)) {} FTVHelp::~FTVHelp() = default; /*! This will create a folder tree view table of contents file (tree.js). * \sa finalize() */ void FTVHelp::initialize() { } /*! Finalizes the FTV help. This will finish and close the * contents file (index.js). * \sa initialize() */ void FTVHelp::finalize() { generateTreeView(); } /*! Increase the level of the contents hierarchy. * This will start a new sublist in contents file. * \sa decContentsDepth() */ void FTVHelp::incContentsDepth() { //printf("%p: incContentsDepth() indent=%d\n",this,p->indent); p->indent++; p->indentNodes.resize(p->indent+1); } /*! Decrease the level of the contents hierarchy. * This will end the current sublist. * \sa incContentsDepth() */ void FTVHelp::decContentsDepth() { //printf("%p: decContentsDepth() indent=%d\n",this,p->indent); ASSERT(p->indent>0); if (p->indent>0) { p->indent--; auto &nl = p->indentNodes[p->indent]; if (!nl.empty()) { auto &parent = nl.back(); auto &children = p->indentNodes[p->indent+1]; for (const auto &child : children) { parent->children.push_back(child); } children.clear(); } } } /*! Add a list item to the contents file. * \param isDir TRUE if the item is a directory, FALSE if it is a text * \param name the name of the item. * \param ref the URL of to the item. * \param file the file containing the definition of the item * \param anchor the anchor within the file. * \param separateIndex put the entries in a separate index file * \param addToNavIndex add this entry to the quick navigation index * \param def Definition corresponding to this entry */ void FTVHelp::addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def ) { //printf("%p: p->indent=%d addContentsItem(%d,%s,%s,%s,%s)\n",(void*)this,p->indent,isDir,qPrint(name),qPrint(ref),qPrint(file),qPrint(anchor)); auto &nl = p->indentNodes[p->indent]; if (!nl.empty()) { nl.back()->isLast=FALSE; } auto newNode = std::make_shared<FTVNode>(isDir,ref,file,anchor,name,separateIndex,addToNavIndex,def); nl.push_back(newNode); newNode->index = static_cast<int>(nl.size()-1); if (p->indent>0) { auto &pnl = p->indentNodes[p->indent-1]; if (!pnl.empty()) { newNode->parent = pnl.back(); } } } static QCString node2URL(const FTVNodePtr &n,bool overruleFile=FALSE,bool srcLink=FALSE) { QCString url = n->file; if (!url.isEmpty() && url.at(0)=='!') // relative URL { // remove leading ! url = url.mid(1); } else if (!url.isEmpty() && url.at(0)=='^') // absolute URL { // skip, keep ^ in the output } else // local file (with optional anchor) { if (overruleFile && n->def && n->def->definitionType()==Definition::TypeFile) { const FileDef *fd = toFileDef(n->def); if (srcLink) { url = fd->getSourceFileBase(); } else { url = fd->getOutputFileBase(); } } addHtmlExtensionIfMissing(url); if (!n->anchor.isEmpty()) url+="#"+n->anchor; } return url; } static QCString generateIndentLabel(const FTVNodePtr &n,int level) { QCString result; auto parent = n->parent.lock(); if (parent) { result=generateIndentLabel(parent,level+1); } result+=QCString().setNum(n->index)+"_"; return result; } static void generateIndent(TextStream &t, const FTVNodePtr &n,bool opened) { int indent=0; auto parent = n->parent.lock(); while (parent) { indent++; parent=parent->parent.lock(); } if (n->isDir) { QCString dir = opened ? "&#9660;" : "&#9658;"; t << "<span style=\"width:" << (indent*16) << "px;display:inline-block;\">&#160;</span>" << "<span id=\"arr_" << generateIndentLabel(n,0) << "\" class=\"arrow\" "; t << "onclick=\"dynsection.toggleFolder('" << generateIndentLabel(n,0) << "')\""; t << ">" << dir << "</span>"; } else { t << "<span style=\"width:" << ((indent+1)*16) << "px;display:inline-block;\">&#160;</span>"; } } void FTVHelp::Private::generateLink(TextStream &t,const FTVNodePtr &n) { //printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n", // qPrint(n->ref),qPrint(n->file),qPrint(n->anchor)); bool setTarget = FALSE; if (n->file.isEmpty()) // no link { t << "<b>" << convertToHtml(n->name) << "</b>"; } else // link into other frame { if (!n->ref.isEmpty()) // link to entity imported via tag file { t << "<a class=\"elRef\" "; QCString result = externalLinkTarget(); if (result != "") setTarget = TRUE; t << result; } else // local link { t << "<a class=\"el\" "; } t << "href=\""; t << externalRef("",n->ref,TRUE); t << node2URL(n); if (!setTarget) { if (topLevelIndex) t << "\" target=\"basefrm\">"; else t << "\" target=\"_self\">"; } else { t << "\">"; } t << convertToHtml(n->name); t << "</a>"; if (!n->ref.isEmpty()) { t << "&#160;[external]"; } } } static void generateBriefDoc(TextStream &t,const Definition *def) { QCString brief = def->briefDescription(TRUE); //printf("*** %p: generateBriefDoc(%s)='%s'\n",def,qPrint(def->name()),qPrint(brief)); if (!brief.isEmpty()) { auto parser { createDocParser() }; auto ast { validatingParseDoc(*parser.get(), def->briefFile(),def->briefLine(), def,nullptr,brief,FALSE,FALSE, QCString(),TRUE,TRUE,Config_getBool(MARKDOWN_SUPPORT)) }; const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST*>(ast.get()); if (astImpl) { QCString relPath = relativePathToRoot(def->getOutputFileBase()); OutputCodeList htmlList; htmlList.add<HtmlCodeGenerator>(&t,relPath); HtmlDocVisitor visitor(t,htmlList,def); std::visit(visitor,astImpl->root); } } } static char compoundIcon(const ClassDef *cd) { char icon='C'; if (cd->getLanguage() == SrcLangExt::Slice) { if (cd->compoundType()==ClassDef::Interface) { icon='I'; } else if (cd->compoundType()==ClassDef::Struct) { icon='S'; } else if (cd->compoundType()==ClassDef::Exception) { icon='E'; } } return icon; } void FTVHelp::Private::generateTree(TextStream &t, const FTVNodes &nl,int level,int maxLevel,int &index) { for (const auto &n : nl) { t << "<tr id=\"row_" << generateIndentLabel(n,0) << "\""; if ((index&1)==0) // even row t << " class=\"even\""; else t << " class=\"odd\""; if (level>=maxLevel) // item invisible by default t << " style=\"display:none;\""; else // item visible by default index++; t << "><td class=\"entry\">"; bool nodeOpened = level+1<maxLevel; generateIndent(t,n,nodeOpened); if (n->isDir) { if (n->def && n->def->definitionType()==Definition::TypeGroup) { // no icon } else if (n->def && n->def->definitionType()==Definition::TypePage) { // no icon } else if (n->def && n->def->definitionType()==Definition::TypeNamespace) { if ((n->def->getLanguage() == SrcLangExt::Slice) || (n->def->getLanguage() == SrcLangExt::Fortran)) { t << "<span class=\"icona\"><span class=\"icon\">M</span></span>"; } else if ((n->def->getLanguage() == SrcLangExt::Java) || (n->def->getLanguage() == SrcLangExt::VHDL)) { t << "<span class=\"icona\"><span class=\"icon\">P</span></span>"; } else { t << "<span class=\"icona\"><span class=\"icon\">N</span></span>"; } } else if (n->def && n->def->definitionType()==Definition::TypeModule) { t << "<span class=\"icona\"><span class=\"icon\">M</span></span>"; } else if (n->def && n->def->definitionType()==Definition::TypeClass) { char icon=compoundIcon(toClassDef(n->def)); t << "<span class=\"icona\"><span class=\"icon\">" << icon << "</span></span>"; } else { t << "<span id=\"img_" << generateIndentLabel(n,0) << "\" class=\"iconf" << (nodeOpened?"open":"closed") << "\" onclick=\"dynsection.toggleFolder('" << generateIndentLabel(n,0) << "')\">&#160;</span>"; } generateLink(t,n); t << "</td><td class=\"desc\">"; if (n->def) { generateBriefDoc(t,n->def); } t << "</td></tr>\n"; folderId++; generateTree(t,n->children,level+1,maxLevel,index); } else // leaf node { const FileDef *srcRef=nullptr; if (n->def && n->def->definitionType()==Definition::TypeFile && (toFileDef(n->def))->generateSourceFile()) { srcRef = toFileDef(n->def); } if (srcRef) { QCString fn=srcRef->getSourceFileBase(); addHtmlExtensionIfMissing(fn); t << "<a href=\"" << fn << "\">"; } if (n->def && n->def->definitionType()==Definition::TypeGroup) { // no icon } else if (n->def && n->def->definitionType()==Definition::TypePage) { // no icon } else if (n->def && n->def->definitionType()==Definition::TypeNamespace) { if ((n->def->getLanguage() == SrcLangExt::Slice) || (n->def->getLanguage() == SrcLangExt::Fortran)) { t << "<span class=\"icona\"><span class=\"icon\">M</span></span>"; } else if ((n->def->getLanguage() == SrcLangExt::Java) || (n->def->getLanguage() == SrcLangExt::VHDL)) { t << "<span class=\"icona\"><span class=\"icon\">P</span></span>"; } else { t << "<span class=\"icona\"><span class=\"icon\">N</span></span>"; } } else if (n->def && n->def->definitionType()==Definition::TypeModule) { t << "<span class=\"icona\"><span class=\"icon\">M</span></span>"; } else if (n->def && n->def->definitionType()==Definition::TypeClass) { char icon=compoundIcon(toClassDef(n->def)); t << "<span class=\"icona\"><span class=\"icon\">" << icon << "</span></span>"; } else if (n->def && n->def->definitionType()==Definition::TypeConcept) { t << "<span class=\"icona\"><span class=\"icon\">R</span></span>"; } else if (n->def && n->def->definitionType()==Definition::TypeDir) { t << "<span class=\"iconfclosed\"></span>"; } else { t << "<span class=\"icondoc\"></span>"; } if (srcRef) { t << "</a>"; } generateLink(t,n); t << "</td><td class=\"desc\">"; if (n->def) { generateBriefDoc(t,n->def); } t << "</td></tr>\n"; } } } //----------------------------------------------------------- struct NavIndexEntry { NavIndexEntry(const QCString &u,const QCString &p) : url(u), path(p) {} QCString url; QCString path; }; class NavIndexEntryList : public std::vector<NavIndexEntry> { }; static QCString pathToNode(const FTVNodePtr &leaf,const FTVNodePtr &n) { QCString result; auto parent = n->parent.lock(); if (parent) { result+=pathToNode(leaf,parent); } result+=QCString().setNum(n->index); if (leaf!=n) result+=","; return result; } static bool dupOfParent(const FTVNodePtr &n) { auto parent = n->parent.lock(); if (!parent) return FALSE; if (n->file==parent->file) return TRUE; return FALSE; } static void generateJSLink(TextStream &t,const FTVNodePtr &n) { if (n->file.isEmpty()) // no link { t << "\"" << convertToJSString(n->name) << "\", null, "; } else // link into other page { QCString result = n->name; if (Config_getBool(HIDE_SCOPE_NAMES)) result=stripScope(result); t << "\"" << convertToJSString(result) << "\", \""; t << externalRef("",n->ref,TRUE); t << node2URL(n); t << "\", "; } } static QCString convertFileId2Var(const QCString &fileId) { QCString varId = fileId; int i=varId.findRev('/'); if (i>=0) varId = varId.mid(i+1); return substitute(varId,"-","_"); } struct JSTreeFile { JSTreeFile(const QCString &fi,const FTVNodePtr &n) : fileId(fi), node(n) {} QCString fileId; FTVNodePtr node; }; using JSTreeFiles = std::vector<JSTreeFile>; static void collectJSTreeFiles(const FTVNodes &nl,JSTreeFiles &files) { QCString htmlOutput = Config_getString(HTML_OUTPUT); for (const auto &n : nl) { if (n->separateIndex) // add new file if there are children { if (!n->children.empty()) { QCString fileId = n->file; files.emplace_back(fileId,n); collectJSTreeFiles(n->children,files); } } else // traverse without adding a new file { collectJSTreeFiles(n->children,files); } } } static std::mutex g_navIndexMutex; static bool generateJSTree(NavIndexEntryList &navIndex,TextStream &t, const FTVNodes &nl,int level,bool &first) { QCString htmlOutput = Config_getString(HTML_OUTPUT); QCString indentStr; indentStr.fill(' ',level*2); bool found=FALSE; for (const auto &n : nl) { // terminate previous entry if (!first) t << ",\n"; first=FALSE; // start entry if (!found) { t << "[\n"; } found=TRUE; if (n->addToNavIndex) // add entry to the navigation index { std::lock_guard lock(g_navIndexMutex); if (n->def && n->def->definitionType()==Definition::TypeFile) { const FileDef *fd = toFileDef(n->def); bool src = false; bool doc = fileVisibleInIndex(fd,src); if (doc) { navIndex.emplace_back(node2URL(n,TRUE,FALSE),pathToNode(n,n)); } if (src) { navIndex.emplace_back(node2URL(n,TRUE,TRUE),pathToNode(n,n)); } } else { navIndex.emplace_back(node2URL(n),pathToNode(n,n)); } } if (n->separateIndex) // store items in a separate file for dynamic loading { t << indentStr << " [ "; generateJSLink(t,n); if (!n->children.empty()) // write children to separate file for dynamic loading { QCString fileId = n->file; if (!n->anchor.isEmpty()) { fileId+="_"+n->anchor; } if (dupOfParent(n)) { fileId+="_dup"; } t << "\"" << fileId << "\" ]"; } else // no children { t << "null ]"; } } else // show items in this file { bool firstChild=TRUE; t << indentStr << " [ "; generateJSLink(t,n); bool emptySection = !generateJSTree(navIndex,t,n->children,level+1,firstChild); if (emptySection) t << "null ]"; else t << "\n" << indentStr << " ] ]"; } } return found; } static void generateJSTreeFiles(NavIndexEntryList &navIndex,TextStream &t,const FTVNodes &nodeList) { QCString htmlOutput = Config_getString(HTML_OUTPUT); auto getVarName = [](const FTVNodePtr n) { QCString fileId = n->file; if (!n->anchor.isEmpty()) fileId+="_"+n->anchor; if (dupOfParent(n)) fileId+="_dup"; return fileId; }; auto generateJSFile = [&](const JSTreeFile &tf) { QCString fileId = getVarName(tf.node); QCString fileName = htmlOutput+"/"+fileId+".js"; std::ofstream ff = Portable::openOutputStream(fileName); if (ff.is_open()) { bool firstChild = true; TextStream tt(&ff); tt << "var " << convertFileId2Var(fileId) << " =\n"; generateJSTree(navIndex,tt,tf.node->children,1,firstChild); tt << "\n];"; } }; JSTreeFiles jsTreeFiles; collectJSTreeFiles(nodeList,jsTreeFiles); std::size_t numThreads = static_cast<std::size_t>(Config_getInt(NUM_PROC_THREADS)); if (numThreads>1) // multi threaded version { ThreadPool threadPool(numThreads); std::vector< std::future<void> > results; for (const auto &tf : jsTreeFiles) { results.emplace_back(threadPool.queue([&](){ generateJSFile(tf); })); } // wait for the results for (auto &f : results) f.get(); } else // single threaded version { for (const auto &tf : jsTreeFiles) { generateJSFile(tf); } } } static void generateJSNavTree(const FTVNodes &nodeList) { QCString htmlOutput = Config_getString(HTML_OUTPUT); std::ofstream f = Portable::openOutputStream(htmlOutput+"/navtreedata.js"); NavIndexEntryList navIndex; if (f.is_open()) { TextStream t(&f); //TextStream tidx(&fidx); //tidx << "var NAVTREEINDEX =\n"; //tidx << "{\n"; t << JAVASCRIPT_LICENSE_TEXT; t << "var NAVTREE =\n"; t << "[\n"; t << " [ "; QCString projName = Config_getString(PROJECT_NAME); if (projName.isEmpty()) { if (mainPageHasTitle()) // Use title of main page as root { t << "\"" << convertToJSString(Doxygen::mainPage->title()) << "\", "; } else // Use default section title as root { LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::MainPage); t << "\"" << convertToJSString(lne->title()) << "\", "; } } else // use PROJECT_NAME as root tree element { t << "\"" << convertToJSString(projName) << "\", "; } t << "\"index" << Doxygen::htmlFileExtension << "\", "; // add special entry for index page navIndex.emplace_back("index"+Doxygen::htmlFileExtension,""); // related page index is written as a child of index.html, so add this as well navIndex.emplace_back("pages"+Doxygen::htmlFileExtension,""); bool first=TRUE; generateJSTree(navIndex,t,nodeList,1,first); generateJSTreeFiles(navIndex,t,nodeList); if (first) t << "]\n"; else t << "\n ] ]\n"; t << "];\n\n"; // write the navigation index (and sub-indices) std::stable_sort(navIndex.begin(),navIndex.end(),[](const auto &n1,const auto &n2) { return !n1.url.isEmpty() && (n2.url.isEmpty() || (n1.url<n2.url)); }); int subIndex=0; int elemCount=0; const int maxElemCount=250; std::ofstream tsidx = Portable::openOutputStream(htmlOutput+"/navtreeindex0.js"); if (tsidx.is_open()) { t << "var NAVTREEINDEX =\n"; t << "[\n"; tsidx << "var NAVTREEINDEX" << subIndex << " =\n"; tsidx << "{\n"; first=TRUE; auto it = navIndex.begin(); while (it!=navIndex.end()) { const NavIndexEntry &e = *it; if (elemCount==0) { if (!first) { t << ",\n"; } else { first=FALSE; } t << "\"" << e.url << "\""; } tsidx << "\"" << e.url << "\":[" << e.path << "]"; ++it; if (it!=navIndex.end() && elemCount<maxElemCount-1) tsidx << ","; // not last entry tsidx << "\n"; elemCount++; if (it!=navIndex.end() && elemCount>=maxElemCount) // switch to new sub-index { tsidx << "};\n"; elemCount=0; tsidx.close(); subIndex++; QCString fileName = htmlOutput+"/navtreeindex"+QCString().setNum(subIndex)+".js"; tsidx = Portable::openOutputStream(fileName); if (!tsidx.is_open()) break; tsidx << "var NAVTREEINDEX" << subIndex << " =\n"; tsidx << "{\n"; } } tsidx << "};\n"; t << "\n];\n"; } t << "\nvar SYNCONMSG = '" << theTranslator->trPanelSynchronisationTooltip(FALSE) << "';"; t << "\nvar SYNCOFFMSG = '" << theTranslator->trPanelSynchronisationTooltip(TRUE) << "';"; } auto &mgr = ResourceMgr::instance(); { std::ofstream fn = Portable::openOutputStream(htmlOutput+"/navtree.js"); if (fn.is_open()) { TextStream t(&fn); t << substitute(mgr.getAsString("navtree.js"),"$PROJECTID",getProjectId()); } } } //----------------------------------------------------------- // new style images void FTVHelp::generateTreeViewImages() { QCString dname=Config_getString(HTML_OUTPUT); const ResourceMgr &rm = ResourceMgr::instance(); rm.copyResource("doc.svg",dname); rm.copyResource("docd.svg",dname); rm.copyResource("folderopen.svg",dname); rm.copyResource("folderopend.svg",dname); rm.copyResource("folderclosed.svg",dname); rm.copyResource("folderclosedd.svg",dname); rm.copyResource("splitbar.lum",dname); rm.copyResource("splitbard.lum",dname); } // new style scripts void FTVHelp::generateTreeViewScripts() { QCString htmlOutput = Config_getString(HTML_OUTPUT); // generate navtree.js & navtreeindex.js generateJSNavTree(p->indentNodes[0]); } // write tree inside page void FTVHelp::generateTreeViewInline(TextStream &t) { int preferredNumEntries = Config_getInt(HTML_INDEX_NUM_ENTRIES); t << "<div class=\"directory\">\n"; int d=1, depth=1; for (const auto &n : p->indentNodes[0]) { if (!n->children.empty()) { d = n->computeTreeDepth(2); if (d>depth) depth=d; } } int preferredDepth = depth; // write level selector if (depth>1) { t << "<div class=\"levels\">["; t << theTranslator->trDetailLevel(); t << " "; for (int i=1;i<=depth;i++) { t << "<span onclick=\"javascript:dynsection.toggleLevel(" << i << ");\">" << i << "</span>"; } t << "]</div>"; if (preferredNumEntries>0) { preferredDepth=1; for (int i=1;i<=depth;i++) { int num=0; for (const auto &n : p->indentNodes[0]) { num+=n->numNodesAtLevel(0,i); } if (num<=preferredNumEntries) { preferredDepth=i; } else { break; } } } } //printf("preferred depth=%d\n",preferredDepth); if (!p->indentNodes[0].empty()) { t << "<table class=\"directory\">\n"; int index=0; p->generateTree(t,p->indentNodes[0],0,preferredDepth,index); t << "</table>\n"; } t << "</div><!-- directory -->\n"; } // write old style index.html and tree.html void FTVHelp::generateTreeView() { generateTreeViewImages(); generateTreeViewScripts(); }
25,936
C++
.cpp
877
24.258837
146
0.587214
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,463
conceptdef.cpp
doxygen_doxygen/src/conceptdef.cpp
/****************************************************************************** * * Copyright (C) 1997-2021 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 "conceptdef.h" #include "definitionimpl.h" #include "util.h" #include "config.h" #include "doxygen.h" #include "language.h" #include "outputlist.h" #include "searchindex.h" #include "message.h" #include "parserintf.h" #include "layout.h" #include "namespacedef.h" //------------------------------------------------------------------------------------ class ConceptDefImpl : public DefinitionMixin<ConceptDefMutable> { public: ConceptDefImpl(const QCString &fileName,int startLine,int startColumn, const QCString &name,const QCString &tagRef=QCString(),const QCString &tagFile=QCString()); ~ConceptDefImpl() override; NON_COPYABLE(ConceptDefImpl) //---------- ConceptDef DefType definitionType() const override; CodeSymbolType codeSymbolType() const override { return CodeSymbolType::Concept; } QCString getOutputFileBase() const override; bool hasDetailedDescription() const override; QCString displayName(bool includeScope=true) const override; const IncludeInfo *includeInfo() const override; ArgumentList getTemplateParameterList() const override; QCString anchor() const override; bool isLinkableInProject() const override; bool isLinkable() const override; QCString initializer() const override; void writeDeclarationLink(OutputList &ol,bool &found, const QCString &header,bool localNames) const override; const NamespaceDef *getNamespaceDef() const override; const FileDef *getFileDef() const override; const ModuleDef *getModuleDef() const override; QCString title() const override; int groupId() const override; //---------- ConceptDefMutable void setIncludeFile(FileDef *fd,const QCString &incName,bool local,bool force) override; void setTemplateArguments(const ArgumentList &al) override; void setNamespace(NamespaceDef *nd) override; void setFileDef(FileDef *fd) override; void setModuleDef(ModuleDef *mod) override; void writeTagFile(TextStream &) override; void writeDocumentation(OutputList &) override; void setInitializer(const QCString &init) override; void findSectionsInDocumentation() override; void setGroupId(int id) override; //---------- Helpers void writeBriefDescription(OutputList &) const; void writeAuthorSection(OutputList &ol) const; void writeIncludeFiles(OutputList &ol) const; void writeDetailedDescription(OutputList &ol,const QCString &title) const; void writeDefinition(OutputList &ol,const QCString &title) const; void addConceptAttributes(OutputList &ol) const; private: QCString m_fileName; std::unique_ptr<IncludeInfo> m_incInfo; NamespaceDef *m_nspace = nullptr; FileDef *m_fileDef = nullptr; ModuleDef *m_moduleDef = nullptr; ArgumentList m_tArgList; QCString m_initializer; int m_groupId = -1; }; std::unique_ptr<ConceptDef> createConceptDef( const QCString &fileName,int startLine,int startColumn, const QCString &name, const QCString &tagRef,const QCString &tagFile) { return std::make_unique<ConceptDefImpl>(fileName,startLine,startColumn,name,tagRef,tagFile); } //------------------------------------------------------------------------------------ class ConceptDefAliasImpl : public DefinitionAliasMixin<ConceptDef> { public: ConceptDefAliasImpl(const Definition *newScope,const ConceptDef *cd) : DefinitionAliasMixin(newScope,cd) { init(); } ~ConceptDefAliasImpl() override { deinit(); } NON_COPYABLE(ConceptDefAliasImpl) const ConceptDef *getCdAlias() const { return toConceptDef(getAlias()); } DefType definitionType() const override { return TypeConcept; } CodeSymbolType codeSymbolType() const override { return getCdAlias()->codeSymbolType(); } QCString getOutputFileBase() const override { return getCdAlias()->getOutputFileBase(); } QCString getReference() const override { return getCdAlias()->getReference(); } bool isReference() const override { return getCdAlias()->isReference(); } bool hasDetailedDescription() const override { return getCdAlias()->hasDetailedDescription(); } QCString displayName(bool includeScope=true) const override { return getCdAlias()->displayName(includeScope); } const IncludeInfo *includeInfo() const override { return getCdAlias()->includeInfo(); } ArgumentList getTemplateParameterList() const override { return getCdAlias()->getTemplateParameterList(); } QCString anchor() const override { return getCdAlias()->anchor(); } bool isLinkableInProject() const override { return getCdAlias()->isLinkableInProject(); } bool isLinkable() const override { return getCdAlias()->isLinkable(); } QCString initializer() const override { return getCdAlias()->initializer(); } const NamespaceDef *getNamespaceDef() const override { return getCdAlias()->getNamespaceDef(); } const FileDef *getFileDef() const override { return getCdAlias()->getFileDef(); } const ModuleDef *getModuleDef() const override { return getCdAlias()->getModuleDef(); } QCString title() const override { return getCdAlias()->title(); } void writeDeclarationLink(OutputList &ol,bool &found, const QCString &header,bool localNames) const override { getCdAlias()->writeDeclarationLink(ol,found,header,localNames); } int groupId() const override { return getCdAlias()->groupId(); } }; std::unique_ptr<ConceptDef> createConceptDefAlias(const Definition *newScope,const ConceptDef *cd) { return std::make_unique<ConceptDefAliasImpl>(newScope,cd); } //------------------------------------------------------------------------------------ ConceptDefImpl::ConceptDefImpl(const QCString &fileName,int startLine,int startColumn, const QCString &name,const QCString &tagRef,const QCString &tagFile) : DefinitionMixin(fileName,startLine,startColumn,name) { if (!tagFile.isEmpty()) { if (!tagRef.isEmpty()) { m_fileName = stripExtension(tagFile); } else { m_fileName = convertNameToFile(stripExtension(tagFile)); } } else { m_fileName = convertNameToFile(QCString("concept")+name); } setReference(tagRef); } ConceptDefImpl::~ConceptDefImpl() { } Definition::DefType ConceptDefImpl::definitionType() const { return TypeConcept; } QCString ConceptDefImpl::getOutputFileBase() const { return m_fileName; } bool ConceptDefImpl::hasDetailedDescription() const { bool repeatBrief = Config_getBool(REPEAT_BRIEF); bool sourceBrowser = Config_getBool(SOURCE_BROWSER); return ((!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty() || (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef())); } QCString ConceptDefImpl::anchor() const { return ""; } QCString ConceptDefImpl::displayName(bool includeScope) const { return includeScope ? name() : localName(); } const IncludeInfo *ConceptDefImpl::includeInfo() const { return m_incInfo.get(); } ArgumentList ConceptDefImpl::getTemplateParameterList() const { return m_tArgList; } bool ConceptDefImpl::isLinkableInProject() const { bool hideUndoc = Config_getBool(HIDE_UNDOC_CLASSES); return (hasDocumentation() || !hideUndoc) && /* documented */ !isHidden() && /* not hidden */ !isReference(); /* not an external reference */ } bool ConceptDefImpl::isLinkable() const { return isLinkableInProject() || isReference(); } void ConceptDefImpl::setIncludeFile(FileDef *fd,const QCString &incName,bool local,bool force) { if (!m_incInfo) m_incInfo = std::make_unique<IncludeInfo>(); if ((!incName.isEmpty() && m_incInfo->includeName.isEmpty()) || (fd!=nullptr && m_incInfo->fileDef==nullptr) ) { m_incInfo->fileDef = fd; m_incInfo->includeName = incName; m_incInfo->kind = local ? IncludeKind::IncludeLocal : IncludeKind::IncludeSystem; } if (force && !incName.isEmpty()) { m_incInfo->includeName = incName; m_incInfo->kind = local ? IncludeKind::IncludeLocal : IncludeKind::IncludeSystem; } } void ConceptDefImpl::setTemplateArguments(const ArgumentList &al) { m_tArgList = al; } void ConceptDefImpl::setNamespace(NamespaceDef *nd) { m_nspace = nd; } const NamespaceDef *ConceptDefImpl::getNamespaceDef() const { return m_nspace; } void ConceptDefImpl::setFileDef(FileDef *fd) { m_fileDef=fd; } void ConceptDefImpl::setModuleDef(ModuleDef *mod) { m_moduleDef=mod; } const FileDef *ConceptDefImpl::getFileDef() const { return m_fileDef; } const ModuleDef *ConceptDefImpl::getModuleDef() const { return m_moduleDef; } QCString ConceptDefImpl::title() const { return theTranslator->trConceptReference(displayName()); } int ConceptDefImpl::groupId() const { return m_groupId; } void ConceptDefImpl::setGroupId(int id) { m_groupId = id; } void ConceptDefImpl::writeTagFile(TextStream &tagFile) { tagFile << " <compound kind=\"concept\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; QCString fn = getOutputFileBase(); addHtmlExtensionIfMissing(fn); tagFile << " <filename>" << convertToXML(fn) << "</filename>\n"; QCString idStr = id(); if (!idStr.isEmpty()) { tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>\n"; } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>\n"; } void ConceptDefImpl::writeBriefDescription(OutputList &ol) const { if (hasBriefDescription()) { auto parser { createDocParser() }; auto ast { validatingParseDoc( *parser.get(),briefFile(),briefLine(),this,nullptr, briefDescription(),TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) }; if (!ast->isEmpty()) { ol.startParagraph(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.writeString(" - "); ol.popGeneratorState(); ol.writeDoc(ast.get(),this,nullptr); ol.pushGeneratorState(); ol.disable(OutputType::RTF); ol.writeString(" \n"); ol.enable(OutputType::RTF); if (hasDetailedDescription()) { ol.disableAllBut(OutputType::Html); ol.startTextLink(getOutputFileBase(),"details"); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } ol.popGeneratorState(); ol.endParagraph(); } } ol.writeSynopsis(); } void ConceptDefImpl::writeIncludeFiles(OutputList &ol) const { if (m_incInfo) { QCString nm=m_incInfo->includeName.isEmpty() ? (m_incInfo->fileDef ? m_incInfo->fileDef->docName() : QCString() ) : m_incInfo->includeName; if (!nm.isEmpty()) { ol.startParagraph(); ol.startTypewriter(); ol.docify(::includeStatement(SrcLangExt::Cpp,m_incInfo->kind)); ol.docify(::includeOpen(SrcLangExt::Cpp,m_incInfo->kind)); ol.pushGeneratorState(); ol.disable(OutputType::Html); ol.docify(nm); ol.disableAllBut(OutputType::Html); ol.enable(OutputType::Html); if (m_incInfo->fileDef) { ol.writeObjectLink(QCString(),m_incInfo->fileDef->includeName(),QCString(),nm); } else { ol.docify(nm); } ol.popGeneratorState(); ol.docify(::includeClose(SrcLangExt::Cpp,m_incInfo->kind)); ol.endTypewriter(); ol.endParagraph(); } } } static QCString templateSpec(const ArgumentList &al) { TextStream t; t << "template<"; bool first=true; for (const auto &a : al) { if (!first) t << ", "; t << a.type; if (!a.name.isEmpty()) { t << " " << a.name; } if (a.defval.length()!=0) { t << " " << a.defval; } first=false; } t << ">"; return t.str(); } void ConceptDefImpl::setInitializer(const QCString &init) { m_initializer = templateSpec(m_tArgList)+"\nconcept "+name()+" = "+init; } QCString ConceptDefImpl::initializer() const { return m_initializer; } void ConceptDefImpl::writeDefinition(OutputList &ol,const QCString &title) const { ol.startGroupHeader(); ol.parseText(title); ol.endGroupHeader(); auto intf = Doxygen::parserManager->getCodeParser(".cpp"); intf->resetCodeParserState(); auto &codeOL = ol.codeGenerators(); codeOL.startCodeFragment("DoxyCode"); QCString scopeName; if (getOuterScope()!=Doxygen::globalScope) scopeName=getOuterScope()->name(); TextStream conceptDef; conceptDef << m_initializer; intf->parseCode(codeOL,scopeName,conceptDef.str(),SrcLangExt::Cpp,Config_getBool(STRIP_CODE_COMMENTS),false,QCString(), m_fileDef, -1,-1,true,nullptr,false,this); codeOL.endCodeFragment("DoxyCode"); } void ConceptDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) const { bool repeatBrief = Config_getBool(REPEAT_BRIEF); if (hasDetailedDescription()) { ol.pushGeneratorState(); ol.disable(OutputType::Html); ol.writeRuler(); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); ol.endGroupHeader(); ol.startTextBlock(); // repeat brief description if (!briefDescription().isEmpty() && repeatBrief) { ol.generateDoc(briefFile(),briefLine(),this,nullptr,briefDescription(),FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!briefDescription().isEmpty() && repeatBrief && !documentation().isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputType::Html); ol.writeString("\n\n"); ol.popGeneratorState(); } // write documentation if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,nullptr,documentation(),TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } writeSourceDef(ol); ol.endTextBlock(); } } void ConceptDefImpl::writeAuthorSection(OutputList &ol) const { // write Author section (Man only) ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.startGroupHeader(); ol.parseText(theTranslator->trAuthor(TRUE,TRUE)); ol.endGroupHeader(); ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString(PROJECT_NAME))); ol.popGeneratorState(); } void ConceptDefImpl::addConceptAttributes(OutputList &ol) const { if (isExported()) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.startLabels(); ol.writeLabel("export",false); ol.endLabels(); ol.popGeneratorState(); } } void ConceptDefImpl::writeDocumentation(OutputList &ol) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); QCString pageTitle = theTranslator->trConceptReference(displayName()); startFile(ol,getOutputFileBase(),name(),pageTitle,HighlightedItem::ConceptVisible,!generateTreeView); // ---- navigation part if (!generateTreeView) { if (getOuterScope()!=Doxygen::globalScope) { writeNavigationPath(ol); } ol.endQuickIndices(); } // ---- title part startTitle(ol,getOutputFileBase(),this); ol.parseText(pageTitle); addConceptAttributes(ol); addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),displayName()); // ---- contents part ol.startContents(); //---------------------------------------- start flexible part ------------------------------- for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Concept)) { const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get()); switch (lde->kind()) { case LayoutDocEntry::BriefDesc: writeBriefDescription(ol); break; case LayoutDocEntry::ConceptDefinition: if (ls) writeDefinition(ol,ls->title(getLanguage())); break; case LayoutDocEntry::DetailedDesc: if (ls) writeDetailedDescription(ol,ls->title(getLanguage())); break; case LayoutDocEntry::AuthorSection: writeAuthorSection(ol); break; case LayoutDocEntry::ClassIncludes: writeIncludeFiles(ol); break; case LayoutDocEntry::MemberDeclStart: case LayoutDocEntry::NamespaceClasses: case LayoutDocEntry::NamespaceInterfaces: case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceConcepts: case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::MemberGroups: case LayoutDocEntry::MemberDecl: case LayoutDocEntry::MemberDeclEnd: case LayoutDocEntry::MemberDefStart: case LayoutDocEntry::NamespaceInlineClasses: case LayoutDocEntry::MemberDef: case LayoutDocEntry::MemberDefEnd: case LayoutDocEntry::ClassInheritanceGraph: case LayoutDocEntry::ClassNestedClasses: case LayoutDocEntry::ClassCollaborationGraph: case LayoutDocEntry::ClassAllMembersLink: case LayoutDocEntry::ClassUsedFiles: case LayoutDocEntry::ClassInlineClasses: case LayoutDocEntry::FileClasses: case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: case LayoutDocEntry::FileNamespaces: case LayoutDocEntry::FileConstantGroups: case LayoutDocEntry::FileIncludes: case LayoutDocEntry::FileIncludeGraph: case LayoutDocEntry::FileIncludedByGraph: case LayoutDocEntry::FileInlineClasses: case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::GroupClasses: case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupModules: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: case LayoutDocEntry::GroupNestedGroups: case LayoutDocEntry::GroupFiles: case LayoutDocEntry::GroupGraph: case LayoutDocEntry::GroupPageDocs: case LayoutDocEntry::ModuleExports: case LayoutDocEntry::ModuleClasses: case LayoutDocEntry::ModuleConcepts: case LayoutDocEntry::ModuleUsedFiles: case LayoutDocEntry::DirSubDirs: case LayoutDocEntry::DirFiles: case LayoutDocEntry::DirGraph: err("Internal inconsistency: member %d should not be part of " "LayoutDocManager::Concept entry list\n",lde->kind()); break; } } //---------------------------------------- end flexible part ------------------------------- ol.endContents(); endFileWithNavPath(ol,this); } void ConceptDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const QCString &header,bool localNames) const { if (isLinkable()) { if (!found) // first concept { ol.startMemberHeader("concepts"); if (!header.isEmpty()) { ol.parseText(header); } else { theTranslator->trConcept(true,false); } ol.endMemberHeader(); ol.startMemberList(); found=TRUE; } ol.startMemberDeclaration(); ol.startMemberItem(anchor(),OutputGenerator::MemberItemType::Normal); ol.writeString("concept "); QCString cname = displayName(!localNames); ol.insertMemberAlign(); if (isLinkable()) { ol.writeObjectLink(getReference(), getOutputFileBase(), anchor(), cname ); } else { ol.startBold(); ol.docify(cname); ol.endBold(); } ol.endMemberItem(OutputGenerator::MemberItemType::Normal); // add the brief description if available if (!briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { auto parser { createDocParser() }; auto ast { validatingParseDoc( *parser.get(),briefFile(),briefLine(),this,nullptr, briefDescription(),FALSE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) }; if (!ast->isEmpty()) { ol.startMemberDescription(anchor()); ol.writeDoc(ast.get(),this,nullptr); ol.endMemberDescription(); } } ol.endMemberDeclaration(anchor(),QCString()); } } void ConceptDefImpl::findSectionsInDocumentation() { docFindSections(briefDescription(),this,docFile()); docFindSections(documentation(),this,docFile()); docFindSections(inbodyDocumentation(),this,docFile()); } //------------------------------------------------------------------------------------ bool ConceptLinkedRefMap::declVisible() const { bool hideUndocClasses = Config_getBool(HIDE_UNDOC_CLASSES); for (const auto &cd : *this) { bool isLink = cd->isLinkable(); if (isLink || !hideUndocClasses) { return true; } } return false; } void ConceptLinkedRefMap::writeDeclaration(OutputList &ol,const QCString &header,bool localNames) const { bool found=FALSE; for (const auto &cd : *this) { cd->writeDeclarationLink(ol,found,header,localNames); } if (found) ol.endMemberList(); } //------------------------------------------------------------------------------------ // --- Cast functions // ConceptDef *toConceptDef(Definition *d) { if (d && (typeid(*d)==typeid(ConceptDefImpl) || typeid(*d)==typeid(ConceptDefAliasImpl))) { return static_cast<ConceptDef*>(d); } else { return nullptr; } } ConceptDef *toConceptDef(DefinitionMutable *md) { Definition *d = toDefinition(md); if (d && typeid(*d)==typeid(ConceptDefImpl)) { return static_cast<ConceptDef*>(d); } else { return nullptr; } } const ConceptDef *toConceptDef(const Definition *d) { if (d && (typeid(*d)==typeid(ConceptDefImpl) || typeid(*d)==typeid(ConceptDefAliasImpl))) { return static_cast<const ConceptDef*>(d); } else { return nullptr; } } ConceptDefMutable *toConceptDefMutable(Definition *d) { if (d && typeid(*d)==typeid(ConceptDefImpl)) { return static_cast<ConceptDefMutable*>(d); } else { return nullptr; } } // -- helpers ConceptDef *getConcept(const QCString &n) { if (n.isEmpty()) return nullptr; return Doxygen::conceptLinkedMap->find(n); } ConceptDef *getResolvedConcept(const Definition *d,const QCString &name) { ConceptDef *cd=nullptr; while (d && d!=Doxygen::globalScope) { cd = getConcept(d->name()+"::"+name); if (cd) return cd; d = d->getOuterScope(); } cd = getConcept(name); return cd; }
23,599
C++
.cpp
712
28.491573
127
0.678723
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,465
groupdef.cpp
doxygen_doxygen/src/groupdef.cpp
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 <algorithm> #include <vector> #include <ctype.h> #include "groupdef.h" #include "classdef.h" #include "filedef.h" #include "classlist.h" #include "outputlist.h" #include "namespacedef.h" #include "language.h" #include "util.h" #include "memberlist.h" #include "message.h" #include "membergroup.h" #include "doxygen.h" #include "pagedef.h" #include "docparser.h" #include "searchindex.h" #include "dot.h" #include "dotgroupcollaboration.h" #include "vhdldocgen.h" #include "layout.h" #include "arguments.h" #include "entry.h" #include "membername.h" #include "dirdef.h" #include "config.h" #include "definitionimpl.h" #include "regex.h" #include "moduledef.h" //--------------------------------------------------------------------------- class GroupDefImpl : public DefinitionMixin<GroupDef> { public: GroupDefImpl(const QCString &fileName,int line,const QCString &name,const QCString &title,const QCString &refFileName=QCString()); ~GroupDefImpl() override; NON_COPYABLE(GroupDefImpl) DefType definitionType() const override { return TypeGroup; } CodeSymbolType codeSymbolType() const override { return CodeSymbolType::Default; } QCString getOutputFileBase() const override; QCString anchor() const override { return QCString(); } QCString displayName(bool=TRUE) const override { return hasGroupTitle() ? m_title : DefinitionMixin::name(); } QCString groupTitle() const override { return m_title; } void setGroupTitle( const QCString &newtitle ) override; bool hasGroupTitle( ) const override { return m_titleSet; } void addFile(FileDef *def) override; bool containsFile(const FileDef *def) const override; bool addClass(ClassDef *def) override; bool addConcept(ConceptDef *def) override; bool addModule(ModuleDef *def) override; bool addNamespace(NamespaceDef *def) override; void addGroup(GroupDef *def) override; void addPage(PageDef *def) override; void addExample(PageDef *def) override; void addDir(DirDef *dd) override; bool insertMember(MemberDef *def,bool docOnly=FALSE) override; void removeMember(MemberDef *md) override; bool findGroup(const GroupDef *def) const override; // true if def is a subgroup of this group void writeDocumentation(OutputList &ol) override; void writeMemberPages(OutputList &ol, int hierarchyLevel) override; void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const override; void writeTagFile(TextStream &) override; size_t numDocMembers() const override; bool isLinkableInProject() const override; bool isLinkable() const override; bool isVisibleInHierarchy() const override; bool isASubGroup() const override; void computeAnchors() override; void countMembers() override; void addMembersToMemberGroup() override; void distributeMemberGroupDocumentation() override; void findSectionsInDocumentation() override; void addListReferences() override; void sortMemberLists() override; bool subGrouping() const override { return m_subGrouping; } void setGroupScope(Definition *d) override { m_groupScope = d; } Definition *getGroupScope() const override { return m_groupScope; } MemberList *getMemberList(MemberListType lt) const override; const MemberLists &getMemberLists() const override { return m_memberLists; } /* user defined member groups */ const MemberGroupList &getMemberGroups() const override { return m_memberGroups; } const FileList &getFiles() const override { return m_fileList; } const ClassLinkedRefMap &getClasses() const override { return m_classes; } const ConceptLinkedRefMap &getConcepts() const override { return m_concepts; } const ModuleLinkedRefMap &getModules() const override { return m_modules; } const NamespaceLinkedRefMap &getNamespaces() const override { return m_namespaces; } const GroupList &getSubGroups() const override { return m_groups; } const PageLinkedRefMap &getPages() const override { return m_pages; } const DirList & getDirs() const override { return m_dirList; } const PageLinkedRefMap &getExamples() const override { return m_examples; } bool hasDetailedDescription() const override; void sortSubGroups() override; void writeSummaryLinks(OutputList &ol) const override; bool hasGroupGraph() const override; void overrideGroupGraph(bool e) override; private: void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const); void addMemberToList(MemberListType lt,MemberDef *md); void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); void removeMemberFromList(MemberListType lt,MemberDef *md); void writeGroupGraph(OutputList &ol); void writeFiles(OutputList &ol,const QCString &title); void writeNamespaces(OutputList &ol,const QCString &title); void writeNestedGroups(OutputList &ol,const QCString &title); void writeDirs(OutputList &ol,const QCString &title); void writeClasses(OutputList &ol,const QCString &title); void writeConcepts(OutputList &ol,const QCString &title); void writeModules(OutputList &ol,const QCString &title); void writeInlineClasses(OutputList &ol); void writePageDocumentation(OutputList &ol); void writeDetailedDescription(OutputList &ol,const QCString &title); void writeBriefDescription(OutputList &ol); void writeMemberGroups(OutputList &ol); void startMemberDeclarations(OutputList &ol); void endMemberDeclarations(OutputList &ol); void startMemberDocumentation(OutputList &ol); void endMemberDocumentation(OutputList &ol); void writeAuthorSection(OutputList &ol); void updateLanguage(const Definition *); void setGroupTitleLocal( const QCString &title); QCString m_title; // title of the group bool m_titleSet; // true if title is not the same as the name QCString m_fileName; // base name of the generated file FileList m_fileList; // list of files in the group ClassLinkedRefMap m_classes; // list of classes in the group ConceptLinkedRefMap m_concepts; // list of concepts in the group ModuleLinkedRefMap m_modules; // list of modules in the group NamespaceLinkedRefMap m_namespaces; // list of namespaces in the group GroupList m_groups; // list of sub groups. PageLinkedRefMap m_pages; // list of pages in the group PageLinkedRefMap m_examples; // list of examples in the group DirList m_dirList; // list of directories in the group MemberList m_allMemberList; MemberNameInfoLinkedMap m_allMemberNameInfoLinkedMap; Definition * m_groupScope; MemberLists m_memberLists; MemberGroupList m_memberGroups; bool m_subGrouping; bool m_hasGroupGraph = false; }; std::unique_ptr<GroupDef> createGroupDef(const QCString &fileName,int line,const QCString &name, const QCString &title,const QCString &refFileName) { return std::make_unique<GroupDefImpl>(fileName,line,name,title,refFileName); } //--------------------------------------------------------------------------- GroupDefImpl::GroupDefImpl(const QCString &df,int dl,const QCString &na,const QCString &t, const QCString &refFileName) : DefinitionMixin(df,dl,1,na), m_allMemberList(MemberListType::AllMembersList(),MemberListContainer::Group) { if (!refFileName.isEmpty()) { m_fileName=stripExtension(refFileName); } else { m_fileName = convertNameToFile(QCString("group_")+na); } setGroupTitleLocal( t ); //visited = 0; m_groupScope = nullptr; m_subGrouping=Config_getBool(SUBGROUPING); m_hasGroupGraph=Config_getBool(GROUP_GRAPHS); } GroupDefImpl::~GroupDefImpl() { } void GroupDefImpl::setGroupTitleLocal( const QCString &t ) { if ( !t.isEmpty()) { m_title = t; m_titleSet = TRUE; } else { m_title = name(); m_title[0]=static_cast<char>(toupper(m_title[0])); m_titleSet = FALSE; } } void GroupDefImpl::setGroupTitle( const QCString &t ) { setGroupTitleLocal(t); } void GroupDefImpl::distributeMemberGroupDocumentation() { for (const auto &mg : m_memberGroups) { mg->distributeMemberGroupDocumentation(); } } void GroupDefImpl::findSectionsInDocumentation() { docFindSections(briefDescription(),this,docFile()); docFindSections(documentation(),this,docFile()); docFindSections(inbodyDocumentation(),this,docFile()); for (const auto &mg : m_memberGroups) { mg->findSectionsInDocumentation(this); } for (auto &ml : m_memberLists) { if (ml->listType().isDeclaration()) { ml->findSectionsInDocumentation(this); } } } void GroupDefImpl::addFile(FileDef *def) { bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); if (def->isHidden()) return; updateLanguage(def); if (sortBriefDocs) m_fileList.insert( std::upper_bound( m_fileList.begin(), m_fileList.end(), def, [](const auto &fd1, const auto &fd2) { return qstricmp_sort(fd1->name(),fd2->name())<0; }), def); else m_fileList.push_back(def); } bool GroupDefImpl::containsFile(const FileDef *def) const { return std::find(m_fileList.cbegin(),m_fileList.cend(), def) != m_fileList.cend(); } bool GroupDefImpl::addClass(ClassDef *cd) { if (cd->isHidden()) return FALSE; updateLanguage(cd); QCString qn = cd->name(); if (m_classes.find(qn)==nullptr) { m_classes.add(qn,cd); return TRUE; } return FALSE; } bool GroupDefImpl::addConcept(ConceptDef *cd) { if (cd->isHidden()) return FALSE; QCString qn = cd->name(); if (m_concepts.find(qn)==nullptr) { m_concepts.add(qn,cd); return TRUE; } return FALSE; } bool GroupDefImpl::addModule(ModuleDef *mod) { if (mod->isHidden()) return false; QCString qn = mod->name(); if (m_modules.find(qn)==nullptr) { m_modules.add(qn,mod); return true; } return false; } bool GroupDefImpl::addNamespace(NamespaceDef *def) { //printf("adding namespace hidden=%d\n",def->isHidden()); if (def->isHidden()) return false; if (m_namespaces.find(def->name())==nullptr) { updateLanguage(def); m_namespaces.add(def->name(),def); return true; } return false; } void GroupDefImpl::addDir(DirDef *def) { if (def->isHidden()) return; m_dirList.push_back(def); } void GroupDefImpl::addPage(PageDef *def) { if (def->isHidden()) return; //printf("Making page %s part of a group\n",qPrint(def->name)); m_pages.add(def->name(),def); def->makePartOfGroup(this); } void GroupDefImpl::addExample(PageDef *def) { if (def->isHidden()) return; m_examples.add(def->name(),def); } void GroupDefImpl::addMembersToMemberGroup() { for (auto &ml : m_memberLists) { if (ml->listType().isDeclaration()) { ::addMembersToMemberGroup(ml.get(),&m_memberGroups,this); } } } bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly) { if (md->isHidden()) return FALSE; updateLanguage(md); //printf("GroupDef(%s)::insertMember(%s)\n", qPrint(title), qPrint(md->name())); MemberNameInfo *mni = m_allMemberNameInfoLinkedMap.add(md->name()); for (auto &srcMi : *mni) { const MemberDef *srcMd = srcMi->memberDef(); if (srcMd==md) return FALSE; // already added before! bool sameScope = srcMd->getOuterScope()==md->getOuterScope() || // same class or namespace // both inside a file => definition and declaration do not have to be in the same file (srcMd->getOuterScope()->definitionType()==Definition::TypeFile && md->getOuterScope()->definitionType()==Definition::TypeFile); const ArgumentList &srcMdAl = srcMd->argumentList(); const ArgumentList &mdAl = md->argumentList(); const ArgumentList &tSrcMdAl = srcMd->templateArguments(); const ArgumentList &tMdAl = md->templateArguments(); if (srcMd->isFunction() && md->isFunction() && // both are a function (tSrcMdAl.size()==tMdAl.size()) && // same number of template arguments matchArguments2(srcMd->getOuterScope(),srcMd->getFileDef(),&srcMdAl, md->getOuterScope(),md->getFileDef(),&mdAl, TRUE,srcMd->getLanguage() ) && // matching parameters sameScope // both are found in the same scope ) { MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm && srcMd->getGroupAlias()==nullptr) { mdm->setGroupAlias(srcMd); } else if (mdm && md!=srcMd->getGroupAlias()) { mdm->setGroupAlias(srcMd->getGroupAlias()); } return FALSE; // member is the same as one that is already added } } mni->push_back(std::make_unique<MemberInfo>(md,md->protection(),md->virtualness(),false,false)); //printf("Added member!\n"); m_allMemberList.push_back(md); switch(md->memberType()) { case MemberType::Variable: if (!docOnly) { addMemberToList(MemberListType::DecVarMembers(),md); } addMemberToList(MemberListType::DocVarMembers(),md); break; case MemberType::Function: if (!docOnly) { addMemberToList(MemberListType::DecFuncMembers(),md); } addMemberToList(MemberListType::DocFuncMembers(),md); break; case MemberType::Typedef: if (!docOnly) { addMemberToList(MemberListType::DecTypedefMembers(),md); } addMemberToList(MemberListType::DocTypedefMembers(),md); break; case MemberType::Enumeration: if (!docOnly) { addMemberToList(MemberListType::DecEnumMembers(),md); } addMemberToList(MemberListType::DocEnumMembers(),md); break; case MemberType::EnumValue: if (!docOnly) { addMemberToList(MemberListType::DecEnumValMembers(),md); } addMemberToList(MemberListType::DocEnumValMembers(),md); break; case MemberType::Define: if (!docOnly) { addMemberToList(MemberListType::DecDefineMembers(),md); } addMemberToList(MemberListType::DocDefineMembers(),md); break; case MemberType::Signal: if (!docOnly) { addMemberToList(MemberListType::DecSignalMembers(),md); } addMemberToList(MemberListType::DocSignalMembers(),md); break; case MemberType::Slot: if (md->protection()==Protection::Public) { if (!docOnly) { addMemberToList(MemberListType::DecPubSlotMembers(),md); } addMemberToList(MemberListType::DocPubSlotMembers(),md); } else if (md->protection()==Protection::Protected) { if (!docOnly) { addMemberToList(MemberListType::DecProSlotMembers(),md); } addMemberToList(MemberListType::DocProSlotMembers(),md); } else { if (!docOnly) { addMemberToList(MemberListType::DecPriSlotMembers(),md); } addMemberToList(MemberListType::DocPriSlotMembers(),md); } break; case MemberType::Event: if (!docOnly) { addMemberToList(MemberListType::DecEventMembers(),md); } addMemberToList(MemberListType::DocEventMembers(),md); break; case MemberType::Property: if (!docOnly) { addMemberToList(MemberListType::DecPropMembers(),md); } addMemberToList(MemberListType::DocPropMembers(),md); break; case MemberType::Friend: if (!docOnly) { addMemberToList(MemberListType::DecFriendMembers(),md); } addMemberToList(MemberListType::DocFriendMembers(),md); break; default: err("GroupDefImpl::insertMembers(): " "member '%s' (typeid='%s') with scope '%s' inserted in group scope '%s'!\n", qPrint(md->name()),qPrint(md->memberTypeName()), md->getClassDef() ? qPrint(md->getClassDef()->name()) : "", qPrint(name())); } return TRUE; } void GroupDefImpl::removeMember(MemberDef *md) { // fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", qPrint(title), qPrint(md->name())); MemberNameInfo *mni = m_allMemberNameInfoLinkedMap.find(md->name()); if (mni) { m_allMemberNameInfoLinkedMap.del(md->name()); removeMemberFromList(MemberListType::AllMembersList(),md); switch(md->memberType()) { case MemberType::Variable: removeMemberFromList(MemberListType::DecVarMembers(),md); removeMemberFromList(MemberListType::DocVarMembers(),md); break; case MemberType::Function: removeMemberFromList(MemberListType::DecFuncMembers(),md); removeMemberFromList(MemberListType::DocFuncMembers(),md); break; case MemberType::Typedef: removeMemberFromList(MemberListType::DecTypedefMembers(),md); removeMemberFromList(MemberListType::DocTypedefMembers(),md); break; case MemberType::Enumeration: removeMemberFromList(MemberListType::DecEnumMembers(),md); removeMemberFromList(MemberListType::DocEnumMembers(),md); break; case MemberType::EnumValue: removeMemberFromList(MemberListType::DecEnumValMembers(),md); removeMemberFromList(MemberListType::DocEnumValMembers(),md); break; case MemberType::Define: removeMemberFromList(MemberListType::DecDefineMembers(),md); removeMemberFromList(MemberListType::DocDefineMembers(),md); break; case MemberType::Signal: removeMemberFromList(MemberListType::DecSignalMembers(),md); removeMemberFromList(MemberListType::DocSignalMembers(),md); break; case MemberType::Slot: if (md->protection()==Protection::Public) { removeMemberFromList(MemberListType::DecPubSlotMembers(),md); removeMemberFromList(MemberListType::DocPubSlotMembers(),md); } else if (md->protection()==Protection::Protected) { removeMemberFromList(MemberListType::DecProSlotMembers(),md); removeMemberFromList(MemberListType::DocProSlotMembers(),md); } else { removeMemberFromList(MemberListType::DecPriSlotMembers(),md); removeMemberFromList(MemberListType::DocPriSlotMembers(),md); } break; case MemberType::Event: removeMemberFromList(MemberListType::DecEventMembers(),md); removeMemberFromList(MemberListType::DocEventMembers(),md); break; case MemberType::Property: removeMemberFromList(MemberListType::DecPropMembers(),md); removeMemberFromList(MemberListType::DocPropMembers(),md); break; case MemberType::Friend: removeMemberFromList(MemberListType::DecFriendMembers(),md); removeMemberFromList(MemberListType::DocFriendMembers(),md); break; default: err("GroupDefImpl::removeMember(): unexpected member remove in file!\n"); } } } bool GroupDefImpl::findGroup(const GroupDef *def) const { if (this==def) { return TRUE; } for (const auto &gd : m_groups) { if (gd->findGroup(def)) { return TRUE; } } return FALSE; } void GroupDefImpl::addGroup(GroupDef *def) { //printf("adding group '%s' to group '%s'\n",qPrint(def->name()),qPrint(name())); //if (Config_getBool(SORT_MEMBER_DOCS)) // groupList->inSort(def); //else m_groups.push_back(def); } bool GroupDefImpl::isASubGroup() const { return !partOfGroups().empty(); } void GroupDefImpl::countMembers() { for (auto &ml : m_memberLists) { ml->countDecMembers(); ml->countDocMembers(); } for (const auto &mg : m_memberGroups) { mg->countDecMembers(); mg->countDocMembers(); } } size_t GroupDefImpl::numDocMembers() const { return m_fileList.size()+ m_classes.size()+ m_namespaces.size()+ m_groups.size()+ m_allMemberList.size()+ m_pages.size()+ m_examples.size(); } /*! Compute the HTML anchor names for all members in the group */ void GroupDefImpl::computeAnchors() { //printf("GroupDefImpl::computeAnchors()\n"); m_allMemberList.setAnchors(); } void GroupDefImpl::writeTagFile(TextStream &tagFile) { QCString fn = getOutputFileBase(); addHtmlExtensionIfMissing(fn); tagFile << " <compound kind=\"group\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; tagFile << " <title>" << convertToXML(m_title) << "</title>\n"; tagFile << " <filename>" << fn << "</filename>\n"; for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Group)) { switch (lde->kind()) { case LayoutDocEntry::GroupClasses: { for (const auto &cd : m_classes) { if (cd->isLinkableInProject()) { tagFile << " <class kind=\"" << cd->compoundTypeString() << "\">" << convertToXML(cd->name()) << "</class>\n"; } } } break; case LayoutDocEntry::GroupConcepts: { for (const auto &cd : m_concepts) { if (cd->isLinkableInProject()) { tagFile << " <concept>" << convertToXML(cd->name()) << "</concept>\n"; } } } break; case LayoutDocEntry::GroupModules: { for (const auto &mod : m_modules) { if (mod->isLinkableInProject()) { tagFile << " <module>" << convertToXML(mod->name()) << "</module>\n"; } } } break; case LayoutDocEntry::GroupNamespaces: { for (const auto &nd : m_namespaces) { if (nd->isLinkableInProject()) { tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>\n"; } } } break; case LayoutDocEntry::GroupFiles: { for (const auto &fd : m_fileList) { if (fd->isLinkableInProject()) { tagFile << " <file>" << convertToXML(fd->name()) << "</file>\n"; } } } break; case LayoutDocEntry::GroupPageDocs: { for (const auto &pd : m_pages) { QCString pageName = pd->getOutputFileBase(); if (pd->isLinkableInProject()) { tagFile << " <page>" << convertToXML(pageName) << "</page>\n"; } } } break; case LayoutDocEntry::GroupDirs: { for (const auto &dd : m_dirList) { if (dd->isLinkableInProject()) { tagFile << " <dir>" << convertToXML(dd->displayName()) << "</dir>\n"; } } } break; case LayoutDocEntry::GroupNestedGroups: { for (const auto &gd : m_groups) { if (gd->isVisible()) { tagFile << " <subgroup>" << convertToXML(gd->name()) << "</subgroup>\n"; } } } break; case LayoutDocEntry::MemberDecl: { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) { MemberList * ml = getMemberList(lmd->type); if (ml) { ml->writeTagFile(tagFile,true); } } } break; case LayoutDocEntry::MemberGroups: { for (const auto &mg : m_memberGroups) { mg->writeTagFile(tagFile,true); } } break; default: break; } } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>\n"; } void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { if ((!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) || !documentation().isEmpty() || !inbodyDocumentation().isEmpty() ) { ol.pushGeneratorState(); if (m_pages.size()!=numDocMembers()) // not only pages -> classical layout { ol.pushGeneratorState(); ol.disable(OutputType::Html); ol.writeRuler(); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); } else { ol.disableAllBut(OutputType::Man); // always print title for man page } ol.startGroupHeader(); ol.parseText(title); ol.endGroupHeader(); ol.popGeneratorState(); // repeat brief description if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,nullptr,briefDescription(),FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } // write separator between brief and details if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputType::Man); ol.disable(OutputType::RTF); ol.enableAll(); ol.disableAllBut(OutputType::Man); ol.enable(OutputType::Latex); ol.writeString("\n\n"); ol.popGeneratorState(); } // write detailed documentation if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,nullptr,documentation()+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } // write inbody documentation if (!inbodyDocumentation().isEmpty()) { ol.generateDoc(inbodyFile(),inbodyLine(),this,nullptr,inbodyDocumentation()+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } } } void GroupDefImpl::writeBriefDescription(OutputList &ol) { if (hasBriefDescription()) { auto parser { createDocParser() }; auto ast { validatingParseDoc(*parser.get(), briefFile(),briefLine(),this,nullptr, briefDescription(),TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) }; if (!ast->isEmpty()) { ol.startParagraph(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.writeString(" - "); ol.popGeneratorState(); ol.writeDoc(ast.get(),this,nullptr); ol.pushGeneratorState(); ol.disable(OutputType::RTF); ol.writeString(" \n"); ol.enable(OutputType::RTF); if (hasDetailedDescription()) { ol.disableAllBut(OutputType::Html); ol.startTextLink(QCString(),"details"); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } ol.popGeneratorState(); ol.endParagraph(); } } ol.writeSynopsis(); } void GroupDefImpl::writeGroupGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) && m_hasGroupGraph /*&& Config_getBool(GROUP_GRAPHS)*/) { DotGroupCollaboration graph(this); if (graph.isTooBig()) { warn_uncond("Group dependency graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", qPrint(name()), graph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!graph.isTrivial()) { msg("Generating dependency graph for group %s\n",qPrint(qualifiedName())); ol.pushGeneratorState(); ol.disable(OutputType::Man); //ol.startParagraph(); ol.startGroupCollaboration(); ol.parseText(theTranslator->trCollaborationDiagram(m_title)); ol.endGroupCollaboration(graph); //ol.endParagraph(); ol.popGeneratorState(); } } } void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title) { // write list of files if (!m_fileList.empty()) { ol.startMemberHeader("files"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); for (const auto &fd : m_fileList) { if (!fd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(fd->anchor(),OutputGenerator::MemberItemType::Normal); ol.docify(theTranslator->trFile(FALSE,TRUE)+" "); ol.insertMemberAlign(); ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fd->displayName()); ol.endMemberItem(OutputGenerator::MemberItemType::Normal); if (!fd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(fd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),fd,nullptr,fd->briefDescription(),FALSE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } ol.endMemberDeclaration(QCString(),QCString()); } ol.endMemberList(); } } void GroupDefImpl::writeNamespaces(OutputList &ol,const QCString &title) { // write list of namespaces m_namespaces.writeDeclaration(ol,title); } void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) { // write list of groups int count=0; for (const auto &gd : m_groups) { if (gd->isVisible()) count++; } if (count>0) { ol.startMemberHeader("groups"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); for (const auto &gd : m_groups) { if (gd->isVisible()) { if (!gd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(gd->anchor(),OutputGenerator::MemberItemType::Normal); //ol.docify(theTranslator->trGroup(FALSE,TRUE)); //ol.docify(" "); ol.insertMemberAlign(); ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),QCString(),gd->groupTitle()); ol.endMemberItem(OutputGenerator::MemberItemType::Normal); if (!gd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(gd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),gd,nullptr,gd->briefDescription(),FALSE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } ol.endMemberDeclaration(QCString(),QCString()); } } ol.endMemberList(); } } void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title) { // write list of directories if (!m_dirList.empty()) { ol.startMemberHeader("dirs"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); for(const auto dd : m_dirList) { if (!dd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(dd->anchor(),OutputGenerator::MemberItemType::Normal); ol.parseText(theTranslator->trDir(FALSE,TRUE)); ol.insertMemberAlign(); ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),QCString(),dd->shortName()); ol.endMemberItem(OutputGenerator::MemberItemType::Normal); if (!dd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(dd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),dd,nullptr,dd->briefDescription(),FALSE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberDescription(); } ol.endMemberDeclaration(QCString(),QCString()); } ol.endMemberList(); } } void GroupDefImpl::writeClasses(OutputList &ol,const QCString &title) { // write list of classes m_classes.writeDeclaration(ol,nullptr,title,FALSE); } void GroupDefImpl::writeConcepts(OutputList &ol,const QCString &title) { // write list of concepts m_concepts.writeDeclaration(ol,title,FALSE); } void GroupDefImpl::writeModules(OutputList &ol,const QCString &title) { // write list of modules m_modules.writeDeclaration(ol,title,FALSE); } void GroupDefImpl::writeInlineClasses(OutputList &ol) { m_classes.writeDocumentation(ol); } void GroupDefImpl::writePageDocumentation(OutputList &ol) { for (const auto *pd : m_pages) { if (!pd->isReference()) { const SectionInfo *si=nullptr; if (pd->hasTitle() && !pd->name().isEmpty() && (si=SectionManager::instance().find(pd->name()))!=nullptr) { ol.startSection(si->label(),si->title(),SectionType::Subsection); ol.docify(si->title()); ol.endSection(si->label(),SectionType::Subsection); } ol.startTextBlock(); ol.generateDoc(pd->docFile(),pd->docLine(),pd,nullptr,(pd->documentation()+pd->inbodyDocumentation()),TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endTextBlock(); } } } void GroupDefImpl::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ for (const auto &mg : m_memberGroups) { mg->writeDeclarations(ol,nullptr,nullptr,nullptr,this,nullptr); } } void GroupDefImpl::startMemberDeclarations(OutputList &ol) { ol.startMemberSections(); } void GroupDefImpl::endMemberDeclarations(OutputList &ol) { ol.endMemberSections(); } void GroupDefImpl::startMemberDocumentation(OutputList &ol) { //printf("** GroupDefImpl::startMemberDocumentation()\n"); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.pushGeneratorState(); ol.disable(OutputType::Html); Doxygen::suppressDocWarnings = TRUE; } } void GroupDefImpl::endMemberDocumentation(OutputList &ol) { //printf("** GroupDefImpl::endMemberDocumentation()\n"); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.popGeneratorState(); Doxygen::suppressDocWarnings = FALSE; } } void GroupDefImpl::writeAuthorSection(OutputList &ol) { // write Author section (Man only) ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.startGroupHeader(); ol.parseText(theTranslator->trAuthor(TRUE,TRUE)); ol.endGroupHeader(); ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString(PROJECT_NAME))); ol.popGeneratorState(); } void GroupDefImpl::writeSummaryLinks(OutputList &ol) const { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); bool first=TRUE; SrcLangExt lang = getLanguage(); for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Group)) { if ((lde->kind()==LayoutDocEntry::GroupClasses && m_classes.declVisible()) || (lde->kind()==LayoutDocEntry::GroupConcepts && m_concepts.declVisible()) || (lde->kind()==LayoutDocEntry::GroupModules && m_modules.declVisible()) || (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaces.declVisible(false)) || (lde->kind()==LayoutDocEntry::GroupFiles && !m_fileList.empty()) || (lde->kind()==LayoutDocEntry::GroupNestedGroups && !m_groups.empty()) || (lde->kind()==LayoutDocEntry::GroupDirs && !m_dirList.empty()) ) { const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get()); if (ls) { QCString label = lde->kind()==LayoutDocEntry::GroupClasses ? "nested-classes" : lde->kind()==LayoutDocEntry::GroupConcepts ? "concepts" : lde->kind()==LayoutDocEntry::GroupModules ? "modules" : lde->kind()==LayoutDocEntry::GroupNamespaces ? "namespaces" : lde->kind()==LayoutDocEntry::GroupFiles ? "files" : lde->kind()==LayoutDocEntry::GroupNestedGroups ? "groups" : "dirs"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } } else if (lde->kind()==LayoutDocEntry::MemberDecl) { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) { MemberList * ml = getMemberList(lmd->type); if (ml && ml->declVisible()) { ol.writeSummaryLink(QCString(),ml->listType().toLabel(),lmd->title(lang),first); first=FALSE; } } } } if (!first) { ol.writeString(" </div>\n"); } ol.popGeneratorState(); } void GroupDefImpl::writeDocumentation(OutputList &ol) { //bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); ol.pushGeneratorState(); // Find out how deep this group is nested. In case of multiple parents, use the first one. int hierarchyLevel = 0; const GroupDef *gd = this; while (!gd->partOfGroups().empty()) { gd = gd->partOfGroups().front(); ++hierarchyLevel; } startFile(ol,getOutputFileBase(),name(),m_title,HighlightedItem::Topics, FALSE /* additionalIndices*/, QCString() /*altSidebarName*/, hierarchyLevel); ol.startHeaderSection(); writeSummaryLinks(ol); ol.startTitleHead(getOutputFileBase()); ol.pushGeneratorState(); ol.disable(OutputType::Man); ol.parseText(m_title); ol.popGeneratorState(); addGroupListToTitle(ol,this); ol.pushGeneratorState(); ol.disable(OutputType::Man); ol.endTitleHead(getOutputFileBase(),m_title); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.endTitleHead(getOutputFileBase(),name()); if (!m_title.isEmpty()) { ol.writeString(" - "); ol.parseText(m_title); } ol.popGeneratorState(); ol.endHeaderSection(); ol.startContents(); //---------------------------------------- start flexible part ------------------------------- SrcLangExt lang=getLanguage(); for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::Group)) { const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get()); switch (lde->kind()) { case LayoutDocEntry::BriefDesc: writeBriefDescription(ol); break; case LayoutDocEntry::MemberDeclStart: startMemberDeclarations(ol); break; case LayoutDocEntry::GroupClasses: if (ls) writeClasses(ol,ls->title(lang)); break; case LayoutDocEntry::GroupConcepts: if (ls) writeConcepts(ol,ls->title(lang)); break; case LayoutDocEntry::GroupModules: if (ls) writeModules(ol,ls->title(lang)); break; case LayoutDocEntry::GroupInlineClasses: writeInlineClasses(ol); break; case LayoutDocEntry::GroupNamespaces: if (ls) writeNamespaces(ol,ls->title(lang)); break; case LayoutDocEntry::MemberGroups: writeMemberGroups(ol); break; case LayoutDocEntry::MemberDecl: { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) { writeMemberDeclarations(ol,lmd->type,lmd->title(lang)); } } break; case LayoutDocEntry::MemberDeclEnd: endMemberDeclarations(ol); break; case LayoutDocEntry::DetailedDesc: if (ls) writeDetailedDescription(ol,ls->title(lang)); break; case LayoutDocEntry::MemberDefStart: startMemberDocumentation(ol); break; case LayoutDocEntry::MemberDef: { const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get()); if (lmd) { writeMemberDocumentation(ol,lmd->type,lmd->title(lang)); } } break; case LayoutDocEntry::MemberDefEnd: endMemberDocumentation(ol); break; case LayoutDocEntry::GroupNestedGroups: if (ls) writeNestedGroups(ol,ls->title(lang)); break; case LayoutDocEntry::GroupPageDocs: writePageDocumentation(ol); break; case LayoutDocEntry::GroupDirs: if (ls) writeDirs(ol,ls->title(lang)); break; case LayoutDocEntry::GroupFiles: if (ls) writeFiles(ol,ls->title(lang)); break; case LayoutDocEntry::GroupGraph: writeGroupGraph(ol); break; case LayoutDocEntry::AuthorSection: writeAuthorSection(ol); break; case LayoutDocEntry::ClassIncludes: case LayoutDocEntry::ClassInheritanceGraph: case LayoutDocEntry::ClassNestedClasses: case LayoutDocEntry::ClassCollaborationGraph: case LayoutDocEntry::ClassAllMembersLink: case LayoutDocEntry::ClassUsedFiles: case LayoutDocEntry::ClassInlineClasses: case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::NamespaceClasses: case LayoutDocEntry::NamespaceConcepts: case LayoutDocEntry::NamespaceInterfaces: case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::FileClasses: case LayoutDocEntry::FileConcepts: case LayoutDocEntry::FileInterfaces: case LayoutDocEntry::FileStructs: case LayoutDocEntry::FileExceptions: case LayoutDocEntry::FileNamespaces: case LayoutDocEntry::FileConstantGroups: case LayoutDocEntry::FileIncludes: case LayoutDocEntry::FileIncludeGraph: case LayoutDocEntry::FileIncludedByGraph: case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: case LayoutDocEntry::ModuleExports: case LayoutDocEntry::ModuleClasses: case LayoutDocEntry::ModuleConcepts: case LayoutDocEntry::ModuleUsedFiles: case LayoutDocEntry::DirSubDirs: case LayoutDocEntry::DirFiles: case LayoutDocEntry::DirGraph: err("Internal inconsistency: member %d should not be part of " "LayoutDocManager::Group entry list\n",lde->kind()); break; } } //---------------------------------------- end flexible part ------------------------------- for (auto &subgd : getSubGroups()) { if (!subgd->isReference()) { if (subgd->partOfGroups().front() == this) { ol.writePageLink(subgd->getOutputFileBase(), FALSE); } else { // Could write a note explaining that the subgroup belongs to another // group and add a link here. } } } endFile(ol); ol.popGeneratorState(); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { m_allMemberList.sort(); writeMemberPages(ol, hierarchyLevel + 1); } } void GroupDefImpl::writeMemberPages(OutputList &ol, int hierarchyLevel) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); for (const auto &ml : m_memberLists) { if (ml->listType().isDocumentation()) { ml->writeDocumentationPage(ol,name(),this,hierarchyLevel); } } ol.popGeneratorState(); } void GroupDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const { bool createSubDirs=Config_getBool(CREATE_SUBDIRS); ol.writeString(" <div class=\"navtab\">\n"); ol.writeString(" <table>\n"); for (const auto *md : m_allMemberList) { if (md->getGroupDef()==this && md->isLinkable() && !md->isEnumValue()) { if (md->isLinkableInProject()) { QCString fn = md->getOutputFileBase(); addHtmlExtensionIfMissing(fn); if (md==currentMd) // selected item => highlight { ol.writeString(" <tr><td class=\"navtabHL\">"); } else { ol.writeString(" <tr><td class=\"navtab\">"); } ol.writeString("<a class=\"navtab\" "); ol.writeString("href=\""); if (createSubDirs) ol.writeString("../../"); ol.writeString(fn+"#"+md->anchor()); ol.writeString("\">"); ol.writeString(convertToHtml(md->localName())); ol.writeString("</a>"); ol.writeString("</td></tr>\n"); } } } ol.writeString(" </table>\n"); ol.writeString(" </div>\n"); } //---- helper functions ------------------------------------------------------ void addClassToGroups(const Entry *root,ClassDef *cd) { for (const Grouping &g : root->groups) { GroupDef *gd=nullptr; if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname); if (gd && gd->addClass(cd)) { ClassDefMutable *cdm = toClassDefMutable(cd); if (cdm) { cdm->makePartOfGroup(gd); } //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle()); } else if (!gd && g.pri == Grouping::GROUPING_INGROUP) { warn(root->fileName, root->startLine, "Found non-existing group '%s' for the command '%s', ignoring command", qPrint(g.groupname), Grouping::getGroupPriName( g.pri ) ); } } } void addConceptToGroups(const Entry *root,ConceptDef *cd) { for (const Grouping &g : root->groups) { GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); if (gd && gd->addConcept(cd)) { ConceptDefMutable *cdm = toConceptDefMutable(cd); if (cdm) { cdm->makePartOfGroup(gd); } //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle()); } else if (!gd && g.pri == Grouping::GROUPING_INGROUP) { warn(root->fileName, root->startLine, "Found non-existing group '%s' for the command '%s', ignoring command", qPrint(g.groupname), Grouping::getGroupPriName( g.pri ) ); } } } void addModuleToGroups(const Entry *root,ModuleDef *mod) { for (const Grouping &g : root->groups) { GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); if (gd && gd->addModule(mod)) { mod->makePartOfGroup(gd); //printf("Module %s: in group %s\n",qPrint(mod->name()),gd->groupTitle()); } else if (!gd && g.pri == Grouping::GROUPING_INGROUP) { warn(root->fileName, root->startLine, "Found non-existing group '%s' for the command '%s', ignoring command", qPrint(g.groupname), Grouping::getGroupPriName( g.pri ) ); } } } void addNamespaceToGroups(const Entry *root,NamespaceDef *nd) { //printf("root->groups.size()=%zu\n",root->groups.size()); for (const Grouping &g : root->groups) { GroupDef *gd=nullptr; if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname); //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd); if (gd && gd->addNamespace(nd)) { NamespaceDefMutable *ndm = toNamespaceDefMutable(nd); if (ndm) { ndm->makePartOfGroup(gd); } //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name())); } else if (!gd && g.pri == Grouping::GROUPING_INGROUP) { warn(root->fileName, root->startLine, "Found non-existing group '%s' for the command '%s', ignoring command", qPrint(g.groupname), Grouping::getGroupPriName( g.pri ) ); } } } void addDirToGroups(const Entry *root,DirDef *dd) { //printf("*** root->groups.size()=%d\n",root->groups.size()); for (const Grouping &g : root->groups) { GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); //printf("group '%s'\n",qPrint(g->groupname)); if (gd) { gd->addDir(dd); dd->makePartOfGroup(gd); //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname)); } else if (!gd && g.pri == Grouping::GROUPING_INGROUP) { warn(root->fileName, root->startLine, "Found non-existing group '%s' for the command '%s', ignoring command", qPrint(g.groupname), Grouping::getGroupPriName( g.pri ) ); } } } void addGroupToGroups(const Entry *root,GroupDef *subGroup) { //printf("addGroupToGroups for %s groups=%d\n",qPrint(root->name),root->groups.size()); for (const Grouping &g : root->groups) { GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); if (gd) { if (gd==subGroup) { warn(root->fileName,root->startLine,"Refusing to add group %s to itself", qPrint(gd->name())); } else if (subGroup->findGroup(gd)) { warn(root->fileName,root->startLine,"Refusing to add group %s to group %s, since the latter is already a " "subgroup of the former", qPrint(subGroup->name()),qPrint(gd->name())); } else if (!gd->findGroup(subGroup)) { gd->addGroup(subGroup); subGroup->makePartOfGroup(gd); } } else if (!gd && g.pri == Grouping::GROUPING_INGROUP) { warn(root->fileName, root->startLine, "Found non-existing group '%s' for the command '%s', ignoring command", qPrint(g.groupname), Grouping::getGroupPriName( g.pri ) ); } } } /*! Add a member to the group with the highest priority */ void addMemberToGroups(const Entry *root,MemberDef *md) { //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n", // root, qPrint(root->name), md, qPrint(md->name()), root->groups.size() ); // Search entry's group list for group with highest pri. Grouping::GroupPri_t pri = Grouping::GROUPING_LOWEST; GroupDef *fgd=nullptr; for (const Grouping &g : root->groups) { GroupDef *gd=nullptr; if (!g.groupname.isEmpty()) gd=Doxygen::groupLinkedMap->find(g.groupname); if (gd && g.pri >= pri) { if (fgd && gd!=fgd && g.pri==pri) { warn(root->fileName, root->startLine, "Member %s found in multiple %s groups! " "The member will be put in group %s, and not in group %s", qPrint(md->name()), Grouping::getGroupPriName( pri ), qPrint(gd->name()), qPrint(fgd->name()) ); } fgd = gd; pri = g.pri; } else if (!gd && g.pri == Grouping::GROUPING_INGROUP) { warn(root->fileName, root->startLine, "Found non-existing group '%s' for the command '%s', ignoring command", qPrint(g.groupname), Grouping::getGroupPriName( g.pri ) ); } } //printf("fgd=%p\n",fgd); // put member into group defined by this entry? if (fgd) { GroupDef *mgd = md->getGroupDef(); //printf("mgd=%p\n",mgd); bool insertit = FALSE; if (mgd==nullptr) { insertit = TRUE; } else if (mgd!=fgd) { bool moveit = FALSE; // move member from one group to another if // - the new one has a higher priority // - the new entry has the same priority, but with docs where the old one had no docs if (md->getGroupPri()<pri) { moveit = TRUE; } else { if (md->getGroupPri()==pri) { if (!root->doc.isEmpty() && !md->getGroupHasDocs()) { moveit = TRUE; } else if (!root->doc.isEmpty() && md->getGroupHasDocs()) { warn(md->getGroupFileName(),md->getGroupStartLine(), "Member documentation for %s found several times in %s groups!\n" "%s:%d: The member will remain in group %s, and won't be put into group %s", qPrint(md->name()), Grouping::getGroupPriName( pri ), qPrint(root->fileName), root->startLine, qPrint(mgd->name()), qPrint(fgd->name()) ); } } } if (moveit) { //printf("removeMember\n"); mgd->removeMember(md); insertit = TRUE; } } if (insertit) { //printf("insertMember found at %s line %d: %s: related %s\n", // qPrint(md->getDefFileName()),md->getDefLine(), // qPrint(md->name()),qPrint(root->relates)); bool success = fgd->insertMember(md); if (success) { MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm) { //printf("insertMember successful\n"); mdm->setGroupDef(fgd,pri,root->fileName,root->startLine,!root->doc.isEmpty()); ClassDefMutable *cdm = toClassDefMutable(mdm->getClassDefOfAnonymousType()); if (cdm) { cdm->setGroupDefForAllMembers(fgd,pri,root->fileName,root->startLine,root->doc.length() != 0); } if (mdm->isEnumerate() && mdm->getGroupDef() && md->isStrong()) { for (const auto &emd : mdm->enumFieldList()) { MemberDefMutable *emdm = toMemberDefMutable(emd); if (emdm && emdm->getGroupDef()==nullptr) { emdm->setGroupDef(mdm->getGroupDef(),mdm->getGroupPri(), mdm->getGroupFileName(),mdm->getGroupStartLine(), mdm->getGroupHasDocs()); } } } } } } } } void addExampleToGroups(const Entry *root,PageDef *eg) { for (const Grouping &g : root->groups) { GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname); if (gd) { gd->addExample(eg); eg->makePartOfGroup(gd); //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data()); } else if (!gd && g.pri == Grouping::GROUPING_INGROUP) { warn(root->fileName, root->startLine, "Found non-existing group '%s' for the command '%s', ignoring command", qPrint(g.groupname), Grouping::getGroupPriName( g.pri ) ); } } } QCString GroupDefImpl::getOutputFileBase() const { return m_fileName; } void GroupDefImpl::addListReferences() { { const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, getOutputFileBase(), theTranslator->trGroup(TRUE,TRUE), getOutputFileBase(),name(), QCString(), nullptr ); } for (const auto &mg : m_memberGroups) { mg->addListReferences(this); } for (auto &ml : m_memberLists) { if (ml->listType().isDocumentation()) { ml->addListReferences(this); } } } void GroupDefImpl::addMemberToList(MemberListType lt,MemberDef *md) { bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS); const auto &ml = m_memberLists.get(lt,MemberListContainer::Group); ml->setNeedsSorting( (ml->listType().isDeclaration() && sortBriefDocs) || (ml->listType().isDocumentation() && sortMemberDocs)); ml->push_back(md); } // performs a partial reordering to group elements together with the same scope template<class Vec> static void groupClassesWithSameScope(Vec &vec) { bool done=false; while (!done) // for each iteration { done=true; for (size_t i=0; i<vec.size(); i++) // go through all items { std::string qni = vec[i]->name().str(); size_t posi = qni.rfind("::"); if (posi!=std::string::npos) { std::string scope = qni.substr(0,posi); auto it = std::find_if( vec.begin(), vec.end(), [&](typename Vec::Ptr &cd) { return cd->name().str()==scope; }); if (it!=vec.end()) { size_t idx = std::distance(vec.begin(),it); if (i<idx) // parent scope located after child scope { // to avoid reordering elements with the same parent // we skip to the last one with the same scope size_t k = idx; while (k<vec.size() && vec[k]->name().str().substr(0,posi)==scope) { idx = k; k++; } // swap the items such that i is inserted after idx for (size_t j=i; j<idx; j++) { std::swap(vec[j],vec[j+1]); } done=false; } else if (idx<i && vec[i-1]->name().str().substr(0,posi)!=scope) { // parent scope is found before the item, and the item // has some other item with a different scope in front of it // move idx to the end of range with the same scope while (idx<i && vec[idx]->name().str().substr(0,posi)==scope) { idx++; } // swap the items such that i is just after idx for (size_t j=idx; j<i; j++) { std::swap(vec[j],vec[j+1]); } done=false; } } } } } } void GroupDefImpl::sortMemberLists() { for (auto &ml : m_memberLists) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } } if (Config_getBool(SORT_BRIEF_DOCS)) { std::stable_sort(m_dirList.begin(), m_dirList.end(), compareDirDefs); auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2) { return Config_getBool(SORT_BY_SCOPE_NAME) ? qstricmp_sort(c1->name(), c2->name())<0 : qstricmp_sort(c1->className(), c2->className())<0; }; std::stable_sort(m_classes.begin(), m_classes.end(), classComp); auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2) { return qstricmp_sort(n1->name(),n2->name())<0; }; std::stable_sort(m_namespaces.begin(),m_namespaces.end(),namespaceComp); } else { groupClassesWithSameScope(m_classes); groupClassesWithSameScope(m_namespaces); } } MemberList *GroupDefImpl::getMemberList(MemberListType lt) const { for (auto &ml : m_memberLists) { if (ml->listType()==lt) { return ml.get(); } } return nullptr; } void GroupDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) { bool optimizeVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL); MemberList * ml = getMemberList(lt); if (optimizeVhdl && ml) { VhdlDocGen::writeVhdlDeclarations(ml,ol,this,nullptr,nullptr,nullptr,nullptr); return; } if (ml) { ml->writeDeclarations(ol,nullptr,nullptr,nullptr,this,nullptr,title,QCString()); } } void GroupDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,name(),this,title); } void GroupDefImpl::removeMemberFromList(MemberListType lt,MemberDef *md) { MemberList *ml = getMemberList(lt); if (ml) ml->remove(md); } void GroupDefImpl::sortSubGroups() { std::stable_sort(m_groups.begin(), m_groups.end(), [](const auto &g1,const auto &g2) { return g1->groupTitle() < g2->groupTitle(); }); } static bool hasNonReferenceNestedGroupRec(const GroupDef *gd,int level) { if (level>30) { err("Possible recursive group relation while inside %s\n",qPrint(gd->name())); return false; } bool found=gd->isLinkableInProject(); if (found) { return true; } else { for (const auto &igd : gd->getSubGroups()) { found = found || hasNonReferenceNestedGroupRec(igd,level+1); if (found) break; } } return found; } bool GroupDefImpl::isVisibleInHierarchy() const { bool allExternals = Config_getBool(EXTERNAL_GROUPS); return (allExternals || hasNonReferenceNestedGroupRec(this,0)) && isLinkable(); } bool GroupDefImpl::isLinkableInProject() const { return !isReference() && isLinkable(); } bool GroupDefImpl::isLinkable() const { return hasUserDocumentation(); } // let the "programming language" for a group depend on what is inserted into it. // First item that has an associated languages determines the language for the whole group. void GroupDefImpl::updateLanguage(const Definition *d) { if (getLanguage()==SrcLangExt::Unknown && d->getLanguage()!=SrcLangExt::Unknown) { setLanguage(d->getLanguage()); } } bool GroupDefImpl::hasDetailedDescription() const { bool repeatBrief = Config_getBool(REPEAT_BRIEF); return ((!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty() || !inbodyDocumentation().isEmpty()) && (m_pages.size()!=numDocMembers()); } void GroupDefImpl::overrideGroupGraph(bool e) { m_hasGroupGraph=e; } bool GroupDefImpl::hasGroupGraph() const { return m_hasGroupGraph; } // --- Cast functions GroupDef *toGroupDef(Definition *d) { if (d==nullptr) return nullptr; if (d && typeid(*d)==typeid(GroupDefImpl)) { return static_cast<GroupDef*>(d); } else { return nullptr; } } const GroupDef *toGroupDef(const Definition *d) { if (d==nullptr) return nullptr; if (d && typeid(*d)==typeid(GroupDefImpl)) { return static_cast<const GroupDef*>(d); } else { return nullptr; } }
62,250
C++
.cpp
1,851
27.424095
149
0.635208
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,466
dotlegendgraph.cpp
doxygen_doxygen/src/dotlegendgraph.cpp
/****************************************************************************** * * Copyright (C) 1997-2019 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 <sstream> #include "dotlegendgraph.h" #include "util.h" #include "config.h" #include "doxygen.h" #include "dot.h" #include "language.h" #include "dotfilepatcher.h" #include "dotnode.h" void DotLegendGraph::writeGraph(const QCString &path) { TextStream ts; DotGraph::writeGraph(ts, GraphOutputFormat::BITMAP, EmbeddedOutputFormat::Html, path, "", "", FALSE, 0); if (getDotImageExtension()=="svg") { DotManager::instance()-> createFilePatcher(absBaseName()+Config_getString(HTML_FILE_EXTENSION))-> addSVGObject("graph_legend", absImgName(),QCString()); } } QCString DotLegendGraph::getBaseName() const { return "graph_legend"; } void DotLegendGraph::computeTheGraph() { TextStream md5stream; writeGraphHeader(md5stream,theTranslator->trLegendTitle()); DotNode{this,"Inherited", "", "", TRUE}.setNodeId(9).writeBox(md5stream, GraphType::CallGraph, GraphOutputFormat::BITMAP, false); md5stream << " Node10 -> Node9 [dir=\"back\",color=\"steelblue1\",style=\"solid\" tooltip=\" \"];\n"; DotNode{this,"PublicBase", "", DotNode::placeholderUrl}.setNodeId(10).markHasDocumentation().writeBox(md5stream, GraphType::CallGraph, GraphOutputFormat::BITMAP, false); md5stream << " Node11 -> Node10 [dir=\"back\",color=\"steelblue1\",style=\"solid\" tooltip=\" \"];\n"; DotNode{this,"Truncated", "", DotNode::placeholderUrl}.setNodeId(11).markAsTruncated().markHasDocumentation().writeBox(md5stream, GraphType::CallGraph, GraphOutputFormat::BITMAP, true); md5stream << " Node13 -> Node9 [dir=\"back\",color=\"darkgreen\",style=\"solid\" tooltip=\" \"];\n"; md5stream << " Node13 [label=\"ProtectedBase\",color=\"gray40\",fillcolor=\"white\",style=\"filled\" tooltip=\" \"];\n"; md5stream << " Node14 -> Node9 [dir=\"back\",color=\"firebrick4\",style=\"solid\" tooltip=\" \"];\n"; md5stream << " Node14 [label=\"PrivateBase\",color=\"gray40\",fillcolor=\"white\",style=\"filled\" tooltip=\" \"];\n"; md5stream << " Node15 -> Node9 [dir=\"back\",color=\"steelblue1\",style=\"solid\" tooltip=\" \"];\n"; DotNode{this,"Undocumented", "", ""}.setNodeId(15).writeBox(md5stream, GraphType::CallGraph, GraphOutputFormat::BITMAP, false); md5stream << " Node16 -> Node9 [dir=\"back\",color=\"steelblue1\",style=\"solid\" tooltip=\" \"];\n"; md5stream << " Node16 [label=\"Templ\\< int \\>\",color=\"gray40\",fillcolor=\"white\",style=\"filled\" tooltip=\" \"];\n"; md5stream << " Node17 -> Node16 [dir=\"back\",color=\"orange\",style=\"dashed\",label=\"< int >\",fontcolor=\"grey\" tooltip=\" \"];\n"; md5stream << " Node17 [label=\"Templ\\< T \\>\",color=\"gray40\",fillcolor=\"white\",style=\"filled\" tooltip=\" \"];\n"; md5stream << " Node18 -> Node9 [dir=\"back\",color=\"darkorchid3\",style=\"dashed\",label=\"m_usedClass\",fontcolor=\"grey\" tooltip=\" \"];\n"; md5stream << " Node18 [label=\"Used\",color=\"gray40\",fillcolor=\"white\",style=\"filled\" tooltip=\" \"];\n"; writeGraphFooter(md5stream); m_theGraph = md5stream.str(); } QCString DotLegendGraph::getMapLabel() const { return ""; }
3,723
C++
.cpp
66
54.181818
187
0.677906
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,467
htmldocvisitor.cpp
doxygen_doxygen/src/htmldocvisitor.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 "htmldocvisitor.h" #include "docparser.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" #include "outputlist.h" #include "dot.h" #include "message.h" #include "config.h" #include "htmlgen.h" #include "parserintf.h" #include "msc.h" #include "dia.h" #include "util.h" #include "vhdldocgen.h" #include "filedef.h" #include "memberdef.h" #include "htmlentity.h" #include "emoji.h" #include "plantuml.h" #include "formula.h" #include "fileinfo.h" #include "indexlist.h" #include "growbuf.h" #include "portable.h" #include "codefragment.h" static const int NUM_HTML_LIST_TYPES = 4; static const char types[][NUM_HTML_LIST_TYPES] = {"1", "a", "i", "A"}; enum class contexts_t { NONE, // 0 STARTLI, // 1 STARTDD, // 2 ENDLI, // 3 ENDDD, // 4 STARTTD, // 5 ENDTD, // 6 INTERLI, // 7 INTERDD, // 8 INTERTD // 9 }; static constexpr const char *contexts(contexts_t type) { switch (type) { case contexts_t::NONE: return nullptr; case contexts_t::STARTLI: return "startli"; case contexts_t::STARTDD: return "startdd"; case contexts_t::ENDLI: return "endli"; case contexts_t::ENDDD: return "enddd"; case contexts_t::STARTTD: return "starttd"; case contexts_t::ENDTD: return "endtd"; case contexts_t::INTERLI: return "interli"; case contexts_t::INTERDD: return "interdd"; case contexts_t::INTERTD: return "intertd"; default: return nullptr; } } static const char *hex="0123456789ABCDEF"; static QCString convertIndexWordToAnchor(const QCString &word) { static int cnt = 0; QCString result="a"; QCString cntStr; result += cntStr.setNum(cnt); result += "_"; cnt++; const char *str = word.data(); unsigned char c = 0; if (str) { while ((c = *str++)) { if ((c >= 'a' && c <= 'z') || // ALPHA (c >= 'A' && c <= 'Z') || // ALPHA (c >= '0' && c <= '9') || // DIGIT c == '-' || c == '.' ) { result += c; } else { char enc[4]; enc[0] = '_'; enc[1] = hex[(c & 0xf0) >> 4]; enc[2] = hex[c & 0xf]; enc[3] = 0; result += enc; } } } return result; } static bool mustBeOutsideParagraph(const DocNodeVariant &n) { //printf("mustBeOutsideParagraph(%s)=",docNodeName(n)); if (holds_one_of_alternatives< /* <ul> */ DocHtmlList, DocSimpleList, DocAutoList, /* <dl> */ DocSimpleSect, DocParamSect, DocHtmlDescList, DocXRefItem, /* <table> */ DocHtmlTable, /* <h?> */ DocSection, DocHtmlHeader, /* \internal */ DocInternal, /* <div> */ DocInclude, DocSecRefList, /* <hr> */ DocHorRuler, /* <blockquote> */ DocHtmlBlockQuote, /* \parblock */ DocParBlock, /* \dotfile */ DocDotFile, /* \mscfile */ DocMscFile, /* \diafile */ DocDiaFile, /* \plantumlfile */ DocPlantUmlFile, /* <details> */ DocHtmlDetails, /* <summary> */ DocHtmlSummary, DocIncOperator >(n)) { return TRUE; } const DocVerbatim *dv = std::get_if<DocVerbatim>(&n); if (dv) { DocVerbatim::Type t = dv->type(); if (t == DocVerbatim::JavaDocCode || t == DocVerbatim::JavaDocLiteral) return FALSE; return t!=DocVerbatim::HtmlOnly || dv->isBlock(); } const DocStyleChange *sc = std::get_if<DocStyleChange>(&n); if (sc) { return sc->style()==DocStyleChange::Preformatted || sc->style()==DocStyleChange::Div || sc->style()==DocStyleChange::Center; } const DocFormula *df = std::get_if<DocFormula>(&n); if (df) { return !df->isInline(); } const DocImage *di = std::get_if<DocImage>(&n); if (di) { return !di->isInlineImage(); } return FALSE; } static bool isDocVerbatimVisible(const DocVerbatim &s) { switch (s.type()) { case DocVerbatim::ManOnly: case DocVerbatim::LatexOnly: case DocVerbatim::XmlOnly: case DocVerbatim::RtfOnly: case DocVerbatim::DocbookOnly: return FALSE; default: return TRUE; } } static bool isDocIncludeVisible(const DocInclude &s) { switch (s.type()) { case DocInclude::DontInclude: case DocInclude::LatexInclude: case DocInclude::RtfInclude: case DocInclude::ManInclude: case DocInclude::XmlInclude: case DocInclude::DocbookInclude: return FALSE; default: return TRUE; } } static bool isDocIncOperatorVisible(const DocIncOperator &s) { switch (s.type()) { case DocIncOperator::Skip: return FALSE; default: return TRUE; } } static bool isInvisibleNode(const DocNodeVariant &node) { //printf("isInvisibleNode(%s)\n",docNodeName(node)); // skip over white space const DocWhiteSpace *ws = std::get_if<DocWhiteSpace>(&node); if (ws) return true; // skip over image nodes that are not for HTML output const DocImage *di = std::get_if<DocImage>(&node); if (di) return di->type()!=DocImage::Html; // skip over verbatim nodes that are not visible in the HTML output const DocVerbatim *dv = std::get_if<DocVerbatim>(&node); if (dv) return !isDocVerbatimVisible(*dv); // skip over include nodes that are not visible in the HTML output const DocInclude *dinc = std::get_if<DocInclude>(&node); if (dinc) return !isDocIncludeVisible(*dinc); const DocIncOperator *dio = std::get_if<DocIncOperator>(&node); // skip over include operator nodes that are not visible in the HTML output if (dio) return !isDocIncOperatorVisible(*dio); return false; } static void mergeHtmlAttributes(const HtmlAttribList &attribs, HtmlAttribList &mergeInto) { for (const auto &att : attribs) { auto it = std::find_if(std::begin(mergeInto),std::end(mergeInto), [&att](const auto &opt) { return opt.name==att.name; }); if (it!=std::end(mergeInto)) // attribute name already in mergeInto { it->value = it->value + " " + att.value; } else // attribute name not yet in mergeInto { mergeInto.push_back(att); } } } static QCString htmlAttribsToString(const HtmlAttribList &attribs, QCString *pAltValue = nullptr) { QCString result; for (const auto &att : attribs) { if (!att.value.isEmpty()) // ignore attribute without values as they // are not XHTML compliant, with the exception // of the alt attribute with the img tag { if (att.name=="alt" && pAltValue) // optionally return the value of alt separately // need to convert <img> to <object> for SVG images, // which do not support the alt attribute { *pAltValue = att.value; } else { result+=" "; result+=att.name; result+="=\""+convertToXML(att.value)+"\""; } } else if (att.name=="open") { // The open attribute is a boolean attribute. // Specifies that the details should be visible (open) to the user // As it is a boolean attribute the initialization value is of no interest result+=" "; result+=att.name; result+="=\"true\""; } else if (att.name=="nowrap") // In XHTML, attribute minimization is forbidden, and the nowrap attribute must be defined as <td nowrap="nowrap">. { result+=" "; result+=att.name; result+="=\"nowrap\""; } } return result; } static QCString makeShortName(const QCString &name) { QCString shortName = name; int i = shortName.findRev('/'); if (i!=-1) { shortName=shortName.mid(i+1); } return shortName; } static QCString makeBaseName(const QCString &name) { QCString baseName = makeShortName(name); int i=baseName.find('.'); if (i!=-1) { baseName=baseName.left(i); } return baseName; } //------------------------------------------------------------------------- HtmlDocVisitor::HtmlDocVisitor(TextStream &t,OutputCodeList &ci, const Definition *ctx,const QCString &fn) : m_t(t), m_ci(ci), m_ctx(ctx), m_fileName(fn) { if (ctx) m_langExt=ctx->getDefFileExtension(); } template<class T> void HtmlDocVisitor::visitCaption(TextStream &t,const T &n) { if (n.hasCaption()) { t << "<div class=\"caption\">\n"; for (const auto &child : n.children()) { std::visit(*this, child); } t << "</div>\n"; } } //-------------------------------------- // visitor functions for leaf nodes //-------------------------------------- void HtmlDocVisitor::operator()(const DocWord &w) { if (m_hide) return; filter(w.word()); } void HtmlDocVisitor::operator()(const DocLinkedWord &w) { if (m_hide) return; //printf("linked word: %s\n",qPrint(w.word())); startLink(w.ref(),w.file(),w.relPath(),w.anchor(),w.tooltip()); filter(w.word()); endLink(); } void HtmlDocVisitor::operator()(const DocWhiteSpace &w) { if (m_hide) return; if (m_insidePre) { m_t << w.chars(); } else { m_t << " "; } } void HtmlDocVisitor::operator()(const DocSymbol &s) { if (m_hide) return; if (m_insideTitle && (s.symbol()==HtmlEntityMapper::Sym_Quot || s.symbol()==HtmlEntityMapper::Sym_quot)) // escape "'s inside title="..." { m_t << "&quot;"; } else { const char *res = HtmlEntityMapper::instance().html(s.symbol()); if (res) { m_t << res; } else { err("HTML: non supported HTML-entity found: %s\n", HtmlEntityMapper::instance().html(s.symbol(),TRUE)); } } } void HtmlDocVisitor::operator()(const DocEmoji &s) { if (m_hide) return; const char *res = EmojiEntityMapper::instance().unicode(s.index()); if (res) { m_t << "<span class=\"emoji\">" << res << "</span>"; } else { m_t << s.name(); } } void HtmlDocVisitor::writeObfuscatedMailAddress(const QCString &url) { if (!Config_getBool(OBFUSCATE_EMAILS)) { m_t << "<a href=\"mailto:" << url << "\">"; } else { m_t << "<a href=\"#\" onclick=\"location.href='mai'+'lto:'"; if (!url.isEmpty()) { const char *p = url.data(); uint32_t size=3; while (*p) { m_t << "+'"; for (uint32_t j=0;j<size && *p;j++) { p = writeUTF8Char(m_t,p); } m_t << "'"; if (size==3) size=2; else size=3; } } m_t << "; return false;\">"; } } void HtmlDocVisitor::operator()(const DocURL &u) { if (m_hide) return; if (u.isEmail()) // mail address { QCString url = u.url(); // obfuscate the mail address link writeObfuscatedMailAddress(url); if (!Config_getBool(OBFUSCATE_EMAILS)) { m_t << url; } else { const char *p = url.data(); // also obfuscate the address as shown on the web page uint32_t size=5; while (*p) { for (uint32_t j=0;j<size && *p;j++) { p = writeUTF8Char(m_t,p); } if (*p) m_t << "<span class=\"obfuscator\">.nosp@m.</span>"; if (size==5) size=4; else size=5; } } m_t << "</a>"; } else // web address { m_t << "<a href=\""; m_t << u.url() << "\">"; filter(u.url()); m_t << "</a>"; } } void HtmlDocVisitor::operator()(const DocLineBreak &br) { if (m_hide) return; m_t << "<br "<< htmlAttribsToString(br.attribs()) << " />\n"; } void HtmlDocVisitor::operator()(const DocHorRuler &hr) { if (m_hide) return; forceEndParagraph(hr); m_t << "<hr "<< htmlAttribsToString(hr.attribs()) << " />\n"; forceStartParagraph(hr); } void HtmlDocVisitor::operator()(const DocStyleChange &s) { if (m_hide) return; switch (s.style()) { case DocStyleChange::Bold: if (s.enable()) m_t << "<b" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</b>"; break; case DocStyleChange::S: if (s.enable()) m_t << "<s" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</s>"; break; case DocStyleChange::Strike: if (s.enable()) m_t << "<strike" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</strike>"; break; case DocStyleChange::Del: if (s.enable()) m_t << "<del" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</del>"; break; case DocStyleChange::Underline: if (s.enable()) m_t << "<u" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</u>"; break; case DocStyleChange::Ins: if (s.enable()) m_t << "<ins" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</ins>"; break; case DocStyleChange::Italic: if (s.enable()) m_t << "<em" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</em>"; break; case DocStyleChange::Kbd: if (s.enable()) m_t << "<kbd" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</kbd>"; break; case DocStyleChange::Code: if (s.enable()) m_t << "<code" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</code>"; break; case DocStyleChange::Subscript: if (s.enable()) m_t << "<sub" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</sub>"; break; case DocStyleChange::Superscript: if (s.enable()) m_t << "<sup" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</sup>"; break; case DocStyleChange::Center: if (s.enable()) { forceEndParagraph(s); m_t << "<center" << htmlAttribsToString(s.attribs()) << ">"; } else { m_t << "</center>"; forceStartParagraph(s); } break; case DocStyleChange::Small: if (s.enable()) m_t << "<small" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</small>"; break; case DocStyleChange::Cite: if (s.enable()) m_t << "<cite" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</cite>"; break; case DocStyleChange::Preformatted: if (s.enable()) { forceEndParagraph(s); m_t << "<pre" << htmlAttribsToString(s.attribs()) << ">"; m_insidePre=TRUE; } else { m_insidePre=FALSE; m_t << "</pre>"; forceStartParagraph(s); } break; case DocStyleChange::Div: if (s.enable()) { forceEndParagraph(s); m_t << "<div" << htmlAttribsToString(s.attribs()) << ">"; } else { m_t << "</div>"; forceStartParagraph(s); } break; case DocStyleChange::Span: if (s.enable()) m_t << "<span" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</span>"; break; } } ///-------------------------------------------------------------------------------------- void HtmlDocVisitor::operator()(const DocVerbatim &s) { if (m_hide) return; QCString lang = m_langExt; if (!s.language().isEmpty()) // explicit language setting { lang = s.language(); } SrcLangExt langExt = getLanguageFromCodeLang(lang); switch(s.type()) { case DocVerbatim::Code: forceEndParagraph(s); m_ci.startCodeFragment("DoxyCode"); getCodeParser(lang).parseCode(m_ci, s.context(), s.text(), langExt, Config_getBool(STRIP_CODE_COMMENTS), s.isExample(), s.exampleFile(), nullptr, // fileDef -1, // startLine -1, // endLine true, // inlineFragment nullptr, // memberDef true, // show line numbers m_ctx // search context ); m_ci.endCodeFragment("DoxyCode"); forceStartParagraph(s); break; case DocVerbatim::Verbatim: forceEndParagraph(s); m_t << "<pre class=\"fragment\">"; filter(s.text()); m_t << "</pre>"; forceStartParagraph(s); break; case DocVerbatim::JavaDocLiteral: filter(s.text(), true); break; case DocVerbatim::JavaDocCode: m_t << "<code class=\"JavaDocCode\">"; filter(s.text(), true); m_t << "</code>"; break; case DocVerbatim::HtmlOnly: { if (s.isBlock()) forceEndParagraph(s); m_t << s.text(); if (s.isBlock()) forceStartParagraph(s); } break; case DocVerbatim::ManOnly: case DocVerbatim::LatexOnly: case DocVerbatim::XmlOnly: case DocVerbatim::RtfOnly: case DocVerbatim::DocbookOnly: /* nothing */ break; case DocVerbatim::Dot: { static int dotindex = 1; QCString fileName(4096, QCString::ExplicitSize); forceEndParagraph(s); fileName.sprintf("%s%d%s", qPrint(Config_getString(HTML_OUTPUT)+"/inline_dotgraph_"), dotindex++, ".dot" ); std::ofstream file = Portable::openOutputStream(fileName); if (!file.is_open()) { err("Could not open file %s for writing\n",qPrint(fileName)); } else { QCString stext = s.text(); file.write( stext.data(), stext.length() ); file.close(); m_t << "<div class=\"dotgraph\">\n"; writeDotFile(fileName,s.relPath(),s.context(),s.srcFile(),s.srcLine()); visitCaption(m_t, s); m_t << "</div>\n"; if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName.str()); } forceStartParagraph(s); } break; case DocVerbatim::Msc: { forceEndParagraph(s); static int mscindex = 1; QCString baseName(4096, QCString::ExplicitSize); baseName.sprintf("%s%d", qPrint(Config_getString(HTML_OUTPUT)+"/inline_mscgraph_"), mscindex++ ); std::ofstream file = Portable::openOutputStream(baseName.str()+".msc"); if (!file.is_open()) { err("Could not open file %s.msc for writing\n",qPrint(baseName)); } else { QCString text = "msc {"; text+=s.text(); text+="}"; file.write( text.data(), text.length() ); file.close(); m_t << "<div class=\"mscgraph\">\n"; writeMscFile(baseName+".msc",s.relPath(),s.context(),s.srcFile(),s.srcLine()); visitCaption(m_t, s); m_t << "</div>\n"; if (Config_getBool(DOT_CLEANUP)) Dir().remove(baseName.str()+".msc"); } forceStartParagraph(s); } break; case DocVerbatim::PlantUML: { forceEndParagraph(s); QCString htmlOutput = Config_getString(HTML_OUTPUT); QCString imgExt = getDotImageExtension(); PlantumlManager::OutputFormat format = PlantumlManager::PUML_BITMAP; // default : PUML_BITMAP if (imgExt=="svg") { format = PlantumlManager::PUML_SVG; } QCString baseName = PlantumlManager::instance().writePlantUMLSource( htmlOutput,s.exampleFile(), s.text(),format,s.engine(),s.srcFile(),s.srcLine(),true); m_t << "<div class=\"plantumlgraph\">\n"; writePlantUMLFile(baseName,s.relPath(),s.context(),s.srcFile(),s.srcLine()); visitCaption(m_t, s); m_t << "</div>\n"; forceStartParagraph(s); } break; } } void HtmlDocVisitor::operator()(const DocAnchor &anc) { if (m_hide) return; m_t << "<a class=\"anchor\" id=\"" << anc.anchor() << "\"" << htmlAttribsToString(anc.attribs()) << "></a>"; } void HtmlDocVisitor::operator()(const DocInclude &inc) { if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(inc.extension()); switch(inc.type()) { case DocInclude::Include: forceEndParagraph(inc); m_ci.startCodeFragment("DoxyCode"); getCodeParser(inc.extension()).parseCode(m_ci, inc.context(), inc.text(), langExt, inc.stripCodeComments(), inc.isExample(), inc.exampleFile(), nullptr, // fileDef -1, // startLine -1, // endLine TRUE, // inlineFragment nullptr, // memberDef FALSE, // show line numbers m_ctx // search context ); m_ci.endCodeFragment("DoxyCode"); forceStartParagraph(inc); break; case DocInclude::IncWithLines: { forceEndParagraph(inc); m_ci.startCodeFragment("DoxyCode"); FileInfo cfi( inc.file().str() ); auto fd = createFileDef( cfi.dirPath(), cfi.fileName() ); getCodeParser(inc.extension()).parseCode(m_ci, inc.context(), inc.text(), langExt, inc.stripCodeComments(), inc.isExample(), inc.exampleFile(), fd.get(), // fileDef, -1, // start line -1, // end line true, // inline fragment nullptr, // memberDef true, // show line numbers m_ctx // search context ); m_ci.endCodeFragment("DoxyCode"); forceStartParagraph(inc); } break; case DocInclude::DontInclude: case DocInclude::LatexInclude: case DocInclude::RtfInclude: case DocInclude::ManInclude: case DocInclude::XmlInclude: case DocInclude::DocbookInclude: case DocInclude::DontIncWithLines: break; case DocInclude::HtmlInclude: { if (inc.isBlock()) forceEndParagraph(inc); m_t << inc.text(); if (inc.isBlock()) forceStartParagraph(inc); } break; case DocInclude::VerbInclude: forceEndParagraph(inc); m_t << "<pre class=\"fragment\">"; filter(inc.text()); m_t << "</pre>"; forceStartParagraph(inc); break; case DocInclude::Snippet: case DocInclude::SnippetWithLines: forceEndParagraph(inc); m_ci.startCodeFragment("DoxyCode"); CodeFragmentManager::instance().parseCodeFragment(m_ci, inc.file(), inc.blockId(), inc.context(), inc.type()==DocInclude::SnippetWithLines, inc.trimLeft(), inc.stripCodeComments() ); m_ci.endCodeFragment("DoxyCode"); forceStartParagraph(inc); break; } } void HtmlDocVisitor::operator()(const DocIncOperator &op) { //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n", // op.type(),op.isFirst(),op.isLast(),qPrint(op.text())); if (op.isFirst()) { forceEndParagraph(op); if (!m_hide) m_ci.startCodeFragment("DoxyCode"); pushHidden(m_hide); m_hide=TRUE; } QCString locLangExt = getFileNameExtension(op.includeFileName()); if (locLangExt.isEmpty()) locLangExt = m_langExt; SrcLangExt langExt = getLanguageFromFileName(locLangExt); if (op.type()!=DocIncOperator::Skip) { m_hide = popHidden(); if (!m_hide) { std::unique_ptr<FileDef> fd; if (!op.includeFileName().isEmpty()) { FileInfo cfi( op.includeFileName().str() ); fd = createFileDef( cfi.dirPath(), cfi.fileName() ); } getCodeParser(locLangExt).parseCode( m_ci, op.context(), op.text(), langExt, op.stripCodeComments(), op.isExample(), op.exampleFile(), fd.get(), // fileDef op.line(), // startLine -1, // endLine true, // inline fragment nullptr, // memberDef op.showLineNo(), // show line numbers m_ctx // search context ); } pushHidden(m_hide); m_hide=TRUE; } if (op.isLast()) { m_hide = popHidden(); if (!m_hide) m_ci.endCodeFragment("DoxyCode"); forceStartParagraph(op); } else { if (!m_hide) m_t << "\n"; } } void HtmlDocVisitor::operator()(const DocFormula &f) { if (m_hide) return; bool bDisplay = !f.isInline(); if (bDisplay) { forceEndParagraph(f); m_t << "<p class=\"formulaDsp\">\n"; } if (Config_getBool(USE_MATHJAX)) { QCString text = f.text(); bool closeInline = FALSE; if (!bDisplay && !text.isEmpty() && text.at(0)=='$' && text.at(text.length()-1)=='$') { closeInline=TRUE; text = text.mid(1,text.length()-2); m_t << "\\("; } else if (!bDisplay && !text.isEmpty()) { closeInline=TRUE; m_t << "\\("; } m_t << convertToHtml(text); if (closeInline) { m_t << "\\)"; } } else { const Formula *formula = FormulaManager::instance().findFormula(f.id()); enum class ImageType { Light, Dark }; enum class Visibility { Always, Dark, Light, AutoDark, AutoLight }; auto writeFormula = [&](ImageType imgType,Visibility visibility) -> QCString { // see https://chipcullen.com/how-to-have-dark-mode-image-that-works-with-user-choice for the design idea TextStream t; QCString extension = Config_getEnum(HTML_FORMULA_FORMAT)==HTML_FORMULA_FORMAT_t::svg ? ".svg":".png" ; if (visibility==Visibility::AutoDark || visibility==Visibility::AutoLight) { t << "<picture>"; t << "<source srcset=\"" << f.relPath() << f.name(); if (visibility==Visibility::AutoDark) { t << extension; t << "\" media=\"(prefers-color-scheme: light)\""; } else // AutoLight { t << "_dark"; t << extension; t << "\" media=\"(prefers-color-scheme: dark)\""; } t << "/>"; } t << "<img class=\"formula"; t << (bDisplay ? "Dsp" : "Inl"); if (visibility==Visibility::Light) t << " light-mode-visible"; else if (visibility==Visibility::Dark) t << " dark-mode-visible"; t << "\" alt=\"" << filterQuotedCdataAttr(f.text()) << "\"" << " src=\"" << f.relPath() << f.name(); if (imgType==ImageType::Dark) t << "_dark"; t << extension; if (formula && formula->width()!=-1) { t << "\" width=\""; t << formula->width(); } if (formula && formula->height()!=-1) { t << "\" height=\""; t << formula->height(); } t << "\"/>"; if (visibility==Visibility::AutoDark || visibility==Visibility::AutoLight) { t << "</picture>"; } return QCString(t.str()); }; auto colorStyle = Config_getEnum(HTML_COLORSTYLE); switch(colorStyle) { case HTML_COLORSTYLE_t::LIGHT: m_t << writeFormula(ImageType::Light,Visibility::Always); break; case HTML_COLORSTYLE_t::DARK: m_t << writeFormula(ImageType::Dark, Visibility::Always); break; case HTML_COLORSTYLE_t::AUTO_LIGHT: m_t << writeFormula(ImageType::Light, Visibility::AutoLight); break; case HTML_COLORSTYLE_t::AUTO_DARK: m_t << writeFormula(ImageType::Dark, Visibility::AutoDark); break; case HTML_COLORSTYLE_t::TOGGLE: // write the image twice and use javascript (darkmode_toggle.js) to show only one of them m_t << writeFormula(ImageType::Light,Visibility::Light); m_t << writeFormula(ImageType::Dark, Visibility::Dark); break; } } if (bDisplay) { m_t << "\n</p>\n"; forceStartParagraph(f); } } void HtmlDocVisitor::operator()(const DocIndexEntry &e) { QCString anchor = convertIndexWordToAnchor(e.entry()); if (e.member()) { anchor.prepend(e.member()->anchor()+"_"); } m_t << "<a id=\"" << anchor << "\" name=\"" << anchor << "\"></a>"; //printf("*** DocIndexEntry: word='%s' scope='%s' member='%s'\n", // qPrint(e.entry()), // e.scope() ? qPrint(e.scope()->name()) : "<null>", // e.member() ? qPrint(e.member()->name()) : "<null>" // ); Doxygen::indexList->addIndexItem(e.scope(),e.member(),anchor,e.entry()); } void HtmlDocVisitor::operator()(const DocSimpleSectSep &) { m_t << "</dd>\n"; m_t << "<dd>\n"; } void HtmlDocVisitor::operator()(const DocCite &cite) { if (m_hide) return; if (!cite.file().isEmpty()) { startLink(cite.ref(),cite.file(),cite.relPath(),cite.anchor()); } else { m_t << "<b>["; } filter(cite.text()); if (!cite.file().isEmpty()) { endLink(); } else { m_t << "]</b>"; } } //-------------------------------------- // visitor functions for compound nodes //-------------------------------------- void HtmlDocVisitor::operator()(const DocAutoList &l) { //printf("DocAutoList::visitPre\n"); if (m_hide) return; forceEndParagraph(l); if (l.isEnumList()) { // // Do list type based on depth: // 1. // a. // i. // A. // 1. (repeat)... // m_t << "<ol type=\"" << types[l.depth() % NUM_HTML_LIST_TYPES] << "\">"; } else { if (l.isCheckedList()) { m_t << "<ul class=\"check\">"; } else { m_t << "<ul>"; } } if (!l.isPreformatted()) m_t << "\n"; visitChildren(l); if (l.isEnumList()) { m_t << "</ol>"; } else { m_t << "</ul>"; } if (!l.isPreformatted()) m_t << "\n"; forceStartParagraph(l); } void HtmlDocVisitor::operator()(const DocAutoListItem &li) { if (m_hide) return; switch (li.itemNumber()) { case DocAutoList::Unchecked: // unchecked m_t << "<li class=\"unchecked\">"; break; case DocAutoList::Checked_x: // checked with x case DocAutoList::Checked_X: // checked with X m_t << "<li class=\"checked\">"; break; default: m_t << "<li>"; break; } visitChildren(li); m_t << "</li>"; if (!li.isPreformatted()) m_t << "\n"; } template<class Node> static bool holds_value(const Node *val,const DocNodeVariant &v) { bool b = std::visit([&](auto &&x) { //printf("holds_value val=%s (%p) v=%s (%p)\n", // docNodeName(*val),(void*)val,docNodeName(v),(void *)&x); return val==static_cast<const DocNode*>(&x); }, v); return b; } template<class T> bool isFirstChildNode(const T *parent, const DocPara &node) { return !parent->children().empty() && holds_value(&node,parent->children().front()); } template<class T> bool isLastChildNode(const T *parent, const DocPara &node) { return !parent->children().empty() && holds_value(&node,parent->children().back()); } bool isSeparatedParagraph(const DocSimpleSect &parent,const DocPara &par) { const DocNodeList &nodes = parent.children(); auto it = std::find_if(std::begin(nodes),std::end(nodes),[&par](const auto &n) { return holds_value(&par,n); }); if (it==std::end(nodes)) return FALSE; size_t count = parent.children().size(); auto isSeparator = [](auto &&it_) { return std::get_if<DocSimpleSectSep>(&(*it_))!=nullptr; }; if (count>1 && it==std::begin(nodes)) // it points to first node { return isSeparator(std::next(it)); } else if (count>1 && it==std::prev(std::end(nodes))) // it points to last node { return isSeparator(std::prev(it)); } else if (count>2 && it!=std::begin(nodes) && it!=std::prev(std::end(nodes))) // it points to intermediate node { return isSeparator(std::prev(it)) && isSeparator(std::next(it)); } return false; } static contexts_t getParagraphContext(const DocPara &p,bool &isFirst,bool &isLast) { contexts_t t=contexts_t::NONE; isFirst=FALSE; isLast=FALSE; if (p.parent()) { const auto parBlock = std::get_if<DocParBlock>(p.parent()); if (parBlock) { // hierarchy: node N -> para -> parblock -> para // adapt return value to kind of N const DocNodeVariant *p3 = nullptr; if (::parent(p.parent()) && ::parent(::parent(p.parent())) ) { p3 = ::parent(::parent(p.parent())); } isFirst=isFirstChildNode(parBlock,p); isLast =isLastChildNode (parBlock,p); bool isLI = p3!=nullptr && holds_one_of_alternatives<DocHtmlListItem,DocSecRefItem>(*p3); bool isDD = p3!=nullptr && holds_one_of_alternatives<DocHtmlDescData,DocXRefItem,DocSimpleSect>(*p3); bool isTD = p3!=nullptr && holds_one_of_alternatives<DocHtmlCell,DocParamList>(*p3); t=contexts_t::NONE; if (isFirst) { if (isLI) t=contexts_t::STARTLI; else if (isDD) t=contexts_t::STARTDD; else if (isTD) t=contexts_t::STARTTD; } if (isLast) { if (isLI) t=contexts_t::ENDLI; else if (isDD) t=contexts_t::ENDDD; else if (isTD) t=contexts_t::ENDTD; } if (!isFirst && !isLast) { if (isLI) t=contexts_t::INTERLI; else if (isDD) t=contexts_t::INTERDD; else if (isTD) t=contexts_t::INTERTD; } return t; } const auto docAutoListItem = std::get_if<DocAutoListItem>(p.parent()); if (docAutoListItem) { isFirst=isFirstChildNode(docAutoListItem,p); isLast =isLastChildNode (docAutoListItem,p); t=contexts_t::STARTLI; // not used return t; } const auto docSimpleListItem = std::get_if<DocSimpleListItem>(p.parent()); if (docSimpleListItem) { isFirst=TRUE; isLast =TRUE; t=contexts_t::STARTLI; // not used return t; } const auto docParamList = std::get_if<DocParamList>(p.parent()); if (docParamList) { isFirst=TRUE; isLast =TRUE; t=contexts_t::STARTLI; // not used return t; } const auto docHtmlListItem = std::get_if<DocHtmlListItem>(p.parent()); if (docHtmlListItem) { isFirst=isFirstChildNode(docHtmlListItem,p); isLast =isLastChildNode (docHtmlListItem,p); if (isFirst) t=contexts_t::STARTLI; if (isLast) t=contexts_t::ENDLI; if (!isFirst && !isLast) t = contexts_t::INTERLI; return t; } const auto docSecRefItem = std::get_if<DocSecRefItem>(p.parent()); if (docSecRefItem) { isFirst=isFirstChildNode(docSecRefItem,p); isLast =isLastChildNode (docSecRefItem,p); if (isFirst) t=contexts_t::STARTLI; if (isLast) t=contexts_t::ENDLI; if (!isFirst && !isLast) t = contexts_t::INTERLI; return t; } const auto docHtmlDescData = std::get_if<DocHtmlDescData>(p.parent()); if (docHtmlDescData) { isFirst=isFirstChildNode(docHtmlDescData,p); isLast =isLastChildNode (docHtmlDescData,p); if (isFirst) t=contexts_t::STARTDD; if (isLast) t=contexts_t::ENDDD; if (!isFirst && !isLast) t = contexts_t::INTERDD; return t; } const auto docXRefItem = std::get_if<DocXRefItem>(p.parent()); if (docXRefItem) { isFirst=isFirstChildNode(docXRefItem,p); isLast =isLastChildNode (docXRefItem,p); if (isFirst) t=contexts_t::STARTDD; if (isLast) t=contexts_t::ENDDD; if (!isFirst && !isLast) t = contexts_t::INTERDD; return t; } const auto docSimpleSect = std::get_if<DocSimpleSect>(p.parent()); if (docSimpleSect) { isFirst=isFirstChildNode(docSimpleSect,p); isLast =isLastChildNode (docSimpleSect,p); if (isFirst) t=contexts_t::STARTDD; if (isLast) t=contexts_t::ENDDD; if (isSeparatedParagraph(*docSimpleSect,p)) // if the paragraph is enclosed with separators it will // be included in <dd>..</dd> so avoid addition paragraph // markers { isFirst=isLast=TRUE; } if (!isFirst && !isLast) t = contexts_t::INTERDD; return t; } const auto docHtmlCell = std::get_if<DocHtmlCell>(p.parent()); if (docHtmlCell) { isFirst=isFirstChildNode(docHtmlCell,p); isLast =isLastChildNode (docHtmlCell,p); if (isFirst) t=contexts_t::STARTTD; if (isLast) t=contexts_t::ENDTD; if (!isFirst && !isLast) t = contexts_t::INTERTD; return t; } } return t; } static bool determineIfNeedsTag(const DocPara &p) { bool needsTag = FALSE; if (p.parent()) { if (holds_one_of_alternatives<DocSection, DocInternal, DocHtmlListItem, DocHtmlDescData, DocHtmlCell, DocSimpleListItem, DocAutoListItem, DocSimpleSect, DocXRefItem, DocHtmlBlockQuote, DocParBlock, DocHtmlDetails, DocHtmlSummary >(*p.parent())) { needsTag = TRUE; } else if (std::get_if<DocRoot>(p.parent())) { needsTag = !std::get<DocRoot>(*p.parent()).singleLine(); } } return needsTag; } void HtmlDocVisitor::operator()(const DocPara &p) { if (m_hide) return; //printf("> DocPara\n"); //dumpDocNodeList(p.children()); bool needsTag = determineIfNeedsTag(p); //printf(" needsTag=%d\n",needsTag); bool needsTagBefore = needsTag; bool needsTagAfter = needsTag; // if the first element of a paragraph is something that should be outside of // the paragraph (<ul>,<dl>,<table>,..) then that will already started the // paragraph and we don't need to do it here if (!p.children().empty()) { auto it = std::find_if(std::begin(p.children()),std::end(p.children()), [](const auto &node) { return !isInvisibleNode(node); }); if (it!=std::end(p.children())) { const DocNodeVariant &n = *it; if (mustBeOutsideParagraph(n)) { needsTagBefore = FALSE; } } } // check if this paragraph is the first or last or intermediate child of a <li> or <dd>. // this allows us to mark the tag with a special class so we can // fix the otherwise ugly spacing. bool isFirst = false; bool isLast = false; contexts_t t = getParagraphContext(p,isFirst,isLast); //printf("startPara first=%d last=%d\n",isFirst,isLast); if (isFirst && isLast) needsTagBefore=FALSE; //printf(" needsTagBefore=%d\n",needsTagBefore); // write the paragraph tag (if needed) if (needsTagBefore) { if (contexts(t)) m_t << "<p class=\"" << contexts(t) << "\"" << htmlAttribsToString(p.attribs()) << ">"; else m_t << "<p" << htmlAttribsToString(p.attribs()) << ">"; } visitChildren(p); // if the last element of a paragraph is something that should be outside of // the paragraph (<ul>,<dl>,<table>) then that will already have ended the // paragraph and we don't need to do it here if (!p.children().empty()) { auto it = std::prev(std::end(p.children())); for (;;) { const DocNodeVariant &n = *it; if (!isInvisibleNode(n)) { if (mustBeOutsideParagraph(n)) { needsTagAfter = FALSE; } // stop searching if we found a node that is visible break; } if (it==std::begin(p.children())) { // stop searching if we are at the beginning of the list break; } else { --it; } } } //printf("endPara first=%d last=%d\n",isFirst,isLast); if (isFirst && isLast) needsTagAfter=FALSE; //printf(" needsTagAfter=%d\n",needsTagAfter); if (needsTagAfter) m_t << "</p>\n"; //printf("< DocPara\n"); } void HtmlDocVisitor::operator()(const DocRoot &r) { //printf("> DocRoot\n"); //dumpDocNodeList(r.children()); visitChildren(r); //printf("< DocRoot\n"); } void HtmlDocVisitor::operator()(const DocSimpleSect &s) { if (m_hide) return; forceEndParagraph(s); m_t << "<dl class=\"section " << s.typeString() << "\"><dt>"; switch(s.type()) { case DocSimpleSect::See: m_t << theTranslator->trSeeAlso(); break; case DocSimpleSect::Return: m_t << theTranslator->trReturns(); break; case DocSimpleSect::Author: m_t << theTranslator->trAuthor(TRUE,TRUE); break; case DocSimpleSect::Authors: m_t << theTranslator->trAuthor(TRUE,FALSE); break; case DocSimpleSect::Version: m_t << theTranslator->trVersion(); break; case DocSimpleSect::Since: m_t << theTranslator->trSince(); break; case DocSimpleSect::Date: m_t << theTranslator->trDate(); break; case DocSimpleSect::Note: m_t << theTranslator->trNote(); break; case DocSimpleSect::Warning: m_t << theTranslator->trWarning(); break; case DocSimpleSect::Pre: m_t << theTranslator->trPrecondition(); break; case DocSimpleSect::Post: m_t << theTranslator->trPostcondition(); break; case DocSimpleSect::Copyright: m_t << theTranslator->trCopyright(); break; case DocSimpleSect::Invar: m_t << theTranslator->trInvariant(); break; case DocSimpleSect::Remark: m_t << theTranslator->trRemarks(); break; case DocSimpleSect::Attention: m_t << theTranslator->trAttention(); break; case DocSimpleSect::Important: m_t << theTranslator->trImportant(); break; case DocSimpleSect::User: break; case DocSimpleSect::Rcs: break; case DocSimpleSect::Unknown: break; } if (s.title()) { std::visit(*this,*s.title()); } m_t << "</dt><dd>"; visitChildren(s); m_t << "</dd></dl>\n"; forceStartParagraph(s); } void HtmlDocVisitor::operator()(const DocTitle &t) { if (m_hide) return; visitChildren(t); } void HtmlDocVisitor::operator()(const DocSimpleList &sl) { if (m_hide) return; forceEndParagraph(sl); m_t << "<ul>"; if (!sl.isPreformatted()) m_t << "\n"; visitChildren(sl); m_t << "</ul>"; if (!sl.isPreformatted()) m_t << "\n"; forceStartParagraph(sl); } void HtmlDocVisitor::operator()(const DocSimpleListItem &li) { if (m_hide) return; m_t << "<li>"; if (li.paragraph()) { visit(*this,*li.paragraph()); } m_t << "</li>"; if (!li.isPreformatted()) m_t << "\n"; } void HtmlDocVisitor::operator()(const DocSection &s) { if (m_hide) return; forceEndParagraph(s); m_t << "<h" << s.level() << ">"; m_t << "<a class=\"anchor\" id=\"" << s.anchor(); m_t << "\"></a>\n"; if (s.title()) { std::visit(*this,*s.title()); } m_t << "</h" << s.level() << ">\n"; visitChildren(s); forceStartParagraph(s); } void HtmlDocVisitor::operator()(const DocHtmlList &s) { if (m_hide) return; forceEndParagraph(s); if (s.type()==DocHtmlList::Ordered) { m_t << "<ol" << htmlAttribsToString(s.attribs()); } else { m_t << "<ul" << htmlAttribsToString(s.attribs()); } m_t << ">\n"; visitChildren(s); if (s.type()==DocHtmlList::Ordered) { m_t << "</ol>"; } else { m_t << "</ul>"; } if (!s.isPreformatted()) m_t << "\n"; forceStartParagraph(s); } void HtmlDocVisitor::operator()(const DocHtmlListItem &i) { if (m_hide) return; m_t << "<li" << htmlAttribsToString(i.attribs()) << ">"; if (!i.isPreformatted()) m_t << "\n"; visitChildren(i); m_t << "</li>\n"; } void HtmlDocVisitor::operator()(const DocHtmlDescList &dl) { if (m_hide) return; forceEndParagraph(dl); m_t << "<dl" << htmlAttribsToString(dl.attribs()) << ">\n"; visitChildren(dl); m_t << "</dl>\n"; forceStartParagraph(dl); } void HtmlDocVisitor::operator()(const DocHtmlDescTitle &dt) { if (m_hide) return; m_t << "<dt" << htmlAttribsToString(dt.attribs()) << ">"; visitChildren(dt); m_t << "</dt>\n"; } void HtmlDocVisitor::operator()(const DocHtmlDescData &dd) { if (m_hide) return; m_t << "<dd" << htmlAttribsToString(dd.attribs()) << ">"; visitChildren(dd); m_t << "</dd>\n"; } void HtmlDocVisitor::operator()(const DocHtmlTable &t) { if (m_hide) return; forceEndParagraph(t); if (t.caption()) { QCString anc = std::get<DocHtmlCaption>(*t.caption()).anchor(); if (!anc.isEmpty()) { m_t << "<a class=\"anchor\" id=\"" << anc << "\"></a>\n"; } } QCString attrs = htmlAttribsToString(t.attribs()); if (attrs.isEmpty()) { m_t << "<table class=\"doxtable\">\n"; } else { m_t << "<table" << htmlAttribsToString(t.attribs()) << ">\n"; } if (t.caption()) { std::visit(*this,*t.caption()); } visitChildren(t); m_t << "</table>\n"; forceStartParagraph(t); } void HtmlDocVisitor::operator()(const DocHtmlRow &tr) { if (m_hide) return; m_t << "<tr" << htmlAttribsToString(tr.attribs()) << ">\n"; visitChildren(tr); m_t << "</tr>\n"; } void HtmlDocVisitor::operator()(const DocHtmlCell &c) { if (m_hide) return; if (c.isHeading()) { m_t << "<th" << htmlAttribsToString(c.attribs()) << ">"; } else { m_t << "<td" << htmlAttribsToString(c.attribs()) << ">"; } visitChildren(c); if (c.isHeading()) m_t << "</th>"; else m_t << "</td>"; } void HtmlDocVisitor::operator()(const DocHtmlCaption &c) { if (m_hide) return; m_t << "<caption" << htmlAttribsToString(c.attribs()) << ">"; visitChildren(c); m_t << "</caption>\n"; } void HtmlDocVisitor::operator()(const DocInternal &i) { if (m_hide) return; visitChildren(i); } void HtmlDocVisitor::operator()(const DocHRef &href) { if (m_hide) return; if (href.url().startsWith("mailto:")) { writeObfuscatedMailAddress(href.url().mid(7)); } else { QCString url = correctURL(href.url(),href.relPath()); m_t << "<a href=\"" << convertToHtml(url) << "\"" << htmlAttribsToString(href.attribs()) << ">"; } visitChildren(href); m_t << "</a>"; } void HtmlDocVisitor::operator()(const DocHtmlSummary &s) { if (m_hide) return; m_t << "<summary " << htmlAttribsToString(s.attribs()) << ">\n"; visitChildren(s); m_t << "</summary>\n"; } void HtmlDocVisitor::operator()(const DocHtmlDetails &d) { if (m_hide) return; forceEndParagraph(d); m_t << "<details " << htmlAttribsToString(d.attribs()) << ">\n"; auto summary = d.summary(); if (summary) { std::visit(*this,*summary); } visitChildren(d); m_t << "</details>\n"; forceStartParagraph(d); } void HtmlDocVisitor::operator()(const DocHtmlHeader &header) { if (m_hide) return; forceEndParagraph(header); m_t << "<h" << header.level() << htmlAttribsToString(header.attribs()) << ">"; visitChildren(header); m_t << "</h" << header.level() << ">\n"; forceStartParagraph(header); } void HtmlDocVisitor::operator()(const DocImage &img) { if (img.type()==DocImage::Html) { bool inlineImage = img.isInlineImage(); bool typeSVG = img.isSVG(); QCString url = img.url(); if (!inlineImage) { forceEndParagraph(img); } if (m_hide) return; QCString baseName=makeShortName(img.name()); if (!inlineImage) m_t << "<div class=\"image\">\n"; QCString sizeAttribs; if (!img.width().isEmpty()) { sizeAttribs+=" width=\""+img.width()+"\""; } if (!img.height().isEmpty()) // link to local file { sizeAttribs+=" height=\""+img.height()+"\""; } // 16 cases: url.isEmpty() | typeSVG | inlineImage | img.hasCaption() HtmlAttribList extraAttribs; if (typeSVG) { HtmlAttrib opt; opt.name = "style"; opt.value = "pointer-events: none;"; extraAttribs.push_back(opt); } QCString alt; mergeHtmlAttributes(img.attribs(),extraAttribs); QCString attrs = htmlAttribsToString(extraAttribs,&alt); QCString src; if (url.isEmpty()) { src = img.relPath()+img.name(); } else { src = correctURL(url,img.relPath()); } if (typeSVG && !inlineImage) { m_t << "<object type=\"image/svg+xml\" data=\"" << convertToHtml(src) << "\"" << sizeAttribs << attrs; if (inlineImage) { // skip closing tag } else { m_t << ">" << alt << "</object>\n"; } } else { m_t << "<img src=\"" << convertToHtml(src) << "\" alt=\"" << alt << "\"" << sizeAttribs << attrs; if (inlineImage) { m_t << " class=\"inline\""; } else { m_t << "/>\n"; } } if (img.hasCaption()) { if (inlineImage) { m_t << " title=\""; m_insideTitle=true; } else { m_t << "<div class=\"caption\">\n"; } } else if (inlineImage) { m_t << "/>"; } visitChildren(img); if (img.hasCaption()) { if (inlineImage) { m_t << "\"/>"; m_insideTitle=false; } else // end <div class="caption"> { m_t << "</div>"; } } if (!inlineImage) // end <div class="image"> { m_t << "</div>\n"; forceStartParagraph(img); } } else // other format -> skip { } } void HtmlDocVisitor::operator()(const DocDotFile &df) { if (m_hide) return; if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file())); forceEndParagraph(df); m_t << "<div class=\"dotgraph\">\n"; writeDotFile(df.file(),df.relPath(),df.context(),df.srcFile(),df.srcLine()); if (df.hasCaption()) { m_t << "<div class=\"caption\">\n"; } visitChildren(df); if (df.hasCaption()) { m_t << "</div>\n"; } m_t << "</div>\n"; forceStartParagraph(df); } void HtmlDocVisitor::operator()(const DocMscFile &df) { if (m_hide) return; if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file())); forceEndParagraph(df); m_t << "<div class=\"mscgraph\">\n"; writeMscFile(df.file(),df.relPath(),df.context(),df.srcFile(),df.srcLine()); if (df.hasCaption()) { m_t << "<div class=\"caption\">\n"; } visitChildren(df); if (df.hasCaption()) { m_t << "</div>\n"; } m_t << "</div>\n"; forceStartParagraph(df); } void HtmlDocVisitor::operator()(const DocDiaFile &df) { if (m_hide) return; if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file())); forceEndParagraph(df); m_t << "<div class=\"diagraph\">\n"; writeDiaFile(df.file(),df.relPath(),df.context(),df.srcFile(),df.srcLine()); if (df.hasCaption()) { m_t << "<div class=\"caption\">\n"; } visitChildren(df); if (df.hasCaption()) { m_t << "</div>\n"; } m_t << "</div>\n"; forceStartParagraph(df); } void HtmlDocVisitor::operator()(const DocPlantUmlFile &df) { if (m_hide) return; if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(HTML_OUTPUT)+"/"+stripPath(df.file())); forceEndParagraph(df); QCString htmlOutput = Config_getString(HTML_OUTPUT); QCString imgExt = getDotImageExtension(); PlantumlManager::OutputFormat format = PlantumlManager::PUML_BITMAP; // default : PUML_BITMAP if (imgExt=="svg") { format = PlantumlManager::PUML_SVG; } std::string inBuf; readInputFile(df.file(),inBuf); QCString baseName = PlantumlManager::instance().writePlantUMLSource( htmlOutput,QCString(), inBuf.c_str(),format,QCString(),df.srcFile(),df.srcLine(),false); baseName=makeBaseName(baseName); m_t << "<div class=\"plantumlgraph\">\n"; writePlantUMLFile(baseName,df.relPath(),QCString(),df.srcFile(),df.srcLine()); if (df.hasCaption()) { m_t << "<div class=\"caption\">\n"; } visitChildren(df); if (df.hasCaption()) { m_t << "</div>\n"; } m_t << "</div>\n"; forceStartParagraph(df); } void HtmlDocVisitor::operator()(const DocLink &lnk) { if (m_hide) return; startLink(lnk.ref(),lnk.file(),lnk.relPath(),lnk.anchor()); visitChildren(lnk); endLink(); } void HtmlDocVisitor::operator()(const DocRef &ref) { if (m_hide) return; if (!ref.file().isEmpty()) { // when ref.isSubPage()==TRUE we use ref.file() for HTML and // ref.anchor() for LaTeX/RTF startLink(ref.ref(),ref.file(),ref.relPath(),ref.isSubPage() ? QCString() : ref.anchor()); } if (!ref.hasLinkText()) filter(ref.targetTitle()); visitChildren(ref); if (!ref.file().isEmpty()) endLink(); //m_t << " "; } void HtmlDocVisitor::operator()(const DocSecRefItem &ref) { if (m_hide) return; if (!ref.file().isEmpty()) { m_t << "<li>"; startLink(ref.ref(),ref.file(),ref.relPath(),ref.isSubPage() ? QCString() : ref.anchor()); } visitChildren(ref); if (!ref.file().isEmpty()) { endLink(); m_t << "</li>\n"; } } void HtmlDocVisitor::operator()(const DocSecRefList &s) { if (m_hide) return; forceEndParagraph(s); m_t << "<div>\n"; m_t << "<ul class=\"multicol\">\n"; visitChildren(s); m_t << "</ul>\n"; m_t << "</div>\n"; forceStartParagraph(s); } void HtmlDocVisitor::operator()(const DocParamSect &s) { if (m_hide) return; forceEndParagraph(s); QCString className; QCString heading; switch(s.type()) { case DocParamSect::Param: heading=theTranslator->trParameters(); className="params"; break; case DocParamSect::RetVal: heading=theTranslator->trReturnValues(); className="retval"; break; case DocParamSect::Exception: heading=theTranslator->trExceptions(); className="exception"; break; case DocParamSect::TemplateParam: heading=theTranslator->trTemplateParameters(); className="tparams"; break; default: ASSERT(0); } m_t << "<dl class=\"" << className << "\"><dt>"; m_t << heading; m_t << "</dt><dd>\n"; m_t << " <table class=\"" << className << "\">\n"; visitChildren(s); m_t << " </table>\n"; m_t << " </dd>\n"; m_t << "</dl>\n"; forceStartParagraph(s); } void HtmlDocVisitor::operator()(const DocSeparator &s) { if (m_hide) return; m_t << "&#160;" << s.chars() << "&#160;"; } void HtmlDocVisitor::operator()(const DocParamList &pl) { //printf("DocParamList::visitPre\n"); if (m_hide) return; m_t << " <tr>"; const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent()); if (sect && sect->hasInOutSpecifier()) { m_t << "<td class=\"paramdir\">"; if (pl.direction()!=DocParamSect::Unspecified) { m_t << "["; if (pl.direction()==DocParamSect::In) { m_t << "in"; } else if (pl.direction()==DocParamSect::Out) { m_t << "out"; } else if (pl.direction()==DocParamSect::InOut) { m_t << "in,out"; } m_t << "]"; } m_t << "</td>"; } if (sect && sect->hasTypeSpecifier()) { m_t << "<td class=\"paramtype\">"; for (const auto &type : pl.paramTypes()) { std::visit(*this,type); } m_t << "</td>"; } m_t << "<td class=\"paramname\">"; bool first=TRUE; for (const auto &param : pl.parameters()) { if (!first) m_t << ","; else first=FALSE; std::visit(*this,param); } m_t << "</td><td>"; for (const auto &par : pl.paragraphs()) { std::visit(*this,par); } m_t << "</td></tr>\n"; } void HtmlDocVisitor::operator()(const DocXRefItem &x) { if (m_hide) return; if (x.title().isEmpty()) return; forceEndParagraph(x); bool anonymousEnum = x.file()=="@"; if (!anonymousEnum) { QCString fn = x.file(); addHtmlExtensionIfMissing(fn); m_t << "<dl class=\"" << x.key() << "\"><dt><b><a class=\"el\" href=\"" << x.relPath() << fn << "#" << x.anchor() << "\">"; } else { m_t << "<dl class=\"" << x.key() << "\"><dt><b>"; } filter(x.title()); if (!anonymousEnum) m_t << "</a>"; m_t << "</b></dt><dd>"; visitChildren(x); if (x.title().isEmpty()) return; m_t << "</dd></dl>\n"; forceStartParagraph(x); } void HtmlDocVisitor::operator()(const DocInternalRef &ref) { if (m_hide) return; startLink(QCString(),ref.file(),ref.relPath(),ref.anchor()); visitChildren(ref); endLink(); m_t << " "; } void HtmlDocVisitor::operator()(const DocText &t) { visitChildren(t); } void HtmlDocVisitor::operator()(const DocHtmlBlockQuote &b) { if (m_hide) return; forceEndParagraph(b); m_t << "<blockquote class=\"doxtable\"" << htmlAttribsToString(b.attribs()) << ">\n"; visitChildren(b); m_t << "</blockquote>\n"; forceStartParagraph(b); } void HtmlDocVisitor::operator()(const DocVhdlFlow &vf) { if (m_hide) return; if (VhdlDocGen::getFlowMember()) // use VHDL flow chart creator { forceEndParagraph(vf); QCString fname=FlowChart::convertNameToFileName(); m_t << "<p>"; m_t << theTranslator->trFlowchart(); m_t << " "; m_t << "<a href=\""; m_t << fname; m_t << ".svg\">"; m_t << VhdlDocGen::getFlowMember()->name(); m_t << "</a>"; if (vf.hasCaption()) { m_t << "<br />"; } } visitChildren(vf); if (VhdlDocGen::getFlowMember()) // use VHDL flow chart creator { m_t << "</p>"; forceStartParagraph(vf); } } void HtmlDocVisitor::operator()(const DocParBlock &pb) { if (m_hide) return; visitChildren(pb); } void HtmlDocVisitor::filter(const QCString &str, const bool retainNewline) { if (str.isEmpty()) return; const char *p=str.data(); while (*p) { char c=*p++; switch(c) { case '\n': if(retainNewline) m_t << "<br/>"; m_t << c; break; case '<': m_t << "&lt;"; break; case '>': m_t << "&gt;"; break; case '&': m_t << "&amp;"; break; case '\\': if ((*p == '(') || (*p == ')')) m_t << "\\&zwj;" << *p++; else m_t << c; break; default: { uint8_t uc = static_cast<uint8_t>(c); if (uc<32 && !isspace(c)) // non-printable control characters { m_t << "&#x24" << hex[uc>>4] << hex[uc&0xF] << ";"; } else { m_t << c; } } break; } } } /// Escape basic entities to produce a valid CDATA attribute value, /// assume that the outer quoting will be using the double quote &quot; QCString HtmlDocVisitor::filterQuotedCdataAttr(const QCString &str) { GrowBuf growBuf; if (str.isEmpty()) return str; const char *p=str.data(); while (*p) { char c=*p++; switch(c) { case '&': growBuf.addStr("&amp;"); break; case '"': growBuf.addStr("&quot;"); break; case '<': growBuf.addStr("&lt;"); break; case '>': growBuf.addStr("&gt;"); break; case '\\': if ((*p == '(') || (*p == ')')) { growBuf.addStr("\\&zwj;"); growBuf.addChar(*p++); } else { growBuf.addChar(c); } break; default: { uint8_t uc = static_cast<uint8_t>(c); if (uc<32 && !isspace(c)) // non-printable control characters { growBuf.addStr("&#x24"); growBuf.addChar(hex[uc>>4]); growBuf.addChar(hex[uc&0xF]); growBuf.addStr(";"); } else { growBuf.addChar(c); } } break; } } growBuf.addChar(0); return growBuf.get(); } void HtmlDocVisitor::startLink(const QCString &ref,const QCString &file, const QCString &relPath,const QCString &anchor, const QCString &tooltip) { //printf("HtmlDocVisitor: file=%s anchor=%s\n",qPrint(file),qPrint(anchor)); if (!ref.isEmpty()) // link to entity imported via tag file { m_t << "<a class=\"elRef\" "; m_t << externalLinkTarget(); } else // local link { m_t << "<a class=\"el\" "; } m_t << "href=\""; QCString fn = file; addHtmlExtensionIfMissing(fn); m_t << createHtmlUrl(relPath,ref,true, m_fileName == Config_getString(HTML_OUTPUT)+"/"+fn, fn, anchor); m_t << "\""; if (!tooltip.isEmpty()) m_t << " title=\"" << convertToHtml(tooltip) << "\""; m_t << ">"; } void HtmlDocVisitor::endLink() { m_t << "</a>"; } void HtmlDocVisitor::writeDotFile(const QCString &fn,const QCString &relPath, const QCString &context,const QCString &srcFile,int srcLine) { QCString baseName=makeBaseName(fn); baseName.prepend("dot_"); QCString outDir = Config_getString(HTML_OUTPUT); writeDotGraphFromFile(fn,outDir,baseName,GraphOutputFormat::BITMAP,srcFile,srcLine); writeDotImageMapFromFile(m_t,fn,outDir,relPath,baseName,context,-1,srcFile,srcLine); } void HtmlDocVisitor::writeMscFile(const QCString &fileName,const QCString &relPath, const QCString &context,const QCString &srcFile,int srcLine) { QCString baseName=makeBaseName(fileName); baseName.prepend("msc_"); QCString outDir = Config_getString(HTML_OUTPUT); QCString imgExt = getDotImageExtension(); MscOutputFormat mscFormat = MscOutputFormat::BITMAP; if ("svg" == imgExt) mscFormat = MscOutputFormat::SVG; writeMscGraphFromFile(fileName,outDir,baseName,mscFormat,srcFile,srcLine); writeMscImageMapFromFile(m_t,fileName,outDir,relPath,baseName,context,mscFormat,srcFile,srcLine); } void HtmlDocVisitor::writeDiaFile(const QCString &fileName, const QCString &relPath, const QCString &,const QCString &srcFile,int srcLine) { QCString baseName=makeBaseName(fileName); baseName.prepend("dia_"); QCString outDir = Config_getString(HTML_OUTPUT); writeDiaGraphFromFile(fileName,outDir,baseName,DiaOutputFormat::BITMAP,srcFile,srcLine); m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />\n"; } void HtmlDocVisitor::writePlantUMLFile(const QCString &fileName, const QCString &relPath, const QCString &,const QCString &/* srcFile */,int /* srcLine */) { QCString baseName=makeBaseName(fileName); QCString outDir = Config_getString(HTML_OUTPUT); QCString imgExt = getDotImageExtension(); if (imgExt=="svg") { PlantumlManager::instance().generatePlantUMLOutput(fileName,outDir,PlantumlManager::PUML_SVG); //m_t << "<iframe scrolling=\"no\" frameborder=\"0\" src=\"" << relPath << baseName << ".svg" << "\" />\n"; //m_t << "<p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p>"; //m_t << "</iframe>\n"; m_t << "<object type=\"image/svg+xml\" data=\"" << relPath << baseName << ".svg\"></object>\n"; } else { PlantumlManager::instance().generatePlantUMLOutput(fileName,outDir,PlantumlManager::PUML_BITMAP); m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />\n"; } } /** Returns TRUE if the child nodes in paragraph \a para until \a nodeIndex contain a style change node that is still active and that style change is one that must be located outside of a paragraph, i.e. it is a center, div, or pre tag. See also bug746162. */ static bool insideStyleChangeThatIsOutsideParagraph(const DocPara *para, DocNodeList::const_iterator it) { //printf("insideStyleChangeThatIsOutputParagraph(index=%d)\n",nodeIndex); int styleMask=0; bool styleOutsideParagraph=FALSE; while (!styleOutsideParagraph) { const DocNodeVariant *n = &(*it); const DocStyleChange *sc = std::get_if<DocStyleChange>(n); if (sc) { if (!sc->enable()) // remember styles that has been closed already { styleMask|=static_cast<int>(sc->style()); } bool paraStyle = sc->style()==DocStyleChange::Center || sc->style()==DocStyleChange::Div || sc->style()==DocStyleChange::Preformatted; //printf("Found style change %s enabled=%d\n",sc->styleString(),sc->enable()); if (sc->enable() && (styleMask&static_cast<int>(sc->style()))==0 && // style change that is still active paraStyle ) { styleOutsideParagraph=TRUE; } } if (it!=std::begin(para->children())) { --it; } else { break; } } return styleOutsideParagraph; } /** Used for items found inside a paragraph, which due to XHTML restrictions * have to be outside of the paragraph. This method will forcefully end * the current paragraph and forceStartParagraph() will restart it. */ template<class Node> void HtmlDocVisitor::forceEndParagraph(const Node &n) { const DocPara *para=std::get_if<DocPara>(n.parent()); if (para) { const DocNodeList &children = para->children(); //printf("forceEndParagraph\n"); //dumpDocNodeList(children); auto it = std::find_if(std::begin(children),std::end(children), [&n](const auto &np) { return holds_value(&n,np); }); if (it==std::end(children)) return; if (it==std::begin(children)) return; // first node in paragraph it = std::prev(it); bool found=false; while (!found) { found = !isInvisibleNode(*it); if (found) break; if (it!=std::begin(children)) { --it; } else { break; } } if (!found) return; // first visible node in paragraph const DocNodeVariant &v = *it; if (mustBeOutsideParagraph(v)) return; // previous node already outside paragraph context bool styleOutsideParagraph=false; if (it!=std::begin(children)) { it = std::prev(it); styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,it); } bool isFirst = false; bool isLast = false; getParagraphContext(*para,isFirst,isLast); //printf("forceEnd first=%d last=%d styleOutsideParagraph=%d\n",isFirst,isLast,styleOutsideParagraph); if (isFirst && isLast) return; if (styleOutsideParagraph) return; //printf("adding </p>\n"); m_t << "</p>"; } } /** Used for items found inside a paragraph, which due to XHTML restrictions * have to be outside of the paragraph. This method will forcefully start * the paragraph, that was previously ended by forceEndParagraph(). */ template<class Node> void HtmlDocVisitor::forceStartParagraph(const Node &n) { //printf("> forceStartParagraph(%s)\n",docNodeName(n)); const DocPara *para=nullptr; if (n.parent() && (para = std::get_if<DocPara>(n.parent()))) // if we are inside a paragraph { const DocNodeList &children = para->children(); auto it = std::find_if(std::begin(children), std::end(children), [&n](const auto &np) { return holds_value(&n,np); }); if (it==std::end(children)) return; bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,it); //printf("it=%s (%p) styleOutsideParagraph=%d\n", // docNodeName(*it), (void *)&*it, styleOutsideParagraph); if (styleOutsideParagraph) return; it = std::next(it); while (it!=std::end(children) && isInvisibleNode(*it)) { ++it; } if (it!=std::end(children)) { const DocNodeVariant &v = *it; if (mustBeOutsideParagraph(v)) return; // next element also outside paragraph } else { return; // only whitespace at the end! } bool needsTag = true; bool isFirst = false; bool isLast = false; getParagraphContext(*para,isFirst,isLast); if (isFirst && isLast) needsTag = false; //printf("forceStart first=%d last=%d needsTag=%d\n",isFirst,isLast,needsTag); if (needsTag) m_t << "<p>"; } }
70,010
C++
.cpp
2,307
24.032943
148
0.56886
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,469
pagedef.cpp
doxygen_doxygen/src/pagedef.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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 "pagedef.h" #include "groupdef.h" #include "docparser.h" #include "config.h" #include "util.h" #include "outputlist.h" #include "doxygen.h" #include "language.h" #include "namespacedef.h" #include "reflist.h" #include "definitionimpl.h" #include "indexlist.h" //------------------------------------------------------------------------------------------ class PageDefImpl : public DefinitionMixin<PageDef> { public: PageDefImpl(const QCString &f,int l,const QCString &n,const QCString &d,const QCString &t); ~PageDefImpl() override; NON_COPYABLE(PageDefImpl) void setFileName(const QCString &name) override; void setLocalToc(const LocalToc &tl) override; void setShowLineNo(bool) override; DefType definitionType() const override { return TypePage; } CodeSymbolType codeSymbolType() const override { return CodeSymbolType::Default; } bool isLinkableInProject() const override { return /*hasDocumentation() &&*/ !isReference(); } bool isLinkable() const override { return isLinkableInProject() || isReference(); } QCString getOutputFileBase() const override; QCString anchor() const override { return QCString(); } void findSectionsInDocumentation() override; QCString title() const override { return m_title; } const GroupDef * getGroupDef() const override; const PageLinkedRefMap &getSubPages() const override { return m_subPages; } void addInnerCompound(Definition *d) override; bool visibleInIndex() const override; bool documentedPage() const override; bool hasSubPages() const override; bool hasParentPage() const override; bool hasTitle() const override; LocalToc localToc() const override { return m_localToc; } void setPageScope(Definition *d) override { m_pageScope = d; } Definition *getPageScope() const override { return m_pageScope; } QCString displayName(bool=TRUE) const override { return hasTitle() ? m_title : DefinitionMixin::name(); } bool showLineNo() const override; void setTitle(const QCString &title) override; void writeDocumentation(OutputList &ol) override; void writeTagFile(TextStream &) override; void setNestingLevel(int l) override; void writePageDocumentation(OutputList &ol) const override; void addSectionsToIndex() override; private: QCString m_fileName; QCString m_title; PageLinkedRefMap m_subPages; // list of pages in the group Definition *m_pageScope; int m_nestingLevel; LocalToc m_localToc; bool m_showLineNo; }; std::unique_ptr<PageDef> createPageDef(const QCString &f,int l,const QCString &n,const QCString &d,const QCString &t) { return std::make_unique<PageDefImpl>(f,l,n,d,t); } //------------------------------------------------------------------------------------------ PageDefImpl::PageDefImpl(const QCString &f,int l,const QCString &n, const QCString &d,const QCString &t) : DefinitionMixin(f,l,1,n), m_title(!t.isEmpty() ? t : n) { setDocumentation(d,f,l); m_pageScope = nullptr; m_nestingLevel = 0; m_fileName = ::convertNameToFile(n,FALSE,TRUE); m_showLineNo = FALSE; } PageDefImpl::~PageDefImpl() { } void PageDefImpl::findSectionsInDocumentation() { docFindSections(briefDescription(),this,docFile()); docFindSections(documentation(),this,docFile()); docFindSections(inbodyDocumentation(),this,docFile()); } const GroupDef *PageDefImpl::getGroupDef() const { return !partOfGroups().empty() ? partOfGroups().front() : nullptr; } QCString PageDefImpl::getOutputFileBase() const { if (getGroupDef()) return getGroupDef()->getOutputFileBase(); else return m_fileName; } void PageDefImpl::setFileName(const QCString &name) { m_fileName = name; } void PageDefImpl::addInnerCompound(Definition *def) { if (def->definitionType()==Definition::TypePage) { PageDef *pd = toPageDef(def); if (pd) { m_subPages.add(pd->name(),pd); pd->setOuterScope(this); if (this==Doxygen::mainPage.get()) { pd->setNestingLevel(m_nestingLevel); } else { pd->setNestingLevel(m_nestingLevel+1); } } } } void PageDefImpl::addSectionsToIndex() { const SectionRefs &sectionRefs = getSectionRefs(); if (sectionRefs.empty()) return; //printf("PageDefImpl::addSectionsToIndex()\n"); int level=1; for (auto it = sectionRefs.begin(); it!=sectionRefs.end(); ++it) { const SectionInfo *si = *it; SectionType type = si->type(); if (type.isSection()) { //printf(" level=%d title=%s\n",level,qPrint(si->title)); int nextLevel = type.level(); if (nextLevel>level) { for (int i=level;i<nextLevel;i++) { Doxygen::indexList->incContentsDepth(); } } else if (nextLevel<level) { for (int i=nextLevel;i<level;i++) { Doxygen::indexList->decContentsDepth(); } } QCString title = si->title(); if (title.isEmpty()) title = si->label(); title = parseCommentAsText(this,nullptr,title,si->fileName(),si->lineNr()); // determine if there is a next level inside this item, but be aware of the anchor and table section references. auto it_next = std::next(it); bool isDir = (it_next!=sectionRefs.end()) ? ((*it_next)->type().isSection() && (*it_next)->type().level() > nextLevel) : false; Doxygen::indexList->addContentsItem(isDir,title, getReference(), getOutputFileBase(), si->label(), false, true); level = nextLevel; } } while (level>1) { Doxygen::indexList->decContentsDepth(); level--; } } bool PageDefImpl::hasParentPage() const { return getOuterScope() && getOuterScope()->definitionType()==Definition::TypePage; } void PageDefImpl::writeTagFile(TextStream &tagFile) { bool found = name()=="citelist"; for (RefListManager::Ptr &rl : RefListManager::instance()) { if (rl->listName()==name()) { found=TRUE; break; } } if (!found) // not one of the generated related pages { QCString fn = getOutputFileBase(); addHtmlExtensionIfMissing(fn); tagFile << " <compound kind=\"page\">\n"; tagFile << " <name>" << name() << "</name>\n"; tagFile << " <title>" << convertToXML(title()) << "</title>\n"; tagFile << " <filename>" << fn << "</filename>\n"; for (const auto &subPage : m_subPages) { QCString sfn = subPage->getOutputFileBase(); addHtmlExtensionIfMissing(sfn); tagFile << " <subpage>" << sfn << "</subpage>\n"; } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>\n"; } } void PageDefImpl::writeDocumentation(OutputList &ol) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); int hierarchyLevel = -1; // Pages start at the root PageDef *pd = this; while (pd->hasParentPage()) { pd = (PageDef *)pd->getOuterScope(); ++hierarchyLevel; } //outputList->disable(OutputType::Man); QCString pageName,manPageName; pageName = escapeCharsInString(name(),FALSE,TRUE); manPageName = escapeCharsInString(name(),TRUE,TRUE); //printf("PageDefImpl::writeDocumentation: %s\n",getOutputFileBase().data()); ol.pushGeneratorState(); //1.{ ol.pushGeneratorState(); //2.{ ol.disableAllBut(OutputType::Man); startFile(ol,getOutputFileBase(),manPageName,title(),HighlightedItem::Pages,!generateTreeView, QCString() /* altSidebarName */, hierarchyLevel); ol.enableAll(); ol.disable(OutputType::Man); startFile(ol,getOutputFileBase(),pageName,title(),HighlightedItem::Pages,!generateTreeView, QCString() /* altSidebarName */, hierarchyLevel); ol.popGeneratorState(); //2.} if (!generateTreeView) { if (getOuterScope()!=Doxygen::globalScope && !Config_getBool(DISABLE_INDEX)) { DefinitionMutable *outerScope = toDefinitionMutable(getOuterScope()); if (outerScope) { outerScope->writeNavigationPath(ol); } } ol.endQuickIndices(); } const SectionInfo *si=SectionManager::instance().find(name()); // save old generator state and write title only to Man generator ol.pushGeneratorState(); //2.{ ol.disableAllBut(OutputType::Man); ol.startTitleHead(manPageName); ol.endTitleHead(manPageName, manPageName); if (si) { ol.writeString(" - "); if (si->title() != manPageName) { ol.generateDoc(docFile(),getStartBodyLine(),this,nullptr,si->title(),TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endSection(si->label(),si->type()); } } ol.popGeneratorState(); //2.} ol.pushGeneratorState(); //2.{ ol.disable(OutputType::Man); QCString title; if (this == Doxygen::mainPage.get() && !hasTitle()) title = theTranslator->trMainPage(); else title = m_title; if (!title.isEmpty() && !name().isEmpty() && si!=nullptr) { ol.startPageDoc(si->title()); //ol.startSection(si->label,si->title,si->type); ol.startHeaderSection(); ol.startTitleHead(getOutputFileBase()); ol.parseText(title); ol.endTitleHead(getOutputFileBase(),title); ol.endHeaderSection(); /*ol.generateDoc(docFile(),getStartBodyLine(),this,nullptr,si->title(),TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));*/ } else ol.startPageDoc(""); ol.popGeneratorState(); //2.} ol.startContents(); if ((m_localToc.isHtmlEnabled() || m_localToc.isLatexEnabled() || m_localToc.isDocbookEnabled()) && hasSections()) { writeToc(ol, m_localToc); } writePageDocumentation(ol); ol.endContents(); ol.endPageDoc(); if (generateTreeView && getOuterScope()!=Doxygen::globalScope && !Config_getBool(DISABLE_INDEX)) { endFileWithNavPath(ol,getOuterScope()); } else { endFile(ol,FALSE,TRUE); } ol.popGeneratorState(); //1.} } void PageDefImpl::writePageDocumentation(OutputList &ol) const { ol.startTextBlock(); QCString docStr = (briefDescription().isEmpty()?"":briefDescription()+"\n\n")+documentation()+inbodyDocumentation(); if (hasBriefDescription() && !SectionManager::instance().find(name())) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.writeString(" - "); ol.popGeneratorState(); } ol.disableAllBut(OutputType::Html); ol.generateDoc( docFile(), // fileName docLine(), // startLine this, // context nullptr, // memberdef docStr, // docStr true, // index words false, // not an example QCString(), // exampleName false, // singleLine false, // linkFromIndex TRUE // markdown support ); ol.enableAll(); ol.disable(OutputType::Html); ol.generateDoc( docFile(), // fileName docLine(), // startLine this, // context nullptr, // memberdef docStr, // docStr false, // index words false, // not an example QCString(), // exampleName false, // singleLine false, // linkFromIndex TRUE // markdown support ); ol.enable(OutputType::Html); ol.endTextBlock(); if (hasSubPages()) { // for printed documentation we write subpages as section's of the // parent page. ol.pushGeneratorState(); ol.disableAll(); ol.enable(OutputType::Latex); ol.enable(OutputType::Docbook); ol.enable(OutputType::RTF); for (const auto &subPage : m_subPages) { ol.writePageLink(subPage->getOutputFileBase(), FALSE); } ol.popGeneratorState(); } } bool PageDefImpl::visibleInIndex() const { bool externalPages = Config_getBool(EXTERNAL_PAGES); return // not part of a group !getGroupDef() && // not an externally defined page (!isReference() || externalPages); } bool PageDefImpl::documentedPage() const { return // not part of a group !getGroupDef() && // not an externally defined page !isReference(); } bool PageDefImpl::hasSubPages() const { return !m_subPages.empty(); } void PageDefImpl::setNestingLevel(int l) { m_nestingLevel = l; } void PageDefImpl::setLocalToc(const LocalToc &lt) { m_localToc = lt; } void PageDefImpl::setShowLineNo(bool b) { m_showLineNo = b; } bool PageDefImpl::showLineNo() const { return m_showLineNo; } bool PageDefImpl::hasTitle() const { return !m_title.isEmpty() && m_title.lower()!="notitle"; } void PageDefImpl::setTitle(const QCString &title) { m_title = title; } // --- Cast functions PageDef *toPageDef(Definition *d) { if (d==nullptr) return nullptr; if (d && typeid(*d)==typeid(PageDefImpl)) { return static_cast<PageDef*>(d); } else { return nullptr; } } const PageDef *toPageDef(const Definition *d) { if (d==nullptr) return nullptr; if (d && typeid(*d)==typeid(PageDefImpl)) { return static_cast<const PageDef*>(d); } else { return nullptr; } }
14,103
C++
.cpp
443
27.23702
134
0.644626
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,470
dotrunner.cpp
doxygen_doxygen/src/dotrunner.cpp
/****************************************************************************** * * Copyright (C) 1997-2019 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 <cassert> #include <cmath> #ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable : 4242 ) #pragma warning( disable : 4244 ) #pragma warning( disable : 4996 ) #endif #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif #include <gunzip.hh> #if defined(__clang__) #pragma clang diagnostic pop #endif #ifdef _MSC_VER #pragma warning( pop ) #endif #include "dotrunner.h" #include "util.h" #include "portable.h" #include "dot.h" #include "message.h" #include "config.h" #include "dir.h" #include "doxygen.h" // the graphicx LaTeX has a limitation of maximum size of 16384 // To be on the save side we take it a little bit smaller i.e. 150 inch * 72 dpi // It is anyway hard to view these size of images #define MAX_LATEX_GRAPH_INCH 150 #define MAX_LATEX_GRAPH_SIZE (MAX_LATEX_GRAPH_INCH * 72) //#define DBG(x) printf x #define DBG(x) do {} while(0) //----------------------------------------------------------------------------------------- // since dot silently reproduces the input file when it does not // support the PNG format, we need to check the result. static void checkPngResult(const QCString &imgName) { FILE *f = Portable::fopen(imgName,"rb"); if (f) { char data[4]; if (fread(data,1,4,f)==4) { if (!(data[1]=='P' && data[2]=='N' && data[3]=='G')) { err("Image '%s' produced by dot is not a valid PNG!\n" "You should either select a different format " "(DOT_IMAGE_FORMAT in the config file) or install a more " "recent version of graphviz (1.7+)\n",qPrint(imgName) ); } } else { err("Could not read image '%s' generated by dot!\n",qPrint(imgName)); } fclose(f); } else { err("Could not open image '%s' generated by dot!\n",qPrint(imgName)); } } static bool resetPDFSize(const int width,const int height, const QCString &base) { QCString tmpName = base+".tmp"; QCString patchFile = base+".dot"; Dir thisDir; if (!thisDir.rename(patchFile.str(),tmpName.str())) { err("Failed to rename file %s to %s!\n",qPrint(patchFile),qPrint(tmpName)); return FALSE; } std::ifstream fi = Portable::openInputStream(tmpName); std::ofstream t = Portable::openOutputStream(patchFile); if (!fi.is_open()) { err("problem opening file %s for patching!\n",qPrint(tmpName)); thisDir.rename(tmpName.str(),patchFile.str()); return FALSE; } if (!t.is_open()) { err("problem opening file %s for patching!\n",qPrint(patchFile)); thisDir.rename(tmpName.str(),patchFile.str()); return FALSE; } std::string line; while (getline(fi,line)) // foreach line { if (line.find("LATEX_PDF_SIZE") != std::string::npos) { double scale = (width > height ? width : height)/double(MAX_LATEX_GRAPH_INCH); t << " size=\""<<width/scale << "," <<height/scale << "\";\n"; } else t << line << "\n"; } fi.close(); t.close(); // remove temporary file thisDir.remove(tmpName.str()); return TRUE; } bool DotRunner::readBoundingBox(const QCString &fileName,int *width,int *height,bool isEps) { std::ifstream f = Portable::openInputStream(fileName); if (!f.is_open()) { err("Failed to open file %s for extracting bounding box\n",qPrint(fileName)); return false; } // read file contents into string 'contents' std::stringstream buffer; buffer << f.rdbuf(); std::string contents = buffer.str(); // start of bounding box marker we are looking for const std::string boundingBox = isEps ? "%%PageBoundingBox:" : "/MediaBox ["; // helper routine to extract the bounding boxes width and height auto extractBoundingBox = [&fileName,&boundingBox,&width,&height](const char *s) -> bool { int x=0, y=0; double w=0, h=0; if (sscanf(s+boundingBox.length(),"%d %d %lf %lf",&x,&y,&w,&h)==4) { *width = static_cast<int>(std::ceil(w)); *height = static_cast<int>(std::ceil(h)); return true; } err("Failed to extract bounding box from generated diagram file %s\n",qPrint(fileName)); return false; }; // compressed segment start and end markers const std::string streamStart = "stream\n"; const std::string streamEnd = "\nendstream"; auto detectDeflateStreamStart = [&streamStart](const char *s) { size_t len = streamStart.length(); bool streamOK = strncmp(s,streamStart.c_str(),len)==0; if (streamOK) // ASCII marker matches, check stream header bytes as well { unsigned short header1 = static_cast<unsigned char>(s[len])<<8; // CMF byte if (header1) // not end of string { unsigned short header = (static_cast<unsigned char>(s[len+1])) | header1; // FLG byte // check for correct header (see https://www.rfc-editor.org/rfc/rfc1950) return ((header&0x8F20)==0x0800) && (header%31)==0; } } return false; }; const size_t l = contents.length(); size_t i=0; while (i<l) { if (!isEps && contents[i]=='s' && detectDeflateStreamStart(&contents[i])) { // compressed stream start int col=17; i+=streamStart.length(); const size_t start=i; DBG(("---- start stream at offset %08x\n",(int)i)); while (i<l) { if (contents[i]=='\n' && strncmp(&contents[i],streamEnd.c_str(),streamEnd.length())==0) { // compressed block found in range [start..i] DBG(("\n---- end stream at offset %08x\n",(int)i)); // decompress it into decompressBuf std::vector<char> decompressBuf; const char *source = &contents[start]; const size_t sourceLen = i-start; size_t sourcePos = 0; decompressBuf.reserve(sourceLen*2); auto getter = [source,&sourcePos,sourceLen]() -> int { return sourcePos<sourceLen ? static_cast<unsigned char>(source[sourcePos++]) : EOF; }; auto putter = [&decompressBuf](const char c) -> int { decompressBuf.push_back(c); return c; }; Deflate(getter,putter); // convert decompression buffer to string std::string s(decompressBuf.begin(), decompressBuf.end()); DBG(("decompressed_data=[[[\n%s\n]]]\n",s.c_str())); // search for bounding box marker const size_t idx = s.find(boundingBox); if (idx!=std::string::npos) // found bounding box in uncompressed data { return extractBoundingBox(s.c_str()+idx); } // continue searching after end stream marker i+=streamEnd.length(); break; } else // compressed stream character { if (col>16) { col=0; DBG(("\n%08x: ",static_cast<int>(i))); } DBG(("%02x ",static_cast<unsigned char>(contents[i]))); col++; i++; } } } else if (((isEps && contents[i]=='%') || (!isEps && contents[i]=='/')) && strncmp(&contents[i],boundingBox.c_str(),boundingBox.length())==0) { // uncompressed bounding box return extractBoundingBox(&contents[i]); } else // uncompressed stream character { i++; } } err("Failed to find bounding box in generated diagram file %s\n",qPrint(fileName)); // nothing found return false; } //--------------------------------------------------------------------------------- DotRunner::DotRunner(const QCString& absDotName, const QCString& md5Hash) : m_file(absDotName) , m_md5Hash(md5Hash) , m_dotExe(Doxygen::verifiedDotPath) , m_cleanUp(Config_getBool(DOT_CLEANUP)) { } void DotRunner::addJob(const QCString &format, const QCString &output, const QCString &srcFile,int srcLine) { for (auto& s: m_jobs) { if (s.format != format) continue; if (s.output != output) continue; // we have this job already return; } auto args = QCString("-T") + format + " -o \"" + output + "\""; m_jobs.emplace_back(format, output, args, srcFile, srcLine); } QCString getBaseNameOfOutput(const QCString &output) { int index = output.findRev('.'); if (index < 0) return output; return output.left(index); } bool DotRunner::run() { int exitCode=0; QCString dotArgs; QCString srcFile; int srcLine=-1; // create output if (Config_getBool(DOT_MULTI_TARGETS)) { dotArgs=QCString("\"")+m_file+"\""; for (auto& s: m_jobs) { dotArgs+=' '; dotArgs+=s.args; } if (!m_jobs.empty()) { srcFile = m_jobs.front().srcFile; srcLine = m_jobs.front().srcLine; } if ((exitCode=Portable::system(m_dotExe,dotArgs,FALSE))!=0) goto error; } else { for (auto& s : m_jobs) { srcFile = s.srcFile; srcLine = s.srcLine; dotArgs=QCString("\"")+m_file+"\" "+s.args; if ((exitCode=Portable::system(m_dotExe,dotArgs,FALSE))!=0) goto error; } } // check output // As there should be only one pdf file be generated, we don't need code for regenerating multiple pdf files in one call for (auto& s : m_jobs) { if (s.format.startsWith("pdf")) { int width=0,height=0; if (!readBoundingBox(s.output,&width,&height,FALSE)) goto error; if ((width > MAX_LATEX_GRAPH_SIZE) || (height > MAX_LATEX_GRAPH_SIZE)) { if (!resetPDFSize(width,height,getBaseNameOfOutput(s.output))) goto error; dotArgs=QCString("\"")+m_file+"\" "+s.args; if ((exitCode=Portable::system(m_dotExe,dotArgs,FALSE))!=0) goto error; } } if (s.format.startsWith("png")) { checkPngResult(s.output); } } // remove .dot files if (m_cleanUp) { //printf("removing dot file %s\n",qPrint(m_file)); Portable::unlink(m_file); } // create checksum file if (!m_md5Hash.isEmpty()) { QCString md5Name = getBaseNameOfOutput(m_file) + ".md5"; FILE *f = Portable::fopen(md5Name,"w"); if (f) { fwrite(m_md5Hash.data(),1,32,f); fclose(f); } } return TRUE; error: err_full(srcFile,srcLine,"Problems running dot: exit code=%d, command='%s', arguments='%s'", exitCode,qPrint(m_dotExe),qPrint(dotArgs)); return FALSE; }
10,842
C++
.cpp
333
27.840841
122
0.623306
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,471
message.cpp
doxygen_doxygen/src/message.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 <cstdio> #include <cstdlib> #include <mutex> #include <atomic> #include "config.h" #include "debug.h" #include "portable.h" #include "message.h" #include "doxygen.h" #include "fileinfo.h" #include "dir.h" // globals static QCString g_warnFormat; static QCString g_warnLineFormat; static const char * g_warningStr = "warning: "; static const char * g_errorStr = "error: "; static FILE * g_warnFile = stderr; static WARN_AS_ERROR_t g_warnBehavior = WARN_AS_ERROR_t::NO; static QCString g_warnlogFile; static bool g_warnlogTemp = false; static std::atomic_bool g_warnStat = false; static std::mutex g_mutex; void initWarningFormat() { g_warnFormat = Config_getString(WARN_FORMAT); g_warnLineFormat = Config_getString(WARN_LINE_FORMAT); g_warnBehavior = Config_getEnum(WARN_AS_ERROR); g_warnlogFile = Config_getString(WARN_LOGFILE); if (g_warnlogFile.isEmpty() && g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT) { uint32_t pid = Portable::pid(); g_warnlogFile.sprintf("doxygen_warnings_temp_%d.tmp",pid); g_warnlogTemp = true; } if (!g_warnlogFile.isEmpty()) { if (g_warnlogFile == "-") { g_warnFile = stdout; } else { FileInfo fi(g_warnlogFile.str()); Dir d(fi.dirPath().c_str()); if (!d.exists() && !d.mkdir(fi.dirPath().c_str())) { // point it to something valid, because warn() relies on it g_warnFile = stderr; err("Cannot create directory for '%s', redirecting 'WARN_LOGFILE' output to 'stderr'\n",g_warnlogFile.data()); } else if (!(g_warnFile = Portable::fopen(g_warnlogFile,"w"))) { // point it to something valid, because warn() relies on it g_warnFile = stderr; err("Cannot open '%s' for writing, redirecting 'WARN_LOGFILE' output to 'stderr'\n",g_warnlogFile.data()); } } } else { g_warnFile = stderr; } if (g_warnBehavior != WARN_AS_ERROR_t::NO) { g_warningStr = g_errorStr; } // make sure the g_warnFile is closed in case we call exit and it is still open std::atexit([](){ if (g_warnFile && g_warnFile!=stderr && g_warnFile!=stdout) { Portable::fclose(g_warnFile); g_warnFile = nullptr; } }); } void msg(const char *fmt, ...) { if (!Config_getBool(QUIET)) { std::unique_lock<std::mutex> lock(g_mutex); if (Debug::isFlagSet(Debug::Time)) { printf("%.3f sec: ",(static_cast<double>(Debug::elapsedTime()))); } va_list args; va_start(args, fmt); vfprintf(stdout, fmt, args); va_end(args); } } static void format_warn(const QCString &file,int line,const QCString &text) { QCString fileSubst = file.isEmpty() ? "<unknown>" : file; QCString lineSubst; lineSubst.setNum(line); QCString textSubst = text; QCString versionSubst; // substitute markers by actual values QCString msgText = substitute( substitute( substitute( substitute( g_warnFormat, "$file",fileSubst ), "$line",lineSubst ), "$version",versionSubst ), "$text",textSubst ); if (g_warnBehavior == WARN_AS_ERROR_t::YES) { msgText += " (warning treated as error, aborting now)"; } msgText += '\n'; { std::unique_lock<std::mutex> lock(g_mutex); // print resulting message fwrite(msgText.data(),1,msgText.length(),g_warnFile); } if (g_warnBehavior == WARN_AS_ERROR_t::YES) { if (g_warnFile != stderr && !Config_getBool(QUIET)) { msg("See '%s' for the reason of termination.\n",qPrint(g_warnlogFile)); } exit(1); } g_warnStat = true; } static void handle_warn_as_error() { if (g_warnBehavior == WARN_AS_ERROR_t::YES) { { std::unique_lock<std::mutex> lock(g_mutex); QCString msgText = " (warning treated as error, aborting now)\n"; fwrite(msgText.data(),1,msgText.length(),g_warnFile); if (g_warnFile != stderr && !Config_getBool(QUIET)) { // cannot use `msg` due to the mutex fprintf(stdout,"See '%s' for the reason of termination.\n",qPrint(g_warnlogFile)); } } exit(1); } g_warnStat = true; } static void do_warn(bool enabled, const QCString &file, int line, const char *prefix, const char *fmt, va_list args) { if (!enabled) return; // warning type disabled va_list argsCopy; va_copy(argsCopy, args); size_t l=0; if (prefix) { l=strlen(prefix); } // determine needed buffersize based on: // format + arguments // prefix // 1 position for `\0` size_t bufSize = vsnprintf(nullptr, 0, fmt, args) + l; QCString text(bufSize, QCString::ExplicitSize); if (prefix) { qstrncpy(text.rawData(),prefix,bufSize); } vsnprintf(text.rawData()+l, bufSize-l+1, fmt, argsCopy); text[bufSize]='\0'; format_warn(file,line,text); va_end(argsCopy); } QCString warn_line(const QCString &file,int line) { QCString fileSubst = file.isEmpty() ? "<unknown>" : file; QCString lineSubst; lineSubst.setNum(line); return substitute( substitute( g_warnLineFormat, "$file",fileSubst ), "$line",lineSubst ); } void warn_(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); do_warn(Config_getBool(WARNINGS), file, line, g_warningStr, fmt, args); va_end(args); } void va_warn(const QCString &file,int line,const char *fmt,va_list args) { do_warn(Config_getBool(WARNINGS), file, line, g_warningStr, fmt, args); } void warn_undoc_(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); do_warn(Config_getBool(WARN_IF_UNDOCUMENTED), file, line, g_warningStr, fmt, args); va_end(args); } void warn_incomplete_doc_(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); do_warn(Config_getBool(WARN_IF_INCOMPLETE_DOC), file, line, g_warningStr, fmt, args); va_end(args); } void warn_doc_error_(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); do_warn(Config_getBool(WARN_IF_DOC_ERROR), file, line, g_warningStr, fmt, args); va_end(args); } void warn_uncond_(const char *fmt, ...) { va_list args; va_start(args, fmt); vfprintf(g_warnFile, (QCString(g_warningStr) + fmt).data(), args); va_end(args); handle_warn_as_error(); } void err_(const char *fmt, ...) { va_list args; va_start(args, fmt); vfprintf(g_warnFile, (QCString(g_errorStr) + fmt).data(), args); va_end(args); handle_warn_as_error(); } extern void err_full_(const QCString &file,int line,const char *fmt, ...) { va_list args; va_start(args, fmt); do_warn(TRUE, file, line, g_errorStr, fmt, args); va_end(args); } void term_(const char *fmt, ...) { { std::unique_lock<std::mutex> lock(g_mutex); va_list args; va_start(args, fmt); vfprintf(g_warnFile, (QCString(g_errorStr) + fmt).data(), args); va_end(args); if (g_warnFile != stderr) { size_t l = strlen(g_errorStr); for (size_t i=0; i<l; i++) fprintf(g_warnFile, " "); fprintf(g_warnFile, "%s\n", "Exiting..."); if (!Config_getBool(QUIET)) { // cannot use `msg` due to the mutex fprintf(stdout,"See '%s' for the reason of termination.\n",qPrint(g_warnlogFile)); } } } exit(1); } void warn_flush() { fflush(g_warnFile); } extern void finishWarnExit() { fflush(stdout); if (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-") { Portable::fclose(g_warnFile); g_warnFile = nullptr; } if (g_warnStat && g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT && g_warnlogFile != "-") { std::ifstream warnFile = Portable::openInputStream(g_warnlogFile); if (!warnFile.is_open()) { g_warnFile = stderr; err("Cannot open warnings file '%s' for reading\n",g_warnlogFile.data()); } else { std::string line; while (getline(warnFile,line)) { fprintf(stderr,"%s\n",line.c_str()); } warnFile.close(); } } if (g_warnlogTemp) Portable::unlink(g_warnlogFile); if (g_warnStat && (g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS || g_warnBehavior == WARN_AS_ERROR_t::FAIL_ON_WARNINGS_PRINT)) { exit(1); } }
9,113
C++
.cpp
314
24.859873
118
0.638344
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,472
docvisitor.cpp
doxygen_doxygen/src/docvisitor.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 <unordered_map> #include <stack> #include "parserintf.h" #include "docvisitor.h" #include "util.h" #include "types.h" #include "doxygen.h" struct DocVisitor::Private { int id; std::unordered_map< std::string, std::unique_ptr<CodeParserInterface> > parserFactoryMap; std::stack<bool> hidden; }; DocVisitor::DocVisitor() : m_p(std::make_unique<Private>()) { } DocVisitor::~DocVisitor() { } CodeParserInterface &DocVisitor::getCodeParser(const QCString &extension) { std::string ext = extension.str(); // for each extension we create a code parser once per visitor, so that // the context of the same parser object is reused throughout multiple passes for instance // for code fragments shown via dontinclude. auto it = m_p->parserFactoryMap.find(ext); if (it==m_p->parserFactoryMap.end()) { auto factory = Doxygen::parserManager->getCodeParserFactory(extension); auto result = m_p->parserFactoryMap.emplace(ext,factory()); it = result.first; } return *it->second.get(); } void DocVisitor::pushHidden(bool hide) { m_p->hidden.push(hide); } bool DocVisitor::popHidden() { if (m_p->hidden.empty()) return false; bool v = m_p->hidden.top(); m_p->hidden.pop(); return v; }
1,883
C++
.cpp
58
30.310345
92
0.713656
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,473
filedef.cpp
doxygen_doxygen/src/filedef.cpp
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 <unordered_set> #include "memberlist.h" #include "classlist.h" #include "filedef.h" #include "doxygen.h" #include "memberdef.h" #include "classdef.h" #include "namespacedef.h" #include "util.h" #include "language.h" #include "outputlist.h" #include "dot.h" #include "dotincldepgraph.h" #include "message.h" #include "docparser.h" #include "searchindex.h" #include "htags.h" #include "parserintf.h" #include "portable.h" #include "vhdldocgen.h" #include "debug.h" #include "layout.h" #include "entry.h" #include "groupdef.h" #include "filename.h" #include "membergroup.h" #include "dirdef.h" #include "config.h" #include "clangparser.h" #include "settings.h" #include "definitionimpl.h" #include "conceptdef.h" #include "outputlist.h" #include "moduledef.h" //--------------------------------------------------------------------------- QCString includeStatement(SrcLangExt lang,IncludeKind kind) { bool isIDLorJava = lang==SrcLangExt::IDL || lang==SrcLangExt::Java; if (isIDLorJava || (kind & IncludeKind_ImportMask)) { return "import "; } else if (kind & IncludeKind_ObjCMask) { return "#import "; } else { return "#include "; } } QCString includeOpen(SrcLangExt lang,IncludeKind kind) { if (lang==SrcLangExt::Java || kind==IncludeKind::ImportModule) return ""; if ((kind & IncludeKind_LocalMask) || (lang==SrcLangExt::IDL)) { return "\""; } else { return "<"; } } QCString includeClose(SrcLangExt lang,IncludeKind kind) { if (lang==SrcLangExt::IDL) return "\";"; else if (lang==SrcLangExt::Java) return ";"; switch (kind) { case IncludeKind::ImportLocal: return "\";"; case IncludeKind::ImportLocalObjC: return "\""; case IncludeKind::IncludeLocal: return "\""; case IncludeKind::ImportSystem: return ">;"; case IncludeKind::ImportSystemObjC: return ">"; case IncludeKind::IncludeSystem: return ">"; case IncludeKind::ImportModule: return ";"; } return ""; } QCString includeTagFileAttributes(SrcLangExt lang,IncludeKind kind) { QCString result; bool isIDLorJava = lang==SrcLangExt::IDL || lang==SrcLangExt::Java; result.sprintf("local=\"%s\" import=\"%s\" module=\"%s\" objc=\"%s\"", (kind & IncludeKind_LocalMask) ? "yes" : "no", (isIDLorJava || (kind & IncludeKind_ImportMask)) ? "yes" : "no", (kind==IncludeKind::ImportModule) ? "yes" : "no", (kind & IncludeKind_ObjCMask) ? "yes" : "no"); return result; } //--------------------------------------------------------------------------- using DefinitionLineMap = std::unordered_map<int,const Definition *>; using MemberDefLineMap = std::unordered_map<int,const MemberDef *>; using IncludeInfoMap = std::unordered_map<std::string, const IncludeInfo *>; class FileDefImpl : public DefinitionMixin<FileDef> { public: FileDefImpl(const QCString &p,const QCString &n,const QCString &ref=QCString(),const QCString &dn=QCString()); ~FileDefImpl() override; NON_COPYABLE(FileDefImpl) DefType definitionType() const override { return TypeFile; } CodeSymbolType codeSymbolType() const override { return CodeSymbolType::Default; } const QCString &name() const override; QCString displayName(bool=TRUE) const override { return localName(); } QCString fileName() const override { return m_fileName; } QCString getOutputFileBase() const override; QCString anchor() const override { return QCString(); } QCString getSourceFileBase() const override; QCString includeName() const override; QCString includeDependencyGraphFileName() const override; QCString includedByDependencyGraphFileName() const override; QCString absFilePath() const override { return m_filePath; } const QCString &docName() const override { return m_docname; } bool isSource() const override { return m_isSource; } bool isDocumentationFile() const override; const Definition *getSourceDefinition(int lineNr) const override; const MemberDef *getSourceMember(int lineNr) const override; QCString getPath() const override { return m_path; } QCString getVersion() const override { return m_fileVersion; } bool isLinkableInProject() const override; bool isLinkable() const override { return isLinkableInProject() || isReference(); } bool isIncluded(const QCString &name) const override; DirDef *getDirDef() const override { return m_dir; } ModuleDef *getModuleDef() const override { return m_moduleDef; } const LinkedRefMap<NamespaceDef> &getUsedNamespaces() const override; const LinkedRefMap<const Definition> &getUsedDefinitions() const override { return m_usingDeclList; } const IncludeInfoList &includeFileList() const override { return m_includeList; } const IncludeInfoList &includedByFileList() const override { return m_includedByList; } void getAllIncludeFilesRecursively(StringVector &incFiles) const override; MemberList *getMemberList(MemberListType lt) const override; const MemberLists &getMemberLists() const override { return m_memberLists; } const MemberGroupList &getMemberGroups() const override { return m_memberGroups; } const NamespaceLinkedRefMap &getNamespaces() const override { return m_namespaces; } const ConceptLinkedRefMap &getConcepts() const override { return m_concepts; } const ClassLinkedRefMap &getClasses() const override { return m_classes; } QCString title() const override; bool hasDetailedDescription() const override; QCString fileVersion() const override; bool subGrouping() const override { return m_subGrouping; } void countMembers() override; int numDocMembers() const override; int numDecMembers() const override; void addSourceRef(int line,const Definition *d,const MemberDef *md) override; void writeDocumentation(OutputList &ol) override; void writeMemberPages(OutputList &ol) override; void writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const override; void writeSummaryLinks(OutputList &ol) const override; void writeTagFile(TextStream &t) override; void writeSourceHeader(OutputList &ol) override; void writeSourceBody(OutputList &ol,ClangTUParser *clangParser) override; void writeSourceFooter(OutputList &ol) override; void parseSource(ClangTUParser *clangParser) override; void setDiskName(const QCString &name) override; void insertMember(MemberDef *md) override; void removeMember(MemberDef *md) override; void insertClass(ClassDef *cd) override; void insertConcept(ConceptDef *cd) override; void insertNamespace(NamespaceDef *nd) override; void computeAnchors() override; void setDirDef(DirDef *dd) override { m_dir=dd; } void setModuleDef(ModuleDef *mod) override { m_moduleDef=mod; } void addUsingDirective(NamespaceDef *nd) override; void addUsingDeclaration(const Definition *d) override; void combineUsingRelations() override; bool generateSourceFile() const override; void sortMemberLists() override; void addIncludeDependency(const FileDef *fd,const QCString &incName,IncludeKind kind) override; void addIncludedByDependency(const FileDef *fd,const QCString &incName,IncludeKind kind) override; void addMembersToMemberGroup() override; void distributeMemberGroupDocumentation() override; void findSectionsInDocumentation() override; void addIncludedUsingDirectives(FileDefSet &visitedFiles) override; void addListReferences() override; bool hasIncludeGraph() const override; bool hasIncludedByGraph() const override; void overrideIncludeGraph(bool e) override; void overrideIncludedByGraph(bool e) override; private: void setDiskNameLocal(const QCString &name); void acquireFileVersion(); void addMemberToList(MemberListType lt,MemberDef *md); void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); void writeIncludeFiles(OutputList &ol); void writeIncludeGraph(OutputList &ol); void writeIncludedByGraph(OutputList &ol); void writeMemberGroups(OutputList &ol); void writeAuthorSection(OutputList &ol); void writeSourceLink(OutputList &ol); void writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool isConstantGroup); void writeClassDeclarations(OutputList &ol,const QCString &title,const ClassLinkedRefMap &list); void writeConcepts(OutputList &ol,const QCString &title); void writeInlineClasses(OutputList &ol); void startMemberDeclarations(OutputList &ol); void endMemberDeclarations(OutputList &ol); void startMemberDocumentation(OutputList &ol); void endMemberDocumentation(OutputList &ol); void writeDetailedDescription(OutputList &ol,const QCString &title); void writeBriefDescription(OutputList &ol); void writeClassesToTagFile(TextStream &t,const ClassLinkedRefMap &list); void removeMemberFromList(MemberListType lt,MemberDef *md); IncludeInfoMap m_includeMap; IncludeInfoList m_includeList; IncludeInfoMap m_includedByMap; IncludeInfoList m_includedByList; LinkedRefMap<NamespaceDef> m_usingDirList; LinkedRefMap<const Definition> m_usingDeclList; QCString m_path; QCString m_filePath; QCString m_inclDepFileName; QCString m_inclByDepFileName; QCString m_outputDiskName; QCString m_fileName; QCString m_docname; DefinitionLineMap m_srcDefMap; MemberDefLineMap m_srcMemberMap; bool m_isSource; QCString m_fileVersion; DirDef *m_dir = nullptr; ModuleDef *m_moduleDef = nullptr; MemberLists m_memberLists; MemberGroupList m_memberGroups; NamespaceLinkedRefMap m_namespaces; ClassLinkedRefMap m_classes; ClassLinkedRefMap m_interfaces; ClassLinkedRefMap m_structs; ClassLinkedRefMap m_exceptions; ConceptLinkedRefMap m_concepts; bool m_subGrouping; bool m_hasIncludeGraph = Config_getBool(INCLUDE_GRAPH); bool m_hasIncludedByGraph = Config_getBool(INCLUDED_BY_GRAPH); }; std::unique_ptr<FileDef> createFileDef(const QCString &p,const QCString &n,const QCString &ref,const QCString &dn) { return std::make_unique<FileDefImpl>(p,n,ref,dn); } //--------------------------------------------------------------------------- /*! create a new file definition, where \a p is the file path, \a nm the file name, and \a lref is an HTML anchor name if the file was read from a tag file or nullptr otherwise */ FileDefImpl::FileDefImpl(const QCString &p,const QCString &nm, const QCString &lref,const QCString &dn) : DefinitionMixin(QCString(p)+nm,1,1,nm,nullptr,nullptr,!p.isEmpty()) { m_path=removeLongPathMarker(p); m_filePath=p+nm; m_fileName=nm; setReference(lref); setDiskNameLocal(!dn.isEmpty() ? dn : nm); m_isSource = guessSection(nm).isSource(); m_docname = nm; m_dir = nullptr; if (Config_getBool(FULL_PATH_NAMES)) { m_docname.prepend(stripFromPath(m_path)); } setLanguage(getLanguageFromFileName( Config_getBool(FULL_PATH_NAMES) ? m_fileName : DefinitionMixin::name())); acquireFileVersion(); m_subGrouping=Config_getBool(SUBGROUPING); } /*! destroy the file definition */ FileDefImpl::~FileDefImpl() { } void FileDefImpl::setDiskNameLocal(const QCString &name) { if (isReference()) { m_outputDiskName = name; m_inclDepFileName = name+"_incl"; m_inclByDepFileName = name+"_dep_incl"; } else { m_outputDiskName = convertNameToFile(name); m_inclDepFileName = convertNameToFile(name+"_incl"); m_inclByDepFileName = convertNameToFile(name+"_dep_incl"); } } void FileDefImpl::setDiskName(const QCString &name) { setDiskNameLocal(name); } /*! Compute the HTML anchor names for all members in the class */ void FileDefImpl::computeAnchors() { MemberList *ml = getMemberList(MemberListType::AllMembersList()); if (ml) ml->setAnchors(); } void FileDefImpl::distributeMemberGroupDocumentation() { //printf("FileDefImpl::distributeMemberGroupDocumentation()\n"); for (const auto &mg : m_memberGroups) { mg->distributeMemberGroupDocumentation(); } } void FileDefImpl::findSectionsInDocumentation() { docFindSections(briefDescription(),this,docFile()); docFindSections(documentation(),this,docFile()); docFindSections(inbodyDocumentation(),this,docFile()); for (const auto &mg : m_memberGroups) { mg->findSectionsInDocumentation(this); } for (auto &ml : m_memberLists) { if (ml->listType().isDeclaration()) { ml->findSectionsInDocumentation(this); } } } bool FileDefImpl::hasDetailedDescription() const { bool repeatBrief = Config_getBool(REPEAT_BRIEF); bool sourceBrowser = Config_getBool(SOURCE_BROWSER); return ((!briefDescription().isEmpty() && repeatBrief) || !documentation().stripWhiteSpace().isEmpty() || // avail empty section (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()) ); } void FileDefImpl::writeTagFile(TextStream &tagFile) { QCString fn=getOutputFileBase(); addHtmlExtensionIfMissing(fn); tagFile << " <compound kind=\"file\">\n"; tagFile << " <name>" << convertToXML(name()) << "</name>\n"; tagFile << " <path>" << convertToXML(stripFromPath(getPath())) << "</path>\n"; tagFile << " <filename>" << fn << "</filename>\n"; for (const auto &ii : m_includeList) { const FileDef *fd=ii.fileDef; if (fd && fd->isLinkable() && !fd->isReference()) { QCString attr = includeTagFileAttributes(fd->getLanguage(),ii.kind); tagFile << " <includes id=\"" << convertToXML(fd->getOutputFileBase()) << "\" " << "name=\"" << convertToXML(fd->name()) << "\" " << attr << ">" << convertToXML(ii.includeName) << "</includes>\n"; } } for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::File)) { switch (lde->kind()) { case LayoutDocEntry::FileClasses: { writeClassesToTagFile(tagFile, m_classes); } break; case LayoutDocEntry::FileInterfaces: { writeClassesToTagFile(tagFile, m_interfaces); } break; case LayoutDocEntry::FileStructs: { writeClassesToTagFile(tagFile, m_structs); } break; case LayoutDocEntry::FileExceptions: { writeClassesToTagFile(tagFile, m_exceptions); } break; case LayoutDocEntry::FileConcepts: { for (const auto *nd : m_concepts) { if (nd->isLinkableInProject()) { tagFile << " <concept>" << convertToXML(nd->name()) << "</concept>\n"; } } } break; case LayoutDocEntry::FileNamespaces: { for (const auto *nd : m_namespaces) { if (nd->isLinkableInProject()) { tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>\n"; } } } break; case LayoutDocEntry::MemberDecl: { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) { MemberList * ml = getMemberList(lmd->type); if (ml) { ml->writeTagFile(tagFile,false,false); } } } break; case LayoutDocEntry::MemberGroups: { for (const auto &mg : m_memberGroups) { mg->writeTagFile(tagFile); } } break; default: break; } } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>\n"; } void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { if (hasDetailedDescription()) { ol.pushGeneratorState(); ol.disable(OutputType::Html); ol.writeRuler(); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.writeAnchor(QCString(),"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); ol.endGroupHeader(); ol.startTextBlock(); if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) { ol.generateDoc(briefFile(),briefLine(),this,nullptr,briefDescription(),FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) { ol.pushGeneratorState(); ol.disable(OutputType::Man); ol.disable(OutputType::RTF); ol.enableAll(); ol.disableAllBut(OutputType::Man); ol.enable(OutputType::Latex); ol.writeString("\n\n"); ol.popGeneratorState(); } if (!documentation().isEmpty()) { ol.generateDoc(docFile(),docLine(),this,nullptr,documentation()+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } //printf("Writing source ref for file %s\n",qPrint(name())); if (Config_getBool(SOURCE_BROWSER)) { ol.startParagraph("definition"); 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(QCString(),getSourceFileBase(),QCString(),name()); ol.parseText(refText.right( refText.length()-fileMarkerPos-2)); // text right from marker 2 } else { err("translation error: invalid marker in trDefinedInSourceFile()\n"); } ol.endParagraph(); } ol.endTextBlock(); } } void FileDefImpl::writeBriefDescription(OutputList &ol) { if (hasBriefDescription()) { auto parser { createDocParser() }; auto ast { validatingParseDoc(*parser.get(), briefFile(),briefLine(),this,nullptr, briefDescription(),TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) }; if (!ast->isEmpty()) { ol.startParagraph(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.writeString(" - "); ol.popGeneratorState(); ol.writeDoc(ast.get(),this,nullptr); ol.pushGeneratorState(); ol.disable(OutputType::RTF); ol.writeString(" \n"); ol.enable(OutputType::RTF); if (Config_getBool(REPEAT_BRIEF) || !documentation().stripWhiteSpace().isEmpty() ) { ol.disableAllBut(OutputType::Html); ol.startTextLink(QCString(),"details"); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } ol.popGeneratorState(); ol.endParagraph(); } } ol.writeSynopsis(); } void FileDefImpl::writeClassesToTagFile(TextStream &tagFile, const ClassLinkedRefMap &list) { for (const auto &cd : list) { if (cd->isLinkableInProject()) { tagFile << " <class kind=\"" << cd->compoundTypeString() << "\">" << convertToXML(cd->name()) << "</class>\n"; } } } void FileDefImpl::writeIncludeFiles(OutputList &ol) { if (!m_includeList.empty()) { ol.startTextBlock(TRUE); for (const auto &ii : m_includeList) { const FileDef *fd=ii.fileDef; ol.startTypewriter(); SrcLangExt lang = fd ? fd->getLanguage() : SrcLangExt::Cpp; ol.docify(::includeStatement(lang,ii.kind)); ol.docify(::includeOpen(lang,ii.kind)); ol.disable(OutputType::Html); ol.docify(ii.includeName); ol.enableAll(); ol.disableAllBut(OutputType::Html); // Here we use the include file name as it appears in the file. // we could also we the name as it is used within doxygen, // then we should have used fd->docName() instead of ii->includeName if (fd && fd->isLinkable()) { ol.writeObjectLink(fd->getReference(), fd->generateSourceFile() ? fd->includeName() : fd->getOutputFileBase(), QCString(),ii.includeName); } else { ModuleDef *mod = ModuleManager::instance().getPrimaryInterface(ii.includeName); if (ii.kind==IncludeKind::ImportModule && mod && mod->isLinkable()) { ol.writeObjectLink(mod->getReference(),mod->getOutputFileBase(), QCString(),ii.includeName); } else { ol.docify(ii.includeName); } } ol.enableAll(); ol.docify(::includeClose(lang,ii.kind)); ol.endTypewriter(); ol.lineBreak(); } ol.endTextBlock(); } } void FileDefImpl::writeIncludeGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) && m_hasIncludeGraph /*&& Config_getBool(INCLUDE_GRAPH)*/) { //printf("Graph for file %s\n",qPrint(name())); DotInclDepGraph incDepGraph(this,FALSE); if (incDepGraph.isTooBig()) { warn_uncond("Include graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", qPrint(name()), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { ol.startTextBlock(); ol.disable(OutputType::Man); ol.startInclDepGraph(); ol.parseText(theTranslator->trInclDepGraph(name())); ol.endInclDepGraph(incDepGraph); ol.enableAll(); ol.endTextBlock(TRUE); } //incDepGraph.writeGraph(Config_getString(HTML_OUTPUT),fd->getOutputFileBase()); } } void FileDefImpl::writeIncludedByGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) && m_hasIncludedByGraph /*&& Config_getBool(INCLUDED_BY_GRAPH)*/) { //printf("Graph for file %s\n",qPrint(name())); DotInclDepGraph incDepGraph(this,TRUE); if (incDepGraph.isTooBig()) { warn_uncond("Included by graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", qPrint(name()), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { ol.startTextBlock(); ol.disable(OutputType::Man); ol.startInclDepGraph(); ol.parseText(theTranslator->trInclByDepGraph()); ol.endInclDepGraph(incDepGraph); ol.enableAll(); ol.endTextBlock(TRUE); } //incDepGraph.writeGraph(Config_getString(HTML_OUTPUT),fd->getOutputFileBase()); } } void FileDefImpl::writeSourceLink(OutputList &ol) { //printf("%s: generateSourceFile()=%d\n",qPrint(name()),generateSourceFile()); if (generateSourceFile()) { ol.disableAllBut(OutputType::Html); ol.startParagraph(); ol.startTextLink(includeName(),QCString()); ol.parseText(theTranslator->trGotoSourceCode()); ol.endTextLink(); ol.endParagraph(); ol.enableAll(); } } void FileDefImpl::writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool const isConstantGroup) { // write list of namespaces m_namespaces.writeDeclaration(ol,title,isConstantGroup); } void FileDefImpl::writeClassDeclarations(OutputList &ol,const QCString &title,const ClassLinkedRefMap &list) { // write list of classes list.writeDeclaration(ol,nullptr,title,FALSE); } void FileDefImpl::writeConcepts(OutputList &ol,const QCString &title) { // write list of classes m_concepts.writeDeclaration(ol,title,FALSE); } void FileDefImpl::writeInlineClasses(OutputList &ol) { // temporarily undo the disabling could be done by startMemberDocumentation() // as a result of setting SEPARATE_MEMBER_PAGES to YES; see bug730512 bool isEnabled = ol.isEnabled(OutputType::Html); ol.enable(OutputType::Html); m_classes.writeDocumentation(ol,this); // restore the initial state if needed if (!isEnabled) ol.disable(OutputType::Html); } void FileDefImpl::startMemberDeclarations(OutputList &ol) { ol.startMemberSections(); } void FileDefImpl::endMemberDeclarations(OutputList &ol) { ol.endMemberSections(); } void FileDefImpl::startMemberDocumentation(OutputList &ol) { if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.disable(OutputType::Html); Doxygen::suppressDocWarnings = TRUE; } } void FileDefImpl::endMemberDocumentation(OutputList &ol) { if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.enable(OutputType::Html); Doxygen::suppressDocWarnings = FALSE; } } void FileDefImpl::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ for (const auto &mg : m_memberGroups) { if (!mg->allMembersInSameSection() || !m_subGrouping) { mg->writeDeclarations(ol,nullptr,nullptr,this,nullptr,nullptr); } } } void FileDefImpl::writeAuthorSection(OutputList &ol) { // write Author section (Man only) ol.pushGeneratorState(); ol.disableAllBut(OutputType::Man); ol.startGroupHeader(); ol.parseText(theTranslator->trAuthor(TRUE,TRUE)); ol.endGroupHeader(); ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString(PROJECT_NAME))); ol.popGeneratorState(); } void FileDefImpl::writeSummaryLinks(OutputList &ol) const { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); bool first=TRUE; SrcLangExt lang=getLanguage(); for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::File)) { const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get()); if (lde->kind()==LayoutDocEntry::FileClasses && m_classes.declVisible() && ls) { QCString label = "nested-classes"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileInterfaces && m_interfaces.declVisible() && ls) { QCString label = "interfaces"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileStructs && m_structs.declVisible() && ls) { QCString label = "structs"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileExceptions && m_exceptions.declVisible() && ls) { QCString label = "exceptions"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileNamespaces && m_namespaces.declVisible(false) && ls) { QCString label = "namespaces"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::FileConcepts && m_concepts.declVisible() && ls) { QCString label = "concepts"; ol.writeSummaryLink(QCString(),label,ls->title(lang),first); first=FALSE; } else if (lde->kind()==LayoutDocEntry::MemberDecl) { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) { MemberList * ml = getMemberList(lmd->type); if (ml && ml->declVisible()) { ol.writeSummaryLink(QCString(),ml->listType().toLabel(),lmd->title(lang),first); first=FALSE; } } } } if (!first) { ol.writeString(" </div>\n"); } ol.popGeneratorState(); } /*! Write the documentation page for this file to the file of output generators \a ol. */ void FileDefImpl::writeDocumentation(OutputList &ol) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); //funcList->countDecMembers(); //QCString fn = name(); //if (Config_getBool(FULL_PATH_NAMES)) //{ // fn.prepend(stripFromPath(getPath())); //} //printf("WriteDocumentation diskname=%s\n",qPrint(diskname)); QCString versionTitle; if (!m_fileVersion.isEmpty()) { versionTitle=("("+m_fileVersion+")"); } QCString title = m_docname+versionTitle; QCString pageTitle=theTranslator->trFileReference(m_docname); if (getDirDef()) { startFile(ol,getOutputFileBase(),name(),pageTitle,HighlightedItem::FileVisible,!generateTreeView); if (!generateTreeView) { getDirDef()->writeNavigationPath(ol); ol.endQuickIndices(); } startTitle(ol,getOutputFileBase(),this); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.parseText(theTranslator->trFileReference(displayName())); // Html only ol.enableAll(); ol.disable(OutputType::Html); ol.parseText(Config_getBool(FULL_PATH_NAMES) ? // other output formats pageTitle : theTranslator->trFileReference(name())); ol.popGeneratorState(); addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),title); } else { startFile(ol,getOutputFileBase(),name(),pageTitle,HighlightedItem::FileVisible,!generateTreeView); if (!generateTreeView) { ol.endQuickIndices(); } startTitle(ol,getOutputFileBase(),this); ol.parseText(pageTitle); addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),title); } ol.startContents(); if (!m_fileVersion.isEmpty()) { ol.disableAllBut(OutputType::Html); ol.startProjectNumber(); ol.docify(versionTitle); ol.endProjectNumber(); ol.enableAll(); } //---------------------------------------- start flexible part ------------------------------- SrcLangExt lang = getLanguage(); for (const auto &lde : LayoutDocManager::instance().docEntries(LayoutDocManager::File)) { const LayoutDocEntrySection *ls = dynamic_cast<const LayoutDocEntrySection*>(lde.get()); switch (lde->kind()) { case LayoutDocEntry::BriefDesc: writeBriefDescription(ol); break; case LayoutDocEntry::MemberDeclStart: startMemberDeclarations(ol); break; case LayoutDocEntry::FileIncludes: writeIncludeFiles(ol); break; case LayoutDocEntry::FileIncludeGraph: writeIncludeGraph(ol); break; case LayoutDocEntry::FileIncludedByGraph: writeIncludedByGraph(ol); break; case LayoutDocEntry::FileSourceLink: writeSourceLink(ol); break; case LayoutDocEntry::FileClasses: if (ls) writeClassDeclarations(ol,ls->title(lang),m_classes); break; case LayoutDocEntry::FileInterfaces: if (ls) writeClassDeclarations(ol,ls->title(lang),m_interfaces); break; case LayoutDocEntry::FileStructs: if (ls) writeClassDeclarations(ol,ls->title(lang),m_structs); break; case LayoutDocEntry::FileExceptions: if (ls) writeClassDeclarations(ol,ls->title(lang),m_exceptions); break; case LayoutDocEntry::FileConcepts: if (ls) writeConcepts(ol,ls->title(lang)); break; case LayoutDocEntry::FileNamespaces: if (ls) writeNamespaceDeclarations(ol,ls->title(lang),false); break; case LayoutDocEntry::FileConstantGroups: if (ls) writeNamespaceDeclarations(ol,ls->title(lang),true); break; case LayoutDocEntry::MemberGroups: writeMemberGroups(ol); break; case LayoutDocEntry::MemberDecl: { const LayoutDocEntryMemberDecl *lmd = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()); if (lmd) writeMemberDeclarations(ol,lmd->type,lmd->title(lang)); } break; case LayoutDocEntry::MemberDeclEnd: endMemberDeclarations(ol); break; case LayoutDocEntry::DetailedDesc: if (ls) writeDetailedDescription(ol,ls->title(lang)); break; case LayoutDocEntry::MemberDefStart: startMemberDocumentation(ol); break; case LayoutDocEntry::FileInlineClasses: writeInlineClasses(ol); break; case LayoutDocEntry::MemberDef: { const LayoutDocEntryMemberDef *lmd = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get()); if (lmd) writeMemberDocumentation(ol,lmd->type,lmd->title(lang)); } break; case LayoutDocEntry::MemberDefEnd: endMemberDocumentation(ol); break; case LayoutDocEntry::AuthorSection: writeAuthorSection(ol); break; case LayoutDocEntry::ClassIncludes: case LayoutDocEntry::ClassInheritanceGraph: case LayoutDocEntry::ClassNestedClasses: case LayoutDocEntry::ClassCollaborationGraph: case LayoutDocEntry::ClassAllMembersLink: case LayoutDocEntry::ClassUsedFiles: case LayoutDocEntry::ClassInlineClasses: case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::NamespaceClasses: case LayoutDocEntry::NamespaceConcepts: case LayoutDocEntry::NamespaceInterfaces: case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: case LayoutDocEntry::ConceptDefinition: case LayoutDocEntry::GroupClasses: case LayoutDocEntry::GroupConcepts: case LayoutDocEntry::GroupModules: case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: case LayoutDocEntry::GroupDirs: case LayoutDocEntry::GroupNestedGroups: case LayoutDocEntry::GroupFiles: case LayoutDocEntry::GroupGraph: case LayoutDocEntry::GroupPageDocs: case LayoutDocEntry::ModuleExports: case LayoutDocEntry::ModuleClasses: case LayoutDocEntry::ModuleConcepts: case LayoutDocEntry::ModuleUsedFiles: case LayoutDocEntry::DirSubDirs: case LayoutDocEntry::DirFiles: case LayoutDocEntry::DirGraph: err("Internal inconsistency: member %d should not be part of " "LayoutDocManager::File entry list\n",lde->kind()); break; } } //---------------------------------------- end flexible part ------------------------------- ol.endContents(); endFileWithNavPath(ol,this); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { MemberList *ml = getMemberList(MemberListType::AllMembersList()); if (ml) ml->sort(); writeMemberPages(ol); } } void FileDefImpl::writeMemberPages(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); for (const auto &ml : m_memberLists) { if (ml->listType().isDocumentation()) { ml->writeDocumentationPage(ol,name(),this); } } ol.popGeneratorState(); } void FileDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *currentMd) const { bool createSubDirs=Config_getBool(CREATE_SUBDIRS); ol.writeString(" <div class=\"navtab\">\n"); ol.writeString(" <table>\n"); MemberList *allMemberList = getMemberList(MemberListType::AllMembersList()); if (allMemberList) { for (const auto &md : *allMemberList) { if (md->getFileDef()==this && md->getNamespaceDef()==nullptr && md->isLinkable() && !md->isEnumValue()) { if (md->isLinkableInProject()) { QCString fn=md->getOutputFileBase(); addHtmlExtensionIfMissing(fn); if (md==currentMd) // selected item => highlight { ol.writeString(" <tr><td class=\"navtabHL\">"); } else { ol.writeString(" <tr><td class=\"navtab\">"); } ol.writeString("<a class=\"navtab\" "); ol.writeString("href=\""); if (createSubDirs) ol.writeString("../../"); ol.writeString(fn+"#"+md->anchor()); ol.writeString("\">"); ol.writeString(convertToHtml(md->localName())); ol.writeString("</a>"); ol.writeString("</td></tr>\n"); } } } } ol.writeString(" </table>\n"); ol.writeString(" </div>\n"); } /*! Write a source listing of this file to the output */ void FileDefImpl::writeSourceHeader(OutputList &ol) { bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); QCString title = m_docname; if (!m_fileVersion.isEmpty()) { title+=(" ("+m_fileVersion+")"); } QCString pageTitle = theTranslator->trSourceFile(title); ol.disable(OutputType::Man); bool isDocFile = isDocumentationFile(); bool genSourceFile = !isDocFile && generateSourceFile(); if (getDirDef()) { startFile(ol,getSourceFileBase(),QCString(),pageTitle,HighlightedItem::FileVisible, !generateTreeView, !isDocFile && genSourceFile ? QCString() : getOutputFileBase(), 0); if (!generateTreeView) { getDirDef()->writeNavigationPath(ol); ol.endQuickIndices(); } startTitle(ol,getSourceFileBase()); ol.parseText(name()); endTitle(ol,getSourceFileBase(),title); } else { startFile(ol,getSourceFileBase(),QCString(),pageTitle,HighlightedItem::FileVisible,false, !isDocFile && genSourceFile ? QCString() : getOutputFileBase(), 0); startTitle(ol,getSourceFileBase()); ol.parseText(title); endTitle(ol,getSourceFileBase(),QCString()); } ol.startContents(); if (isLinkable()) { ol.startTextLink(getOutputFileBase(),QCString()); ol.parseText(theTranslator->trGotoDocumentation()); ol.endTextLink(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::RTF); ol.writeString("\\par\n"); ol.popGeneratorState(); } } void FileDefImpl::writeSourceBody(OutputList &ol,[[maybe_unused]] ClangTUParser *clangParser) { bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); OutputCodeList devNullList; devNullList.add<DevNullCodeGenerator>(); #if USE_LIBCLANG if (Doxygen::clangAssistedParsing && clangParser && (getLanguage()==SrcLangExt::Cpp || getLanguage()==SrcLangExt::ObjC)) { auto &codeOL = ol.codeGenerators(); codeOL.startCodeFragment("DoxyCode"); clangParser->switchToFile(this); clangParser->writeSources(codeOL,this); codeOL.endCodeFragment("DoxyCode"); } else #endif { auto intf = Doxygen::parserManager->getCodeParser(getDefFileExtension()); intf->resetCodeParserState(); auto &codeOL = ol.codeGenerators(); codeOL.startCodeFragment("DoxyCode"); bool needs2PassParsing = Doxygen::parseSourcesNeeded && // we need to parse (filtered) sources for cross-references !filterSourceFiles && // but user wants to show sources as-is !getFileFilter(absFilePath(),TRUE).isEmpty(); // and there is a filter used while parsing if (needs2PassParsing) { // parse code for cross-references only (see bug707641) intf->parseCode(devNullList,QCString(), fileToString(absFilePath(),TRUE,TRUE), getLanguage(), Config_getBool(STRIP_CODE_COMMENTS), FALSE,QCString(),this ); } intf->parseCode(codeOL,QCString(), fileToString(absFilePath(),filterSourceFiles,TRUE), getLanguage(), // lang Config_getBool(STRIP_CODE_COMMENTS), FALSE, // isExampleBlock QCString(), // exampleName this, // fileDef -1, // startLine -1, // endLine FALSE, // inlineFragment nullptr, // memberDef TRUE, // showLineNumbers nullptr, // searchCtx !needs2PassParsing // collectXRefs ); codeOL.endCodeFragment("DoxyCode"); } } void FileDefImpl::writeSourceFooter(OutputList &ol) { ol.endContents(); endFileWithNavPath(ol,this); ol.enableAll(); } void FileDefImpl::parseSource([[maybe_unused]] ClangTUParser *clangParser) { bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); OutputCodeList devNullList; devNullList.add<DevNullCodeGenerator>(); #if USE_LIBCLANG if (Doxygen::clangAssistedParsing && clangParser && (getLanguage()==SrcLangExt::Cpp || getLanguage()==SrcLangExt::ObjC)) { clangParser->switchToFile(this); clangParser->writeSources(devNullList,this); } else #endif { auto intf = Doxygen::parserManager->getCodeParser(getDefFileExtension()); intf->resetCodeParserState(); intf->parseCode( devNullList,QCString(), fileToString(absFilePath(),filterSourceFiles,TRUE), getLanguage(), Config_getBool(STRIP_CODE_COMMENTS), FALSE,QCString(),this ); } } void FileDefImpl::addMembersToMemberGroup() { for (auto &ml : m_memberLists) { if (ml->listType().isDeclaration()) { ::addMembersToMemberGroup(ml.get(),&m_memberGroups,this); } } // add members inside sections to their groups for (const auto &mg : m_memberGroups) { if (mg->allMembersInSameSection() && m_subGrouping) { //printf("----> addToDeclarationSection(%s)\n",qPrint(mg->header())); mg->addToDeclarationSection(); } } } /*! Adds member definition \a md to the list of all members of this file */ void FileDefImpl::insertMember(MemberDef *md) { if (md->isHidden()) return; //printf("%s:FileDefImpl::insertMember(%s (=%p) list has %d elements)\n", // qPrint(name()),qPrint(md->name()),md,allMemberList.count()); MemberList *allMemberList = getMemberList(MemberListType::AllMembersList()); if (allMemberList && allMemberList->contains(md)) { return; } if (allMemberList==nullptr) { m_memberLists.emplace_back(std::make_unique<MemberList>(MemberListType::AllMembersList(),MemberListContainer::File)); allMemberList = m_memberLists.back().get(); } allMemberList->push_back(md); switch (md->memberType()) { case MemberType::Property: if (md->getLanguage() == SrcLangExt::Python) { addMemberToList(MemberListType::PropertyMembers(),md); addMemberToList(MemberListType::Properties(),md); break; } // fallthrough, explicitly no break here case MemberType::Variable: addMemberToList(MemberListType::DecVarMembers(),md); addMemberToList(MemberListType::DocVarMembers(),md); break; case MemberType::Function: addMemberToList(MemberListType::DecFuncMembers(),md); addMemberToList(MemberListType::DocFuncMembers(),md); break; case MemberType::Typedef: addMemberToList(MemberListType::DecTypedefMembers(),md); addMemberToList(MemberListType::DocTypedefMembers(),md); break; case MemberType::Sequence: addMemberToList(MemberListType::DecSequenceMembers(),md); addMemberToList(MemberListType::DocSequenceMembers(),md); break; case MemberType::Dictionary: addMemberToList(MemberListType::DecDictionaryMembers(),md); addMemberToList(MemberListType::DocDictionaryMembers(),md); break; case MemberType::Enumeration: addMemberToList(MemberListType::DecEnumMembers(),md); addMemberToList(MemberListType::DocEnumMembers(),md); break; case MemberType::EnumValue: // enum values are shown inside their enums break; case MemberType::Define: addMemberToList(MemberListType::DecDefineMembers(),md); addMemberToList(MemberListType::DocDefineMembers(),md); break; default: err("FileDefImpl::insertMembers(): " "member '%s' with class scope '%s' inserted in file scope '%s'!\n", qPrint(md->name()), md->getClassDef() ? qPrint(md->getClassDef()->name()) : "<global>", qPrint(name())); } //addMemberToGroup(md,groupId); } void FileDefImpl::removeMemberFromList(MemberListType lt,MemberDef *md) { MemberList *ml = getMemberList(lt); if (ml) ml->remove(md); } void FileDefImpl::removeMember(MemberDef *md) { removeMemberFromList(MemberListType::AllMembersList(),md); switch(md->memberType()) { case MemberType::Property: if (md->getLanguage() == SrcLangExt::Python) { removeMemberFromList(MemberListType::PropertyMembers(),md); removeMemberFromList(MemberListType::Properties(),md); break; } // fallthrough, explicitly no break here case MemberType::Variable: removeMemberFromList(MemberListType::DecVarMembers(),md); removeMemberFromList(MemberListType::DocVarMembers(),md); break; case MemberType::Function: removeMemberFromList(MemberListType::DecFuncMembers(),md); removeMemberFromList(MemberListType::DocFuncMembers(),md); break; case MemberType::Typedef: removeMemberFromList(MemberListType::DecTypedefMembers(),md); removeMemberFromList(MemberListType::DocTypedefMembers(),md); break; case MemberType::Sequence: removeMemberFromList(MemberListType::DecSequenceMembers(),md); removeMemberFromList(MemberListType::DocSequenceMembers(),md); break; case MemberType::Dictionary: removeMemberFromList(MemberListType::DecDictionaryMembers(),md); removeMemberFromList(MemberListType::DocDictionaryMembers(),md); break; case MemberType::Enumeration: removeMemberFromList(MemberListType::DecEnumMembers(),md); removeMemberFromList(MemberListType::DocEnumMembers(),md); break; case MemberType::EnumValue: // enum values are shown inside their enums break; case MemberType::Define: removeMemberFromList(MemberListType::DecDefineMembers(),md); removeMemberFromList(MemberListType::DocDefineMembers(),md); break; default: err("FileDefImpl::removeMember(): unexpected member remove in file!\n"); } } /*! Adds compound definition \a cd to the list of all compounds of this file */ void FileDefImpl::insertClass(ClassDef *cd) { if (cd->isHidden()) return; ClassLinkedRefMap *list = &m_classes; if (Config_getBool(OPTIMIZE_OUTPUT_SLICE)) { if (cd->compoundType()==ClassDef::Interface) { list = &m_interfaces; } else if (cd->compoundType()==ClassDef::Struct) { list = &m_structs; } else if (cd->compoundType()==ClassDef::Exception) { list = &m_exceptions; } } list->add(cd->name(),cd); } void FileDefImpl::insertConcept(ConceptDef *cd) { if (cd->isHidden()) return; m_concepts.add(cd->name(),cd); } /*! Adds namespace definition \a nd to the list of all compounds of this file */ void FileDefImpl::insertNamespace(NamespaceDef *nd) { if (nd->isHidden()) return; m_namespaces.add(nd->name(),nd); } const QCString &FileDefImpl::name() const { if (Config_getBool(FULL_PATH_NAMES)) return m_fileName; else return DefinitionMixin::name(); } void FileDefImpl::addSourceRef(int line,const Definition *d,const MemberDef *md) { //printf("FileDefImpl::addSourceRef(%d,%s,%s)\n",line,qPrint(d?d->name():"nullptr"),qPrint(md?md->name():"nullptr")); if (d) { m_srcDefMap.emplace(line,d); if (md) m_srcMemberMap.emplace(line,md); //printf("Adding member %s with anchor %s at line %d to file %s\n", // md?qPrint(md->name()):"<none>",md?qPrint(md->anchor()):"<none>",line,qPrint(name())); } } const Definition *FileDefImpl::getSourceDefinition(int lineNr) const { auto it = m_srcDefMap.find(lineNr); //printf("%s::getSourceDefinition(%d)=%s\n",qPrint(name()),lineNr,it!=m_srcDefMap.end()?qPrint(it->second->name()):"none"); return it!=m_srcDefMap.end() ? it->second : nullptr; } const MemberDef *FileDefImpl::getSourceMember(int lineNr) const { auto it = m_srcMemberMap.find(lineNr); //printf("%s::getSourceMember(%d)=%s\n",qPrint(name()),lineNr,it!=m_srcMemberMap.end()?qPrint(it->second->name()):"none"); return it!=m_srcMemberMap.end() ? it->second : nullptr; } void FileDefImpl::addUsingDirective(NamespaceDef *nd) { m_usingDirList.add(nd->qualifiedName(),nd); //printf("%p: FileDefImpl::addUsingDirective: %s:%d\n",this,qPrint(name()),usingDirList->count()); } const LinkedRefMap<NamespaceDef> &FileDefImpl::getUsedNamespaces() const { //printf("%p: FileDefImpl::getUsedNamespace: %s:%d\n",this,qPrint(name()),usingDirList?usingDirList->count():0); return m_usingDirList; } void FileDefImpl::addUsingDeclaration(const Definition *d) { m_usingDeclList.add(d->qualifiedName(),d); } void FileDefImpl::addIncludeDependency(const FileDef *fd,const QCString &incName,IncludeKind kind) { //printf("FileDefImpl::addIncludeDependency(%p,%s,%d)\n",(void*)fd,qPrint(incName),kind); QCString iName = fd ? fd->absFilePath() : incName; if (!iName.isEmpty() && m_includeMap.find(iName.str())==m_includeMap.end()) { m_includeList.emplace_back(fd,incName,kind); m_includeMap.emplace(iName.str(),&m_includeList.back()); } } void FileDefImpl::addIncludedUsingDirectives(FileDefSet &visitedFiles) { if (visitedFiles.find(this)!=visitedFiles.end()) return; // file already processed visitedFiles.insert(this); //printf("( FileDefImpl::addIncludedUsingDirectives for file %s\n",qPrint(name())); if (!m_includeList.empty()) // file contains #includes { { for (const auto &ii : m_includeList) // foreach #include... { if (ii.fileDef) // ...that is a known file { // recurse into this file const_cast<FileDef*>(ii.fileDef)->addIncludedUsingDirectives(visitedFiles); } } } { // iterate through list from last to first for (auto ii_it = m_includeList.rbegin(); ii_it!=m_includeList.rend(); ++ii_it) { auto &ii = *ii_it; if (ii.fileDef && ii.fileDef!=this) { // add using directives auto unl = ii.fileDef->getUsedNamespaces(); for (auto it = unl.rbegin(); it!=unl.rend(); ++it) { auto *nd = *it; //printf(" adding using directive for %s\n",qPrint(nd->qualifiedName())); m_usingDirList.prepend(nd->qualifiedName(),nd); } // add using declarations auto udl = ii.fileDef->getUsedDefinitions(); for (auto it = udl.rbegin(); it!=udl.rend(); ++it) { auto *d = *it; m_usingDeclList.prepend(d->qualifiedName(),d); } } } } } //printf(") end FileDefImpl::addIncludedUsingDirectives for file %s\n",qPrint(name())); } void FileDefImpl::addIncludedByDependency(const FileDef *fd,const QCString &incName,IncludeKind kind) { //printf("FileDefImpl::addIncludedByDependency(%p,%s,%d)\n",fd,incName,local); QCString iName = fd ? fd->absFilePath() : incName; if (!iName.isEmpty() && m_includedByMap.find(iName.str())==m_includedByMap.end()) { m_includedByList.emplace_back(fd,incName,kind); m_includedByMap.emplace(iName.str(),&m_includedByList.back()); } } bool FileDefImpl::isIncluded(const QCString &name) const { if (name.isEmpty()) return FALSE; return m_includeMap.find(name.str())!=m_includeMap.end(); } bool FileDefImpl::generateSourceFile() const { bool sourceBrowser = Config_getBool(SOURCE_BROWSER); bool verbatimHeaders = Config_getBool(VERBATIM_HEADERS); return !isReference() && (sourceBrowser || (verbatimHeaders && (guessSection(name()).isHeader() || !m_includedByMap.empty())) ) && !isDocumentationFile(); } void FileDefImpl::addListReferences() { { const RefItemVector &xrefItems = xrefListItems(); addRefItem(xrefItems, getOutputFileBase(), theTranslator->trFile(TRUE,TRUE), getOutputFileBase(),name(), QCString(), nullptr ); } for (const auto &mg : m_memberGroups) { mg->addListReferences(this); } for (auto &ml : m_memberLists) { if (ml->listType().isDocumentation()) { ml->addListReferences(this); } } } //------------------------------------------------------------------- void FileDefImpl::combineUsingRelations() { LinkedRefMap<NamespaceDef> usingDirList = m_usingDirList; NamespaceDefSet visitedNamespaces; for (auto &nd : usingDirList) { NamespaceDefMutable *ndm = toNamespaceDefMutable(nd); if (ndm) { ndm->combineUsingRelations(visitedNamespaces); } } for (auto &nd : usingDirList) { // add used namespaces of namespace nd to this namespace for (const auto &und : nd->getUsedNamespaces()) { addUsingDirective(und); } // add used classes of namespace nd to this namespace for (const auto &ud : nd->getUsedDefinitions()) { addUsingDeclaration(ud); } } } bool FileDefImpl::isDocumentationFile() const { static const std::unordered_set<std::string> docExtensions = { "doc", "txt", "dox", "md", "markdown" }; int lastDot = name().findRev('.'); return (lastDot!=-1 && docExtensions.find(name().mid(lastDot+1).str())!=docExtensions.end()) || getLanguageFromFileName(getFileNameExtension(name())) == SrcLangExt::Markdown; } void FileDefImpl::acquireFileVersion() { QCString vercmd = Config_getString(FILE_VERSION_FILTER); if (!vercmd.isEmpty() && !m_filePath.isEmpty() && !isReference() && m_filePath!="generated" && m_filePath!="graph_legend.dox") { msg("Version of %s : ",qPrint(m_filePath)); QCString cmd = vercmd+" \""+m_filePath+"\""; Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",qPrint(cmd)); FILE *f=Portable::popen(cmd,"r"); if (!f) { err("could not execute %s\n",qPrint(vercmd)); return; } const int bufSize=1024; char buf[bufSize]; int numRead = static_cast<int>(fread(buf,1,bufSize-1,f)); Portable::pclose(f); if (numRead>0 && numRead<bufSize) { buf[numRead]='\0'; m_fileVersion=QCString(buf,numRead).stripWhiteSpace(); if (!m_fileVersion.isEmpty()) { msg("%s\n",qPrint(m_fileVersion)); return; } } msg("no version available\n"); } } QCString FileDefImpl::getSourceFileBase() const { if (Htags::useHtags) { return Htags::path2URL(m_filePath); } else { return m_outputDiskName+"_source"; } } QCString FileDefImpl::getOutputFileBase() const { return m_outputDiskName; } /*! Returns the name of the verbatim copy of this file (if any). */ QCString FileDefImpl::includeName() const { return getSourceFileBase(); } void FileDefImpl::addMemberToList(MemberListType lt,MemberDef *md) { bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS); const auto &ml = m_memberLists.get(lt,MemberListContainer::File); ml->setNeedsSorting( (ml->listType().isDeclaration() && sortBriefDocs) || (ml->listType().isDocumentation() && sortMemberDocs)); ml->push_back(md); if (ml->listType().isDeclaration()) { MemberDefMutable *mdm = toMemberDefMutable(md); if (mdm) { mdm->setSectionList(this,ml.get()); } } } void FileDefImpl::sortMemberLists() { for (auto &ml : m_memberLists) { if (ml->needsSorting()) { ml->sort(); ml->setNeedsSorting(FALSE); } } for (const auto &mg : m_memberGroups) { MemberList &mlg = const_cast<MemberList&>(mg->members()); if (mlg.needsSorting()) { mlg.sort(); mlg.setNeedsSorting(FALSE); } } std::stable_sort(m_includedByList.begin(),m_includedByList.end(), [](const auto &fi1,const auto &fi2) { return fi1.includeName < fi2.includeName; }); if (Config_getBool(SORT_BRIEF_DOCS)) { auto classComp = [](const ClassLinkedRefMap::Ptr &c1,const ClassLinkedRefMap::Ptr &c2) { return Config_getBool(SORT_BY_SCOPE_NAME) ? qstricmp_sort(c1->name(), c2->name())<0 : qstricmp_sort(c1->className(), c2->className())<0; }; std::stable_sort(m_classes.begin(), m_classes.end(), classComp); std::stable_sort(m_interfaces.begin(),m_interfaces.end(),classComp); std::stable_sort(m_structs.begin(), m_structs.end(), classComp); std::stable_sort(m_exceptions.begin(),m_exceptions.end(),classComp); auto namespaceComp = [](const NamespaceLinkedRefMap::Ptr &n1,const NamespaceLinkedRefMap::Ptr &n2) { return qstricmp_sort(n1->name(),n2->name())<0; }; std::stable_sort(m_namespaces.begin(),m_namespaces.end(),namespaceComp); } } MemberList *FileDefImpl::getMemberList(MemberListType lt) const { for (auto &ml : m_memberLists) { if (ml->listType()==lt) { return ml.get(); } } return nullptr; } void FileDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) { bool optVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL); MemberList * ml = getMemberList(lt); if (ml) { if (optVhdl) // use specific declarations function { VhdlDocGen::writeVhdlDeclarations(ml,ol,nullptr,nullptr,this,nullptr,nullptr); } else { ml->writeDeclarations(ol,nullptr,nullptr,this,nullptr,nullptr,title,QCString()); } } } void FileDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,name(),this,title); } bool FileDefImpl::isLinkableInProject() const { bool showFiles = Config_getBool(SHOW_FILES); return hasDocumentation() && !isReference() && (showFiles || isLinkableViaGroup()); } static void getAllIncludeFilesRecursively( StringUnorderedSet &filesVisited,const FileDef *fd,StringVector &incFiles) { for (const auto &ii : fd->includeFileList()) { if (ii.fileDef && !ii.fileDef->isReference() && filesVisited.find(ii.fileDef->absFilePath().str())==filesVisited.end()) { //printf("FileDefImpl::addIncludeDependency(%s)\n",qPrint(ii->fileDef->absFilePath())); incFiles.push_back(ii.fileDef->absFilePath().str()); filesVisited.insert(ii.fileDef->absFilePath().str()); getAllIncludeFilesRecursively(filesVisited,ii.fileDef,incFiles); } } } void FileDefImpl::getAllIncludeFilesRecursively(StringVector &incFiles) const { StringUnorderedSet includes; ::getAllIncludeFilesRecursively(includes,this,incFiles); } QCString FileDefImpl::title() const { return theTranslator->trFileReference(name()); } QCString FileDefImpl::fileVersion() const { return m_fileVersion; } QCString FileDefImpl::includeDependencyGraphFileName() const { return m_inclDepFileName; } QCString FileDefImpl::includedByDependencyGraphFileName() const { return m_inclByDepFileName; } void FileDefImpl::countMembers() { for (auto &ml : m_memberLists) { ml->countDecMembers(); ml->countDocMembers(); } for (const auto &mg : m_memberGroups) { mg->countDecMembers(); mg->countDocMembers(); } } int FileDefImpl::numDocMembers() const { MemberList *ml = getMemberList(MemberListType::AllMembersList()); return ml ? ml->numDocMembers() : 0; } int FileDefImpl::numDecMembers() const { MemberList *ml = getMemberList(MemberListType::AllMembersList()); return ml ? ml->numDecMembers() : 0; } void FileDefImpl::overrideIncludeGraph(bool e) { m_hasIncludeGraph=e; } void FileDefImpl::overrideIncludedByGraph(bool e) { m_hasIncludedByGraph=e; } bool FileDefImpl::hasIncludeGraph() const { return m_hasIncludeGraph; } bool FileDefImpl::hasIncludedByGraph() const { return m_hasIncludedByGraph; } // ----------------------- bool compareFileDefs(const FileDef *fd1, const FileDef *fd2) { return qstricmp_sort(fd1->name(),fd2->name()) < 0; } // --- Cast functions FileDef *toFileDef(Definition *d) { if (d==nullptr) return nullptr; if (d && typeid(*d)==typeid(FileDefImpl)) { return static_cast<FileDef*>(d); } else { return nullptr; } } const FileDef *toFileDef(const Definition *d) { if (d==nullptr) return nullptr; if (d && typeid(*d)==typeid(FileDefImpl)) { return static_cast<const FileDef*>(d); } else { return nullptr; } }
61,138
C++
.cpp
1,763
29.563812
144
0.674851
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,474
cppvalue.cpp
doxygen_doxygen/src/cppvalue.cpp
/****************************************************************************** * * Copyright (C) 1997-2021 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 <stdlib.h> #include "cppvalue.h" #include "constexp.h" CPPValue CPPValue::parseOctal(const std::string& token) { long val = 0; for (const char *p = token.c_str(); *p != 0; p++) { if (*p >= '0' && *p <= '7') val = val * 8 + *p - '0'; } return CPPValue(val); } CPPValue CPPValue::parseDecimal(const std::string& token) { long val = 0; for (const char *p = token.c_str(); *p != 0; p++) { if (*p >= '0' && *p <= '9') val = val * 10 + *p - '0'; } return CPPValue(val); } CPPValue CPPValue::parseHexadecimal(const std::string& token) { long val = 0; for (const char *p = token.c_str(); *p != 0; p++) { if (*p >= '0' && *p <= '9') val = val * 16 + *p - '0'; else if (*p >= 'a' && *p <= 'f') val = val * 16 + *p - 'a' + 10; else if (*p >= 'A' && *p <= 'F') val = val * 16 + *p - 'A' + 10; } //printf("parseHexadecimal %s->%x\n",qPrint(token),val); return CPPValue(val); } CPPValue CPPValue::parseBinary(const std::string& token) { long val = 0; for (const char *p = token.c_str(); *p != 0; p++) { if (*p >= '0' && *p <= '1') val = val * 2 + *p - '0'; } return CPPValue(val); } CPPValue CPPValue::parseCharacter(const std::string& token) // does not work for '\n' and the alike { if (token[1]=='\\') { switch(token[2]) { case 'n': return CPPValue('\n'); case 't': return CPPValue('\t'); case 'v': return CPPValue('\v'); case 'b': return CPPValue('\b'); case 'r': return CPPValue('\r'); case 'f': return CPPValue('\f'); case 'a': return CPPValue('\a'); case '\\': return CPPValue('\\'); case '?': return CPPValue('\?'); case '\'': return CPPValue('\''); case '"': return CPPValue('"'); case '0': // fall through case '1': // fall through case '2': // fall through case '3': // fall through case '4': // fall through case '5': // fall through case '6': // fall through case '7': // fall through return parseOctal(token); case 'x': case 'X': return parseHexadecimal(token); default: printf("Invalid escape sequence %s found!\n",token.c_str()); return CPPValue(0L); } } return CPPValue(token[1]); } CPPValue CPPValue::parseFloat(const std::string& token) { return CPPValue(std::stod(token)); }
3,033
C++
.cpp
94
28.340426
99
0.568407
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,475
layout.cpp
doxygen_doxygen/src/layout.cpp
/****************************************************************************** * * * * * Copyright (C) 1997-2015 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 <array> #include <assert.h> #include "types.h" #include "layout.h" #include "message.h" #include "language.h" #include "util.h" #include "doxygen.h" #include "version.h" #include "config.h" #include "xml.h" #include "resourcemgr.h" #include "docparser.h" #include "docnode.h" #include "debug.h" inline QCString compileOptions(const QCString &def) { return def; } inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1) { return compileOptions(def)+"|"+QCString().setNum(static_cast<long>(langId1))+"="+value1; } inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1, SrcLangExt langId2,const QCString &value2) { return compileOptions(def,langId1,value1)+ "|"+QCString().setNum(static_cast<long>(langId2))+"="+value2; } inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1, SrcLangExt langId2,const QCString &value2, SrcLangExt langId3,const QCString &value3) { return compileOptions(def,langId1,value1,langId2,value2)+ "|"+QCString().setNum(static_cast<long>(langId3))+"="+value3; } inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1, SrcLangExt langId2,const QCString &value2, SrcLangExt langId3,const QCString &value3, SrcLangExt langId4,const QCString &value4) { return compileOptions(def,langId1,value1,langId2,value2,langId3,value3)+ "|"+QCString().setNum(static_cast<long>(langId4))+"="+value4; } inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1, SrcLangExt langId2,const QCString &value2, SrcLangExt langId3,const QCString &value3, SrcLangExt langId4,const QCString &value4, SrcLangExt langId5,const QCString &value5) { return compileOptions(def,langId1,value1,langId2,value2,langId3,value3,langId4,value4)+ "|"+QCString().setNum(static_cast<long>(langId5))+"="+value5; } static bool elemIsVisible(const XMLHandlers::Attributes &attrib,bool defVal=TRUE) { QCString visible = XMLHandlers::value(attrib,"visible"); if (visible.isEmpty()) return defVal; if (visible.at(0)=='$' && visible.length()>1) { QCString id = visible.mid(1); const ConfigValues::Info *opt = ConfigValues::instance().get(id); if (opt && opt->type==ConfigValues::Info::Bool) { return ConfigValues::instance().*(opt->value.b); } else if (opt && opt->type==ConfigValues::Info::String) { return opt->getBooleanRepresentation(); } else if (!opt) { err("found unsupported value '%s' for visible attribute in layout file, reverting to '%s'\n", qPrint(visible),(defVal?"yes":"no")); return defVal; } } QCString visibleLow = visible.lower(); if (visibleLow=="no" || visibleLow=="false" || visibleLow=="0") return FALSE; else if (visibleLow=="yes" || visibleLow=="true" || visibleLow=="1") return TRUE; else { err("found unsupported value '%s' for visible attribute in layout file, reverting to '%s'\n", qPrint(visible),(defVal?"yes":"no")); return defVal; } } static bool parentIsVisible(LayoutNavEntry *parent) { return parent==nullptr || parent->visible(); } //--------------------------------------------------------------------------------- LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind, const QCString &file) const { LayoutNavEntry *result=nullptr; for (const auto &entry : m_children) { // depth first search, needed to find the entry furthest from the // root in case an entry is in the tree twice result = entry->find(kind,file); if (result) return result; if (entry->kind()==kind && (file==QCString() || entry->baseFile()==file)) { return entry.get(); } } return result; } QCString LayoutNavEntry::url() const { QCString url = baseFile().stripWhiteSpace(); if ((kind()!=LayoutNavEntry::User && kind()!=LayoutNavEntry::UserGroup) || (kind()==LayoutNavEntry::UserGroup && url.startsWith("usergroup"))) { addHtmlExtensionIfMissing(url); } else if (url.startsWith("@ref ") || url.startsWith("\\ref ")) { bool found=false; QCString relPath = ""; QCString context = QCString(); auto parser { createDocParser() }; auto dfAst { createRef( *parser.get(), url.mid(5).stripWhiteSpace(), context ) }; auto dfAstImpl = dynamic_cast<const DocNodeAST*>(dfAst.get()); const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root); if (!df->file().isEmpty() || !df->anchor().isEmpty()) { found = true; url=externalRef(relPath,df->ref(),TRUE); if (!df->file().isEmpty()) { QCString fn = df->file(); addHtmlExtensionIfMissing(fn); url += fn; } if (!df->anchor().isEmpty()) { url += "#" + df->anchor(); } } if (!found) { msg("explicit link request to '%s' in layout file '%s' could not be resolved\n",qPrint(url.mid(5)),qPrint(Config_getString(LAYOUT_FILE))); } } //printf("LayoutNavEntry::url()=%s\n",qPrint(url)); return url; } //--------------------------------------------------------------------------------- class LayoutParser { public: static LayoutParser &instance() { static LayoutParser theInstance; return theInstance; } // =========== XMLHandler events void setDocumentLocator(const XMLLocator *locator) { m_locator = locator; } void error( const std::string &fileName,int lineNr,const std::string &msg) { warn(fileName.c_str(),lineNr,"%s",msg.c_str()); } void startElement( const std::string &name, const XMLHandlers::Attributes& attrib ); void endElement( const std::string &name ); void startSimpleEntry(LayoutDocEntry::Kind k,const XMLHandlers::Attributes &attrib) { bool isVisible = m_visible && elemIsVisible(attrib) && parentIsVisible(m_rootNav); if (m_part!=LayoutDocManager::Undefined && isVisible) { LayoutDocManager::instance().addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(k,isVisible)); } } // ============ Specific callbacks void startSectionEntry(LayoutDocEntry::Kind k,const XMLHandlers::Attributes &attrib, const QCString &title) { bool isVisible = m_visible && elemIsVisible(attrib) && parentIsVisible(m_rootNav); QCString userTitle = XMLHandlers::value(attrib,"title"); //printf("startSectionEntry: title='%s' userTitle='%s'\n", // qPrint(title),qPrint(userTitle)); if (userTitle.isEmpty()) userTitle = title; if (m_part!=LayoutDocManager::Undefined && isVisible) { LayoutDocManager::instance().addEntry(m_part,std::make_unique<LayoutDocEntrySection>(k,userTitle,isVisible)); } } void startMemberDeclEntry(const XMLHandlers::Attributes &attrib,MemberListType type, const QCString &title,const QCString &subscript) { QCString userTitle = XMLHandlers::value(attrib,"title"); QCString userSubscript = XMLHandlers::value(attrib,"subtitle"); if (userTitle.isEmpty()) userTitle = title; if (userSubscript.isEmpty()) userSubscript = subscript; bool isVisible = m_visible && elemIsVisible(attrib) && parentIsVisible(m_rootNav); if (m_part!=LayoutDocManager::Undefined && isVisible) { LayoutDocManager::instance().addEntry(m_part,std::make_unique<LayoutDocEntryMemberDecl>(type,userTitle,userSubscript)); } } void startMemberDefEntry(const XMLHandlers::Attributes &attrib,MemberListType type, const QCString &title,const QCString &) { QCString userTitle = XMLHandlers::value(attrib,"title"); if (userTitle.isEmpty()) userTitle = title; //printf("memberdef: %s\n",qPrint(userTitle)); bool isVisible = m_visible && elemIsVisible(attrib) && parentIsVisible(m_rootNav); if (m_part!=LayoutDocManager::Undefined && isVisible) { LayoutDocManager::instance().addEntry(m_part,std::make_unique<LayoutDocEntryMemberDef>(type,userTitle)); } } void startLayout(const XMLHandlers::Attributes &) { } void startNavIndex(const XMLHandlers::Attributes &) { m_scope="navindex/"; m_rootNav = LayoutDocManager::instance().rootNavEntry(); if (m_rootNav) { m_rootNav->clear(); } } void endNavIndex() { m_scope=""; if (m_rootNav && !m_rootNav->find(LayoutNavEntry::MainPage)) { // no MainPage node... add one as the first item of the root node... m_rootNav->prependChild(std::make_unique<LayoutNavEntry>(m_rootNav,LayoutNavEntry::MainPage, TRUE, "index",theTranslator->trMainPage(),"")); } } void startNavEntry(const XMLHandlers::Attributes &attrib) { bool javaOpt = Config_getBool(OPTIMIZE_OUTPUT_JAVA); bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); bool hasGraphicalHierarchy = Config_getBool(HAVE_DOT) && Config_getBool(GRAPHICAL_HIERARCHY); bool extractAll = Config_getBool(EXTRACT_ALL); static struct NavEntryMap { const char *typeStr; // type attribute name in the XML file LayoutNavEntry::Kind kind; // corresponding enum name QCString mainName; // default title for an item if it has children QCString subName; // optional name for an item if it is rendered as a child QCString intro; // introduction text to be put on the index page QCString baseFile; // base name of the file containing the index page } mapping[] = { { "mainpage", LayoutNavEntry::MainPage, theTranslator->trMainPage(), QCString(), QCString(), "index" }, { "pages", LayoutNavEntry::Pages, theTranslator->trRelatedPages(), QCString(), theTranslator->trRelatedPagesDescription(), "pages" }, { "topics", LayoutNavEntry::Topics, theTranslator->trTopics(), QCString(), theTranslator->trTopicListDescription(), "topics" }, { "modules", LayoutNavEntry::Modules, theTranslator->trModules(), theTranslator->trModulesList(), theTranslator->trModulesDescription(), "modules" }, { "modulelist", LayoutNavEntry::ModuleList, theTranslator->trModulesList(), QCString(), theTranslator->trModulesListDescription(extractAll), "modules" }, { "modulemembers", LayoutNavEntry::ModuleMembers, theTranslator->trModulesMembers(), QCString(), theTranslator->trModulesMemberDescription(extractAll), "modulemembers" }, { "namespaces", LayoutNavEntry::Namespaces, javaOpt || vhdlOpt ? theTranslator->trPackages() : fortranOpt || sliceOpt ? theTranslator->trModules() : theTranslator->trNamespaces(), javaOpt || vhdlOpt ? theTranslator->trPackageList() : fortranOpt || sliceOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(), javaOpt || vhdlOpt ? theTranslator->trPackageListDescription() : fortranOpt || sliceOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll), "namespaces" }, { "namespacelist", LayoutNavEntry::NamespaceList, javaOpt || vhdlOpt ? theTranslator->trPackageList() : fortranOpt || sliceOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(), QCString(), javaOpt || vhdlOpt ? theTranslator->trPackageListDescription() : fortranOpt || sliceOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll), "namespaces" }, { "namespacemembers", LayoutNavEntry::NamespaceMembers, javaOpt || vhdlOpt ? theTranslator->trPackageMembers() : fortranOpt || sliceOpt ? theTranslator->trModulesMembers() : theTranslator->trNamespaceMembers(), QCString(), fortranOpt || sliceOpt ? theTranslator->trModulesMemberDescription(extractAll) : theTranslator->trNamespaceMemberDescription(extractAll), "namespacemembers" }, { "concepts", LayoutNavEntry::Concepts, theTranslator->trConcept(true,false), theTranslator->trConceptList(), theTranslator->trConceptListDescription(extractAll), "concepts" }, { "classindex", LayoutNavEntry::ClassIndex, fortranOpt ? theTranslator->trCompoundIndexFortran() : vhdlOpt ? theTranslator->trDesignUnitIndex() : theTranslator->trCompoundIndex(), QCString(), QCString(), "classes" }, { "classes", LayoutNavEntry::Classes, fortranOpt ? theTranslator->trDataTypes() : vhdlOpt ? theTranslator->trDesignUnits() : theTranslator->trClasses(), theTranslator->trCompoundList(), fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? theTranslator->trDesignUnitListDescription() : theTranslator->trCompoundListDescription(), "annotated" }, { "classlist", LayoutNavEntry::ClassList, fortranOpt ? theTranslator->trCompoundListFortran() : vhdlOpt ? theTranslator->trDesignUnitList() : theTranslator->trCompoundList(), QCString(), fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? theTranslator->trDesignUnitListDescription() : theTranslator->trCompoundListDescription(), "annotated" }, { "hierarchy", LayoutNavEntry::ClassHierarchy, vhdlOpt ? theTranslator->trDesignUnitHierarchy() : theTranslator->trClassHierarchy(), QCString(), theTranslator->trClassHierarchyDescription(), hasGraphicalHierarchy ? "inherits" : "hierarchy" }, { "classmembers", LayoutNavEntry::ClassMembers, fortranOpt ? theTranslator->trCompoundMembersFortran() : vhdlOpt ? theTranslator->trDesignUnitMembers() : theTranslator->trCompoundMembers(), QCString(), fortranOpt ? theTranslator->trCompoundMembersDescriptionFortran(extractAll) : theTranslator->trCompoundMembersDescription(extractAll), "functions" }, { "interfaceindex", LayoutNavEntry::InterfaceIndex, theTranslator->trInterfaceIndex(), QCString(), QCString(), "interfaces" }, { "interfaces", LayoutNavEntry::Interfaces, theTranslator->trSliceInterfaces(), theTranslator->trInterfaceList(), theTranslator->trInterfaceListDescription(), "annotatedinterfaces" }, { "interfacelist", LayoutNavEntry::InterfaceList, theTranslator->trInterfaceList(), QCString(), theTranslator->trInterfaceListDescription(), "annotatedinterfaces" }, { "interfacehierarchy", LayoutNavEntry::InterfaceHierarchy, theTranslator->trInterfaceHierarchy(), QCString(), theTranslator->trInterfaceHierarchyDescription(), hasGraphicalHierarchy ? "interfaceinherits" : "interfacehierarchy" }, { "structindex", LayoutNavEntry::StructIndex, theTranslator->trStructIndex(), QCString(), QCString(), "structs" }, { "structs", LayoutNavEntry::Structs, theTranslator->trStructs(), theTranslator->trStructList(), theTranslator->trStructListDescription(), "annotatedstructs" }, { "structlist", LayoutNavEntry::StructList, theTranslator->trStructList(), QCString(), theTranslator->trStructListDescription(), "annotatedstructs" }, { "exceptionindex", LayoutNavEntry::ExceptionIndex, theTranslator->trExceptionIndex(), QCString(), QCString(), "exceptions" }, { "exceptions", LayoutNavEntry::Exceptions, theTranslator->trExceptions(), theTranslator->trExceptionList(), theTranslator->trExceptionListDescription(), "annotatedexceptions" }, { "exceptionlist", LayoutNavEntry::ExceptionList, theTranslator->trExceptionList(), QCString(), theTranslator->trExceptionListDescription(), "annotatedexceptions" }, { "exceptionhierarchy", LayoutNavEntry::ExceptionHierarchy, theTranslator->trExceptionHierarchy(), QCString(), theTranslator->trExceptionHierarchyDescription(), hasGraphicalHierarchy ? "exceptioninherits" : "exceptionhierarchy" }, { "files", LayoutNavEntry::Files, theTranslator->trFile(TRUE,FALSE), theTranslator->trFileList(), theTranslator->trFileListDescription(extractAll), "files" }, { "filelist", LayoutNavEntry::FileList, theTranslator->trFileList(), QCString(), theTranslator->trFileListDescription(extractAll), "files" }, { "globals", LayoutNavEntry::FileGlobals, theTranslator->trFileMembers(), QCString(), theTranslator->trFileMembersDescription(extractAll), "globals" }, { "examples", LayoutNavEntry::Examples, theTranslator->trExamples(), QCString(), theTranslator->trExamplesDescription(), "examples" }, { "user", LayoutNavEntry::User, QCString(), QCString(), QCString(), "user" }, { "usergroup", LayoutNavEntry::UserGroup, QCString(), QCString(), QCString(), "usergroup" }, { nullptr, // end of list static_cast<LayoutNavEntry::Kind>(0), QCString(), QCString(), QCString(), QCString() } }; // find type in the table int i=0; QCString type = XMLHandlers::value(attrib,"type"); while (mapping[i].typeStr) { if (mapping[i].typeStr==type) break; i++; } if (mapping[i].typeStr==nullptr) { std::string fileName = m_locator->fileName(); if (type.isEmpty()) { warn(fileName.c_str(),m_locator->lineNr(),"an entry tag within a navindex has no type attribute! Check your layout file!"); } else { warn(fileName.c_str(),m_locator->lineNr(),"the type '%s' is not supported for the entry tag within a navindex! Check your layout file!",qPrint(type)); } m_invalidEntry=TRUE; return; } LayoutNavEntry::Kind kind = mapping[i].kind; QCString baseFile = mapping[i].baseFile; QCString title = XMLHandlers::value(attrib,"title"); bool isVisible = m_visible && elemIsVisible(attrib) && parentIsVisible(m_rootNav); if (title.isEmpty()) // use default title { title = mapping[i].mainName; // use title for main row if (m_rootNav!=LayoutDocManager::instance().rootNavEntry() && !mapping[i].subName.isEmpty()) { title = mapping[i].subName; // if this is a child of another row, use the subName if available // this is mainly done to get compatible naming with older versions. } } QCString intro = XMLHandlers::value(attrib,"intro"); if (intro.isEmpty()) // use default intro text { intro = mapping[i].intro; } QCString url = XMLHandlers::value(attrib,"url"); if (mapping[i].kind==LayoutNavEntry::User && !url.isEmpty()) { baseFile=url; } else if (kind==LayoutNavEntry::UserGroup) { if (!url.isEmpty()) { if (url == "[none]") { baseFile = QCString(); } else { baseFile=url; } } else { baseFile+=QCString().sprintf("%d",m_userGroupCount++); } } // create new item and make it the new root m_rootNav = LayoutDocManager::instance().createChildNavEntry(m_rootNav,kind,isVisible,baseFile,title,intro); } void endNavEntry() { // set the root back to the parent if (m_rootNav && !m_invalidEntry) m_rootNav = m_rootNav->parent(); m_invalidEntry=FALSE; } void recurseNavEntryChildren(LayoutNavEntry &lne) { bool vis = lne.visible(); for (const auto &lne1 : lne.children()) { lne1->setVisible(vis && lne1->visible()); recurseNavEntryChildren(*lne1); } } void startTop(const XMLHandlers::Attributes &attrib,LayoutDocManager::LayoutPart part, const QCString &scope, LayoutNavEntry::Kind nav) { LayoutDocManager::instance().clear(part); m_scope = scope; m_part = part; m_visible = elemIsVisible(attrib); auto *lne = LayoutDocManager::instance().rootNavEntry()->find(nav); if (lne) { m_visible = m_visible && lne->visible(); lne->setVisible(m_visible); recurseNavEntryChildren(*lne); } } void endTop() { m_scope=""; m_part = LayoutDocManager::Undefined; } void startMemberDef(const XMLHandlers::Attributes &attrib) { m_scope+="memberdef/"; if (m_part!=LayoutDocManager::Undefined) { bool isVisible = m_visible && elemIsVisible(attrib) && parentIsVisible(m_rootNav); LayoutDocManager::instance().addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(LayoutDocEntry::MemberDefStart,isVisible)); } } void endMemberDef() { QCString scopeOrg = m_scope; int i=m_scope.findRev("memberdef/"); if (i!=-1) { m_scope=m_scope.left(i); if (m_part!=LayoutDocManager::Undefined) { bool isVisible = true; for (const auto &lde : LayoutDocManager::instance().docEntries(m_part)) { if (lde->kind() == LayoutDocEntry::MemberDefStart) { isVisible = static_cast<const LayoutDocEntrySimple*>(lde.get())->visible(); } } LayoutDocManager::instance().addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(LayoutDocEntry::MemberDefEnd,isVisible)); } } } void startMemberDecl(const XMLHandlers::Attributes &attrib) { m_scope+="memberdecl/"; if (m_part!=LayoutDocManager::Undefined) { bool isVisible = m_visible && elemIsVisible(attrib) && parentIsVisible(m_rootNav); LayoutDocManager::instance().addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(LayoutDocEntry::MemberDeclStart,isVisible)); } } void endMemberDecl() { int i=m_scope.findRev("memberdecl/"); if (i!=-1) { m_scope=m_scope.left(i); if (m_part!=LayoutDocManager::Undefined) { bool isVisible = true; for (const auto &lde : LayoutDocManager::instance().docEntries(m_part)) { if (lde->kind() == LayoutDocEntry::MemberDeclStart) { isVisible = static_cast<const LayoutDocEntrySimple*>(lde.get())->visible(); } } LayoutDocManager::instance().addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(LayoutDocEntry::MemberDeclEnd,isVisible)); } } } private: QCString m_scope; LayoutDocManager::LayoutPart m_part = LayoutDocManager::Undefined; LayoutNavEntry *m_rootNav = nullptr; bool m_invalidEntry = false; bool m_visible = true; static int m_userGroupCount; const XMLLocator *m_locator = nullptr; }; //--------------------------------------------------------------------------------- namespace { struct ElementCallbacks { using StartCallback = std::function<void(LayoutParser&,const XMLHandlers::Attributes&)>; using EndCallback = std::function<void(LayoutParser&)>; StartCallback startCb; EndCallback endCb = [](LayoutParser &){}; }; template<class...Args> static auto startCb(void (LayoutParser::*fn)(Args...)) { return [=](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(attr); }; } template<class...Args> static auto startCb(void (LayoutParser::*fn)(Args...), LayoutDocEntry::Kind kind ) { return [=](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(kind,attr); }; } template<class...Args> static auto startCb(void (LayoutParser::*fn)(Args...), LayoutDocEntry::Kind kind, const std::function<QCString()> &title ) { return [=](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(kind,attr,title()); }; } template<class...Args> static auto startCb(void (LayoutParser::*fn)(Args...), MemberListType type, const std::function<QCString()> &title ) { return [=](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(attr,type,title(),QCString()); }; } template<class...Args> static auto startCb(void (LayoutParser::*fn)(Args...), MemberListType type, const std::function<QCString()> &title, const std::function<QCString()> &subtitle ) { return [=](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(attr,type,title(),subtitle()); }; } template<class...Args> static auto startCb(void (LayoutParser::*fn)(Args...), LayoutDocManager::LayoutPart part, const QCString &scope, LayoutNavEntry::Kind nav ) { return [=](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(attr,part,scope,nav); }; } static auto endCb(void (LayoutParser::*fn)()) { return [=](LayoutParser &parser) { (parser.*fn)(); }; } static const std::map< std::string, ElementCallbacks > g_elementHandlers = { // path/name { "doxygenlayout", { startCb(&LayoutParser::startLayout) } }, { "navindex", { startCb(&LayoutParser::startNavIndex), endCb(&LayoutParser::endNavIndex) } }, { "navindex/tab", { startCb(&LayoutParser::startNavEntry), endCb(&LayoutParser::endNavEntry) } }, // class layout handlers { "class", { startCb(&LayoutParser::startTop,LayoutDocManager::Class,"class/",LayoutNavEntry::Classes), endCb(&LayoutParser::endTop) } }, { "class/briefdescription", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::BriefDesc) } }, { "class/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc, [](){ return compileOptions(theTranslator->trDetailedDescription()); }) } }, { "class/authorsection", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::AuthorSection) } }, { "class/includes", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassIncludes) } }, { "class/inheritancegraph", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassInheritanceGraph) } }, { "class/collaborationgraph", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassCollaborationGraph) } }, { "class/allmemberslink", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassAllMembersLink) } }, { "class/usedfiles", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassUsedFiles) } }, { "class/memberdecl", { startCb(&LayoutParser::startMemberDecl), endCb(&LayoutParser::endMemberDecl) } }, { "class/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::MemberGroups) } }, { "class/memberdecl/nestedclasses", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::ClassNestedClasses, []() { return compileOptions(/*default*/ theTranslator->trCompounds(), SrcLangExt::VHDL, theTranslator->trVhdlType(VhdlSpecifier::ENTITY,FALSE), SrcLangExt::Fortran,theTranslator->trDataTypes()); }) } }, { "class/memberdecl/services", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Services(), []() { return compileOptions(theTranslator->trServices()); }) } }, { "class/memberdecl/interfaces", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Interfaces(), []() { return compileOptions(theTranslator->trInterfaces()); }) } }, { "class/memberdecl/publictypes", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::PubTypes(), []() { return compileOptions(theTranslator->trPublicTypes()); }) } }, { "class/memberdecl/publicslots", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::PubSlots(), []() { return compileOptions(theTranslator->trPublicSlots()); }) } }, { "class/memberdecl/signals", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Signals(), []() { return compileOptions(theTranslator->trSignals()); }) } }, { "class/memberdecl/publicmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubMethods(), []() { return compileOptions(/* default */ theTranslator->trPublicMembers(), SrcLangExt::ObjC, theTranslator->trInstanceMethods(), SrcLangExt::Slice,theTranslator->trOperations()); }) } }, { "class/memberdecl/publicstaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubStaticMethods(), []() { return compileOptions(/* default */ theTranslator->trStaticPublicMembers(), SrcLangExt::ObjC, theTranslator->trClassMethods()); }) } }, { "class/memberdecl/publicattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubAttribs(), []() { return compileOptions(/* default */ theTranslator->trPublicAttribs(), SrcLangExt::Slice,theTranslator->trDataMembers()); }) } }, { "class/memberdecl/publicstaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubStaticAttribs(), []() { return compileOptions(theTranslator->trStaticPublicAttribs()); }) } }, { "class/memberdecl/protectedtypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProTypes(), []() { return compileOptions(theTranslator->trProtectedTypes()); }) } }, { "class/memberdecl/protectedslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProSlots(), []() { return compileOptions(theTranslator->trProtectedSlots()); }) } }, { "class/memberdecl/protectedmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProMethods(), []() { return compileOptions(theTranslator->trProtectedMembers()); }) } }, { "class/memberdecl/protectedstaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProStaticMethods(), []() { return compileOptions(theTranslator->trStaticProtectedMembers()); }) } }, { "class/memberdecl/protectedattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProAttribs(), []() { return compileOptions(theTranslator->trProtectedAttribs()); }) } }, { "class/memberdecl/protectedstaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProStaticAttribs(), []() { return compileOptions(theTranslator->trStaticProtectedAttribs()); }) } }, { "class/memberdecl/packagetypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacTypes(), []() { return compileOptions(theTranslator->trPackageTypes()); }) } }, { "class/memberdecl/packagemethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacMethods(), []() { return compileOptions(theTranslator->trPackageFunctions()); }) } }, { "class/memberdecl/packagestaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacStaticMethods(), []() { return compileOptions(theTranslator->trStaticPackageFunctions()); }) } }, { "class/memberdecl/packageattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacAttribs(), []() { return compileOptions(theTranslator->trPackageAttribs()); }) } }, { "class/memberdecl/packagestaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacStaticAttribs(), []() { return compileOptions(theTranslator->trStaticPackageAttribs()); }) } }, { "class/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(), []() { return compileOptions(theTranslator->trProperties()); }) } }, { "class/memberdecl/events", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Events(), []() { return compileOptions(theTranslator->trEvents()); }) } }, { "class/memberdecl/privatetypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriTypes(), []() { return compileOptions(theTranslator->trPrivateTypes()); }) } }, { "class/memberdecl/privateslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriSlots(), []() { return compileOptions(theTranslator->trPrivateSlots()); }) } }, { "class/memberdecl/privatemethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriMethods(), []() { return compileOptions(theTranslator->trPrivateMembers()); }) } }, { "class/memberdecl/privatestaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriStaticMethods(), []() { return compileOptions(theTranslator->trStaticPrivateMembers()); }) } }, { "class/memberdecl/privateattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriAttribs(), []() { return compileOptions(theTranslator->trPrivateAttribs()); }) } }, { "class/memberdecl/privatestaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriStaticAttribs(), []() { return compileOptions(theTranslator->trStaticPrivateAttribs()); }) } }, { "class/memberdecl/friends", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Friends(), []() { return compileOptions(theTranslator->trFriends()); }) } }, { "class/memberdecl/related", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Related(), []() { return compileOptions(theTranslator->trRelatedSymbols()); }, []() { return compileOptions(theTranslator->trRelatedSymbolsSubscript()); }) } }, { "class/memberdef", { startCb(&LayoutParser::startMemberDef), endCb(&LayoutParser::endMemberDef) } }, { "class/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ClassInlineClasses, []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(), SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); }) } }, { "class/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::TypedefMembers(), []() { return compileOptions(theTranslator->trMemberTypedefDocumentation()); }) } }, { "class/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::EnumMembers(), []() { return compileOptions(theTranslator->trMemberEnumerationDocumentation()); }) } }, { "class/memberdef/services", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::ServiceMembers(), []() { return compileOptions(theTranslator->trInterfaces()); }) } }, { "class/memberdef/interfaces", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::InterfaceMembers(), []() { return compileOptions(theTranslator->trInterfaces()); }) } }, { "class/memberdef/constructors", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::Constructors(), []() { return compileOptions(theTranslator->trConstructorDocumentation()); }) } }, { "class/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::FunctionMembers(), []() { return compileOptions(/* default */ theTranslator->trMemberFunctionDocumentation(), SrcLangExt::ObjC, theTranslator->trMethodDocumentation(), SrcLangExt::Fortran,theTranslator->trMemberFunctionDocumentationFortran(), SrcLangExt::Slice, theTranslator->trOperationDocumentation()); }) } }, { "class/memberdef/related", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::RelatedMembers(), []() { return compileOptions(theTranslator->trRelatedSymbolDocumentation()); }) } }, { "class/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::VariableMembers(), []() { return compileOptions(/* default */ theTranslator->trMemberDataDocumentation(), SrcLangExt::Slice, theTranslator->trDataMemberDocumentation()); }) } }, { "class/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(), []() { return compileOptions(theTranslator->trPropertyDocumentation()); }) } }, { "class/memberdef/events", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::EventMembers(), []() { return compileOptions(theTranslator->trEventDocumentation()); }) } }, // concept layout handlers { "concept", { startCb(&LayoutParser::startTop,LayoutDocManager::Concept,"concept/",LayoutNavEntry::Concepts), endCb(&LayoutParser::endTop) } }, { "concept/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } }, { "concept/definition", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ConceptDefinition, []() { return compileOptions(theTranslator->trConceptDefinition()); }), } }, { "concept/includes", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::ClassIncludes) } }, { "concept/sourcelink", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink) } }, { "concept/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc, []() { return compileOptions(theTranslator->trDetailedDescription()); }) } }, { "concept/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } }, // namespace layout handlers { "namespace", { startCb(&LayoutParser::startTop,LayoutDocManager::Namespace,"namespace/",LayoutNavEntry::Namespaces), endCb(&LayoutParser::endTop) } }, { "namespace/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } }, { "namespace/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc, []() { return compileOptions(theTranslator->trDetailedDescription()); }) } }, { "namespace/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } }, { "namespace/memberdecl", { startCb(&LayoutParser::startMemberDecl), endCb(&LayoutParser::endMemberDecl) } }, { "namespace/memberdecl/nestednamespaces", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceNestedNamespaces, []() { return compileOptions(/* default */ theTranslator->trNamespaces(), SrcLangExt::Java, theTranslator->trPackages(), SrcLangExt::VHDL, theTranslator->trPackages(), SrcLangExt::IDL, theTranslator->trModules(), SrcLangExt::Fortran,theTranslator->trModules(), SrcLangExt::Slice,(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ? theTranslator->trModules() : theTranslator->trNamespaces())); }) } }, { "namespace/memberdecl/constantgroups", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceNestedConstantGroups, []() { return compileOptions(theTranslator->trConstantGroups()); }) } }, { "namespace/memberdecl/interfaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceInterfaces, []() { return compileOptions(theTranslator->trSliceInterfaces()); }) } }, { "namespace/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceClasses, []() { return compileOptions(/* default */ theTranslator->trCompounds(), SrcLangExt::VHDL, theTranslator->trVhdlType(VhdlSpecifier::ENTITY,FALSE), SrcLangExt::Fortran,theTranslator->trDataTypes()); }) } }, { "namespace/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceConcepts, []() { return compileOptions(theTranslator->trConcept(true,false)); }) } }, { "namespace/memberdecl/structs", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceStructs, []() { return compileOptions(theTranslator->trStructs()); }) } }, { "namespace/memberdecl/exceptions", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceExceptions, []() { return compileOptions(theTranslator->trExceptions()); }) } }, { "namespace/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::MemberGroups) } }, { "namespace/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(), []() { return compileOptions(theTranslator->trTypedefs()); }) } }, { "namespace/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(), []() { return compileOptions(theTranslator->trSequences()); }) } }, { "namespace/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(), []() { return compileOptions(theTranslator->trDictionaries()); }) } }, { "namespace/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(), []() { return compileOptions(theTranslator->trEnumerations()); }) } }, { "namespace/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(), []() { return compileOptions(/* default */ theTranslator->trFunctions(), SrcLangExt::Fortran,theTranslator->trSubprograms(), SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); }) } }, { "namespace/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(), []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ? theTranslator->trConstants() : theTranslator->trVariables()); }) } }, { "namespace/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(), []() { return compileOptions(theTranslator->trProperties()); }) } }, { "namespace/memberdef", { startCb(&LayoutParser::startMemberDef), endCb(&LayoutParser::endMemberDef) } }, { "namespace/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceInlineClasses, []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(), SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); }) } }, { "namespace/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(), []() { return compileOptions(theTranslator->trTypedefDocumentation()); }) } }, { "namespace/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(), []() { return compileOptions(theTranslator->trSequenceDocumentation()); }) } }, { "namespace/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(), []() { return compileOptions(theTranslator->trDictionaryDocumentation()); }) } }, { "namespace/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(), []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); }) } }, { "namespace/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(), []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(), SrcLangExt::Fortran,theTranslator->trSubprogramDocumentation()); }) } }, { "namespace/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(), []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ? theTranslator->trConstantDocumentation() : theTranslator->trVariableDocumentation()); }) } }, { "namespace/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(), []() { return compileOptions(theTranslator->trPropertyDocumentation()); }) } }, // file layout handlers { "file", { startCb(&LayoutParser::startTop,LayoutDocManager::File,"file/",LayoutNavEntry::Files), endCb(&LayoutParser::endTop) } }, { "file/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } }, { "file/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc, []() { return compileOptions(theTranslator->trDetailedDescription()); }) } }, { "file/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } }, { "file/includes", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludes) } }, { "file/includegraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludeGraph) } }, { "file/includedbygraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludedByGraph) } }, { "file/sourcelink", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink) } }, { "file/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } }, { "file/memberdecl", { startCb(&LayoutParser::startMemberDecl), endCb(&LayoutParser::endMemberDecl) } }, { "file/memberdecl/interfaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileInterfaces, []() { return compileOptions(theTranslator->trSliceInterfaces()); }) } }, { "file/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileClasses, []() { return compileOptions(/* default */ theTranslator->trCompounds(), SrcLangExt::VHDL, theTranslator->trVhdlType(VhdlSpecifier::ENTITY,FALSE), SrcLangExt::Fortran,theTranslator->trDataTypes()); }) } }, { "file/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::FileConcepts, []() { return compileOptions(theTranslator->trConcept(true,false)); }) } }, { "file/memberdecl/structs", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileStructs, []() { return compileOptions(theTranslator->trStructs()); }) } }, { "file/memberdecl/exceptions", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileExceptions, []() { return compileOptions(theTranslator->trExceptions()); }) } }, { "file/memberdecl/namespaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileNamespaces, []() { return compileOptions(/* default */ theTranslator->trNamespaces(), SrcLangExt::Java, theTranslator->trPackages(), SrcLangExt::IDL, theTranslator->trModules(), SrcLangExt::Fortran,theTranslator->trModules(), SrcLangExt::Slice, theTranslator->trModules()); }) } }, { "file/memberdecl/constantgroups", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileConstantGroups, []() { return compileOptions(theTranslator->trConstantGroups()); }) } }, { "file/memberdecl/defines", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDefineMembers(), []() { return compileOptions(theTranslator->trDefines()); }) } }, { "file/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(), []() { return compileOptions(theTranslator->trTypedefs()); }) } }, { "file/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(), []() { return compileOptions(theTranslator->trSequences()); }) } }, { "file/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(), []() { return compileOptions(theTranslator->trDictionaries()); }) } }, { "file/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(), []() { return compileOptions(theTranslator->trEnumerations()); }) } }, { "file/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(), []() { return compileOptions(/* default */ theTranslator->trFunctions(), SrcLangExt::Fortran,theTranslator->trSubprograms(), SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); }) } }, { "file/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(), []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ? theTranslator->trConstants() : theTranslator->trVariables()); }) } }, { "file/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(), []() { return compileOptions(theTranslator->trProperties()); }) } }, { "file/memberdef", { startCb(&LayoutParser::startMemberDef), endCb(&LayoutParser::endMemberDef) } }, { "file/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileInlineClasses, []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(), SrcLangExt::Fortran, theTranslator->trTypeDocumentation()); }) } }, { "file/memberdef/defines", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDefineMembers(), []() { return compileOptions(theTranslator->trDefineDocumentation()); }) } }, { "file/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(), []() { return compileOptions(theTranslator->trTypedefDocumentation()); }) } }, { "file/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(), []() { return compileOptions(theTranslator->trSequenceDocumentation()); }) } }, { "file/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(), []() { return compileOptions(theTranslator->trDictionaryDocumentation()); }) } }, { "file/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(), []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); }) } }, { "file/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(), []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(), SrcLangExt::Fortran, theTranslator->trSubprogramDocumentation()); }) } }, { "file/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(), []() { return compileOptions(theTranslator->trVariableDocumentation()); }) } }, { "file/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(), []() { return compileOptions(theTranslator->trPropertyDocumentation()); }) } }, // group layout handlers { "group", { startCb(&LayoutParser::startTop,LayoutDocManager::Group,"group/",LayoutNavEntry::None), endCb(&LayoutParser::endTop) } }, { "group/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } }, { "group/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc, []() { return compileOptions(theTranslator->trDetailedDescription()); }) } }, { "group/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } }, { "group/groupgraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::GroupGraph) } }, { "group/memberdecl", { startCb(&LayoutParser::startMemberDecl), endCb(&LayoutParser::endMemberDecl) } }, { "group/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } }, { "group/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupClasses, []() { return compileOptions(/* default */ theTranslator->trCompounds(), SrcLangExt::VHDL, theTranslator->trVhdlType(VhdlSpecifier::ENTITY,FALSE), SrcLangExt::Fortran, theTranslator->trDataTypes()); }) } }, { "group/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupConcepts, []() { return compileOptions(theTranslator->trConcept(true,false)); }) } }, { "group/memberdecl/modules", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupModules, []() { return compileOptions(theTranslator->trModule(true,false)); }) } }, { "group/memberdecl/namespaces", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNamespaces, []() { return compileOptions(/* default */ theTranslator->trNamespaces(), SrcLangExt::Java, theTranslator->trPackages(), SrcLangExt::Fortran, theTranslator->trModules()); }) } }, { "group/memberdecl/dirs", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupDirs, []() { return compileOptions(theTranslator->trDirectories()); }) } }, { "group/memberdecl/nestedgroups", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNestedGroups, []() { return compileOptions(theTranslator->trTopics()); }) } }, { "group/memberdecl/files", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupFiles, []() { return compileOptions(theTranslator->trFile(TRUE,FALSE)); }) } }, { "group/memberdecl/defines", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDefineMembers(), []() { return compileOptions(theTranslator->trDefines()); }) } }, { "group/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(), []() { return compileOptions(theTranslator->trTypedefs()); }) } }, { "group/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(), []() { return compileOptions(theTranslator->trSequences()); }) } }, { "group/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(), []() { return compileOptions(theTranslator->trDictionaries()); }) } }, { "group/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(), []() { return compileOptions(theTranslator->trEnumerations()); }) } }, { "group/memberdecl/enumvalues", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumValMembers(), []() { return compileOptions(theTranslator->trEnumerationValues()); }) } }, { "group/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(), []() { return compileOptions(/* default */ theTranslator->trFunctions(), SrcLangExt::Fortran,theTranslator->trSubprograms(), SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); }) } }, { "group/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(), []() { return compileOptions(theTranslator->trVariables()); }) } }, { "group/memberdecl/signals", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSignalMembers(), []() { return compileOptions(theTranslator->trSignals()); }) } }, { "group/memberdecl/publicslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPubSlotMembers(), []() { return compileOptions(theTranslator->trPublicSlots()); }) } }, { "group/memberdecl/protectedslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecProSlotMembers(), []() { return compileOptions(theTranslator->trProtectedSlots()); }) } }, { "group/memberdecl/privateslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPriSlotMembers(), []() { return compileOptions(theTranslator->trPrivateSlots()); }) } }, { "group/memberdecl/events", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEventMembers(), []() { return compileOptions(theTranslator->trEvents()); }) } }, { "group/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPropMembers(), []() { return compileOptions(theTranslator->trProperties()); }) } }, { "group/memberdecl/friends", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFriendMembers(), []() { return compileOptions(theTranslator->trFriends()); }) } }, { "group/memberdef", { startCb(&LayoutParser::startMemberDef), endCb(&LayoutParser::endMemberDef) } }, { "group/memberdef/pagedocs", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::GroupPageDocs) } }, { "group/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupInlineClasses, []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(), SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); }) } }, { "group/memberdef/defines", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDefineMembers(), []() { return compileOptions(theTranslator->trDefineDocumentation()); }) } }, { "group/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(), []() { return compileOptions(theTranslator->trTypedefDocumentation()); }) } }, { "group/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(), []() { return compileOptions(theTranslator->trSequenceDocumentation()); }) } }, { "group/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(), []() { return compileOptions(theTranslator->trDictionaryDocumentation()); }) } }, { "group/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(), []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); }) } }, { "group/memberdef/enumvalues", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumValMembers(), []() { return compileOptions(theTranslator->trEnumerationValueDocumentation()); }) } }, { "group/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(), []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(), SrcLangExt::Fortran,theTranslator->trSubprogramDocumentation()); }) } }, { "group/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(), []() { return compileOptions(theTranslator->trVariableDocumentation()); }) } }, { "group/memberdef/signals", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSignalMembers(), []() { return compileOptions(theTranslator->trSignals()); }) } }, { "group/memberdef/publicslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPubSlotMembers(), []() { return compileOptions(theTranslator->trPublicSlots()); }) } }, { "group/memberdef/protectedslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocProSlotMembers(), []() { return compileOptions(theTranslator->trProtectedSlots()); }) } }, { "group/memberdef/privateslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPriSlotMembers(), []() { return compileOptions(theTranslator->trPrivateSlots()); }) } }, { "group/memberdef/events", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEventMembers(), []() { return compileOptions(theTranslator->trEvents()); }) } }, { "group/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPropMembers(), []() { return compileOptions(theTranslator->trProperties()); }) } }, { "group/memberdef/friends", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFriendMembers(), []() { return compileOptions(theTranslator->trFriends()); }) } }, // module layout handlers { "module", { startCb(&LayoutParser::startTop,LayoutDocManager::Module,"module/",LayoutNavEntry::Modules), endCb(&LayoutParser::endTop) } }, { "module/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } }, { "module/exportedmodules", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleExports, []() { return compileOptions(theTranslator->trExportedModules()); }) } }, { "module/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc, []() { return compileOptions(theTranslator->trDetailedDescription()); }) } }, { "module/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } }, { "module/memberdecl", { startCb(&LayoutParser::startMemberDecl), endCb(&LayoutParser::endMemberDecl) } }, { "module/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleConcepts, []() { return compileOptions(theTranslator->trConcept(true,false)); }) } }, { "module/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleClasses, []() { return compileOptions(theTranslator->trCompounds()); }) } }, { "module/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(), []() { return compileOptions(theTranslator->trEnumerations()); }) } }, { "module/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(), []() { return compileOptions(theTranslator->trTypedefs()); }) } }, { "module/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(), []() { return compileOptions(theTranslator->trFunctions()); }) } }, { "module/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(), []() { return compileOptions(theTranslator->trVariables()); }) } }, { "module/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } }, { "module/memberdecl/files", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleUsedFiles, []() { return compileOptions(theTranslator->trFile(TRUE,FALSE)); }) } }, // directory layout handlers { "directory", { startCb(&LayoutParser::startTop,LayoutDocManager::Directory,"directory/",LayoutNavEntry::None), endCb(&LayoutParser::endTop) } }, { "directory/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } }, { "directory/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc, []() { return compileOptions(theTranslator->trDetailedDescription()); }) } }, { "directory/directorygraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirGraph) } }, { "directory/memberdecl", { startCb(&LayoutParser::startMemberDecl), endCb(&LayoutParser::endMemberDecl) } }, { "directory/memberdecl/dirs", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirSubDirs) } }, { "directory/memberdecl/files", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirFiles) } }, }; } // namespace void LayoutParser::startElement( const std::string &name, const XMLHandlers::Attributes& attrib ) { //printf("startElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name)); auto it = g_elementHandlers.find(m_scope.str()+name); if (it!=g_elementHandlers.end()) { it->second.startCb(*this,attrib); } else { std::string fileName = m_locator->fileName(); warn(fileName.c_str(),m_locator->lineNr(),"Unexpected start tag '%s' found in scope='%s'!", qPrint(name),qPrint(m_scope)); } } void LayoutParser::endElement( const std::string &name ) { //printf("endElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name)); auto it=g_elementHandlers.end(); if (!m_scope.isEmpty() && m_scope.right(name.length()+1)==name+"/") { // element ends current scope it = g_elementHandlers.find(m_scope.left(m_scope.length()-1).str()); } else // continue with current scope { it = g_elementHandlers.find(m_scope.str()+name); } if (it!=g_elementHandlers.end()) { it->second.endCb(*this); } } //--------------------------------------------------------------------------------- int LayoutParser::m_userGroupCount=0; //--------------------------------------------------------------------------------- class LayoutDocManager::Private { public: std::array<LayoutDocEntryList,LayoutDocManager::NrParts> docEntries; LayoutNavEntry rootNav; }; LayoutDocManager::LayoutDocManager() : d(std::make_unique<Private>()) { } LayoutDocManager::~LayoutDocManager() { } void LayoutDocManager::init() { LayoutParser &layoutParser = LayoutParser::instance(); XMLHandlers handlers; handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); }; handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); }; handlers.error = [&layoutParser](const std::string &fileName,int lineNr,const std::string &msg) { layoutParser.error(fileName,lineNr,msg); }; XMLParser parser(handlers); layoutParser.setDocumentLocator(&parser); constexpr auto layoutFile = "layout_default.xml"; QCString layout_default = ResourceMgr::instance().getAsString(layoutFile); parser.parse(layoutFile,layout_default.data(),Debug::isFlagSet(Debug::Lex_xml), [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",layoutFile); }, [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",layoutFile); } ); } LayoutDocManager & LayoutDocManager::instance() { static LayoutDocManager theInstance; return theInstance; } const LayoutDocEntryList &LayoutDocManager::docEntries(LayoutDocManager::LayoutPart part) const { return d->docEntries[static_cast<int>(part)]; } LayoutNavEntry* LayoutDocManager::rootNavEntry() const { return &d->rootNav; } LayoutNavEntry *LayoutDocManager::createChildNavEntry(LayoutNavEntry *parent,LayoutNavEntry::Kind k,bool vs,const QCString &bf, const QCString &tl,const QCString &intro) { if (parent==nullptr) parent = &d->rootNav; auto ptr = std::make_unique<LayoutNavEntry>(parent,k,vs,bf,tl,intro); auto child = ptr.get(); parent->addChild(std::move(ptr)); return child; } void LayoutDocManager::addEntry(LayoutDocManager::LayoutPart p,LayoutDocEntryPtr &&e) { d->docEntries[static_cast<int>(p)].push_back(std::move(e)); } void LayoutDocManager::clear(LayoutDocManager::LayoutPart p) { d->docEntries[static_cast<int>(p)].clear(); } void LayoutDocManager::parse(const QCString &fileName, const char *data) { LayoutParser &layoutParser = LayoutParser::instance(); XMLHandlers handlers; handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); }; handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); }; handlers.error = [&layoutParser](const std::string &fn,int lineNr,const std::string &msg) { layoutParser.error(fn,lineNr,msg); }; XMLParser parser(handlers); layoutParser.setDocumentLocator(&parser); parser.parse(fileName.data(), data ? data : fileToString(fileName).data(), Debug::isFlagSet(Debug::Lex_xml), [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",qPrint(fileName)); }, [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",qPrint(fileName)); }, transcodeCharacterStringToUTF8 ); } //--------------------------------------------------------------------------------- void writeDefaultLayoutFile(const QCString &fileName) { std::ofstream f; if (openOutputFile(fileName,f)) { TextStream t(&f); QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml"); t << substitute(layout_default,"$doxygenversion",getDoxygenVersion()); } else { err("Failed to open file %s for writing!\n",qPrint(fileName)); return; } f.close(); } //---------------------------------------------------------------------------------- // Convert input to a title. // The format of input can be a simple title "A title" or in case there are different // titles for some programming languages they can take the following form: // "A title|16=Another title|8=Yet Another title" // where the number is a value of SrcLangExt in decimal notation (i.e. 16=Java, 8=IDL). QCString extractLanguageSpecificTitle(const QCString &input,SrcLangExt lang) { int s=0,e=input.find('|'); if (e==-1) return input; // simple title case int e1=e; while (e!=-1) // look for 'number=title' pattern separated by '|' { s=e+1; e=input.find('|',s); int i=input.find('=',s); assert(i>s); SrcLangExt key= static_cast<SrcLangExt>(input.mid(s,i-s).toUInt()); if (key==lang) // found matching key { if (e==-1) e=static_cast<int>(input.length()); return input.mid(i+1,e-i-1); } } return input.left(e1); // fallback, no explicit language key found } //---------------------------------------------------------------------------------- QCString LayoutDocEntrySection::title(SrcLangExt lang) const { return extractLanguageSpecificTitle(m_title,lang); } //---------------------------------------------------------------------------------- QCString LayoutDocEntryMemberDecl::title(SrcLangExt lang) const { return extractLanguageSpecificTitle(m_title,lang); } QCString LayoutDocEntryMemberDecl::subtitle(SrcLangExt lang) const { return extractLanguageSpecificTitle(m_subscript,lang); } //---------------------------------------------------------------------------------- QCString LayoutDocEntryMemberDef::title(SrcLangExt lang) const { return extractLanguageSpecificTitle(m_title,lang); }
95,145
C++
.cpp
1,464
45.589481
215
0.513735
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,476
htags.cpp
doxygen_doxygen/src/htags.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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 <unordered_map> #include <string> #include "htags.h" #include "util.h" #include "message.h" #include "config.h" #include "portable.h" #include "fileinfo.h" #include "dir.h" bool Htags::useHtags = FALSE; static Dir g_inputDir; static std::unordered_map<std::string,std::string> g_symbolMap; /*! constructs command line of htags(1) and executes it. * \retval TRUE success * \retval FALSE an error has occurred. */ bool Htags::execute(const QCString &htmldir) { const StringVector &inputSource = Config_getList(INPUT); bool quiet = Config_getBool(QUIET); bool warnings = Config_getBool(WARNINGS); QCString htagsOptions = ""; //Config_getString(HTAGS_OPTIONS); QCString projectName = Config_getString(PROJECT_NAME); QCString projectNumber = Config_getString(PROJECT_NUMBER); if (inputSource.empty()) { g_inputDir.setPath(Dir::currentDirPath()); } else if (inputSource.size()==1) { g_inputDir.setPath(inputSource.back()); if (!g_inputDir.exists()) err("Cannot find directory %s. " "Check the value of the INPUT tag in the configuration file.\n", inputSource.back().c_str() ); } else { err("If you use USE_HTAGS then INPUT should specify a single directory.\n"); return FALSE; } /* * Construct command line for htags(1). */ QCString commandLine = " -g -s -a -n "; if (!quiet) commandLine += "-v "; if (warnings) commandLine += "-w "; if (!htagsOptions.isEmpty()) { commandLine += ' '; commandLine += htagsOptions; } if (!projectName.isEmpty()) { commandLine += "-t \""; commandLine += projectName; if (!projectNumber.isEmpty()) { commandLine += '-'; commandLine += projectNumber; } commandLine += "\" "; } commandLine += " \"" + htmldir + "\""; std::string oldDir = Dir::currentDirPath(); Dir::setCurrent(g_inputDir.absPath()); //printf("CommandLine=[%s]\n",qPrint(commandLine)); bool result=Portable::system("htags",commandLine,FALSE)==0; if (!result) { err("Problems running %s. Check your installation\n", "htags"); } Dir::setCurrent(oldDir); return result; } /*! load filemap and make index. * \param htmlDir of HTML directory generated by htags(1). * \retval TRUE success * \retval FALSE error */ bool Htags::loadFilemap(const QCString &htmlDir) { QCString fileMapName = htmlDir+"/HTML/FILEMAP"; FileInfo fi(fileMapName.str()); /* * Construct FILEMAP dictionary. * * In FILEMAP, URL includes 'html' suffix but we cut it off according * to the method of FileDef class. * * FILEMAP format: * <NAME>\t<HREF>.html\n * QDICT: * dict[<NAME>] = <HREF> */ if (fi.exists() && fi.isReadable()) { std::ifstream f = Portable::openInputStream(fileMapName); if (f.is_open()) { std::string lineStr; while (getline(f,lineStr)) { QCString line(lineStr); //printf("Read line: %s",qPrint(line)); int sep = line.find('\t'); if (sep!=-1) { QCString key = line.left(sep).stripWhiteSpace(); QCString value = line.mid(sep+1).stripWhiteSpace(); int ext=value.findRev('.'); if (ext!=-1) value=value.left(ext); // strip extension g_symbolMap.emplace(key.str(),value.str()); //printf("Key/Value=(%s,%s)\n",qPrint(key),qPrint(value)); } } return true; } else { err("file %s cannot be opened\n",qPrint(fileMapName)); } } return false; } /*! convert path name into the url in the hypertext generated by htags. * \param path path name * \returns URL nullptr: not found. */ QCString Htags::path2URL(const QCString &path) { QCString url,symName=path; QCString dir = g_inputDir.absPath(); size_t dl=dir.length(); if (symName.length()>dl+1) { symName = symName.mid(dl+1); } if (!symName.isEmpty()) { auto it = g_symbolMap.find(symName.str()); //printf("path2URL=%s symName=%s result=%p\n",qPrint(path),qPrint(symName),result); if (it!=g_symbolMap.end()) { url = QCString("HTML/"+it->second); } } return url; }
4,835
C++
.cpp
165
25.393939
87
0.648776
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,477
qcstring.cpp
doxygen_doxygen/src/qcstring.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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 "qcstring.h" #include <limits.h> #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <ctype.h> inline char toLowerChar(char c) { return c>='A' && c<='Z' ? c|0x20 : c; } QCString &QCString::sprintf( const char *format, ... ) { va_list ap; va_start( ap, format ); const size_t minlen=256; size_t l = length(); if (l<minlen) { resize(minlen+1); l=minlen; } int n=vsnprintf( rawData(), l+1, format, ap); if (n<0) n=static_cast<int>(l); resize(n); va_end( ap ); return *this; } int QCString::find( char c, int index, bool cs ) const { if (index<0 || index>=static_cast<int>(length())) return -1; // index outside string const char *pos = nullptr; if (cs) { pos = strchr(data()+index,c); } else { pos = data()+index; c = toLowerChar(c); while (*pos && toLowerChar(*pos)!=c) pos++; if (!*pos && c) pos=nullptr; // not found } return pos ? static_cast<int>(pos - data()) : -1; } int QCString::find( const char *str, int index, bool cs ) const { int l = static_cast<int>(length()); if (index<0 || index>=l) return -1; // index outside string if (!str) return -1; // no string to search for if (!*str) return index; // empty string matching at index const char *pos = nullptr; if (cs) // case sensitive { pos = strstr(data()+index,str); } else // case insensitive { pos = data(); int len = qstrlen(str); while (*pos) { if (qstrnicmp(pos,str,len)==0) break; pos++; } if (!*pos) pos = nullptr; // not found } return pos ? static_cast<int>(pos - data()) : -1; } int QCString::find( const QCString &str, int index, bool cs ) const { return find(str.data(),index,cs); } int QCString::findRev( char c, int index, bool cs) const { const char *b = data(); const char *pos = nullptr; int len = static_cast<int>(length()); if (len==0) return -1; // empty string if (index<0) // start from end { if (cs) { pos = strrchr(b,c); return pos ? static_cast<int>(pos - b) : -1; } index=len; } else if (index>len) // bad index { return -1; } pos = b+index; if (cs) { while ( pos>=b && *pos!=c) pos--; } else { c = toLowerChar(c); while ( pos>=b && toLowerChar(*pos)!=c) pos--; } return pos>=b ? static_cast<int>(pos - b) : -1; } int QCString::findRev( const char *str, int index, bool cs) const { int slen = static_cast<int>(qstrlen(str)); int len = static_cast<int>(length()); if (index<0) index = len-slen; // start from end else if (index>len) return -1; // bad index else if (index+slen>len) index=len-slen; // str would be too long if (index<0) return -1; // no match possible const char *pos = data()+index; if (cs) // case sensitive { for (int i=index; i>=0; i--) if (qstrncmp(pos--,str,slen)==0) return i; } else // case insensitive { for (int i=index; i>=0; i--) if (qstrnicmp(pos,str,slen)==0) return i; } return -1; } int QCString::contains( char c, bool cs ) const { if (length()==0) return 0; int count=0; const char *pos = data(); if (cs) { while (*pos) if (*pos++ == c) count++; } else { c = toLowerChar(c); while (*pos) { if (toLowerChar(*pos)==c) count++; pos++; } } return count; } int QCString::contains( const char *str, bool cs ) const { if (str==nullptr || length()==0) return 0; int count=0; const char *pos = data(); int len = qstrlen(str); while (*pos) { if (cs) { if (qstrncmp(pos,str,len)==0) count++; } else { if (qstrnicmp(pos,str,len)==0) count++; } pos++; } return count; } QCString QCString::simplifyWhiteSpace() const { if ( isEmpty() ) // nothing to do return *this; QCString result( length(), ExplicitSize ); const char *from = data(); char *to = result.rawData(); char *first = to; while ( TRUE ) { while ( *from && qisspace(*from) ) from++; while ( *from && !qisspace(*from) ) *to++ = *from++; if ( *from ) *to++ = 0x20; // ' ' else break; } if ( to > first && *(to-1) == 0x20 ) to--; *to = '\0'; result.resize( static_cast<int>(to - result.data()) ); return result; } QCString &QCString::replace( size_t index, size_t len, const char *s) { remove( index, len ); insert( index, s ); return *this; } static bool ok_in_base( char c, int base ) { if ( base <= 10 ) return c>='0' && c<='9' && (c-'0') < base; else return (c>='0' && c<='9') || (c >= 'a' && c < char('a'+base-10)) || (c >= 'A' && c < char('A'+base-10)); } short QCString::toShort(bool *ok, int base) const { long v = toLong( ok, base ); if ( ok && *ok && (v < -32768 || v > 32767) ) { *ok = FALSE; v = 0; } return static_cast<short>(v); } uint16_t QCString::toUShort(bool *ok,int base) const { unsigned long v = toULong( ok, base ); if ( ok && *ok && (v > 65535) ) { *ok = FALSE; v = 0; } return static_cast<uint16_t>(v); } int QCString::toInt(bool *ok, int base) const { return static_cast<int>(toLong( ok, base )); } uint32_t QCString::toUInt(bool *ok,int base) const { return static_cast<uint32_t>(toULong( ok, base )); } long QCString::toLong(bool *ok,int base) const { const char *p = data(); long val=0; int l = static_cast<int>(length()); const long max_mult = INT_MAX / base; bool is_ok = FALSE; int neg = 0; if ( !p ) goto bye; while ( l && qisspace(*p) ) // skip leading space l--,p++; if ( l && *p == '-' ) { l--; p++; neg = 1; } else if ( *p == '+' ) { l--; p++; } // NOTE: toULong() code is similar if ( !l || !ok_in_base(*p,base) ) goto bye; while ( l && ok_in_base(*p,base) ) { l--; int dv = 0; if ( *p>='0' && *p<='9' ) { dv = *p-'0'; } else { if ( *p >= 'a' && *p <= 'z' ) dv = *p - 'a' + 10; else dv = *p - 'A' + 10; } if ( val > max_mult || (val == max_mult && dv > (INT_MAX%base)+neg) ) goto bye; val = base*val + dv; p++; } if ( neg ) val = -val; while ( l && qisspace(*p) ) // skip trailing space l--,p++; if ( !l ) is_ok = TRUE; bye: if ( ok ) *ok = is_ok; return is_ok ? val : 0; } unsigned long QCString::toULong(bool *ok,int base) const { const char *p = data(); unsigned long val=0; int l = static_cast<int>(length()); const unsigned long max_mult = 429496729; // UINT_MAX/10, rounded down bool is_ok = FALSE; if ( !p ) goto bye; while ( l && qisspace(*p) ) // skip leading space l--,p++; if ( *p == '+' ) l--,p++; // NOTE: toLong() code is similar if ( !l || !ok_in_base(*p,base) ) goto bye; while ( l && ok_in_base(*p,base) ) { l--; uint32_t dv = 0; if ( *p>='0' && *p<='9' ) { dv = *p-'0'; } else { if ( *p >= 'a' && *p <= 'z' ) dv = *p - 'a' + 10; else dv = *p - 'A' + 10; } if ( val > max_mult || (val == max_mult && dv > (UINT_MAX%base)) ) goto bye; val = base*val + dv; p++; } while ( l && qisspace(*p) ) // skip trailing space l--,p++; if ( !l ) is_ok = TRUE; bye: if ( ok ) *ok = is_ok; return is_ok ? val : 0; } uint64_t QCString::toUInt64(bool *ok,int base) const { const char *p = data(); uint64_t val=0; int l = static_cast<int>(length()); const uint64_t max_mult = 1844674407370955161ULL; // ULLONG_MAX/10, rounded down bool is_ok = FALSE; if ( !p ) goto bye; while ( l && qisspace(*p) ) // skip leading space l--,p++; if ( *p == '+' ) l--,p++; // NOTE: toULong() code is similar if ( !l || !ok_in_base(*p,base) ) goto bye; while ( l && ok_in_base(*p,base) ) { l--; uint32_t dv = 0; if ( *p>='0' && *p<='9' ) { dv = *p-'0'; } else { if ( *p >= 'a' && *p <= 'z' ) dv = *p - 'a' + 10; else dv = *p - 'A' + 10; } if ( val > max_mult || (val == max_mult && dv > (ULLONG_MAX%base)) ) goto bye; val = base*val + dv; p++; } while ( l && qisspace(*p) ) // skip trailing space l--,p++; if ( !l ) is_ok = TRUE; bye: if ( ok ) *ok = is_ok; return is_ok ? val : 0; } //------------------------------------------------- void *qmemmove( void *dst, const void *src, size_t len ) { if ( dst > src ) { char *d = static_cast<char *>(dst) + len - 1; const char *s = static_cast<const char *>(src) + len - 1; while ( len-- ) *d-- = *s--; } else if ( dst < src ) { char *d = static_cast<char *>(dst); const char *s = static_cast<const char *>(src); while ( len-- ) *d++ = *s++; } return dst; } char *qstrdup( const char *str ) { if ( !str ) return nullptr; char *dst = new char[qstrlen(str)+1]; return strcpy( dst, str ); } void qstrfree( const char *str ) { delete[](str); } char *qstrncpy( char *dst, const char *src, size_t len ) { if ( !src ) return nullptr; strncpy( dst, src, len ); if ( len > 0 ) dst[len-1] = '\0'; return dst; } int qstricmp( const char *s1, const char *s2 ) { if ( !s1 || !s2 ) { return s1 == s2 ? 0 : static_cast<int>(s2 - s1); } int res = 0; char c = 0; for ( ; !(res = ((c=toLowerChar(*s1)) - toLowerChar(*s2))); s1++, s2++ ) { if ( !c ) // strings are equal break; } return res; } int qstrnicmp( const char *s1, const char *s2, size_t len ) { if ( !s1 || !s2 ) { return static_cast<int>(s2 - s1); } for ( ; len--; s1++, s2++ ) { char c = toLowerChar(*s1); int res = c-toLowerChar(*s2); if ( res!=0 ) // strings are not equal return res; if ( c==0 ) // strings are equal break; } return 0; } /// substitute all occurrences of \a src in \a s by \a dst QCString substitute(const QCString &s,const QCString &src,const QCString &dst) { if (s.isEmpty() || src.isEmpty()) return s; const char *q = nullptr, *p = nullptr; size_t srcLen = src.length(); size_t dstLen = dst.length(); size_t resLen = 0; if (srcLen!=dstLen) { int count = 0; for (p = s.data(); (q=strstr(p,src.data()))!=nullptr; p=q+srcLen) count++; resLen = s.length()+count*(dstLen-srcLen); } else // result has same size as s { resLen = s.length(); } QCString result(resLen, QCString::ExplicitSize); char *r = result.rawData(); for (p = s.data(); (q=strstr(p,src.data()))!=nullptr; p=q+srcLen) { int l = static_cast<int>(q-p); memcpy(r,p,l); r+=l; if (dstLen>0) memcpy(r,dst.data(),dstLen); r+=dstLen; } if (r) { qstrcpy(r,p); } //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data()); return result; } /// substitute all occurrences of \a src in \a s by \a dst, but skip /// each consecutive sequence of \a src where the number consecutive /// \a src matches \a skip_seq; if \a skip_seq is negative, skip any /// number of consecutive \a src QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq) { if (s.isEmpty() || src.isEmpty()) return s; const char *p = nullptr, *q = nullptr; size_t srcLen = src.length(); size_t dstLen = dst.length(); size_t resLen = 0; if (srcLen!=dstLen) { int count = 0; for (p=s.data(); (q=strstr(p,src.data()))!=nullptr; p=q+srcLen) count++; resLen = s.length()+count*(dstLen-srcLen); } else // result has same size as s { resLen = s.length(); } QCString result(resLen, QCString::ExplicitSize); char *r = result.rawData(); for (p = s.data(); (q=strstr(p,src.data()))!=nullptr; p=q+srcLen) { // search a consecutive sequence of src int seq = 0, skip = 0; if (skip_seq) { for (const char *n=q+srcLen; qstrncmp(n,src.data(),srcLen)==0; seq=1+skip, n+=srcLen) ++skip; // number of consecutive src after the current one // verify the allowed number of consecutive src to skip if (skip_seq > 0 && skip_seq != seq) seq = skip = 0; } // skip a consecutive sequence of src when necessary int l = static_cast<int>((q + seq * srcLen)-p); memcpy(r,p,l); r+=l; if (skip) { // skip only the consecutive src found after the current one q += skip * srcLen; // the next loop will skip the current src, aka (p=q+srcLen) continue; } if (dstLen>0) memcpy(r,dst.data(),dstLen); r+=dstLen; } qstrcpy(r,p); result.resize(strlen(result.data())); //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data()); return result; } QCString QCString::stripLeadingAndTrailingEmptyLines() const { if (isEmpty()) return QCString(); const std::string &s = m_rep; int end=static_cast<int>(s.length()); int start=0,p=0; // skip leading empty lines for (;;) { int c; while ((c=s[p]) && (c==' ' || c=='\t')) p++; if (s[p]=='\n') { start=++p; } else { break; } } // skip trailing empty lines p=end-1; if (p>=start && s.at(p)=='\n') p--; while (p>=start) { int c; while ((c=s[p]) && (c==' ' || c=='\t')) p--; if (s[p]=='\n') { end=p+1; } else { break; } p--; } //printf("stripLeadingAndTrailingEmptyLines(%d-%d)\n",start,end); return s.substr(start,end-start); }
14,053
C++
.cpp
568
21.075704
91
0.557738
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,479
xmlgen.cpp
doxygen_doxygen/src/xmlgen.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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 <stdlib.h> #include "textstream.h" #include "xmlgen.h" #include "doxygen.h" #include "message.h" #include "config.h" #include "classlist.h" #include "util.h" #include "defargs.h" #include "outputgen.h" #include "outputlist.h" #include "dot.h" #include "dotclassgraph.h" #include "dotincldepgraph.h" #include "pagedef.h" #include "filename.h" #include "version.h" #include "xmldocvisitor.h" #include "docparser.h" #include "language.h" #include "parserintf.h" #include "arguments.h" #include "memberlist.h" #include "groupdef.h" #include "memberdef.h" #include "namespacedef.h" #include "membername.h" #include "membergroup.h" #include "dirdef.h" #include "section.h" #include "htmlentity.h" #include "resourcemgr.h" #include "dir.h" #include "utf8.h" #include "portable.h" #include "outputlist.h" #include "moduledef.h" // no debug info #define XML_DB(x) do {} while(0) // debug to stdout //#define XML_DB(x) printf x // debug inside output //#define XML_DB(x) QCString __t;__t.sprintf x;m_t << __t //------------------ inline void writeXMLString(TextStream &t,const QCString &s) { t << convertToXML(s); } inline void writeXMLCodeString(bool hide,TextStream &t,const QCString &str, size_t &col, size_t stripIndentAmount) { if (str.isEmpty()) return; const int tabSize = Config_getInt(TAB_SIZE); const char *s = str.data(); char c=0; if (hide) // only update column count { col=updateColumnCount(s,col); } else // actually output content and keep track of m_col { while ((c=*s++)) { switch(c) { case '\t': { int spacesToNextTabStop = tabSize - (col%tabSize); while (spacesToNextTabStop--) { if (col>=stripIndentAmount) t << "<sp/>"; col++; } break; } case ' ': if (col>=stripIndentAmount) t << "<sp/>"; col++; break; case '<': t << "&lt;"; col++; break; case '>': t << "&gt;"; col++; break; case '&': t << "&amp;"; col++; break; case '\'': t << "&apos;"; col++; break; case '"': t << "&quot;"; col++; break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: // encode invalid XML characters (see http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char) t << "<sp value=\"" << int(c) << "\"/>"; break; default: s=writeUTF8Char(t,s-1); col++; break; } } } } static void writeXMLHeader(TextStream &t) { t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"; t << "<doxygen xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; t << "xsi:noNamespaceSchemaLocation=\"compound.xsd\" "; t << "version=\"" << getDoxygenVersion() << "\" "; t << "xml:lang=\"" << theTranslator->trISOLang() << "\""; t << ">\n"; } static void writeCombineScript() { QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/combine.xslt"; std::ofstream t = Portable::openOutputStream(fileName); if (!t.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } t << "<!-- XSLT script to combine the generated output into a single file. \n" " If you have xsltproc you could use:\n" " xsltproc combine.xslt index.xml >all.xml\n" "-->\n" "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n" " <xsl:output method=\"xml\" version=\"1.0\" indent=\"no\" standalone=\"yes\" />\n" " <xsl:template match=\"/\">\n" " <doxygen version=\"{doxygenindex/@version}\" xml:lang=\"{doxygenindex/@xml:lang}\">\n" " <!-- Load all doxygen generated xml files -->\n" " <xsl:for-each select=\"doxygenindex/compound\">\n" " <xsl:copy-of select=\"document( concat( @refid, '.xml' ) )/doxygen/*\" />\n" " </xsl:for-each>\n" " </doxygen>\n" " </xsl:template>\n" "</xsl:stylesheet>\n"; } void writeXMLLink(TextStream &t,const QCString &extRef,const QCString &compoundId, const QCString &anchorId,const QCString &text,const QCString &tooltip) { t << "<ref refid=\"" << compoundId; if (!anchorId.isEmpty()) t << "_1" << anchorId; t << "\" kindref=\""; if (!anchorId.isEmpty()) t << "member"; else t << "compound"; t << "\""; if (!extRef.isEmpty()) t << " external=\"" << extRef << "\""; if (!tooltip.isEmpty()) t << " tooltip=\"" << convertToXML(tooltip) << "\""; t << ">"; writeXMLString(t,text); t << "</ref>"; } /** Implements TextGeneratorIntf for an XML stream. */ class TextGeneratorXMLImpl : public TextGeneratorIntf { public: TextGeneratorXMLImpl(TextStream &t): m_t(t) {} void writeString(std::string_view s,bool /*keepSpaces*/) const override { writeXMLString(m_t,QCString(s)); } void writeBreak(int) const override {} void writeLink(const QCString &extRef,const QCString &file, const QCString &anchor,std::string_view text ) const override { writeXMLLink(m_t,extRef,file,anchor,QCString(text),QCString()); } private: TextStream &m_t; }; //------------------------------------------------------------------------------------------- XMLCodeGenerator::XMLCodeGenerator(TextStream *t) : m_t(t) { } /** Generator for producing XML formatted source code. */ void XMLCodeGenerator::codify(const QCString &text) { XML_DB(("(codify \"%s\")\n",qPrint(text))); if (!m_hide && m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag) { *m_t << "<highlight class=\"normal\">"; m_normalHLNeedStartTag=FALSE; } writeXMLCodeString(m_hide,*m_t,text,m_col,m_stripIndentAmount); } void XMLCodeGenerator::stripCodeComments(bool b) { m_stripCodeComments = b; } void XMLCodeGenerator::endSpecialComment() { m_hide = false; } void XMLCodeGenerator::startSpecialComment() { m_hide = m_stripCodeComments; } void XMLCodeGenerator::setStripIndentAmount(size_t amount) { m_stripIndentAmount = amount; } void XMLCodeGenerator::writeCodeLink(CodeSymbolType, const QCString &ref,const QCString &file, const QCString &anchor,const QCString &name, const QCString &tooltip) { if (m_hide) return; XML_DB(("(writeCodeLink)\n")); if (m_insideCodeLine && !m_insideSpecialHL && m_normalHLNeedStartTag) { *m_t << "<highlight class=\"normal\">"; m_normalHLNeedStartTag=FALSE; } writeXMLLink(*m_t,ref,file,anchor,name,tooltip); m_col+=name.length(); } void XMLCodeGenerator::writeTooltip(const QCString &, const DocLinkInfo &, const QCString &, const QCString &, const SourceLinkInfo &, const SourceLinkInfo & ) { if (m_hide) return; XML_DB(("(writeToolTip)\n")); } void XMLCodeGenerator::startCodeLine(int) { m_col=0; if (m_hide) return; XML_DB(("(startCodeLine)\n")); *m_t << "<codeline"; if (m_lineNumber!=-1) { *m_t << " lineno=\"" << m_lineNumber << "\""; if (!m_refId.isEmpty()) { *m_t << " refid=\"" << m_refId << "\""; if (m_isMemberRef) { *m_t << " refkind=\"member\""; } else { *m_t << " refkind=\"compound\""; } } if (!m_external.isEmpty()) { *m_t << " external=\"" << m_external << "\""; } } *m_t << ">"; m_insideCodeLine=TRUE; m_col=0; } void XMLCodeGenerator::endCodeLine() { if (m_hide) return; XML_DB(("(endCodeLine)\n")); if (!m_insideSpecialHL && !m_normalHLNeedStartTag) { *m_t << "</highlight>"; m_normalHLNeedStartTag=TRUE; } if (m_insideCodeLine) { *m_t << "</codeline>\n"; } m_lineNumber = -1; m_refId.clear(); m_external.clear(); m_insideCodeLine=FALSE; } void XMLCodeGenerator::startFontClass(const QCString &colorClass) { if (m_hide) return; XML_DB(("(startFontClass)\n")); if (m_insideCodeLine && !m_insideSpecialHL && !m_normalHLNeedStartTag) { *m_t << "</highlight>"; m_normalHLNeedStartTag=TRUE; } *m_t << "<highlight class=\"" << colorClass << "\">"; // non DocBook m_insideSpecialHL=TRUE; } void XMLCodeGenerator::endFontClass() { if (m_hide) return; XML_DB(("(endFontClass)\n")); *m_t << "</highlight>"; // non DocBook m_insideSpecialHL=FALSE; } void XMLCodeGenerator::writeCodeAnchor(const QCString &) { if (m_hide) return; XML_DB(("(writeCodeAnchor)\n")); } void XMLCodeGenerator::writeLineNumber(const QCString &extRef,const QCString &compId, const QCString &anchorId,int l,bool) { if (m_hide) return; XML_DB(("(writeLineNumber)\n")); // we remember the information provided here to use it // at the <codeline> start tag. m_lineNumber = l; if (!compId.isEmpty()) { m_refId=compId; if (!anchorId.isEmpty()) m_refId+=QCString("_1")+anchorId; m_isMemberRef = anchorId!=nullptr; if (!extRef.isEmpty()) m_external=extRef; } } void XMLCodeGenerator::finish() { XML_DB(("(finish insideCodeLine=%d)\n",m_insideCodeLine)); if (m_insideCodeLine) endCodeLine(); } void XMLCodeGenerator::startCodeFragment(const QCString &) { XML_DB(("(startCodeFragment)\n")); *m_t << " <programlisting>\n"; } void XMLCodeGenerator::endCodeFragment(const QCString &) { XML_DB(("(endCodeFragment)\n")); *m_t << " </programlisting>\n"; } //------------------------------------------------------------------------------------------- static void writeTemplateArgumentList(TextStream &t, const ArgumentList &al, const Definition *scope, const FileDef *fileScope, int indent) { QCString indentStr; indentStr.fill(' ',indent); if (al.hasParameters()) { t << indentStr << "<templateparamlist>\n"; for (const Argument &a : al) { t << indentStr << " <param>\n"; if (!a.type.isEmpty()) { t << indentStr << " <type>"; linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,nullptr,a.type); t << "</type>\n"; } if (!a.name.isEmpty()) { t << indentStr << " <declname>" << convertToXML(a.name) << "</declname>\n"; t << indentStr << " <defname>" << convertToXML(a.name) << "</defname>\n"; } if (!a.defval.isEmpty()) { t << indentStr << " <defval>"; linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,nullptr,a.defval); t << "</defval>\n"; } if (!a.typeConstraint.isEmpty()) { t << indentStr << " <typeconstraint>"; linkifyText(TextGeneratorXMLImpl(t),scope,fileScope,nullptr,a.typeConstraint); t << "</typeconstraint>\n"; } t << indentStr << " </param>\n"; } t << indentStr << "</templateparamlist>\n"; } } static void writeMemberTemplateLists(const MemberDef *md,TextStream &t) { writeTemplateArgumentList(t,md->templateArguments(),md->getClassDef(),md->getFileDef(),8); } static void writeTemplateList(const ClassDef *cd,TextStream &t) { writeTemplateArgumentList(t,cd->templateArguments(),cd,cd->getFileDef(),4); } static void writeTemplateList(const ConceptDef *cd,TextStream &t) { writeTemplateArgumentList(t,cd->getTemplateParameterList(),cd,cd->getFileDef(),4); } static void writeXMLDocBlock(TextStream &t, const QCString &fileName, int lineNr, const Definition *scope, const MemberDef * md, const QCString &text) { QCString stext = text.stripWhiteSpace(); if (stext.isEmpty()) return; // convert the documentation string into an abstract syntax tree auto parser { createDocParser() }; auto ast { validatingParseDoc(*parser.get(), fileName,lineNr,scope,md,text,FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) }; auto astImpl = dynamic_cast<const DocNodeAST*>(ast.get()); if (astImpl) { // create a code generator OutputCodeList xmlCodeList; xmlCodeList.add<XMLCodeGenerator>(&t); // create a parse tree visitor for XML XmlDocVisitor visitor(t,xmlCodeList,scope?scope->getDefFileExtension():QCString("")); // visit all nodes std::visit(visitor,astImpl->root); // clean up } } void writeXMLCodeBlock(TextStream &t,FileDef *fd) { auto intf=Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); SrcLangExt langExt = getLanguageFromFileName(fd->getDefFileExtension()); intf->resetCodeParserState(); OutputCodeList xmlList; xmlList.add<XMLCodeGenerator>(&t); xmlList.startCodeFragment("DoxyCode"); intf->parseCode(xmlList, // codeOutList QCString(), // scopeName fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES)), langExt, // lang Config_getBool(STRIP_CODE_COMMENTS), FALSE, // isExampleBlock QCString(), // exampleName fd, // fileDef -1, // startLine -1, // endLine FALSE, // inlineFragment nullptr, // memberDef TRUE // showLineNumbers ); //xmlList.get<XMLCodeGenerator>(OutputType::XML)->finish(); xmlList.endCodeFragment("DoxyCode"); } static void writeMemberReference(TextStream &t,const Definition *def,const MemberDef *rmd,const QCString &tagName) { QCString scope = rmd->getScopeString(); QCString name = rmd->name(); if (!scope.isEmpty() && scope!=def->name()) { name.prepend(scope+getLanguageSpecificSeparator(rmd->getLanguage())); } t << " <" << tagName << " refid=\""; t << rmd->getOutputFileBase() << "_1" << rmd->anchor() << "\""; if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef()) { t << " compoundref=\"" << rmd->getBodyDef()->getOutputFileBase() << "\""; t << " startline=\"" << rmd->getStartBodyLine() << "\""; if (rmd->getEndBodyLine()!=-1) { t << " endline=\"" << rmd->getEndBodyLine() << "\""; } } t << ">" << convertToXML(name) << "</" << tagName << ">\n"; } // removes anonymous markers like '@1' from s. // examples '@3::A' -> '::A', 'A::@2::B' -> 'A::B', '@A' -> '@A' static void stripAnonymousMarkers(QCString &s) { auto isDigit = [](char c) { return c>='0' && c<='9'; }; int len = static_cast<int>(s.length()); int i=0,j=0; if (len>0) { while (i<len) { if (i<len-1 && s[i]=='@' && isDigit(s[i+1])) // found pattern '@\d+' { if (j>=2 && i>=2 && s[i-2]==':' && s[i-1]==':') j-=2; // found pattern '::@\d+' i+=2; // skip over @ and first digit while (i<len && isDigit(s[i])) i++; // skip additional digits } else // copy characters { s[j++]=s[i++]; } } // resize resulting string s.resize(j); } } static void stripQualifiers(QCString &typeStr) { bool done=false; typeStr.stripPrefix("friend "); while (!done) { if (typeStr.stripPrefix("static ")) {} else if (typeStr.stripPrefix("constexpr ")) {} else if (typeStr.stripPrefix("consteval ")) {} else if (typeStr.stripPrefix("constinit ")) {} else if (typeStr.stripPrefix("virtual ")) {} else if (typeStr=="virtual") typeStr=""; else done=TRUE; } } static QCString classOutputFileBase(const ClassDef *cd) { //bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES); //if (inlineGroupedClasses && cd->partOfGroups()!=0) return cd->getOutputFileBase(); //else // return cd->getOutputFileBase(); } static QCString memberOutputFileBase(const MemberDef *md) { //bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES); //if (inlineGroupedClasses && md->getClassDef() && md->getClassDef()->partOfGroups()!=0) // return md->getClassDef()->getXmlOutputFileBase(); //else // return md->getOutputFileBase(); return md->getOutputFileBase(); } static QCString extractNoExcept(QCString &argsStr) { QCString expr; //printf("extractNoExcept(%s)\n",qPrint(argsStr)); int i = argsStr.find("noexcept("); if (i!=-1) { int bracketCount = 1; size_t p = i+9; bool found = false; bool insideString = false; bool insideChar = false; char pc = 0; while (!found && p<argsStr.length()) { char c = argsStr[p++]; if (insideString) { if (c=='"' && pc!='\\') insideString=false; } else if (insideChar) { if (c=='\'' && pc!='\\') insideChar=false; } else { switch (c) { case '(': bracketCount++; break; case ')': bracketCount--; found = bracketCount==0; break; case '"': insideString = true; break; case '\'': insideChar = true; break; } } pc = c; } expr = argsStr.mid(i+9,p-i-10); argsStr = (argsStr.left(i) + argsStr.mid(p)).stripWhiteSpace(); } //printf("extractNoExcept -> argsStr='%s', expr='%s'\n",qPrint(argsStr),qPrint(expr)); return expr; } static void generateXMLForMember(const MemberDef *md,TextStream &ti,TextStream &t,const Definition *def) { // + declaration/definition arg lists // + reimplements // + reimplementedBy // + exceptions // + const/volatile specifiers // - examples // + source definition // + source references // + source referenced by // - body code // + template arguments // (templateArguments(), definitionTemplateParameterLists()) // - call graph // enum values are written as part of the enum if (md->memberType()==MemberType::EnumValue) return; if (md->isHidden()) return; // group members are only visible in their group bool groupMember = md->getGroupDef() && def->definitionType()!=Definition::TypeGroup; QCString memType; bool isFunc=FALSE; switch (md->memberType()) { case MemberType::Define: memType="define"; break; case MemberType::Function: memType="function"; isFunc=TRUE; break; case MemberType::Variable: memType="variable"; break; case MemberType::Typedef: memType="typedef"; break; case MemberType::Enumeration: memType="enum"; break; case MemberType::EnumValue: ASSERT(0); break; case MemberType::Signal: memType="signal"; isFunc=TRUE; break; case MemberType::Slot: memType="slot"; isFunc=TRUE; break; case MemberType::Friend: memType="friend"; isFunc=TRUE; break; case MemberType::DCOP: memType="dcop"; isFunc=TRUE; break; case MemberType::Property: memType="property"; break; case MemberType::Event: memType="event"; break; case MemberType::Interface: memType="interface"; break; case MemberType::Service: memType="service"; break; case MemberType::Sequence: memType="sequence"; break; case MemberType::Dictionary: memType="dictionary"; break; } QCString nameStr = md->name(); QCString typeStr = md->typeString(); QCString argsStr = md->argsString(); QCString defStr = md->definition(); defStr.stripPrefix("constexpr "); defStr.stripPrefix("consteval "); defStr.stripPrefix("constinit "); stripAnonymousMarkers(typeStr); stripQualifiers(typeStr); if (typeStr=="auto") { int i=argsStr.findRev("->"); if (i!=-1) // move trailing return type into type and strip it from argsStr { typeStr=argsStr.mid(i+2).stripWhiteSpace(); argsStr=argsStr.left(i).stripWhiteSpace(); i=defStr.find("auto "); if (i!=-1) { defStr=defStr.left(i)+typeStr+defStr.mid(i+4); } } } QCString noExceptExpr = extractNoExcept(argsStr); stripAnonymousMarkers(nameStr); ti << " <member refid=\"" << memberOutputFileBase(md) << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>" << convertToXML(nameStr) << "</name></member>\n"; if (groupMember) { t << " <member refid=\"" << md->getGroupDef()->getOutputFileBase() << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>" << convertToXML(nameStr) << "</name></member>\n"; return; } else { t << " <memberdef kind=\""; t << memType << "\" id=\""; t << memberOutputFileBase(md); t << "_1" // encoded ':' character (see util.cpp:convertNameToFile) << md->anchor(); } //enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t; t << "\" prot=\""; switch (md->protection()) { case Protection::Public: t << "public"; break; case Protection::Protected: t << "protected"; break; case Protection::Private: t << "private"; break; case Protection::Package: t << "package"; break; } t << "\""; t << " static=\""; if (md->isStatic()) t << "yes"; else t << "no"; t << "\""; if (md->isNoDiscard()) { t << " nodiscard=\"yes\""; } if (md->isConstExpr()) { t << " constexpr=\"yes\""; } if (md->isConstEval()) { t << " consteval=\"yes\""; } if (md->isConstInit()) { t << " constinit=\"yes\""; } if (md->isExternal()) { t << " extern=\"yes\""; } if (isFunc) { const ArgumentList &al = md->argumentList(); t << " const=\""; if (al.constSpecifier()) t << "yes"; else t << "no"; t << "\""; t << " explicit=\""; if (md->isExplicit()) t << "yes"; else t << "no"; t << "\""; t << " inline=\""; if (md->isInline()) t << "yes"; else t << "no"; t << "\""; if (al.refQualifier()!=RefQualifierType::None) { t << " refqual=\""; if (al.refQualifier()==RefQualifierType::LValue) t << "lvalue"; else t << "rvalue"; t << "\""; } if (md->isFinal()) { t << " final=\"yes\""; } if (md->isSealed()) { t << " sealed=\"yes\""; } if (md->isNew()) { t << " new=\"yes\""; } if (md->isOptional()) { t << " optional=\"yes\""; } if (md->isRequired()) { t << " required=\"yes\""; } if (md->isNoExcept()) { t << " noexcept=\"yes\""; } if (!noExceptExpr.isEmpty()) { t << " noexceptexpression=\"" << convertToXML(noExceptExpr) << "\""; } if (al.volatileSpecifier()) { t << " volatile=\"yes\""; } t << " virt=\""; switch (md->virtualness()) { case Specifier::Normal: t << "non-virtual"; break; case Specifier::Virtual: t << "virtual"; break; case Specifier::Pure: t << "pure-virtual"; break; default: ASSERT(0); } t << "\""; } if (md->memberType() == MemberType::Enumeration) { t << " strong=\""; if (md->isStrong()) t << "yes"; else t << "no"; t << "\""; } if (md->memberType() == MemberType::Variable) { //ArgumentList *al = md->argumentList(); //t << " volatile=\""; //if (al && al->volatileSpecifier) t << "yes"; else t << "no"; t << " mutable=\""; if (md->isMutable()) t << "yes"; else t << "no"; t << "\""; if (md->isInitonly()) { t << " initonly=\"yes\""; } if (md->isAttribute()) { t << " attribute=\"yes\""; } if (md->isUNOProperty()) { t << " property=\"yes\""; } if (md->isReadonly()) { t << " readonly=\"yes\""; } if (md->isBound()) { t << " bound=\"yes\""; } if (md->isRemovable()) { t << " removable=\"yes\""; } if (md->isConstrained()) { t << " constrained=\"yes\""; } if (md->isTransient()) { t << " transient=\"yes\""; } if (md->isMaybeVoid()) { t << " maybevoid=\"yes\""; } if (md->isMaybeDefault()) { t << " maybedefault=\"yes\""; } if (md->isMaybeAmbiguous()) { t << " maybeambiguous=\"yes\""; } } else if (md->memberType() == MemberType::Property) { t << " readable=\""; if (md->isReadable()) t << "yes"; else t << "no"; t << "\""; t << " writable=\""; if (md->isWritable()) t << "yes"; else t << "no"; t << "\""; t << " gettable=\""; if (md->isGettable()) t << "yes"; else t << "no"; t << "\""; t << " privategettable=\""; if (md->isPrivateGettable()) t << "yes"; else t << "no"; t << "\""; t << " protectedgettable=\""; if (md->isProtectedGettable()) t << "yes"; else t << "no"; t << "\""; t << " settable=\""; if (md->isSettable()) t << "yes"; else t << "no"; t << "\""; t << " privatesettable=\""; if (md->isPrivateSettable()) t << "yes"; else t << "no"; t << "\""; t << " protectedsettable=\""; if (md->isProtectedSettable()) t << "yes"; else t << "no"; t << "\""; if (md->isAssign() || md->isCopy() || md->isRetain() || md->isStrong() || md->isWeak()) { t << " accessor=\""; if (md->isAssign()) t << "assign"; else if (md->isCopy()) t << "copy"; else if (md->isRetain()) t << "retain"; else if (md->isStrong()) t << "strong"; else if (md->isWeak()) t << "weak"; t << "\""; } } else if (md->memberType() == MemberType::Event) { t << " add=\""; if (md->isAddable()) t << "yes"; else t << "no"; t << "\""; t << " remove=\""; if (md->isRemovable()) t << "yes"; else t << "no"; t << "\""; t << " raise=\""; if (md->isRaisable()) t << "yes"; else t << "no"; t << "\""; } t << ">\n"; if (md->memberType()!=MemberType::Define && md->memberType()!=MemberType::Enumeration ) { writeMemberTemplateLists(md,t); t << " <type>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,typeStr); t << "</type>\n"; if (md->isTypeAlias()) { defStr+=" = "+md->initializer(); } stripAnonymousMarkers(defStr); t << " <definition>" << convertToXML(defStr) << "</definition>\n"; t << " <argsstring>" << convertToXML(argsStr) << "</argsstring>\n"; } if (md->memberType() == MemberType::Enumeration) { t << " <type>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,md->enumBaseType()); t << "</type>\n"; } QCString qualifiedNameStr = md->qualifiedName(); stripAnonymousMarkers(qualifiedNameStr); t << " <name>" << convertToXML(nameStr) << "</name>\n"; if (nameStr!=qualifiedNameStr) { t << " <qualifiedname>" << convertToXML(qualifiedNameStr) << "</qualifiedname>\n"; } if (md->memberType() == MemberType::Property) { if (md->isReadable()) t << " <read>" << convertToXML(md->getReadAccessor()) << "</read>\n"; if (md->isWritable()) t << " <write>" << convertToXML(md->getWriteAccessor()) << "</write>\n"; } if (md->memberType()==MemberType::Variable && !md->bitfieldString().isEmpty()) { QCString bitfield = md->bitfieldString(); if (bitfield.at(0)==':') bitfield=bitfield.mid(1); t << " <bitfield>" << convertToXML(bitfield) << "</bitfield>\n"; } const MemberDef *rmd = md->reimplements(); if (rmd) { t << " <reimplements refid=\"" << memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">" << convertToXML(rmd->name()) << "</reimplements>\n"; } for (const auto &rbmd : md->reimplementedBy()) { t << " <reimplementedby refid=\"" << memberOutputFileBase(rbmd) << "_1" << rbmd->anchor() << "\">" << convertToXML(rbmd->name()) << "</reimplementedby>\n"; } for (const auto &qmd : md->getQualifiers()) { t << " <qualifier>" << convertToXML(qmd.c_str()) << "</qualifier>\n"; } if (md->isFriendClass()) // for friend classes we show a link to the class as a "parameter" { t << " <param>\n"; t << " <type>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,nameStr); t << "</type>\n"; t << " </param>\n"; } else if (isFunc) //function { const ArgumentList &declAl = md->declArgumentList(); const ArgumentList &defAl = md->argumentList(); bool isFortran = md->getLanguage()==SrcLangExt::Fortran; if (declAl.hasParameters()) { auto defIt = defAl.begin(); for (const Argument &a : declAl) { //const Argument *defArg = defAli.current(); const Argument *defArg = nullptr; if (defIt!=defAl.end()) { defArg = &(*defIt); ++defIt; } t << " <param>\n"; if (!a.attrib.isEmpty()) { t << " <attributes>"; writeXMLString(t,a.attrib); t << "</attributes>\n"; } if (isFortran && defArg && !defArg->type.isEmpty()) { t << " <type>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,defArg->type); t << "</type>\n"; } else if (!a.type.isEmpty()) { t << " <type>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,a.type); t << "</type>\n"; } if (!a.name.isEmpty()) { t << " <declname>"; writeXMLString(t,a.name); t << "</declname>\n"; } if (defArg && !defArg->name.isEmpty() && defArg->name!=a.name) { t << " <defname>"; writeXMLString(t,defArg->name); t << "</defname>\n"; } if (!a.array.isEmpty()) { t << " <array>"; writeXMLString(t,a.array); t << "</array>\n"; } if (!a.defval.isEmpty()) { t << " <defval>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,a.defval); t << "</defval>\n"; } if (defArg && defArg->hasDocumentation()) { t << " <briefdescription>"; writeXMLDocBlock(t,md->getDefFileName(),md->getDefLine(), md->getOuterScope(),md,defArg->docs); t << "</briefdescription>\n"; } t << " </param>\n"; } } } else if (md->memberType()==MemberType::Define && !md->argsString().isEmpty()) // define { if (md->argumentList().empty()) // special case for "foo()" to // distinguish it from "foo". { t << " <param></param>\n"; } else { for (const Argument &a : md->argumentList()) { t << " <param><defname>" << a.type << "</defname></param>\n"; } } } if (!md->requiresClause().isEmpty()) { t << " <requiresclause>"; linkifyText(TextGeneratorXMLImpl(t),md,md->getFileDef(),md,md->requiresClause()); t << " </requiresclause>\n"; } if (!md->isTypeAlias() && (md->hasOneLineInitializer() || md->hasMultiLineInitializer())) { t << " <initializer>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,md->initializer()); t << "</initializer>\n"; } if (!md->excpString().isEmpty()) { t << " <exceptions>"; linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,md->excpString()); t << "</exceptions>\n"; } if (md->memberType()==MemberType::Enumeration) // enum { for (const auto &emd : md->enumFieldList()) { ti << " <member refid=\"" << memberOutputFileBase(md) << "_1" << emd->anchor() << "\" kind=\"enumvalue\"><name>" << convertToXML(emd->name()) << "</name></member>\n"; t << " <enumvalue id=\"" << memberOutputFileBase(md) << "_1" << emd->anchor() << "\" prot=\""; switch (emd->protection()) { case Protection::Public: t << "public"; break; case Protection::Protected: t << "protected"; break; case Protection::Private: t << "private"; break; case Protection::Package: t << "package"; break; } t << "\">\n"; t << " <name>"; writeXMLString(t,emd->name()); t << "</name>\n"; if (!emd->initializer().isEmpty()) { t << " <initializer>"; writeXMLString(t,emd->initializer()); t << "</initializer>\n"; } t << " <briefdescription>\n"; writeXMLDocBlock(t,emd->briefFile(),emd->briefLine(),emd->getOuterScope(),emd,emd->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,emd->docFile(),emd->docLine(),emd->getOuterScope(),emd,emd->documentation()); t << " </detaileddescription>\n"; t << " </enumvalue>\n"; } } t << " <briefdescription>\n"; writeXMLDocBlock(t,md->briefFile(),md->briefLine(),md->getOuterScope(),md,md->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation()); t << " </detaileddescription>\n"; t << " <inbodydescription>\n"; writeXMLDocBlock(t,md->docFile(),md->inbodyLine(),md->getOuterScope(),md,md->inbodyDocumentation()); t << " </inbodydescription>\n"; if (md->getDefLine()!=-1) { t << " <location file=\"" << convertToXML(stripFromPath(md->getDefFileName())) << "\" line=\"" << md->getDefLine() << "\" column=\"" << md->getDefColumn() << "\"" ; if (md->getStartBodyLine()!=-1) { const FileDef *bodyDef = md->getBodyDef(); if (bodyDef) { t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\""; } t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\"" << md->getEndBodyLine() << "\""; } if (md->getDeclLine()!=-1) { t << " declfile=\"" << convertToXML(stripFromPath(md->getDeclFileName())) << "\" declline=\"" << md->getDeclLine() << "\" declcolumn=\"" << md->getDeclColumn() << "\""; } t << "/>\n"; } //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers()); auto refList = md->getReferencesMembers(); for (const auto &refmd : refList) { writeMemberReference(t,def,refmd,"references"); } auto refByList = md->getReferencedByMembers(); for (const auto &refmd : refByList) { writeMemberReference(t,def,refmd,"referencedby"); } t << " </memberdef>\n"; } // namespace members are also inserted in the file scope, but // to prevent this duplication in the XML output, we optionally filter those here. static bool memberVisible(const Definition *d,const MemberDef *md) { return Config_getBool(XML_NS_MEMB_FILE_SCOPE) || d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==nullptr; } static void generateXMLSection(const Definition *d,TextStream &ti,TextStream &t, const MemberList *ml,const QCString &kind,const QCString &header=QCString(), const QCString &documentation=QCString()) { if (ml==nullptr) return; int count=0; for (const auto &md : *ml) { if (memberVisible(d,md) && (md->memberType()!=MemberType::EnumValue) && !md->isHidden()) { count++; } } if (count==0) return; // empty list t << " <sectiondef kind=\"" << kind << "\">\n"; if (!header.isEmpty()) { t << " <header>" << convertToXML(header) << "</header>\n"; } if (!documentation.isEmpty()) { t << " <description>"; writeXMLDocBlock(t,d->docFile(),d->docLine(),d,nullptr,documentation); t << "</description>\n"; } for (const auto &md : *ml) { if (memberVisible(d,md)) { generateXMLForMember(md,ti,t,d); } } t << " </sectiondef>\n"; } static void writeListOfAllMembers(const ClassDef *cd,TextStream &t) { t << " <listofallmembers>\n"; for (auto &mni : cd->memberNameInfoLinkedMap()) { for (auto &mi : *mni) { const MemberDef *md=mi->memberDef(); if (!md->isAnonymous()) { Protection prot = mi->prot(); Specifier virt=md->virtualness(); t << " <member refid=\"" << memberOutputFileBase(md) << "_1" << md->anchor() << "\" prot=\""; switch (prot) { case Protection::Public: t << "public"; break; case Protection::Protected: t << "protected"; break; case Protection::Private: t << "private"; break; case Protection::Package: t << "package"; break; } t << "\" virt=\""; switch(virt) { case Specifier::Normal: t << "non-virtual"; break; case Specifier::Virtual: t << "virtual"; break; case Specifier::Pure: t << "pure-virtual"; break; } t << "\""; if (!mi->ambiguityResolutionScope().isEmpty()) { t << " ambiguityscope=\"" << convertToXML(mi->ambiguityResolutionScope()) << "\""; } t << "><scope>" << convertToXML(cd->name()) << "</scope><name>" << convertToXML(md->name()) << "</name></member>\n"; } } } t << " </listofallmembers>\n"; } static void writeInnerClasses(const ClassLinkedRefMap &cl,TextStream &t) { for (const auto &cd : cl) { if (!cd->isHidden() && !cd->isAnonymous()) { t << " <innerclass refid=\"" << classOutputFileBase(cd) << "\" prot=\""; switch(cd->protection()) { case Protection::Public: t << "public"; break; case Protection::Protected: t << "protected"; break; case Protection::Private: t << "private"; break; case Protection::Package: t << "package"; break; } t << "\">" << convertToXML(cd->name()) << "</innerclass>\n"; } } } static void writeInnerConcepts(const ConceptLinkedRefMap &cl,TextStream &t) { for (const auto &cd : cl) { if (cd->isHidden()) { t << " <innerconcept refid=\"" << cd->getOutputFileBase() << "\">" << convertToXML(cd->name()) << "</innerconcept>\n"; } } } static void writeInnerModules(const ModuleLinkedRefMap &ml,TextStream &t) { for (const auto &mod : ml) { if (mod->isHidden()) { t << " <innermodule refid=\"" << mod->getOutputFileBase() << "\">" << convertToXML(mod->name()) << "</innermodule>\n"; } } } static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl,TextStream &t) { for (const auto &nd : nl) { if (!nd->isHidden() && !nd->isAnonymous()) { t << " <innernamespace refid=\"" << nd->getOutputFileBase() << "\"" << (nd->isInline() ? " inline=\"yes\"" : "") << ">" << convertToXML(nd->name()) << "</innernamespace>\n"; } } } static void writeExports(const ImportInfoMap &exportMap,TextStream &t) { if (exportMap.empty()) return; t << " <exports>\n"; for (const auto &[moduleName,importInfoList] : exportMap) { for (const auto &importInfo : importInfoList) { t << " <export"; ModuleDef *mod = ModuleManager::instance().getPrimaryInterface(importInfo.importName); if (mod && mod->isLinkableInProject()) { t << " refid=\"" << mod->getOutputFileBase() << "\""; } t << ">"; t << importInfo.importName; t << "</export>\n"; } } t << " </exports>\n"; } static void writeInnerFiles(const FileList &fl,TextStream &t) { for (const auto &fd : fl) { t << " <innerfile refid=\"" << fd->getOutputFileBase() << "\">" << convertToXML(fd->name()) << "</innerfile>\n"; } } static void writeInnerPages(const PageLinkedRefMap &pl,TextStream &t) { for (const auto &pd : pl) { t << " <innerpage refid=\"" << pd->getOutputFileBase(); if (pd->getGroupDef()) { t << "_" << pd->name(); } t << "\">" << convertToXML(pd->title()) << "</innerpage>\n"; } } static void writeInnerGroups(const GroupList &gl,TextStream &t) { for (const auto &sgd : gl) { t << " <innergroup refid=\"" << sgd->getOutputFileBase() << "\">" << convertToXML(sgd->groupTitle()) << "</innergroup>\n"; } } static void writeInnerDirs(const DirList *dl,TextStream &t) { if (dl) { for(const auto subdir : *dl) { t << " <innerdir refid=\"" << subdir->getOutputFileBase() << "\">" << convertToXML(subdir->displayName()) << "</innerdir>\n"; } } } static void writeIncludeInfo(const IncludeInfo *ii,TextStream &t) { if (ii) { QCString nm = ii->includeName; if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName(); if (!nm.isEmpty()) { t << " <includes"; if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references { t << " refid=\"" << ii->fileDef->getOutputFileBase() << "\""; } t << " local=\"" << ((ii->kind & IncludeKind_LocalMask) ? "yes" : "no") << "\">"; t << nm; t << "</includes>\n"; } } } static void generateXMLForClass(const ClassDef *cd,TextStream &ti) { // + brief description // + detailed description // + template argument list(s) // - include file // + member groups // + inheritance diagram // + list of direct super classes // + list of direct sub classes // + list of inner classes // + collaboration diagram // + list of all members // + user defined member sections // + standard member sections // + detailed member documentation // - examples using the class if (cd->isReference()) return; // skip external references. if (cd->isHidden()) return; // skip hidden classes. if (cd->isAnonymous()) return; // skip anonymous compounds. if (cd->templateMaster()!=nullptr) return; // skip generated template instances. if (cd->isArtificial()) return; // skip artificially created classes msg("Generating XML output for class %s\n",qPrint(cd->name())); ti << " <compound refid=\"" << classOutputFileBase(cd) << "\" kind=\"" << cd->compoundTypeString() << "\"><name>" << convertToXML(cd->name()) << "</name>\n"; QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+ classOutputFileBase(cd)+".xml"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << classOutputFileBase(cd) << "\" kind=\"" << cd->compoundTypeString() << "\" language=\"" << langToString(cd->getLanguage()) << "\" prot=\""; switch (cd->protection()) { case Protection::Public: t << "public"; break; case Protection::Protected: t << "protected"; break; case Protection::Private: t << "private"; break; case Protection::Package: t << "package"; break; } if (cd->isFinal()) t << "\" final=\"yes"; if (cd->isSealed()) t << "\" sealed=\"yes"; if (cd->isAbstract()) t << "\" abstract=\"yes"; t << "\">\n"; t << " <compoundname>"; QCString nameStr = cd->name(); stripAnonymousMarkers(nameStr); writeXMLString(t,nameStr); t << "</compoundname>\n"; for (const auto &bcd : cd->baseClasses()) { t << " <basecompoundref "; if (bcd.classDef->isLinkable()) { t << "refid=\"" << classOutputFileBase(bcd.classDef) << "\" "; } t << "prot=\""; switch (bcd.prot) { case Protection::Public: t << "public"; break; case Protection::Protected: t << "protected"; break; case Protection::Private: t << "private"; break; case Protection::Package: ASSERT(0); break; } t << "\" virt=\""; switch(bcd.virt) { case Specifier::Normal: t << "non-virtual"; break; case Specifier::Virtual: t << "virtual"; break; case Specifier::Pure: t <<"pure-virtual"; break; } t << "\">"; if (!bcd.templSpecifiers.isEmpty()) { t << convertToXML( insertTemplateSpecifierInScope( bcd.classDef->name(),bcd.templSpecifiers) ); } else { t << convertToXML(bcd.classDef->displayName()); } t << "</basecompoundref>\n"; } for (const auto &bcd : cd->subClasses()) { t << " <derivedcompoundref refid=\"" << classOutputFileBase(bcd.classDef) << "\" prot=\""; switch (bcd.prot) { case Protection::Public: t << "public"; break; case Protection::Protected: t << "protected"; break; case Protection::Private: t << "private"; break; case Protection::Package: ASSERT(0); break; } t << "\" virt=\""; switch (bcd.virt) { case Specifier::Normal: t << "non-virtual"; break; case Specifier::Virtual: t << "virtual"; break; case Specifier::Pure: t << "pure-virtual"; break; } t << "\">" << convertToXML(bcd.classDef->displayName()) << "</derivedcompoundref>\n"; } writeIncludeInfo(cd->includeInfo(),t); writeInnerClasses(cd->getClasses(),t); writeTemplateList(cd,t); for (const auto &mg : cd->getMemberGroups()) { generateXMLSection(cd,ti,t,&mg->members(),"user-defined",mg->header(), mg->documentation()); } for (const auto &ml : cd->getMemberLists()) { if (!ml->listType().isDetailed()) { generateXMLSection(cd,ti,t,ml.get(),ml->listType().toXML()); } } if (!cd->requiresClause().isEmpty()) { t << " <requiresclause>"; linkifyText(TextGeneratorXMLImpl(t),cd,cd->getFileDef(),nullptr,cd->requiresClause()); t << " </requiresclause>\n"; } for (const auto &qcd : cd->getQualifiers()) { t << " <qualifier>" << convertToXML(qcd.c_str()) << "</qualifier>\n"; } t << " <briefdescription>\n"; writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,nullptr,cd->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd,nullptr,cd->documentation()); t << " </detaileddescription>\n"; DotClassGraph inheritanceGraph(cd,GraphType::Inheritance); if (!inheritanceGraph.isTrivial()) { t << " <inheritancegraph>\n"; inheritanceGraph.writeXML(t); t << " </inheritancegraph>\n"; } DotClassGraph collaborationGraph(cd,GraphType::Collaboration); if (!collaborationGraph.isTrivial()) { t << " <collaborationgraph>\n"; collaborationGraph.writeXML(t); t << " </collaborationgraph>\n"; } t << " <location file=\"" << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\"" << cd->getDefLine() << "\"" << " column=\"" << cd->getDefColumn() << "\"" ; if (cd->getStartBodyLine()!=-1) { const FileDef *bodyDef = cd->getBodyDef(); if (bodyDef) { t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\""; } t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" << cd->getEndBodyLine() << "\""; } t << "/>\n"; writeListOfAllMembers(cd,t); t << " </compounddef>\n"; t << "</doxygen>\n"; ti << " </compound>\n"; } static void generateXMLForConcept(const ConceptDef *cd,TextStream &ti) { if (cd->isReference() || cd->isHidden()) return; // skip external references. ti << " <compound refid=\"" << cd->getOutputFileBase() << "\" kind=\"concept\"" << "><name>" << convertToXML(cd->name()) << "</name>\n"; QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+cd->getOutputFileBase()+".xml"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << cd->getOutputFileBase() << "\" kind=\"concept\">\n"; t << " <compoundname>"; QCString nameStr = cd->name(); stripAnonymousMarkers(nameStr); writeXMLString(t,nameStr); t << "</compoundname>\n"; writeIncludeInfo(cd->includeInfo(),t); writeTemplateList(cd,t); t << " <initializer>"; linkifyText(TextGeneratorXMLImpl(t),cd,cd->getFileDef(),nullptr,cd->initializer()); t << " </initializer>\n"; t << " <briefdescription>\n"; writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,nullptr,cd->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd,nullptr,cd->documentation()); t << " </detaileddescription>\n"; t << " <location file=\"" << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\"" << cd->getDefLine() << "\"" << " column=\"" << cd->getDefColumn() << "\"/>\n" ; t << " </compounddef>\n"; t << "</doxygen>\n"; ti << " </compound>\n"; } static void generateXMLForModule(const ModuleDef *mod,TextStream &ti) { if (mod->isReference() || mod->isHidden() || !mod->isPrimaryInterface()) return; ti << " <compound refid=\"" << mod->getOutputFileBase() << "\" kind=\"module\"" << "><name>" << convertToXML(mod->name()) << "</name>\n"; QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+mod->getOutputFileBase()+".xml"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << mod->getOutputFileBase() << "\" kind=\"module\">\n"; t << " <compoundname>"; writeXMLString(t,mod->name()); t << "</compoundname>\n"; writeInnerFiles(mod->getUsedFiles(),t); writeInnerClasses(mod->getClasses(),t); writeInnerConcepts(mod->getConcepts(),t); for (const auto &ml : mod->getMemberLists()) { if (ml->listType().isDeclaration()) { generateXMLSection(mod,ti,t,ml.get(),ml->listType().toXML()); } } for (const auto &mg : mod->getMemberGroups()) { generateXMLSection(mod,ti,t,&mg->members(),"user-defined",mg->header(), mg->documentation()); } t << " <briefdescription>\n"; writeXMLDocBlock(t,mod->briefFile(),mod->briefLine(),mod,nullptr,mod->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,mod->docFile(),mod->docLine(),mod,nullptr,mod->documentation()); t << " </detaileddescription>\n"; writeExports(mod->getExports(),t); t << " <location file=\"" << convertToXML(stripFromPath(mod->getDefFileName())) << "\" line=\"" << mod->getDefLine() << "\"" << " column=\"" << mod->getDefColumn() << "\"/>\n" ; t << " </compounddef>\n"; t << "</doxygen>\n"; ti << " </compound>\n"; } static void generateXMLForNamespace(const NamespaceDef *nd,TextStream &ti) { // + contained class definitions // + contained namespace definitions // + member groups // + normal members // + brief desc // + detailed desc // + location // - files containing (parts of) the namespace definition if (nd->isReference() || nd->isHidden()) return; // skip external references ti << " <compound refid=\"" << nd->getOutputFileBase() << "\" kind=\"namespace\"" << "><name>" << convertToXML(nd->name()) << "</name>\n"; QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+nd->getOutputFileBase()+".xml"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << nd->getOutputFileBase() << "\" kind=\"namespace\" " << (nd->isInline()?"inline=\"yes\" ":"") << "language=\"" << langToString(nd->getLanguage()) << "\">\n"; t << " <compoundname>"; QCString nameStr = nd->name(); stripAnonymousMarkers(nameStr); writeXMLString(t,nameStr); t << "</compoundname>\n"; writeInnerClasses(nd->getClasses(),t); writeInnerConcepts(nd->getConcepts(),t); writeInnerNamespaces(nd->getNamespaces(),t); for (const auto &mg : nd->getMemberGroups()) { generateXMLSection(nd,ti,t,&mg->members(),"user-defined",mg->header(), mg->documentation()); } for (const auto &ml : nd->getMemberLists()) { if (ml->listType().isDeclaration()) { generateXMLSection(nd,ti,t,ml.get(),ml->listType().toXML()); } } t << " <briefdescription>\n"; writeXMLDocBlock(t,nd->briefFile(),nd->briefLine(),nd,nullptr,nd->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,nd->docFile(),nd->docLine(),nd,nullptr,nd->documentation()); t << " </detaileddescription>\n"; t << " <location file=\"" << convertToXML(stripFromPath(nd->getDefFileName())) << "\" line=\"" << nd->getDefLine() << "\"" << " column=\"" << nd->getDefColumn() << "\"/>\n" ; t << " </compounddef>\n"; t << "</doxygen>\n"; ti << " </compound>\n"; } static void generateXMLForFile(FileDef *fd,TextStream &ti) { // + includes files // + includedby files // + include graph // + included by graph // + contained class definitions // + contained namespace definitions // + member groups // + normal members // + brief desc // + detailed desc // + source code // + location // - number of lines if (fd->isReference()) return; // skip external references ti << " <compound refid=\"" << fd->getOutputFileBase() << "\" kind=\"file\"><name>" << convertToXML(fd->name()) << "</name>\n"; QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+fd->getOutputFileBase()+".xml"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << fd->getOutputFileBase() << "\" kind=\"file\" language=\"" << langToString(fd->getLanguage()) << "\">\n"; t << " <compoundname>"; writeXMLString(t,fd->name()); t << "</compoundname>\n"; for (const auto &inc : fd->includeFileList()) { t << " <includes"; if (inc.fileDef && !inc.fileDef->isReference()) // TODO: support external references { t << " refid=\"" << inc.fileDef->getOutputFileBase() << "\""; } t << " local=\"" << ((inc.kind & IncludeKind_LocalMask) ? "yes" : "no") << "\">"; t << inc.includeName; t << "</includes>\n"; } for (const auto &inc : fd->includedByFileList()) { t << " <includedby"; if (inc.fileDef && !inc.fileDef->isReference()) // TODO: support external references { t << " refid=\"" << inc.fileDef->getOutputFileBase() << "\""; } t << " local=\"" << ((inc.kind &IncludeKind_LocalMask) ? "yes" : "no") << "\">"; t << inc.includeName; t << "</includedby>\n"; } DotInclDepGraph incDepGraph(fd,FALSE); if (!incDepGraph.isTrivial()) { t << " <incdepgraph>\n"; incDepGraph.writeXML(t); t << " </incdepgraph>\n"; } DotInclDepGraph invIncDepGraph(fd,TRUE); if (!invIncDepGraph.isTrivial()) { t << " <invincdepgraph>\n"; invIncDepGraph.writeXML(t); t << " </invincdepgraph>\n"; } writeInnerClasses(fd->getClasses(),t); writeInnerConcepts(fd->getConcepts(),t); writeInnerNamespaces(fd->getNamespaces(),t); for (const auto &mg : fd->getMemberGroups()) { generateXMLSection(fd,ti,t,&mg->members(),"user-defined",mg->header(), mg->documentation()); } for (const auto &ml : fd->getMemberLists()) { if (ml->listType().isDeclaration()) { generateXMLSection(fd,ti,t,ml.get(),ml->listType().toXML()); } } t << " <briefdescription>\n"; writeXMLDocBlock(t,fd->briefFile(),fd->briefLine(),fd,nullptr,fd->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,fd->docFile(),fd->docLine(),fd,nullptr,fd->documentation()); t << " </detaileddescription>\n"; if (Config_getBool(XML_PROGRAMLISTING)) { writeXMLCodeBlock(t,fd); } t << " <location file=\"" << convertToXML(stripFromPath(fd->getDefFileName())) << "\"/>\n"; t << " </compounddef>\n"; t << "</doxygen>\n"; ti << " </compound>\n"; } static void generateXMLForGroup(const GroupDef *gd,TextStream &ti) { // + members // + member groups // + files // + classes // + namespaces // - packages // + pages // + child groups // - examples // + brief description // + detailed description if (gd->isReference()) return; // skip external references ti << " <compound refid=\"" << gd->getOutputFileBase() << "\" kind=\"group\"><name>" << convertToXML(gd->name()) << "</name>\n"; QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+gd->getOutputFileBase()+".xml"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << gd->getOutputFileBase() << "\" kind=\"group\">\n"; t << " <compoundname>" << convertToXML(gd->name()) << "</compoundname>\n"; t << " <title>" << convertToXML(gd->groupTitle()) << "</title>\n"; writeInnerModules(gd->getModules(),t); writeInnerFiles(gd->getFiles(),t); writeInnerClasses(gd->getClasses(),t); writeInnerConcepts(gd->getConcepts(),t); writeInnerNamespaces(gd->getNamespaces(),t); writeInnerPages(gd->getPages(),t); writeInnerGroups(gd->getSubGroups(),t); for (const auto &mg : gd->getMemberGroups()) { generateXMLSection(gd,ti,t,&mg->members(),"user-defined",mg->header(), mg->documentation()); } for (const auto &ml : gd->getMemberLists()) { if (ml->listType().isDeclaration()) { generateXMLSection(gd,ti,t,ml.get(),ml->listType().toXML()); } } t << " <briefdescription>\n"; writeXMLDocBlock(t,gd->briefFile(),gd->briefLine(),gd,nullptr,gd->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,gd->docFile(),gd->docLine(),gd,nullptr,gd->documentation()); t << " </detaileddescription>\n"; t << " </compounddef>\n"; t << "</doxygen>\n"; ti << " </compound>\n"; } static void generateXMLForDir(DirDef *dd,TextStream &ti) { if (dd->isReference()) return; // skip external references ti << " <compound refid=\"" << dd->getOutputFileBase() << "\" kind=\"dir\"><name>" << convertToXML(dd->displayName()) << "</name>\n"; QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+dd->getOutputFileBase()+".xml"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << dd->getOutputFileBase() << "\" kind=\"dir\">\n"; t << " <compoundname>" << convertToXML(dd->displayName()) << "</compoundname>\n"; writeInnerDirs(&dd->subDirs(),t); writeInnerFiles(dd->getFiles(),t); t << " <briefdescription>\n"; writeXMLDocBlock(t,dd->briefFile(),dd->briefLine(),dd,nullptr,dd->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; writeXMLDocBlock(t,dd->docFile(),dd->docLine(),dd,nullptr,dd->documentation()); t << " </detaileddescription>\n"; t << " <location file=\"" << convertToXML(stripFromPath(dd->name())) << "\"/>\n"; t << " </compounddef>\n"; t << "</doxygen>\n"; ti << " </compound>\n"; } static void generateXMLForPage(PageDef *pd,TextStream &ti,bool isExample) { // + name // + title // + documentation // + location const char *kindName = isExample ? "example" : "page"; if (pd->isReference()) return; QCString pageName = pd->getOutputFileBase(); if (pd->getGroupDef()) { pageName+=QCString("_")+pd->name(); } if (pageName=="index") pageName="indexpage"; // to prevent overwriting the generated index page. ti << " <compound refid=\"" << pageName << "\" kind=\"" << kindName << "\"><name>" << convertToXML(pd->name()) << "</name>\n"; QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+pageName+".xml"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } TextStream t(&f); writeXMLHeader(t); t << " <compounddef id=\"" << pageName; t << "\" kind=\"" << kindName << "\">\n"; t << " <compoundname>" << convertToXML(pd->name()) << "</compoundname>\n"; if (pd==Doxygen::mainPage.get()) // main page is special { QCString title; if (mainPageHasTitle()) { title = filterTitle(convertCharEntitiesToUTF8(Doxygen::mainPage->title())); } else { title = Config_getString(PROJECT_NAME); } t << " <title>" << convertToXML(convertCharEntitiesToUTF8(title)) << "</title>\n"; } else { const SectionInfo *si = SectionManager::instance().find(pd->name()); if (si) { t << " <title>" << convertToXML(filterTitle(convertCharEntitiesToUTF8(si->title()))) << "</title>\n"; } } writeInnerPages(pd->getSubPages(),t); const SectionRefs &sectionRefs = pd->getSectionRefs(); if (pd->localToc().isXmlEnabled() && !sectionRefs.empty()) { int level=1; int indent=0; auto writeIndent = [&]() { for (int i=0;i<4+indent*2;i++) t << " "; }; auto incIndent = [&](const char *text) { writeIndent(); t << text << "\n"; indent++; }; auto decIndent = [&](const char *text) { indent--; writeIndent(); t << text << "\n"; }; incIndent("<tableofcontents>"); int maxLevel = pd->localToc().xmlLevel(); BoolVector inLi(maxLevel+1,false); for (const SectionInfo *si : sectionRefs) { if (si->type().isSection()) { //printf(" level=%d title=%s\n",level,qPrint(si->title)); int nextLevel = si->type().level(); if (nextLevel>level) { for (int l=level;l<nextLevel;l++) { if (l < maxLevel) incIndent("<tableofcontents>"); } } else if (nextLevel<level) { for (int l=level;l>nextLevel;l--) { if (l <= maxLevel && inLi[l]) decIndent("</tocsect>"); inLi[l]=false; if (l <= maxLevel) decIndent("</tableofcontents>"); } } if (nextLevel <= maxLevel) { if (inLi[nextLevel]) { decIndent("</tocsect>"); } else if (level>nextLevel) { decIndent("</tableofcontents>"); incIndent("<tableofcontents>"); } QCString titleDoc = convertToXML(si->title()); QCString label = convertToXML(si->label()); if (titleDoc.isEmpty()) titleDoc = label; incIndent("<tocsect>"); writeIndent(); t << "<name>" << titleDoc << "</name>\n"; writeIndent(); t << "<reference>" << convertToXML(pageName) << "_1" << label << "</reference>\n"; inLi[nextLevel]=true; level = nextLevel; } } } while (level>1 && level <= maxLevel) { if (inLi[level]) decIndent("</tocsect>"); inLi[level]=false; decIndent("</tableofcontents>"); level--; } if (level <= maxLevel && inLi[level]) decIndent("</tocsect>"); inLi[level]=false; decIndent("</tableofcontents>"); } t << " <briefdescription>\n"; writeXMLDocBlock(t,pd->briefFile(),pd->briefLine(),pd,nullptr,pd->briefDescription()); t << " </briefdescription>\n"; t << " <detaileddescription>\n"; if (isExample) { writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,nullptr, pd->documentation()+"\n\\include "+pd->name()); } else { writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,nullptr, pd->documentation()); } t << " </detaileddescription>\n"; t << " <location file=\"" << convertToXML(stripFromPath(pd->getDefFileName())) << "\"/>\n"; t << " </compounddef>\n"; t << "</doxygen>\n"; ti << " </compound>\n"; } void generateXML() { // + classes // + concepts // + namespaces // + files // + groups // + related pages // - examples QCString outputDirectory = Config_getString(XML_OUTPUT); Dir xmlDir(outputDirectory.str()); createSubDirs(xmlDir); ResourceMgr::instance().copyResource("xml.xsd",outputDirectory); ResourceMgr::instance().copyResource("index.xsd",outputDirectory); QCString fileName=outputDirectory+"/compound.xsd"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } { TextStream t(&f); // write compound.xsd, but replace special marker with the entities QCString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd"); const char *startLine = compound_xsd.data(); while (*startLine) { // find end of the line const char *endLine = startLine+1; while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n int len=static_cast<int>(endLine-startLine); if (len>0) { QCString s(startLine,len); if (s.find("<!-- Automatically insert here the HTML entities -->")!=-1) { HtmlEntityMapper::instance().writeXMLSchema(t); } else { t.write(startLine,len); } } startLine=endLine; } } f.close(); fileName=outputDirectory+"/doxyfile.xsd"; f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } { TextStream t(&f); // write doxyfile.xsd, but replace special marker with the entities QCString doxyfile_xsd = ResourceMgr::instance().getAsString("doxyfile.xsd"); const char *startLine = doxyfile_xsd.data(); while (*startLine) { // find end of the line const char *endLine = startLine+1; while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n int len=static_cast<int>(endLine-startLine); if (len>0) { QCString s(startLine,len); if (s.find("<!-- Automatically insert here the configuration settings -->")!=-1) { Config::writeXSDDoxyfile(t); } else { t.write(startLine,len); } } startLine=endLine; } } f.close(); fileName=outputDirectory+"/Doxyfile.xml"; f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing\n",fileName.data()); return; } else { TextStream t(&f); Config::writeXMLDoxyfile(t); } f.close(); fileName=outputDirectory+"/index.xml"; f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing!\n",qPrint(fileName)); return; } else { TextStream t(&f); // write index header t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n"; t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" "; t << "version=\"" << getDoxygenVersion() << "\" "; t << "xml:lang=\"" << theTranslator->trISOLang() << "\""; t << ">\n"; for (const auto &cd : *Doxygen::classLinkedMap) { generateXMLForClass(cd.get(),t); } for (const auto &cd : *Doxygen::conceptLinkedMap) { msg("Generating XML output for concept %s\n",qPrint(cd->displayName())); generateXMLForConcept(cd.get(),t); } for (const auto &nd : *Doxygen::namespaceLinkedMap) { msg("Generating XML output for namespace %s\n",qPrint(nd->displayName())); generateXMLForNamespace(nd.get(),t); } for (const auto &fn : *Doxygen::inputNameLinkedMap) { for (const auto &fd : *fn) { msg("Generating XML output for file %s\n",qPrint(fd->name())); generateXMLForFile(fd.get(),t); } } for (const auto &gd : *Doxygen::groupLinkedMap) { msg("Generating XML output for group %s\n",qPrint(gd->name())); generateXMLForGroup(gd.get(),t); } for (const auto &pd : *Doxygen::pageLinkedMap) { msg("Generating XML output for page %s\n",qPrint(pd->name())); generateXMLForPage(pd.get(),t,FALSE); } for (const auto &dd : *Doxygen::dirLinkedMap) { msg("Generate XML output for dir %s\n",qPrint(dd->name())); generateXMLForDir(dd.get(),t); } for (const auto &mod : ModuleManager::instance().modules()) { msg("Generating XML output for module %s\n",qPrint(mod->name())); generateXMLForModule(mod.get(),t); } for (const auto &pd : *Doxygen::exampleLinkedMap) { msg("Generating XML output for example %s\n",qPrint(pd->name())); generateXMLForPage(pd.get(),t,TRUE); } if (Doxygen::mainPage) { msg("Generating XML output for the main page\n"); generateXMLForPage(Doxygen::mainPage.get(),t,FALSE); } //t << " </compoundlist>\n"; t << "</doxygenindex>\n"; } writeCombineScript(); clearSubDirs(xmlDir); }
70,845
C++
.cpp
2,156
27.855751
114
0.580807
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,480
dot.cpp
doxygen_doxygen/src/dot.cpp
/***************************************************************************** * * Copyright (C) 1997-2019 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 <cstdlib> #include <cassert> #include <sstream> #include <algorithm> #include <mutex> #include "config.h" #include "dot.h" #include "dotrunner.h" #include "dotfilepatcher.h" #include "util.h" #include "portable.h" #include "message.h" #include "doxygen.h" #include "language.h" #include "indexlist.h" #include "dir.h" #define MAP_CMD "cmapx" //-------------------------------------------------------------------- static QCString g_dotFontPath; static std::mutex g_dotManagerMutex; static void setDotFontPath(const QCString &path) { ASSERT(g_dotFontPath.isEmpty()); g_dotFontPath = Portable::getenv("DOTFONTPATH"); QCString newFontPath = Config_getString(DOT_FONTPATH); if (!newFontPath.isEmpty() && !path.isEmpty()) { newFontPath.prepend(path+Portable::pathListSeparator()); } else if (newFontPath.isEmpty() && !path.isEmpty()) { newFontPath=path; } else { Portable::unsetenv("DOTFONTPATH"); return; } Portable::setenv("DOTFONTPATH",newFontPath); } static void unsetDotFontPath() { if (g_dotFontPath.isEmpty()) { Portable::unsetenv("DOTFONTPATH"); } else { Portable::setenv("DOTFONTPATH",g_dotFontPath); } g_dotFontPath=""; } //-------------------------------------------------------------------- DotManager *DotManager::instance() { static DotManager theInstance; return &theInstance; } DotManager::DotManager() : m_runners(), m_filePatchers(), m_workers(static_cast<size_t>(Config_getInt(DOT_NUM_THREADS))) { } DotManager::~DotManager() { } DotRunner* DotManager::createRunner(const QCString &absDotName, const QCString& md5Hash) { std::lock_guard<std::mutex> lock(g_dotManagerMutex); DotRunner* rv = nullptr; auto const runit = m_runners.find(absDotName.str()); if (runit == m_runners.end()) { auto insobj = std::make_unique<DotRunner>(absDotName, md5Hash); rv = insobj.get(); m_runners.emplace(absDotName.str(), std::move(insobj)); } else { // we have a match if (md5Hash != runit->second->getMd5Hash()) { err("md5 hash does not match for two different runs of %s !\n", qPrint(absDotName)); } rv = runit->second.get(); } assert(rv); return rv; } DotFilePatcher *DotManager::createFilePatcher(const QCString &fileName) { std::lock_guard<std::mutex> lock(g_dotManagerMutex); auto patcher = m_filePatchers.find(fileName.str()); if (patcher != m_filePatchers.end()) return &(patcher->second); auto rv = m_filePatchers.emplace(fileName.str(), fileName); assert(rv.second); return &(rv.first->second); } bool DotManager::run() { size_t numDotRuns = m_runners.size(); size_t numFilePatchers = m_filePatchers.size(); if (numDotRuns+numFilePatchers>1) { if (Config_getInt(DOT_NUM_THREADS)<=1) { msg("Generating dot graphs in single threaded mode...\n"); } else { msg("Generating dot graphs using %d parallel threads...\n",Config_getInt(DOT_NUM_THREADS)); } } size_t i=1; bool setPath=FALSE; if (Config_getBool(GENERATE_HTML)) { setDotFontPath(Config_getString(HTML_OUTPUT)); setPath=TRUE; } else if (Config_getBool(GENERATE_LATEX)) { setDotFontPath(Config_getString(LATEX_OUTPUT)); setPath=TRUE; } else if (Config_getBool(GENERATE_RTF)) { setDotFontPath(Config_getString(RTF_OUTPUT)); setPath=TRUE; } else if (Config_getBool(GENERATE_DOCBOOK)) { setDotFontPath(Config_getString(DOCBOOK_OUTPUT)); setPath=TRUE; } // fill work queue with dot operations size_t prev=1; if (Config_getInt(DOT_NUM_THREADS)<=1) // no threads to work with { for (auto & dr : m_runners) { msg("Running dot for graph %zu/%zu\n",prev,numDotRuns); dr.second->run(); prev++; } } else // use multiple threads to run instances of dot in parallel { std::vector< std::future<void> > results; for (auto & dr: m_runners) { DotRunner *runner = dr.second.get(); auto process = [runner]() { runner->run(); }; results.emplace_back(m_workers.queue(process)); } for (auto &f : results) { f.get(); msg("Running dot for graph %zu/%zu\n",prev,numDotRuns); prev++; } } if (setPath) { unsetDotFontPath(); } // patch the output file and insert the maps and figures i=1; // since patching the svg files may involve patching the header of the SVG // (for zoomable SVGs), and patching the .html files requires reading that // header after the SVG is patched, we first process the .svg files and // then the other files. for (auto & fp : m_filePatchers) { if (fp.second.isSVGFile()) { msg("Patching output file %zu/%zu\n",i,numFilePatchers); if (!fp.second.run()) return FALSE; i++; } } for (auto& fp : m_filePatchers) { if (!fp.second.isSVGFile()) { msg("Patching output file %zu/%zu\n",i,numFilePatchers); if (!fp.second.run()) return FALSE; i++; } } return TRUE; } //-------------------------------------------------------------------- void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir, const QCString &outFile,GraphOutputFormat format, const QCString &srcFile,int srcLine) { Dir d(outDir.str()); if (!d.exists()) { term("Output dir %s does not exist!\n",qPrint(outDir)); } QCString imgExt = getDotImageExtension(); QCString imgName = QCString(outFile)+"."+imgExt; QCString absImgName = QCString(d.absPath())+"/"+imgName; QCString absOutFile = QCString(d.absPath())+"/"+outFile; DotRunner dotRun(inFile); if (format==GraphOutputFormat::BITMAP) { dotRun.addJob(Config_getEnumAsString(DOT_IMAGE_FORMAT),absImgName,srcFile,srcLine); } else // format==GraphOutputFormat::EPS { if (Config_getBool(USE_PDFLATEX)) { dotRun.addJob("pdf",absOutFile+".pdf",srcFile,srcLine); } else { dotRun.addJob("ps",absOutFile+".eps",srcFile,srcLine); } } dotRun.preventCleanUp(); if (!dotRun.run()) { return; } Doxygen::indexList->addImageFile(imgName); } /*! Writes user defined image map to the output. * \param t text stream to write to * \param inFile just the basename part of the filename * \param outDir output directory * \param relPath relative path the to root of the output dir * \param baseName the base name of the output files * \param context the scope in which this graph is found (for resolving links) * \param graphId a unique id for this graph, use for dynamic sections * \param srcFile the source file * \param srcLine the line number in the source file */ void writeDotImageMapFromFile(TextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context,int graphId, const QCString &srcFile,int srcLine) { Dir d(outDir.str()); if (!d.exists()) { term("Output dir %s does not exist!\n",qPrint(outDir)); } QCString mapName = baseName+".map"; QCString imgExt = getDotImageExtension(); QCString imgName = baseName+"."+imgExt; QCString absOutFile = QCString(d.absPath())+"/"+mapName; DotRunner dotRun(inFile); dotRun.addJob(MAP_CMD,absOutFile,srcFile,srcLine); dotRun.preventCleanUp(); if (!dotRun.run()) { return; } if (imgExt=="svg") // vector graphics { QCString svgName = outDir+"/"+baseName+".svg"; DotFilePatcher::writeSVGFigureLink(t,relPath,baseName,svgName); DotFilePatcher patcher(svgName); patcher.addSVGConversion("",TRUE,context,TRUE,graphId); patcher.run(); } else // bitmap graphics { TextStream tt; t << "<img src=\"" << relPath << imgName << "\" alt=\"" << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n"; DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context); if (!tt.empty()) { t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">"; t << tt.str(); t << "</map>\n"; } } d.remove(absOutFile.str()); }
8,854
C++
.cpp
300
25.516667
120
0.650006
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,481
tagreader.cpp
doxygen_doxygen/src/tagreader.cpp
/****************************************************************************** * * Copyright (C) 1997-2023 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 "tagreader.h" #include <map> #include <functional> #include <utility> #include <algorithm> #include <variant> #include <assert.h> #include <stdio.h> #include <stdarg.h> #include "xml.h" #include "entry.h" #include "doxygen.h" #include "util.h" #include "message.h" #include "defargs.h" #include "arguments.h" #include "filedef.h" #include "filename.h" #include "section.h" #include "containers.h" #include "debug.h" #include "anchor.h" #include "moduledef.h" // ----------------- private part ----------------------------------------------- namespace { /** Information about an linkable anchor */ class TagAnchorInfo { public: TagAnchorInfo(const QCString &f, const QCString &l, const QCString &t=QCString()) : label(l), fileName(f), title(t) {} QCString label; QCString fileName; QCString title; }; /** Container for enum values that are scoped within an enum */ class TagEnumValueInfo { public: QCString name; QCString file; QCString anchor; QCString clangid; }; /** Container for include info that can be read from a tagfile */ class TagIncludeInfo { public: QCString id; QCString name; QCString text; bool isLocal; bool isImported; bool isModule; bool isObjC; }; /** Container for member specific info that can be read from a tagfile */ class TagMemberInfo { public: QCString type; QCString name; QCString anchorFile; QCString anchor; QCString arglist; QCString kind; QCString clangId; std::vector<TagAnchorInfo> docAnchors; Protection prot = Protection::Public; Specifier virt = Specifier::Normal; bool isStatic = false; std::vector<TagEnumValueInfo> enumValues; int lineNr; }; /** Base class for all compound types */ struct TagCompoundInfo { std::vector<TagMemberInfo> members; QCString name; QCString filename; std::vector<TagAnchorInfo> docAnchors; int lineNr = 0; }; /** Container for class specific info that can be read from a tagfile */ struct TagClassInfo : public TagCompoundInfo { enum class Kind { None=-1, Class, Struct, Union, Interface, Exception, Protocol, Category, Enum, Service, Singleton }; TagClassInfo(Kind k) : kind(k) {} QCString clangId; QCString anchor; std::vector<BaseInfo> bases; StringVector templateArguments; StringVector classList; Kind kind; bool isObjC = false; }; using TagClassInfoPtr = std::unique_ptr<TagClassInfo>; /** Container for concept specific info that can be read from a tagfile */ struct TagConceptInfo : public TagCompoundInfo { QCString clangId; }; using TagConceptInfoPtr = std::unique_ptr<TagConceptInfo>; /** Container for module specific info that can be read from a tagfile */ struct TagModuleInfo : public TagCompoundInfo { QCString clangId; }; using TagModuleInfoPtr = std::unique_ptr<TagModuleInfo>; /** Container for namespace specific info that can be read from a tagfile */ struct TagNamespaceInfo : public TagCompoundInfo { QCString clangId; StringVector classList; StringVector conceptList; StringVector namespaceList; }; using TagNamespaceInfoPtr = std::unique_ptr<TagNamespaceInfo>; /** Container for package specific info that can be read from a tagfile */ struct TagPackageInfo : public TagCompoundInfo { StringVector classList; }; using TagPackageInfoPtr = std::unique_ptr<TagPackageInfo>; /** Container for file specific info that can be read from a tagfile */ struct TagFileInfo : public TagCompoundInfo { QCString path; StringVector classList; StringVector conceptList; StringVector namespaceList; std::vector<TagIncludeInfo> includes; }; using TagFileInfoPtr = std::unique_ptr<TagFileInfo>; /** Container for group specific info that can be read from a tagfile */ struct TagGroupInfo : public TagCompoundInfo { QCString title; StringVector subgroupList; StringVector classList; StringVector conceptList; StringVector namespaceList; StringVector fileList; StringVector pageList; StringVector dirList; StringVector moduleList; }; using TagGroupInfoPtr = std::unique_ptr<TagGroupInfo>; /** Container for page specific info that can be read from a tagfile */ struct TagPageInfo : public TagCompoundInfo { QCString title; StringVector subpages; }; using TagPageInfoPtr = std::unique_ptr<TagPageInfo>; /** Container for directory specific info that can be read from a tagfile */ struct TagDirInfo : public TagCompoundInfo { QCString path; StringVector subdirList; StringVector fileList; }; using TagDirInfoPtr = std::unique_ptr<TagDirInfo>; /** Variant class that holds a unique pointer to one of the specific container types */ class TagCompoundVariant { public: using VariantT = std::variant< std::monostate, // 0 TagClassInfoPtr, // 1 TagConceptInfoPtr, // 2 TagNamespaceInfoPtr, // 3 TagPackageInfoPtr, // 4 TagFileInfoPtr, // 5 TagGroupInfoPtr, // 6 TagPageInfoPtr, // 7 TagDirInfoPtr, // 8 TagModuleInfoPtr>; // 9 enum class Type : uint8_t { Uninitialized = 0, Class = 1, Concept = 2, Namespace = 3, Package = 4, File = 5, Group = 6, Page = 7, Dir = 8, Module = 9 }; TagCompoundVariant() {} explicit TagCompoundVariant(VariantT &&v) : m_variant(std::move(v)) {} TagCompoundVariant(const TagCompoundVariant &) = delete; TagCompoundVariant &operator=(const TagCompoundVariant &) = delete; TagCompoundVariant(TagCompoundVariant &&) = default; TagCompoundVariant &operator=(TagCompoundVariant &&) = default; ~TagCompoundVariant() = default; /** Generic non-const getter */ template<class R> R *get() { std::unique_ptr<R> *p = std::get_if<std::unique_ptr<R>>(&m_variant); return p ? p->get() : nullptr; } /** Generic const getter */ template<class R> const R *get() const { const std::unique_ptr<R> *p = std::get_if<std::unique_ptr<R>>(&m_variant); return p ? p->get() : nullptr; } /** Generic factory method to create a variant holding a unique pointer to a given compound type */ template<class R,typename... Args> static TagCompoundVariant make(Args&&... args) { return TagCompoundVariant(VariantT(std::make_unique<R>(std::forward<Args>(args)...))); } /** @name convenience const and non-const getters for each variant component * @{ */ TagClassInfo *getClassInfo() { return get<TagClassInfo >(); } const TagClassInfo *getClassInfo() const { return get<TagClassInfo >(); } TagConceptInfo *getConceptInfo() { return get<TagConceptInfo >(); } const TagConceptInfo *getConceptInfo() const { return get<TagConceptInfo >(); } TagNamespaceInfo *getNamespaceInfo() { return get<TagNamespaceInfo>(); } const TagNamespaceInfo *getNamespaceInfo() const { return get<TagNamespaceInfo>(); } TagPackageInfo *getPackageInfo() { return get<TagPackageInfo >(); } const TagPackageInfo *getPackageInfo() const { return get<TagPackageInfo >(); } TagFileInfo *getFileInfo() { return get<TagFileInfo >(); } const TagFileInfo *getFileInfo() const { return get<TagFileInfo >(); } TagGroupInfo *getGroupInfo() { return get<TagGroupInfo >(); } const TagGroupInfo *getGroupInfo() const { return get<TagGroupInfo >(); } TagPageInfo *getPageInfo() { return get<TagPageInfo >(); } const TagPageInfo *getPageInfo() const { return get<TagPageInfo >(); } TagDirInfo *getDirInfo() { return get<TagDirInfo >(); } const TagDirInfo *getDirInfo() const { return get<TagDirInfo >(); } TagModuleInfo *getModuleInfo() { return get<TagModuleInfo >(); } const TagModuleInfo *getModuleInfo() const { return get<TagModuleInfo >(); } /** @} */ /** Convenience method to get the shared compound info */ TagCompoundInfo *getCompoundInfo() { switch(type()) { case Type::Uninitialized: return nullptr; case Type::Class: return getClassInfo(); case Type::Concept: return getConceptInfo(); case Type::Namespace: return getNamespaceInfo(); case Type::Package: return getPackageInfo(); case Type::File: return getFileInfo(); case Type::Group: return getGroupInfo(); case Type::Page: return getPageInfo(); case Type::Dir: return getDirInfo(); case Type::Module: return getModuleInfo(); } return nullptr; } Type type() const { return static_cast<Type>(m_variant.index()); } private: VariantT m_variant; }; /** Tag file parser. * * Reads an XML-structured tagfile and builds up the structure in * memory. The method buildLists() is used to transfer/translate * the structures to the doxygen engine. */ class TagFileParser { public: explicit TagFileParser(const char *tagName) : m_tagName(tagName) {} void setDocumentLocator ( const XMLLocator * locator ) { m_locator = locator; } void startDocument() { m_state = Invalid; } void startElement( const QCString &name, const XMLHandlers::Attributes& attrib ); void endElement( const QCString &name ); void characters ( const QCString & ch ) { m_curString+=ch; } void error( const QCString &fileName,int lineNr,const QCString &msg) { ::warn_(fileName,lineNr,"%s",qPrint(msg)); } void dump(); void buildLists(const std::shared_ptr<Entry> &root); void addIncludes(); void startCompound( const XMLHandlers::Attributes& attrib ); void endCompound() { switch (m_state) { case InClass: case InConcept: case InFile: case InNamespace: case InGroup: case InPage: case InDir: case InModule: case InPackage: m_tagFileCompounds.push_back(std::move(m_curCompound)); break; default: p_warn("tag 'compound' was not expected!"); break; } } void startMember( const XMLHandlers::Attributes& attrib) { m_curMember = TagMemberInfo(); m_curMember.kind = XMLHandlers::value(attrib,"kind"); QCString protStr = XMLHandlers::value(attrib,"protection"); QCString virtStr = XMLHandlers::value(attrib,"virtualness"); QCString staticStr = XMLHandlers::value(attrib,"static"); m_curMember.lineNr = m_locator->lineNr(); if (protStr=="protected") { m_curMember.prot = Protection::Protected; } else if (protStr=="private") { m_curMember.prot = Protection::Private; } if (virtStr=="virtual") { m_curMember.virt = Specifier::Virtual; } else if (virtStr=="pure") { m_curMember.virt = Specifier::Pure; } if (staticStr=="yes") { m_curMember.isStatic = TRUE; } m_stateStack.push(m_state); m_state = InMember; } void endMember() { m_state = m_stateStack.top(); m_stateStack.pop(); switch(m_state) { case InClass: case InFile: case InNamespace: case InGroup: case InPackage: { TagCompoundInfo *info = m_curCompound.getCompoundInfo(); if (info) { info->members.push_back(m_curMember); } } break; default: p_warn("Unexpected tag 'member' found"); break; } } void startEnumValue( const XMLHandlers::Attributes& attrib) { if (m_state==InMember) { m_curString = ""; m_curEnumValue = TagEnumValueInfo(); m_curEnumValue.file = XMLHandlers::value(attrib,"file"); m_curEnumValue.anchor = XMLHandlers::value(attrib,"anchor"); m_curEnumValue.clangid = XMLHandlers::value(attrib,"clangid"); m_stateStack.push(m_state); m_state = InEnumValue; } else { p_warn("Found 'enumvalue' tag outside of member tag"); } } void endEnumValue() { m_curEnumValue.name = QCString(m_curString).stripWhiteSpace().str(); m_state = m_stateStack.top(); m_stateStack.pop(); if (m_state==InMember) { m_curMember.enumValues.push_back(m_curEnumValue); m_curEnumValue=TagEnumValueInfo(); } } void endDocAnchor() { // Check whether or not the tag is automatically generate, in that case ignore the tag. switch(m_state) { case InClass: case InConcept: case InFile: case InNamespace: case InGroup: case InPage: case InMember: case InPackage: case InDir: case InModule: if (AnchorGenerator::looksGenerated(m_curString.str())) return; break; default: p_warn("Unexpected tag 'docanchor' found"); return; } switch(m_state) { case InClass: case InConcept: case InFile: case InNamespace: case InGroup: case InPage: case InPackage: case InDir: case InModule: { TagCompoundInfo *info = m_curCompound.getCompoundInfo(); if (info) { info->docAnchors.emplace_back(m_fileName,m_curString,m_title); } } break; case InMember: m_curMember.docAnchors.emplace_back(m_fileName,m_curString,m_title); break; default: break; // will not be reached } } void endClass() { switch(m_state) { case InClass: { TagClassInfo *info = m_curCompound.getClassInfo(); if (info) info->classList.push_back(m_curString.str()); } break; case InFile: { TagFileInfo *info = m_curCompound.getFileInfo(); if (info) info->classList.push_back(m_curString.str()); } break; case InNamespace: { TagNamespaceInfo *info = m_curCompound.getNamespaceInfo(); if (info) info->classList.push_back(m_curString.str()); } break; case InGroup: { TagGroupInfo *info = m_curCompound.getGroupInfo(); if (info) info->classList.push_back(m_curString.str()); } break; case InPackage: { TagPackageInfo *info = m_curCompound.getPackageInfo(); if (info) info->classList.push_back(m_curString.str()); } break; default: p_warn("Unexpected tag 'class' found"); break; } } void endConcept() { switch(m_state) { case InNamespace: { TagNamespaceInfo *info = m_curCompound.getNamespaceInfo(); if (info) info->conceptList.push_back(m_curString.str()); } break; case InFile: { TagFileInfo *info = m_curCompound.getFileInfo(); if (info) info->conceptList.push_back(m_curString.str()); } break; case InGroup: { TagGroupInfo *info = m_curCompound.getGroupInfo(); if (info) info->conceptList.push_back(m_curString.str()); } break; default: p_warn("Unexpected tag 'concept' found"); break; } } void endModule() { switch(m_state) { case InGroup: { TagGroupInfo *info = m_curCompound.getGroupInfo(); if (info) info->moduleList.push_back(m_curString.str()); } break; default: p_warn("Unexpected tag 'module' found"); break; } } void endNamespace() { switch(m_state) { case InNamespace: { TagNamespaceInfo *info = m_curCompound.getNamespaceInfo(); if (info) info->namespaceList.push_back(m_curString.str()); } break; case InFile: { TagFileInfo *info = m_curCompound.getFileInfo(); if (info) info->namespaceList.push_back(m_curString.str()); } break; case InGroup: { TagGroupInfo *info = m_curCompound.getGroupInfo(); if (info) info->namespaceList.push_back(m_curString.str()); } break; default: p_warn("Unexpected tag 'namespace' found"); break; } } void endFile() { switch(m_state) { case InGroup: { TagGroupInfo *info = m_curCompound.getGroupInfo(); if (info) info->fileList.push_back(m_curString.str()); } break; case InDir: { TagDirInfo *info = m_curCompound.getDirInfo(); if (info) info->fileList.push_back(m_curString.str()); } break; default: p_warn("Unexpected tag 'file' found"); break; } } void endPage() { switch(m_state) { case InGroup: { TagGroupInfo *info = m_curCompound.getGroupInfo(); if (info) info->fileList.push_back(m_curString.str()); } break; default: p_warn("Unexpected tag 'page' found"); break; } } void endSubpage() { switch(m_state) { case InPage: { TagPageInfo *info = m_curCompound.getPageInfo(); if (info) info->subpages.push_back(m_curString.str()); } break; default: p_warn("Unexpected tag 'subpage' found"); break; } } void endDir() { switch(m_state) { case InDir: { TagDirInfo *info = m_curCompound.getDirInfo(); if (info) info->subdirList.push_back(m_curString.str()); } break; default: p_warn("Unexpected tag 'dir' found"); break; } } void startStringValue(const XMLHandlers::Attributes& ) { m_curString = ""; } void startDocAnchor(const XMLHandlers::Attributes& attrib ) { m_fileName = XMLHandlers::value(attrib,"file"); m_title = XMLHandlers::value(attrib,"title"); m_curString = ""; } void endType() { if (m_state==InMember) { m_curMember.type = m_curString; } else { p_warn("Unexpected tag 'type' found"); } } void endName() { switch (m_state) { case InClass: case InConcept: case InFile: case InNamespace: case InGroup: case InPage: case InDir: case InPackage: case InModule: { TagCompoundInfo *info = m_curCompound.getCompoundInfo(); if (info) info->name = m_curString; } break; case InMember: m_curMember.name = m_curString; break; default: p_warn("Unexpected tag 'name' found"); break; } } void startBase(const XMLHandlers::Attributes& attrib ) { m_curString=""; TagClassInfo *info = m_curCompound.getClassInfo(); if (m_state==InClass && info) { QCString protStr = XMLHandlers::value(attrib,"protection"); QCString virtStr = XMLHandlers::value(attrib,"virtualness"); Protection prot = Protection::Public; Specifier virt = Specifier::Normal; if (protStr=="protected") { prot = Protection::Protected; } else if (protStr=="private") { prot = Protection::Private; } if (virtStr=="virtual") { virt = Specifier::Virtual; } info->bases.emplace_back(m_curString,prot,virt); } else { p_warn("Unexpected tag 'base' found"); } } void endBase() { TagClassInfo *info = m_curCompound.getClassInfo(); if (m_state==InClass && info) { info->bases.back().name = m_curString; } else { p_warn("Unexpected tag 'base' found"); } } void startIncludes(const XMLHandlers::Attributes& attrib ) { m_curIncludes = TagIncludeInfo(); m_curIncludes.id = XMLHandlers::value(attrib,"id"); m_curIncludes.name = XMLHandlers::value(attrib,"name"); m_curIncludes.isLocal = XMLHandlers::value(attrib,"local")=="yes"; m_curIncludes.isImported = XMLHandlers::value(attrib,"imported")=="yes"; m_curIncludes.isModule = XMLHandlers::value(attrib,"module")=="yes"; m_curIncludes.isObjC = XMLHandlers::value(attrib,"objc")=="yes"; m_curString=""; } void endIncludes() { m_curIncludes.text = m_curString; TagFileInfo *info = m_curCompound.getFileInfo(); if (m_state==InFile && info) { info->includes.push_back(m_curIncludes); } else { p_warn("Unexpected tag 'includes' found"); } } void endTemplateArg() { TagClassInfo *info = m_curCompound.getClassInfo(); if (m_state==InClass && info) { info->templateArguments.push_back(m_curString.str()); } else { p_warn("Unexpected tag 'templarg' found"); } } void endFilename() { switch (m_state) { case InClass: case InConcept: case InNamespace: case InFile: case InGroup: case InPage: case InPackage: case InDir: case InModule: { TagCompoundInfo *info = m_curCompound.getCompoundInfo(); if (info) info->filename = m_curString; } break; default: p_warn("Unexpected tag 'filename' found"); break; } } void endPath() { switch (m_state) { case InFile: { TagFileInfo *info = m_curCompound.getFileInfo(); if (info) info->path = m_curString; } break; case InDir: { TagDirInfo *info = m_curCompound.getDirInfo(); if (info) info->path = m_curString; } break; default: p_warn("Unexpected tag 'path' found"); break; } } void endAnchor() { if (m_state==InMember) { m_curMember.anchor = m_curString; } else if (m_state==InClass) { TagClassInfo *info = m_curCompound.getClassInfo(); if (info) info->anchor = m_curString; } else { p_warn("Unexpected tag 'anchor' found"); } } void endClangId() { if (m_state==InMember) { m_curMember.clangId = m_curString; } else if (m_state==InClass) { TagClassInfo *info = m_curCompound.getClassInfo(); if (info) info->clangId = m_curString; } else if (m_state==InNamespace) { TagNamespaceInfo *info = m_curCompound.getNamespaceInfo(); if (info) info->clangId = m_curString; } else { p_warn("Unexpected tag 'clangid' found"); } } void endAnchorFile() { if (m_state==InMember) { m_curMember.anchorFile = m_curString; } else { p_warn("Unexpected tag 'anchorfile' found"); } } void endArglist() { if (m_state==InMember) { m_curMember.arglist = m_curString; } else { p_warn("Unexpected tag 'arglist' found"); } } void endTitle() { switch (m_state) { case InGroup: { TagGroupInfo *info = m_curCompound.getGroupInfo(); if (info) info->title = m_curString; } break; case InPage: { TagPageInfo *info = m_curCompound.getPageInfo(); if (info) info->title = m_curString; } break; default: p_warn("Unexpected tag 'title' found"); break; } } void endSubgroup() { if (m_state==InGroup) { TagGroupInfo *info = m_curCompound.getGroupInfo(); if (info) info->subgroupList.push_back(m_curString.str()); } else { p_warn("Unexpected tag 'subgroup' found"); } } void startIgnoreElement(const XMLHandlers::Attributes& ) { } void endIgnoreElement() { } void buildMemberList(const std::shared_ptr<Entry> &ce,const std::vector<TagMemberInfo> &members); void addDocAnchors(const std::shared_ptr<Entry> &e,const std::vector<TagAnchorInfo> &l); enum State { Invalid, InClass, InConcept, InFile, InNamespace, InGroup, InPage, InMember, InEnumValue, InPackage, InDir, InModule, InTempArgList }; private: void p_warn(const char *fmt) { QCString fileName = m_locator->fileName(); ::warn_(fileName,m_locator->lineNr(),"%s", fmt); } void p_warn(const char *fmt,const char *s) { QCString fileName = m_locator->fileName(); ::warn_(fileName,m_locator->lineNr(),fmt,s); } //------------------------------------ std::vector< TagCompoundVariant > m_tagFileCompounds; TagCompoundVariant m_curCompound; TagMemberInfo m_curMember; TagEnumValueInfo m_curEnumValue; TagIncludeInfo m_curIncludes; QCString m_curString; QCString m_tagName; QCString m_fileName; QCString m_title; State m_state = Invalid; std::stack<State> m_stateStack; const XMLLocator *m_locator = nullptr; }; //--------------------------------------------------------------------------------------------------------------- struct ElementCallbacks { using StartCallback = std::function<void(TagFileParser&,const XMLHandlers::Attributes&)>; using EndCallback = std::function<void(TagFileParser&)>; StartCallback startCb; EndCallback endCb; }; ElementCallbacks::StartCallback startCb(void (TagFileParser::*fn)(const XMLHandlers::Attributes &)) { return [fn](TagFileParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(attr); }; } ElementCallbacks::EndCallback endCb(void (TagFileParser::*fn)()) { return [fn](TagFileParser &parser) { (parser.*fn)(); }; } static const std::map< std::string, ElementCallbacks > g_elementHandlers = { // name, start element callback, end element callback { "compound", { startCb(&TagFileParser::startCompound ), endCb(&TagFileParser::endCompound ) } }, { "member", { startCb(&TagFileParser::startMember ), endCb(&TagFileParser::endMember ) } }, { "enumvalue", { startCb(&TagFileParser::startEnumValue ), endCb(&TagFileParser::endEnumValue ) } }, { "name", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endName ) } }, { "base", { startCb(&TagFileParser::startBase ), endCb(&TagFileParser::endBase ) } }, { "filename", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endFilename ) } }, { "includes", { startCb(&TagFileParser::startIncludes ), endCb(&TagFileParser::endIncludes ) } }, { "path", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endPath ) } }, { "anchorfile", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endAnchorFile ) } }, { "anchor", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endAnchor ) } }, { "clangid", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endClangId ) } }, { "arglist", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endArglist ) } }, { "title", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endTitle ) } }, { "subgroup", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endSubgroup ) } }, { "class", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endClass ) } }, { "concept", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endConcept ) } }, { "module", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endModule ) } }, { "namespace", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endNamespace ) } }, { "file", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endFile ) } }, { "dir", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endDir ) } }, { "page", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endPage ) } }, { "subpage", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endSubpage ) } }, { "docanchor", { startCb(&TagFileParser::startDocAnchor ), endCb(&TagFileParser::endDocAnchor ) } }, { "tagfile", { startCb(&TagFileParser::startIgnoreElement), endCb(&TagFileParser::endIgnoreElement) } }, { "templarg", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endTemplateArg ) } }, { "type", { startCb(&TagFileParser::startStringValue ), endCb(&TagFileParser::endType ) } } }; //--------------------------------------------------------------------------------------------------------------- struct CompoundFactory { using CreateFunc = std::function<TagCompoundVariant()>; CompoundFactory(TagFileParser::State s,const CreateFunc &f) : state(s), make_instance(f) {} TagFileParser::State state; CreateFunc make_instance; }; static const std::map< std::string, CompoundFactory > g_compoundFactory = { // kind tag state creation function { "class", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Class); } } }, { "struct", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Struct); } } }, { "union", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Union); } } }, { "interface", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Interface); } } }, { "enum", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Enum); } } }, { "exception", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Exception); } } }, { "protocol", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Protocol); } } }, { "category", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Category); } } }, { "service", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Service); } } }, { "singleton", { TagFileParser::InClass, []() { return TagCompoundVariant::make<TagClassInfo>(TagClassInfo::Kind::Singleton); } } }, { "file", { TagFileParser::InFile, []() { return TagCompoundVariant::make<TagFileInfo>(); } } }, { "namespace", { TagFileParser::InNamespace, []() { return TagCompoundVariant::make<TagNamespaceInfo>(); } } }, { "concept", { TagFileParser::InConcept, []() { return TagCompoundVariant::make<TagConceptInfo>(); } } }, { "module", { TagFileParser::InModule, []() { return TagCompoundVariant::make<TagModuleInfo>(); } } }, { "group", { TagFileParser::InGroup, []() { return TagCompoundVariant::make<TagGroupInfo>(); } } }, { "page", { TagFileParser::InPage, []() { return TagCompoundVariant::make<TagPageInfo>(); } } }, { "package", { TagFileParser::InPackage, []() { return TagCompoundVariant::make<TagPackageInfo>(); } } }, { "dir", { TagFileParser::InDir, []() { return TagCompoundVariant::make<TagDirInfo>(); } } } }; //--------------------------------------------------------------------------------------------------------------- void TagFileParser::startElement( const QCString &name, const XMLHandlers::Attributes& attrib ) { //printf("startElement '%s'\n",qPrint(name)); auto it = g_elementHandlers.find(name.str()); if (it!=std::end(g_elementHandlers)) { it->second.startCb(*this,attrib); } else { p_warn("Unknown start tag '%s' found!",qPrint(name)); } } void TagFileParser::endElement( const QCString &name ) { //printf("endElement '%s'\n",qPrint(name)); auto it = g_elementHandlers.find(name.str()); if (it!=std::end(g_elementHandlers)) { it->second.endCb(*this); } else { p_warn("Unknown end tag '%s' found!",qPrint(name)); } } void TagFileParser::startCompound( const XMLHandlers::Attributes& attrib ) { m_curString = ""; std::string kind = XMLHandlers::value(attrib,"kind"); std::string isObjC = XMLHandlers::value(attrib,"objc"); auto it = g_compoundFactory.find(kind); if (it!=g_compoundFactory.end()) { m_curCompound = it->second.make_instance(); m_state = it->second.state; TagCompoundInfo *info = m_curCompound.getCompoundInfo(); if (info) info->lineNr = m_locator->lineNr(); } else { p_warn("Unknown compound attribute '%s' found!",kind.c_str()); m_state = Invalid; } TagClassInfo *classInfo = m_curCompound.getClassInfo(); if (isObjC=="yes" && classInfo) { classInfo->isObjC = TRUE; } } /*! Dumps the internal structures. For debugging only! */ void TagFileParser::dump() { Debug::print(Debug::Tag,0,"-------- Results --------\n"); //============== CLASSES for (const auto &comp : m_tagFileCompounds) { if (comp.type()==TagCompoundVariant::Type::Class) { const TagClassInfo *cd = comp.getClassInfo(); Debug::print(Debug::Tag,0,"class '%s'\n",qPrint(cd->name)); Debug::print(Debug::Tag,0," filename '%s'\n",qPrint(cd->filename)); for (const BaseInfo &bi : cd->bases) { Debug::print(Debug::Tag,0, " base: %s \n", bi.name.isEmpty() ? "" : qPrint(bi.name) ); } for (const auto &md : cd->members) { Debug::print(Debug::Tag,0," member:\n"); Debug::print(Debug::Tag,0," kind: '%s'\n",qPrint(md.kind)); Debug::print(Debug::Tag,0," name: '%s'\n",qPrint(md.name)); Debug::print(Debug::Tag,0," anchor: '%s'\n",qPrint(md.anchor)); Debug::print(Debug::Tag,0," arglist: '%s'\n",qPrint(md.arglist)); } } } //============== CONCEPTS for (const auto &comp : m_tagFileCompounds) { if (comp.type()==TagCompoundVariant::Type::Concept) { const TagConceptInfo *cd = comp.getConceptInfo(); Debug::print(Debug::Tag,0,"concept '%s'\n",qPrint(cd->name)); Debug::print(Debug::Tag,0," filename '%s'\n",qPrint(cd->filename)); } } //============== MODULES for (const auto &comp : m_tagFileCompounds) { if (comp.type()==TagCompoundVariant::Type::Module) { const TagModuleInfo *mi = comp.getModuleInfo(); Debug::print(Debug::Tag,0,"module '%s'\n",qPrint(mi->name)); Debug::print(Debug::Tag,0," filename '%s'\n",qPrint(mi->filename)); } } //============== NAMESPACES for (const auto &comp : m_tagFileCompounds) { if (comp.type()==TagCompoundVariant::Type::Namespace) { const TagNamespaceInfo *nd = comp.getNamespaceInfo(); Debug::print(Debug::Tag,0,"namespace '%s'\n",qPrint(nd->name)); Debug::print(Debug::Tag,0," filename '%s'\n",qPrint(nd->filename)); for (const auto &cls : nd->classList) { Debug::print(Debug::Tag,0, " class: %s \n", cls.c_str() ); } for (const auto &md : nd->members) { Debug::print(Debug::Tag,0," member:\n"); Debug::print(Debug::Tag,0," kind: '%s'\n",qPrint(md.kind)); Debug::print(Debug::Tag,0," name: '%s'\n",qPrint(md.name)); Debug::print(Debug::Tag,0," anchor: '%s'\n",qPrint(md.anchor)); Debug::print(Debug::Tag,0," arglist: '%s'\n",qPrint(md.arglist)); } } } //============== FILES for (const auto &comp : m_tagFileCompounds) { if (comp.type()==TagCompoundVariant::Type::File) { const TagFileInfo *fd = comp.getFileInfo(); Debug::print(Debug::Tag,0,"file '%s'\n",qPrint(fd->name)); Debug::print(Debug::Tag,0," filename '%s'\n",qPrint(fd->filename)); for (const auto &ns : fd->namespaceList) { Debug::print(Debug::Tag,0, " namespace: %s \n", ns.c_str() ); } for (const auto &cs : fd->classList) { Debug::print(Debug::Tag,0, " class: %s \n", cs.c_str() ); } for (const auto &md : fd->members) { Debug::print(Debug::Tag,0," member:\n"); Debug::print(Debug::Tag,0," kind: '%s'\n",qPrint(md.kind)); Debug::print(Debug::Tag,0," name: '%s'\n",qPrint(md.name)); Debug::print(Debug::Tag,0," anchor: '%s'\n",qPrint(md.anchor)); Debug::print(Debug::Tag,0," arglist: '%s'\n",qPrint(md.arglist)); } for (const auto &ii : fd->includes) { Debug::print(Debug::Tag,0," includes id: %s name: %s\n",qPrint(ii.id),qPrint(ii.name)); } } } //============== GROUPS for (const auto &comp : m_tagFileCompounds) { if (comp.type()==TagCompoundVariant::Type::Group) { const TagGroupInfo *gd = comp.getGroupInfo(); Debug::print(Debug::Tag,0,"group '%s'\n",qPrint(gd->name)); Debug::print(Debug::Tag,0," filename '%s'\n",qPrint(gd->filename)); for (const auto &ns : gd->namespaceList) { Debug::print(Debug::Tag,0, " namespace: %s \n", ns.c_str() ); } for (const auto &cs : gd->classList) { Debug::print(Debug::Tag,0, " class: %s \n", cs.c_str() ); } for (const auto &fi : gd->fileList) { Debug::print(Debug::Tag,0, " file: %s \n", fi.c_str() ); } for (const auto &sg : gd->subgroupList) { Debug::print(Debug::Tag,0, " subgroup: %s \n", sg.c_str() ); } for (const auto &pg : gd->pageList) { Debug::print(Debug::Tag,0, " page: %s \n", pg.c_str() ); } for (const auto &md : gd->members) { Debug::print(Debug::Tag,0," member:\n"); Debug::print(Debug::Tag,0," kind: '%s'\n",qPrint(md.kind)); Debug::print(Debug::Tag,0," name: '%s'\n",qPrint(md.name)); Debug::print(Debug::Tag,0," anchor: '%s'\n",qPrint(md.anchor)); Debug::print(Debug::Tag,0," arglist: '%s'\n",qPrint(md.arglist)); } } } //============== PAGES for (const auto &comp : m_tagFileCompounds) { if (comp.type()==TagCompoundVariant::Type::Page) { const TagPageInfo *pd = comp.getPageInfo(); Debug::print(Debug::Tag,0,"page '%s'\n",qPrint(pd->name)); Debug::print(Debug::Tag,0," title '%s'\n",qPrint(pd->title)); Debug::print(Debug::Tag,0," filename '%s'\n",qPrint(pd->filename)); } } //============== DIRS for (const auto &comp : m_tagFileCompounds) { if (comp.type()==TagCompoundVariant::Type::Dir) { const TagDirInfo *dd = comp.getDirInfo(); { Debug::print(Debug::Tag,0,"dir '%s'\n",qPrint(dd->name)); Debug::print(Debug::Tag,0," path '%s'\n",qPrint(dd->path)); for (const auto &fi : dd->fileList) { Debug::print(Debug::Tag,0, " file: %s \n", fi.c_str() ); } for (const auto &sd : dd->subdirList) { Debug::print(Debug::Tag,0, " subdir: %s \n", sd.c_str() ); } } } } Debug::print(Debug::Tag,0,"-------------------------\n"); } void TagFileParser::addDocAnchors(const std::shared_ptr<Entry> &e,const std::vector<TagAnchorInfo> &l) { for (const auto &ta : l) { if (SectionManager::instance().find(QCString(ta.label))==nullptr) { //printf("New sectionInfo file=%s anchor=%s\n", // qPrint(ta->fileName),qPrint(ta->label)); SectionInfo *si=SectionManager::instance().add( ta.label,ta.fileName,-1,ta.title, SectionType::Anchor,0,m_tagName); e->anchors.push_back(si); } else { //printf("Replace sectionInfo file=%s anchor=%s\n", // qPrint(ta->fileName),qPrint(ta->label)); SectionManager::instance().replace( ta.label,ta.fileName,-1,ta.title, SectionType::Anchor,0,m_tagName); } } } void TagFileParser::buildMemberList(const std::shared_ptr<Entry> &ce,const std::vector<TagMemberInfo> &members) { for (const auto &tmi : members) { std::shared_ptr<Entry> me = std::make_shared<Entry>(); me->type = tmi.type; me->name = tmi.name; me->args = tmi.arglist; if (!me->args.isEmpty()) { me->argList = *stringToArgumentList(SrcLangExt::Cpp,me->args); } if (tmi.enumValues.size()>0) { me->spec.setStrong(true); for (const auto &evi : tmi.enumValues) { std::shared_ptr<Entry> ev = std::make_shared<Entry>(); ev->type = "@"; ev->name = evi.name; ev->id = evi.clangid; ev->section = EntryType::makeVariable(); ev->tagInfoData.tagName = m_tagName; ev->tagInfoData.anchor = evi.anchor; ev->tagInfoData.fileName = evi.file; ev->hasTagInfo = TRUE; me->moveToSubEntryAndKeep(ev); } } me->protection = tmi.prot; me->virt = tmi.virt; me->isStatic = tmi.isStatic; me->fileName = ce->fileName; me->id = tmi.clangId; me->startLine = tmi.lineNr; if (ce->section.isGroupDoc()) { me->groups.emplace_back(ce->name,Grouping::GROUPING_INGROUP); } addDocAnchors(me,tmi.docAnchors); me->tagInfoData.tagName = m_tagName; me->tagInfoData.anchor = tmi.anchor; me->tagInfoData.fileName = tmi.anchorFile; me->hasTagInfo = TRUE; if (tmi.kind=="define") { me->type="#define"; me->section = EntryType::makeDefine(); } else if (tmi.kind=="enumvalue") { me->section = EntryType::makeVariable(); me->mtype = MethodTypes::Method; } else if (tmi.kind=="property") { me->section = EntryType::makeVariable(); me->mtype = MethodTypes::Property; } else if (tmi.kind=="event") { me->section = EntryType::makeVariable(); me->mtype = MethodTypes::Event; } else if (tmi.kind=="variable") { me->section = EntryType::makeVariable(); me->mtype = MethodTypes::Method; } else if (tmi.kind=="typedef") { me->section = EntryType::makeVariable(); me->type.prepend("typedef "); me->mtype = MethodTypes::Method; } else if (tmi.kind=="enumeration") { me->section = EntryType::makeEnum(); me->mtype = MethodTypes::Method; } else if (tmi.kind=="function") { me->section = EntryType::makeFunction(); me->mtype = MethodTypes::Method; } else if (tmi.kind=="signal") { me->section = EntryType::makeFunction(); me->mtype = MethodTypes::Signal; } else if (tmi.kind=="prototype") { me->section = EntryType::makeFunction(); me->mtype = MethodTypes::Method; } else if (tmi.kind=="friend") { me->section = EntryType::makeFunction(); me->type.prepend("friend "); me->mtype = MethodTypes::Method; } else if (tmi.kind=="dcop") { me->section = EntryType::makeFunction(); me->mtype = MethodTypes::DCOP; } else if (tmi.kind=="slot") { me->section = EntryType::makeFunction(); me->mtype = MethodTypes::Slot; } ce->moveToSubEntryAndKeep(me); } } /*! Injects the info gathered by the XML parser into the Entry tree. * This tree contains the information extracted from the input in a * "unrelated" form. */ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) { // build class list for (const auto &comp : m_tagFileCompounds) { const TagClassInfo *tci = comp.getClassInfo(); if (tci) { std::shared_ptr<Entry> ce = std::make_shared<Entry>(); ce->section = EntryType::makeClass(); switch (tci->kind) { case TagClassInfo::Kind::Class: break; case TagClassInfo::Kind::Struct: ce->spec = TypeSpecifier().setStruct(true); break; case TagClassInfo::Kind::Union: ce->spec = TypeSpecifier().setUnion(true); break; case TagClassInfo::Kind::Interface: ce->spec = TypeSpecifier().setInterface(true); break; case TagClassInfo::Kind::Enum: ce->spec = TypeSpecifier().setEnum(true); break; case TagClassInfo::Kind::Exception: ce->spec = TypeSpecifier().setException(true); break; case TagClassInfo::Kind::Protocol: ce->spec = TypeSpecifier().setProtocol(true); break; case TagClassInfo::Kind::Category: ce->spec = TypeSpecifier().setCategory(true); break; case TagClassInfo::Kind::Service: ce->spec = TypeSpecifier().setService(true); break; case TagClassInfo::Kind::Singleton: ce->spec = TypeSpecifier().setSingleton(true); break; case TagClassInfo::Kind::None: // should never happen, means not properly initialized assert(tci->kind != TagClassInfo::Kind::None); break; } ce->name = tci->name; if (tci->kind==TagClassInfo::Kind::Protocol) { ce->name+="-p"; } addDocAnchors(ce,tci->docAnchors); ce->tagInfoData.tagName = m_tagName; ce->tagInfoData.anchor = tci->anchor; ce->tagInfoData.fileName = tci->filename; ce->startLine = tci->lineNr; ce->fileName = m_tagName; ce->hasTagInfo = TRUE; ce->id = tci->clangId; ce->lang = tci->isObjC ? SrcLangExt::ObjC : SrcLangExt::Unknown; // transfer base class list ce->extends = tci->bases; if (!tci->templateArguments.empty()) { ArgumentList al; for (const auto &argName : tci->templateArguments) { Argument a; a.type = "class"; a.name = argName.c_str(); al.push_back(a); } ce->tArgLists.push_back(al); } buildMemberList(ce,tci->members); root->moveToSubEntryAndKeep(ce); } } // build file list for (const auto &comp : m_tagFileCompounds) { const TagFileInfo *tfi = comp.getFileInfo(); if (tfi) { std::shared_ptr<Entry> fe = std::make_shared<Entry>(); fe->section = guessSection(tfi->name); fe->name = tfi->name; addDocAnchors(fe,tfi->docAnchors); fe->tagInfoData.tagName = m_tagName; fe->tagInfoData.fileName = tfi->filename; fe->hasTagInfo = TRUE; QCString fullName = m_tagName+":"+tfi->path+stripPath(tfi->name); fe->fileName = fullName; fe->startLine = tfi->lineNr; //printf("createFileDef() filename=%s\n",qPrint(tfi->filename)); QCString tagid = m_tagName+":"+tfi->path; auto fd = createFileDef(tagid, tfi->name,m_tagName, tfi->filename); FileName *mn = Doxygen::inputNameLinkedMap->find(tfi->name); if (mn) { mn->push_back(std::move(fd)); } else { mn = Doxygen::inputNameLinkedMap->add(tfi->name,fullName); mn->push_back(std::move(fd)); } buildMemberList(fe,tfi->members); root->moveToSubEntryAndKeep(fe); } } // build concept list for (const auto &comp : m_tagFileCompounds) { const TagConceptInfo *tci = comp.getConceptInfo(); if (tci) { std::shared_ptr<Entry> ce = std::make_shared<Entry>(); ce->section = EntryType::makeConcept(); ce->name = tci->name; addDocAnchors(ce,tci->docAnchors); ce->tagInfoData.tagName = m_tagName; ce->tagInfoData.fileName = tci->filename; ce->startLine = tci->lineNr; ce->fileName = m_tagName; ce->hasTagInfo = TRUE; ce->id = tci->clangId; root->moveToSubEntryAndKeep(ce); } } // build module list for (const auto &comp : m_tagFileCompounds) { const TagModuleInfo *tmi = comp.getModuleInfo(); if (tmi) { auto &mm = ModuleManager::instance(); mm.createModuleDef(tmi->filename,tmi->lineNr,1,true,tmi->name,QCString()); mm.addTagInfo(tmi->filename,m_tagName,tmi->clangId); ModuleDef *mod = mm.getPrimaryInterface(tmi->name); if (mod && !tmi->docAnchors.empty()) { std::vector<const SectionInfo *> anchorList; for (const auto &ta : tmi->docAnchors) { if (SectionManager::instance().find(QCString(ta.label))==nullptr) { //printf("New sectionInfo file=%s anchor=%s\n", // qPrint(ta->fileName),qPrint(ta->label)); SectionInfo *si=SectionManager::instance().add( ta.label,ta.fileName,-1,ta.title, SectionType::Anchor,0,m_tagName); anchorList.push_back(si); } else { p_warn("Duplicate anchor %s found",qPrint(ta.label)); } } mod->addSectionsToDefinition(anchorList); } } } // build namespace list for (const auto &comp : m_tagFileCompounds) { const TagNamespaceInfo *tni = comp.getNamespaceInfo(); if (tni) { std::shared_ptr<Entry> ne = std::make_shared<Entry>(); ne->section = EntryType::makeNamespace(); ne->name = tni->name; addDocAnchors(ne,tni->docAnchors); ne->tagInfoData.tagName = m_tagName; ne->tagInfoData.fileName = tni->filename; ne->startLine = tni->lineNr; ne->fileName = m_tagName; ne->hasTagInfo = TRUE; ne->id = tni->clangId; buildMemberList(ne,tni->members); root->moveToSubEntryAndKeep(ne); } } // build package list for (const auto &comp : m_tagFileCompounds) { const TagPackageInfo *tpgi = comp.getPackageInfo(); if (tpgi) { std::shared_ptr<Entry> pe = std::make_shared<Entry>(); pe->section = EntryType::makePackage(); pe->name = tpgi->name; addDocAnchors(pe,tpgi->docAnchors); pe->tagInfoData.tagName = m_tagName; pe->tagInfoData.fileName = tpgi->filename; pe->startLine = tpgi->lineNr; pe->fileName = m_tagName; pe->hasTagInfo = TRUE; buildMemberList(pe,tpgi->members); root->moveToSubEntryAndKeep(pe); } } // build group list for (const auto &comp : m_tagFileCompounds) { const TagGroupInfo *tgi = comp.getGroupInfo(); if (tgi) { std::shared_ptr<Entry> ge = std::make_shared<Entry>(); ge->section = EntryType::makeGroupDoc(); ge->name = tgi->name; ge->type = tgi->title; addDocAnchors(ge,tgi->docAnchors); ge->tagInfoData.tagName = m_tagName; ge->tagInfoData.fileName = tgi->filename; ge->startLine = tgi->lineNr; ge->fileName = m_tagName; ge->hasTagInfo = TRUE; buildMemberList(ge,tgi->members); root->moveToSubEntryAndKeep(ge); } } for (const auto &comp : m_tagFileCompounds) { const TagGroupInfo *tgi = comp.getGroupInfo(); if (tgi) { // set subgroup relations bug_774118 for (const auto &sg : tgi->subgroupList) { const auto &children = root->children(); auto i = std::find_if(children.begin(),children.end(), [&](const std::shared_ptr<Entry> &e) { return e->name == sg.c_str(); }); if (i!=children.end()) { (*i)->groups.emplace_back(tgi->name,Grouping::GROUPING_INGROUP); } } } } // build page list for (const auto &comp : m_tagFileCompounds) { const TagPageInfo *tpi = comp.getPageInfo(); if (tpi) { std::shared_ptr<Entry> pe = std::make_shared<Entry>(); bool isIndex = (stripExtensionGeneral(tpi->filename,getFileNameExtension(tpi->filename))=="index"); pe->section = isIndex ? EntryType::makeMainpageDoc() : EntryType::makePageDoc(); pe->name = tpi->name; pe->args = tpi->title; for (const auto &subpage : tpi->subpages) { // we add subpage labels as a kind of "inheritance" relation to prevent // needing to add another list to the Entry class. pe->extends.emplace_back(stripExtension(QCString(subpage)),Protection::Public,Specifier::Normal); } addDocAnchors(pe,tpi->docAnchors); pe->tagInfoData.tagName = m_tagName; pe->tagInfoData.fileName = stripExtension(tpi->filename); pe->startLine = tpi->lineNr; pe->fileName = m_tagName; pe->hasTagInfo = TRUE; root->moveToSubEntryAndKeep(pe); } } } void TagFileParser::addIncludes() { for (const auto &comp : m_tagFileCompounds) { const TagFileInfo *tfi = comp.getFileInfo(); if (tfi) { //printf("tag file tagName=%s path=%s name=%s\n",qPrint(m_tagName),qPrint(tfi->path),qPrint(tfi->name)); FileName *fn = Doxygen::inputNameLinkedMap->find(tfi->name); if (fn) { for (const auto &fd : *fn) { //printf("input file path=%s name=%s\n",qPrint(fd->getPath()),qPrint(fd->name())); if (fd->getPath()==QCString(m_tagName+":"+tfi->path)) { //printf("found\n"); for (const auto &ii : tfi->includes) { //printf("ii->name='%s'\n",qPrint(ii->name)); FileName *ifn = Doxygen::inputNameLinkedMap->find(ii.name); ASSERT(ifn!=nullptr); if (ifn) { for (const auto &ifd : *ifn) { //printf("ifd->getOutputFileBase()=%s ii->id=%s\n", // qPrint(ifd->getOutputFileBase()),qPrint(ii->id)); if (ifd->getOutputFileBase()==QCString(ii.id)) { IncludeKind kind = IncludeKind::IncludeSystem; if (ii.isModule) { kind = IncludeKind::ImportModule; } else if (ii.isImported) { kind = ii.isLocal ? IncludeKind::ImportLocal : IncludeKind::ImportSystem; } else if (ii.isLocal) { kind = IncludeKind::IncludeLocal; } fd->addIncludeDependency(ifd.get(),ii.text,kind); } } } } } } } } } } } // namespace // ----------------- public part ----------------------------------------------- void parseTagFile(const std::shared_ptr<Entry> &root,const char *fullName) { TagFileParser tagFileParser(fullName); QCString inputStr = fileToString(fullName); XMLHandlers handlers; // connect the generic events handlers of the XML parser to the specific handlers of the tagFileParser object handlers.startDocument = [&tagFileParser]() { tagFileParser.startDocument(); }; handlers.startElement = [&tagFileParser](const std::string &name,const XMLHandlers::Attributes &attrs) { tagFileParser.startElement(QCString(name),attrs); }; handlers.endElement = [&tagFileParser](const std::string &name) { tagFileParser.endElement(QCString(name)); }; handlers.characters = [&tagFileParser](const std::string &chars) { tagFileParser.characters(QCString(chars)); }; handlers.error = [&tagFileParser](const std::string &fileName,int lineNr,const std::string &msg) { tagFileParser.error(QCString(fileName),lineNr,QCString(msg)); }; XMLParser parser(handlers); tagFileParser.setDocumentLocator(&parser); parser.parse(fullName,inputStr.data(),Debug::isFlagSet(Debug::Lex_xml), [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",fullName); }, [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",fullName); } ); tagFileParser.buildLists(root); tagFileParser.addIncludes(); if (Debug::isFlagSet(Debug::Tag)) { tagFileParser.dump(); } }
58,903
C++
.cpp
1,703
27.6835
173
0.580507
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,482
trace.cpp
doxygen_doxygen/src/trace.cpp
/****************************************************************************** * * Copyright (C) 1997-2023 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 "trace.h" #include "spdlog/sinks/basic_file_sink.h" // support for basic file logging #include "spdlog/sinks/stdout_sinks.h" std::shared_ptr<spdlog::logger> g_tracer; void initTracing(const QCString &logFile, bool timing) { if (!logFile.isEmpty()) { std::vector<spdlog::sink_ptr> sinks; if (logFile=="stdout") { sinks.push_back(std::make_shared<spdlog::sinks::stdout_sink_mt>()); } else if (logFile=="stderr") { sinks.push_back(std::make_shared<spdlog::sinks::stderr_sink_mt>()); } else // normal file { sinks.push_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(logFile.str(),true)); } g_tracer = std::make_shared<spdlog::logger>("tracing", sinks.begin(),sinks.end()); g_tracer->set_level(spdlog::level::trace); if (timing) { g_tracer->set_pattern("[%C-%m-%d %T.%e][%t][%s:%#](%!) %v"); } else { g_tracer->set_pattern("[%s:%#](%!) %v"); } } } void exitTracing() { if (g_tracer) { spdlog::shutdown(); } }
1,702
C++
.cpp
54
28
95
0.639075
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,483
fileparser.cpp
doxygen_doxygen/src/fileparser.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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 "fileparser.h" #include "outputgen.h" #include "outputlist.h" void FileCodeParser::parseCode(OutputCodeList &codeOutIntf, const QCString &, // scopeName const QCString & input, SrcLangExt, // lang bool, // stripCodeComments bool, // isExampleBlock const QCString &, // exampleName const FileDef * fileDef, int startLine, int endLine, bool inlineFragment, const MemberDef *, // memberDef bool showLineNumbers, const Definition *, // searchCtx, bool // collectXRefs ) { int lineNr = startLine!=-1 ? startLine : 1; size_t length = input.length(); size_t i=0; while (i<length && (endLine==-1 || lineNr<=endLine)) { size_t j=i; while (j<length && input[j]!='\n') j++; QCString lineStr = input.mid(i,j-i); codeOutIntf.startCodeLine(lineNr); if (fileDef != nullptr && showLineNumbers) { codeOutIntf.writeLineNumber(QCString(),QCString(),QCString(),lineNr,!inlineFragment); } if (!lineStr.isEmpty()) codeOutIntf.codify(lineStr.data()); codeOutIntf.endCodeLine(); lineNr++; i=j+1; } }
2,069
C++
.cpp
53
32.339623
91
0.57079
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,484
memberdef.cpp
doxygen_doxygen/src/memberdef.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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 <assert.h> #include <mutex> #include "md5.h" #include "memberdef.h" #include "membername.h" #include "doxygen.h" #include "util.h" #include "code.h" #include "message.h" #include "htmlhelp.h" #include "language.h" #include "outputlist.h" #include "example.h" #include "membergroup.h" #include "groupdef.h" #include "defargs.h" #include "docparser.h" #include "dot.h" #include "dotcallgraph.h" #include "searchindex.h" #include "parserintf.h" #include "vhdldocgen.h" #include "arguments.h" #include "memberlist.h" #include "namespacedef.h" #include "moduledef.h" #include "filedef.h" #include "config.h" #include "definitionimpl.h" #include "regex.h" #include "trace.h" //----------------------------------------------------------------------------- class MemberDefImpl : public DefinitionMixin<MemberDefMutable> { public: MemberDefImpl(const QCString &defFileName,int defLine,int defColumn, const QCString &type,const QCString &name,const QCString &args, const QCString &excp,Protection prot,Specifier virt,bool stat, Relationship related,MemberType t,const ArgumentList &tal, const ArgumentList &al,const QCString &metaData); ~MemberDefImpl() override = default; NON_COPYABLE(MemberDefImpl) DefType definitionType() const override { return TypeMember; } MemberDef *resolveAlias() override { return this; } const MemberDef *resolveAlias() const override { return this; } CodeSymbolType codeSymbolType() const override; std::unique_ptr<MemberDef> deepCopy() const override; void moveTo(Definition *) override; QCString getOutputFileBase() const override; QCString getReference() const override; QCString anchor() const override; QCString declaration() const override; QCString definition() const override; QCString typeString() const override; QCString argsString() const override; QCString excpString() const override; QCString bitfieldString() const override; QCString extraTypeChars() const override; const QCString &initializer() const override; int initializerLines() const override; TypeSpecifier getMemberSpecifiers() const override; VhdlSpecifier getVhdlSpecifiers() const override; const MemberList *getSectionList(const Definition *) const override; QCString displayDefinition() const override; const ClassDef *getClassDef() const override; ClassDef *getClassDef() override; const FileDef *getFileDef() const override; FileDef *getFileDef() override; const NamespaceDef* getNamespaceDef() const override; NamespaceDef* getNamespaceDef() override; const GroupDef *getGroupDef() const override; GroupDef *getGroupDef() override; const ModuleDef *getModuleDef() const override; ClassDef *accessorClass() const override; QCString getReadAccessor() const override; QCString getWriteAccessor() const override; Grouping::GroupPri_t getGroupPri() const override; QCString getGroupFileName() const override; int getGroupStartLine() const override; bool getGroupHasDocs() const override; QCString qualifiedName() const override; QCString objCMethodName(bool localLink,bool showStatic) const override; Protection protection() const override; Specifier virtualness(int count=0) const override; MemberType memberType() const override; QCString memberTypeName() const override; bool isSignal() const override; bool isSlot() const override; bool isVariable() const override; bool isEnumerate() const override; bool isEnumValue() const override; bool isTypedef() const override; bool isSequence() const override; bool isDictionary() const override; bool isFunction() const override; bool isFunctionPtr() const override; bool isDefine() const override; bool isFriend() const override; bool isDCOP() const override; bool isProperty() const override; bool isEvent() const override; bool isRelated() const override; bool isForeign() const override; bool isStatic() const override; bool isInline() const override; bool isExplicit() const override; bool isMutable() const override; bool isGettable() const override; bool isPrivateGettable() const override; bool isProtectedGettable() const override; bool isSettable() const override; bool isPrivateSettable() const override; bool isProtectedSettable() const override; bool isReadable() const override; bool isWritable() const override; bool isAddable() const override; bool isRemovable() const override; bool isRaisable() const override; bool isFinal() const override; bool isAbstract() const override; bool isOverride() const override; bool isInitonly() const override; bool isOptional() const override; bool isRequired() const override; bool isNonAtomic() const override; bool isCopy() const override; bool isAssign() const override; bool isRetain() const override; bool isWeak() const override; bool isStrong() const override; bool isEnumStruct() const override; bool isUnretained() const override; bool isNew() const override; bool isSealed() const override; bool isImplementation() const override; bool isExternal() const override; bool isTypeAlias() const override; bool isDefault() const override; bool isDelete() const override; bool isNoExcept() const override; bool isAttribute() const override; bool isUNOProperty() const override; bool isReadonly() const override; bool isBound() const override; bool isConstrained() const override; bool isTransient() const override; bool isMaybeVoid() const override; bool isMaybeDefault() const override; bool isMaybeAmbiguous() const override; bool isPublished() const override; bool isTemplateSpecialization() const override; bool isObjCMethod() const override; bool isObjCProperty() const override; bool isCSharpProperty() const override; bool isConstructor() const override; bool isDestructor() const override; bool hasOneLineInitializer() const override; bool hasMultiLineInitializer() const override; bool isCallable() const override; bool isStrongEnumValue() const override; bool livesInsideEnum() const override; bool isSliceLocal() const override; bool isNoDiscard() const override; bool isConstExpr() const override; bool isConstEval() const override; bool isConstInit() const override; int numberOfFlowKeyWords() const override; bool isFriendToHide() const override; bool isNotFriend() const override; bool isFunctionOrSignalSlot() const override; bool isRelatedOrFriend() const override; bool isLinkableInProject() const override; bool isLinkable() const override; bool hasDocumentation() const override; bool hasUserDocumentation() const override; bool isDeleted() const override; bool isBriefSectionVisible() const override; bool isDetailedSectionVisible(MemberListContainer container) const override; bool hasDetailedDescription() const override; bool isFriendClass() const override; bool isDocumentedFriendClass() const override; const MemberDef *reimplements() const override; const MemberVector &reimplementedBy() const override; bool isReimplementedBy(const ClassDef *cd) const override; ClassDef *relatedAlso() const override; bool hasDocumentedEnumValues() const override; const MemberDef *getAnonymousEnumType() const override; bool isDocsForDefinition() const override; const MemberDef *getEnumScope() const override; const MemberVector &enumFieldList() const override; void setEnumBaseType(const QCString &type) override; QCString enumBaseType() const override; bool hasExamples() const override; const ExampleList &getExamples() const override; bool isPrototype() const override; const ArgumentList &argumentList() const override; const ArgumentList &declArgumentList() const override; const ArgumentList &templateArguments() const override; const ArgumentLists &definitionTemplateParameterLists() const override; std::optional<ArgumentList> formalTemplateArguments() const override; int getMemberGroupId() const override; MemberGroup *getMemberGroup() const override; bool fromAnonymousScope() const override; MemberDef *fromAnonymousMember() const override; bool hasCallGraph() const override; bool hasCallerGraph() const override; bool hasReferencesRelation() const override; bool hasReferencedByRelation() const override; bool hasEnumValues() const override; bool hasInlineSource() const override; QCString sourceRefName() const override; const MemberDef *templateMaster() const override; QCString getScopeString() const override; ClassDef *getClassDefOfAnonymousType() const override; bool isTypedefValCached() const override; const ClassDef *getCachedTypedefVal() const override; QCString getCachedTypedefTemplSpec() const override; QCString getCachedResolvedTypedef() const override; MemberDef *memberDefinition() const override; MemberDef *memberDeclaration() const override; const MemberDef *inheritsDocsFrom() const override; const MemberDef *getGroupAlias() const override; ClassDef *category() const override; const MemberDef *categoryRelation() const override; QCString displayName(bool=TRUE) const override; QCString getDeclType() const override; StringVector getLabels(const Definition *container) const override; const ArgumentList &typeConstraints() const override; QCString requiresClause() const override; QCString documentation() const override; QCString briefDescription(bool abbr=FALSE) const override; QCString fieldType() const override; bool isReference() const override; QCString getDeclFileName() const override; int getDeclLine() const override; int getDeclColumn() const override; void setMemberType(MemberType t) override; void setDefinition(const QCString &d) override; void setFileDef(FileDef *fd) override; void setAnchor() override; void setProtection(Protection p) override; void setMemberSpecifiers(TypeSpecifier s) override; void setVhdlSpecifiers(VhdlSpecifier s) override; void mergeMemberSpecifiers(TypeSpecifier s) override; void setInitializer(const QCString &i) override; void setBitfields(const QCString &s) override; void setMaxInitLines(int lines) override; void setMemberClass(ClassDef *cd) override; void setSectionList(const Definition *container,const MemberList *sl) override; void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine,bool hasDocs, MemberDef *member=nullptr) override; void setReadAccessor(const QCString &r) override; void setWriteAccessor(const QCString &w) override; void setTemplateSpecialization(bool b) override; void makeRelated() override; void makeForeign() override; void setInheritsDocsFrom(const MemberDef *md) override; void setTagInfo(const TagInfo *i) override; void setArgsString(const QCString &as) override; void setReimplements(MemberDef *md) override; void insertReimplementedBy(MemberDef *md) override; void setRelatedAlso(ClassDef *cd) override; void insertEnumField(MemberDef *md) override; void setEnumScope(MemberDef *md,bool livesInsideEnum=FALSE) override; void setEnumClassScope(ClassDef *cd) override; void setDocumentedEnumValues(bool value) override; void setAnonymousEnumType(const MemberDef *md) override; bool addExample(const QCString &anchor,const QCString &name,const QCString &file) override; void setPrototype(bool p,const QCString &df,int line, int column) override; void setExplicitExternal(bool b,const QCString &df,int line,int column) override; void setDeclFile(const QCString &df,int line,int column) override; void moveArgumentList(std::unique_ptr<ArgumentList> al) override; void moveDeclArgumentList(std::unique_ptr<ArgumentList> al) override; void setDefinitionTemplateParameterLists(const ArgumentLists &lists) override; void setTypeConstraints(const ArgumentList &al) override; void setType(const QCString &t) override; void setAccessorType(ClassDef *cd,const QCString &t) override; void setNamespace(NamespaceDef *nd) override; void setMemberGroup(MemberGroup *grp) override; void setMemberGroupId(int id) override; void makeImplementationDetail() override; void setFromAnonymousScope(bool b) override; void setFromAnonymousMember(MemberDef *m) override; void overrideCallGraph(bool e) override; void overrideCallerGraph(bool e) override; void overrideReferencedByRelation(bool e) override; void overrideReferencesRelation(bool e) override; void overrideEnumValues(bool e) override; void overrideInlineSource(bool e) override; void setTemplateMaster(MemberDef *mt) override; void setFormalTemplateArguments(const ArgumentList &al) override; void addListReference(Definition *d) override; void setDocsForDefinition(bool b) override; void setGroupAlias(const MemberDef *md) override; void cacheTypedefVal(const ClassDef *val,const QCString &templSpec,const QCString &resolvedType) override; void invalidateTypedefValCache() override; void invalidateCachedArgumentTypes() override; void setMemberDefinition(MemberDef *md) override; void setMemberDeclaration(MemberDef *md) override; void copyArgumentNames(const MemberDef *bmd) override; void setCategory(ClassDef *) override; void setCategoryRelation(const MemberDef *) override; void setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace=TRUE) override; void setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) override; void setInbodyDocumentation(const QCString &d,const QCString &inbodyFile,int inbodyLine) override; void setHidden(bool b) override; void setRequiresClause(const QCString &req) override; void incrementFlowKeyWordCount() override; void writeDeclaration(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, bool inGroup, int indentLevel,const ClassDef *inheritFrom=nullptr,const QCString &inheritId=QCString()) const override; void writeDocumentation(const MemberList *ml,int memCount,int memTotal,OutputList &ol, const QCString &scopeName,const Definition *container, bool inGroup,bool showEnumValues=FALSE,bool showInline=FALSE) const override; void writeMemberDocSimple(OutputList &ol,const Definition *container) const override; void writeEnumDeclaration(OutputList &typeDecl, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod) const override; void writeTagFile(TextStream &,bool useQualifiedName,bool showNamespaceMembers) const override; void warnIfUndocumented() const override; void warnIfUndocumentedParams() const override; bool visibleInIndex() const override; void detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const override; std::unique_ptr<MemberDef> createTemplateInstanceMember(const ArgumentList &formalArgs, const std::unique_ptr<ArgumentList> &actualArgs) const override; void findSectionsInDocumentation() override; void writeLink(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, bool onlyText=FALSE) const override; void resolveUnnamedParameters(const MemberDef *md) override; void addQualifiers(const StringVector &qualifiers) override; StringVector getQualifiers() const override; ClassDefMutable *getClassDefMutable() override; void setModuleDef(ModuleDef *mod) override; private: void _computeLinkableInProject(); void _computeIsConstructor(); void _computeIsDestructor(); void _writeGroupInclude(OutputList &ol,bool inGroup) const; void _writeMultiLineInitializer(OutputList &ol,const QCString &scopeName) const; void _writeCallGraph(OutputList &ol) const; void _writeCallerGraph(OutputList &ol) const; void _writeReimplements(OutputList &ol) const; bool _isReimplements() const; void _writeReimplementedBy(OutputList &ol) const; size_t _countReimplementedBy() const; void _writeExamples(OutputList &ol) const; void _writeTypeConstraints(OutputList &ol) const; void _writeEnumValues(OutputList &ol,const Definition *container, const QCString &cfname,const QCString &ciname, const QCString &cname) const; void _writeCategoryRelation(OutputList &ol) const; void _writeTagData(const DefType) const; void _writeTemplatePrefix(OutputList &ol, const Definition *def, const ArgumentList &al, bool writeReqClause=true) const; bool _hasVisibleCallGraph() const; bool _hasVisibleCallerGraph() const; bool _isAnonymousBitField() const; void init(Definition *def,const QCString &t,const QCString &a,const QCString &e, Protection p,Specifier v,bool s,Relationship r, MemberType mt,const ArgumentList &tal, const ArgumentList &al,const QCString &meta ); uint8_t m_isLinkableCached; // 0 = not cached, 1=FALSE, 2=TRUE uint8_t m_isConstructorCached; // 0 = not cached, 1=FALSE, 2=TRUE uint8_t m_isDestructorCached; // 1 = not cached, 1=FALSE, 2=TRUE ClassDef *m_classDef = nullptr; // member of or related to FileDef *m_fileDef = nullptr; // member of file definition NamespaceDef *m_nspace = nullptr; // the namespace this member is in. ModuleDef *m_moduleDef = nullptr; const MemberDef *m_enumScope = nullptr; // the enclosing scope, if this is an enum field bool m_livesInsideEnum = false; const MemberDef *m_annEnumType = nullptr; // the anonymous enum that is the type of this member MemberVector m_enumFields; // enumeration fields MemberDef *m_redefines = nullptr; // the members that this member redefines MemberVector m_redefinedBy; // the list of members that redefine this one MemberDef *m_memDef = nullptr; // member definition for this declaration MemberDef *m_memDec = nullptr; // member declaration for this definition ClassDef *m_relatedAlso = nullptr; // points to class marked by relatedAlso ExampleList m_examples; // a dictionary of all examples for quick access QCString m_type; // return actual type QCString m_accessorType; // return type that tell how to get to this member ClassDef *m_accessorClass = nullptr; // class that this member accesses (for anonymous types) QCString m_args; // function arguments/variable array specifiers QCString m_def; // member definition in code (fully qualified name) QCString m_anc; // HTML anchor name Specifier m_virt = Specifier::Normal; // normal/virtual/pure virtual Protection m_prot = Protection::Public; // protection type [Public/Protected/Private] QCString m_decl; // member declaration in class QCString m_bitfields; // struct member bitfields QCString m_read; // property read accessor QCString m_write; // property write accessor QCString m_exception; // exceptions that can be thrown QCString m_initializer; // initializer QCString m_extraTypeChars; // extra type info found after the argument list QCString m_enumBaseType; // base type of the enum (C++11) QCString m_requiresClause; // requires clause (C++20) int m_initLines = 0; // number of lines in the initializer TypeSpecifier m_memSpec; // The specifiers present for this member VhdlSpecifier m_vhdlSpec; MemberType m_mtype = MemberType::Define; // returns the kind of member int m_maxInitLines = 0; // when the initializer will be displayed int m_userInitLines = 0; // result of explicit \hideinitializer or \showinitializer MemberDef *m_annMemb = nullptr; ArgumentList m_defArgList; // argument list of this member definition ArgumentList m_declArgList; // argument list of this member declaration ArgumentList m_tArgList; // template argument list of function template ArgumentList m_typeConstraints; // type constraints for template parameters MemberDef *m_templateMaster = nullptr; std::optional<ArgumentList> m_formalTemplateArguments; ArgumentLists m_defTmpArgLists; // lists of template argument lists // (for template functions in nested template classes) QCString m_metaData; // Slice metadata. mutable ClassDef *m_cachedAnonymousType = nullptr; // if the member has an anonymous compound // as its type then this is computed by // getClassDefOfAnonymousType() and // cached here. std::map<const Definition *,const MemberList *> m_sectionMap; const MemberDef *m_groupAlias = nullptr; // Member containing the definition int m_grpId = 0; // group id MemberGroup *m_memberGroup = nullptr; // group's member definition GroupDef *m_group = nullptr; // group in which this member is in Grouping::GroupPri_t m_grouppri = Grouping::GROUPING_AUTO_DEF; // priority of this definition QCString m_groupFileName; // file where this grouping was defined int m_groupStartLine = 0; // line " " " " " MemberDef *m_groupMember = nullptr; bool m_isTypedefValCached = false; const ClassDef *m_cachedTypedefValue = nullptr; QCString m_cachedTypedefTemplSpec; QCString m_cachedResolvedType; // documentation inheritance const MemberDef *m_docProvider = nullptr; // to store the output file base from tag files QCString m_explicitOutputFileBase; // to store extra qualifiers StringVector m_qualifiers; // objective-c bool m_implOnly = false; // function found in implementation but not // in the interface mutable bool m_hasDocumentedParams = false; // guard to show only the first warning, acts as cache mutable bool m_hasDocumentedReturnType = false; // guard to show only the first warning, acts as cache bool m_isDMember = false; Relationship m_related = Relationship::Member; // relationship of this to the class bool m_stat = false; // is it a static function? bool m_proto = false; // is it a prototype? bool m_docEnumValues = false; // is an enum with documented enum values. bool m_annScope = false; // member is part of an anonymous scope mutable bool m_hasDetailedDescriptionCached = false; mutable bool m_detailedDescriptionCachedValue = false; // const member. bool m_hasCallGraph = false; bool m_hasCallerGraph = false; bool m_hasReferencedByRelation = false; bool m_hasReferencesRelation = false; bool m_hasInlineSource = false; bool m_hasEnumValues = false; bool m_explExt = false; // member was explicitly declared external bool m_tspec = false; // member is a template specialization bool m_groupHasDocs = false; // true if the entry that caused the grouping was documented bool m_docsForDefinition = false; // TRUE => documentation block is put before // definition. // FALSE => block is put before declaration. ClassDef *m_category = nullptr; const MemberDef *m_categoryRelation = nullptr; QCString m_declFileName; int m_declLine = -1; int m_declColumn = -1; int m_numberOfFlowKW = 0; }; std::unique_ptr<MemberDef> createMemberDef(const QCString &defFileName,int defLine,int defColumn, const QCString &type,const QCString &name,const QCString &args, const QCString &excp,Protection prot,Specifier virt,bool stat, Relationship related,MemberType t,const ArgumentList &tal, const ArgumentList &al,const QCString &metaData) { return std::make_unique<MemberDefImpl>(defFileName,defLine,defColumn,type,name,args,excp,prot,virt, stat,related,t,tal,al,metaData); } //----------------------------------------------------------------------------- class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef> { public: MemberDefAliasImpl(const Definition *newScope,const MemberDef *md) : DefinitionAliasMixin(newScope,md), m_memberGroup(nullptr) { init(); } ~MemberDefAliasImpl() override { deinit(); } NON_COPYABLE(MemberDefAliasImpl) DefType definitionType() const override { return TypeMember; } const MemberDef *getMdAlias() const { return toMemberDef(getAlias()); } MemberDef *getMdAlias() { return toMemberDef(const_cast<Definition*>(getAlias())); } MemberDef *resolveAlias() override { return const_cast<MemberDef*>(getMdAlias()); } const MemberDef *resolveAlias() const override { return getMdAlias(); } std::unique_ptr<MemberDef> deepCopy() const override { return createMemberDefAlias(getScope(),getMdAlias()); } void moveTo(Definition *) override {} const QCString &name() const override { return getMdAlias()->name(); } CodeSymbolType codeSymbolType() const override { return getMdAlias()->codeSymbolType(); } QCString getOutputFileBase() const override { return getMdAlias()->getOutputFileBase(); } QCString getReference() const override { return getMdAlias()->getReference(); } QCString anchor() const override { return getMdAlias()->anchor(); } QCString declaration() const override { return getMdAlias()->declaration(); } QCString definition() const override { return getMdAlias()->definition(); } QCString typeString() const override { return getMdAlias()->typeString(); } QCString argsString() const override { return getMdAlias()->argsString(); } QCString excpString() const override { return getMdAlias()->excpString(); } QCString bitfieldString() const override { return getMdAlias()->bitfieldString(); } QCString extraTypeChars() const override { return getMdAlias()->extraTypeChars(); } const QCString &initializer() const override { return getMdAlias()->initializer(); } int initializerLines() const override { return getMdAlias()->initializerLines(); } TypeSpecifier getMemberSpecifiers() const override { return getMdAlias()->getMemberSpecifiers(); } VhdlSpecifier getVhdlSpecifiers() const override { return getMdAlias()->getVhdlSpecifiers(); } const MemberList *getSectionList(const Definition *container) const override { return getMdAlias()->getSectionList(container); } QCString displayDefinition() const override { return getMdAlias()->displayDefinition(); } const ClassDef *getClassDef() const override { return getMdAlias()->getClassDef(); } ClassDef *getClassDef() override { return getMdAlias()->getClassDef(); } const FileDef *getFileDef() const override { return getMdAlias()->getFileDef(); } FileDef *getFileDef() override { return getMdAlias()->getFileDef(); } const ModuleDef *getModuleDef() const override { return getMdAlias()->getModuleDef(); } const NamespaceDef* getNamespaceDef() const override { return getMdAlias()->getNamespaceDef(); } NamespaceDef* getNamespaceDef() override { return getMdAlias()->getNamespaceDef(); } const ClassDef *accessorClass() const override { return getMdAlias()->accessorClass(); } QCString getReadAccessor() const override { return getMdAlias()->getReadAccessor(); } QCString getWriteAccessor() const override { return getMdAlias()->getWriteAccessor(); } const GroupDef *getGroupDef() const override { return getMdAlias()->getGroupDef(); } GroupDef *getGroupDef() override { return getMdAlias()->getGroupDef(); } Grouping::GroupPri_t getGroupPri() const override { return getMdAlias()->getGroupPri(); } QCString getGroupFileName() const override { return getMdAlias()->getGroupFileName(); } int getGroupStartLine() const override { return getMdAlias()->getGroupStartLine(); } bool getGroupHasDocs() const override { return getMdAlias()->getGroupHasDocs(); } QCString qualifiedName() const override { return getMdAlias()->qualifiedName(); } QCString objCMethodName(bool localLink,bool showStatic) const override { return getMdAlias()->objCMethodName(localLink,showStatic); } Protection protection() const override { return getMdAlias()->protection(); } Specifier virtualness(int /* count */) const override { return getMdAlias()->virtualness(); } MemberType memberType() const override { return getMdAlias()->memberType(); } QCString memberTypeName() const override { return getMdAlias()->memberTypeName(); } bool isSignal() const override { return getMdAlias()->isSignal(); } bool isSlot() const override { return getMdAlias()->isSlot(); } bool isVariable() const override { return getMdAlias()->isVariable(); } bool isEnumerate() const override { return getMdAlias()->isEnumerate(); } bool isEnumValue() const override { return getMdAlias()->isEnumValue(); } bool isTypedef() const override { return getMdAlias()->isTypedef(); } bool isSequence() const override { return getMdAlias()->isSequence(); } bool isDictionary() const override { return getMdAlias()->isDictionary(); } bool isFunction() const override { return getMdAlias()->isFunction(); } bool isFunctionPtr() const override { return getMdAlias()->isFunctionPtr(); } bool isDefine() const override { return getMdAlias()->isDefine(); } bool isFriend() const override { return getMdAlias()->isFriend(); } bool isDCOP() const override { return getMdAlias()->isDCOP(); } bool isProperty() const override { return getMdAlias()->isProperty(); } bool isEvent() const override { return getMdAlias()->isEvent(); } bool isRelated() const override { return getMdAlias()->isRelated(); } bool isForeign() const override { return getMdAlias()->isForeign(); } bool isStatic() const override { return getMdAlias()->isStatic(); } bool isInline() const override { return getMdAlias()->isInline(); } bool isExplicit() const override { return getMdAlias()->isExplicit(); } bool isMutable() const override { return getMdAlias()->isMutable(); } bool isGettable() const override { return getMdAlias()->isGettable(); } bool isPrivateGettable() const override { return getMdAlias()->isPrivateGettable(); } bool isProtectedGettable() const override { return getMdAlias()->isProtectedGettable(); } bool isSettable() const override { return getMdAlias()->isSettable(); } bool isPrivateSettable() const override { return getMdAlias()->isPrivateSettable(); } bool isProtectedSettable() const override { return getMdAlias()->isProtectedSettable(); } bool isReadable() const override { return getMdAlias()->isReadable(); } bool isWritable() const override { return getMdAlias()->isWritable(); } bool isAddable() const override { return getMdAlias()->isAddable(); } bool isRemovable() const override { return getMdAlias()->isRemovable(); } bool isRaisable() const override { return getMdAlias()->isRaisable(); } bool isFinal() const override { return getMdAlias()->isFinal(); } bool isAbstract() const override { return getMdAlias()->isAbstract(); } bool isOverride() const override { return getMdAlias()->isOverride(); } bool isInitonly() const override { return getMdAlias()->isInitonly(); } bool isOptional() const override { return getMdAlias()->isOptional(); } bool isRequired() const override { return getMdAlias()->isRequired(); } bool isNonAtomic() const override { return getMdAlias()->isNonAtomic(); } bool isCopy() const override { return getMdAlias()->isCopy(); } bool isAssign() const override { return getMdAlias()->isAssign(); } bool isRetain() const override { return getMdAlias()->isRetain(); } bool isWeak() const override { return getMdAlias()->isWeak(); } bool isStrong() const override { return getMdAlias()->isStrong(); } bool isEnumStruct() const override { return getMdAlias()->isEnumStruct(); } bool isUnretained() const override { return getMdAlias()->isUnretained(); } bool isNew() const override { return getMdAlias()->isNew(); } bool isSealed() const override { return getMdAlias()->isSealed(); } bool isImplementation() const override { return getMdAlias()->isImplementation(); } bool isExternal() const override { return getMdAlias()->isExternal(); } bool isTypeAlias() const override { return getMdAlias()->isTypeAlias(); } bool isDefault() const override { return getMdAlias()->isDefault(); } bool isDelete() const override { return getMdAlias()->isDelete(); } bool isNoExcept() const override { return getMdAlias()->isNoExcept(); } bool isAttribute() const override { return getMdAlias()->isAttribute(); } bool isUNOProperty() const override { return getMdAlias()->isUNOProperty(); } bool isReadonly() const override { return getMdAlias()->isReadable(); } bool isBound() const override { return getMdAlias()->isBound(); } bool isConstrained() const override { return getMdAlias()->isConstrained(); } bool isTransient() const override { return getMdAlias()->isTransient(); } bool isMaybeVoid() const override { return getMdAlias()->isMaybeVoid(); } bool isMaybeDefault() const override { return getMdAlias()->isMaybeDefault(); } bool isMaybeAmbiguous() const override { return getMdAlias()->isMaybeAmbiguous(); } bool isPublished() const override { return getMdAlias()->isPublished(); } bool isTemplateSpecialization() const override { return getMdAlias()->isTemplateSpecialization(); } bool isObjCMethod() const override { return getMdAlias()->isObjCMethod(); } bool isObjCProperty() const override { return getMdAlias()->isObjCProperty(); } bool isCSharpProperty() const override { return getMdAlias()->isCSharpProperty(); } bool isConstructor() const override { return getMdAlias()->isConstructor(); } bool isDestructor() const override { return getMdAlias()->isDestructor(); } bool hasOneLineInitializer() const override { return getMdAlias()->hasOneLineInitializer(); } bool hasMultiLineInitializer() const override { return getMdAlias()->hasMultiLineInitializer(); } bool isCallable() const override { return getMdAlias()->isCallable(); } bool isStrongEnumValue() const override { return getMdAlias()->isStrongEnumValue(); } bool livesInsideEnum() const override { return getMdAlias()->livesInsideEnum(); } bool isSliceLocal() const override { return getMdAlias()->isSliceLocal(); } bool isNoDiscard() const override { return getMdAlias()->isNoDiscard(); } bool isConstExpr() const override { return getMdAlias()->isConstExpr(); } bool isConstEval() const override { return getMdAlias()->isConstEval(); } bool isConstInit() const override { return getMdAlias()->isConstInit(); } int numberOfFlowKeyWords() const override { return getMdAlias()->numberOfFlowKeyWords(); } bool isFriendToHide() const override { return getMdAlias()->isFriendToHide(); } bool isNotFriend() const override { return getMdAlias()->isNotFriend(); } bool isFunctionOrSignalSlot() const override { return getMdAlias()->isFunctionOrSignalSlot(); } bool isRelatedOrFriend() const override { return getMdAlias()->isRelatedOrFriend(); } bool isLinkableInProject() const override { return getMdAlias()->isLinkableInProject(); } bool isLinkable() const override { return getMdAlias()->isLinkable(); } bool hasDocumentation() const override { return getMdAlias()->hasDocumentation(); } bool hasUserDocumentation() const override { return getMdAlias()->hasUserDocumentation(); } bool isDeleted() const override { return getMdAlias()->isDeleted(); } bool isBriefSectionVisible() const override { return getMdAlias()->isBriefSectionVisible(); } bool isDetailedSectionVisible(MemberListContainer container) const override { return getMdAlias()->isDetailedSectionVisible(container); } bool hasDetailedDescription() const override { return getMdAlias()->hasDetailedDescription(); } bool isFriendClass() const override { return getMdAlias()->isFriendClass(); } bool isDocumentedFriendClass() const override { return getMdAlias()->isDocumentedFriendClass(); } const MemberDef *reimplements() const override { return getMdAlias()->reimplements(); } const MemberVector &reimplementedBy() const override { return getMdAlias()->reimplementedBy(); } bool isReimplementedBy(const ClassDef *cd) const override { return getMdAlias()->isReimplementedBy(cd); } ClassDef *relatedAlso() const override { return getMdAlias()->relatedAlso(); } bool hasDocumentedEnumValues() const override { return getMdAlias()->hasDocumentedEnumValues(); } const MemberDef *getAnonymousEnumType() const override { return getMdAlias()->getAnonymousEnumType(); } bool isDocsForDefinition() const override { return getMdAlias()->isDocsForDefinition(); } const MemberDef *getEnumScope() const override { return getMdAlias()->getEnumScope(); } const MemberVector &enumFieldList() const override { return getMdAlias()->enumFieldList(); } QCString enumBaseType() const override { return getMdAlias()->enumBaseType(); } bool hasExamples() const override { return getMdAlias()->hasExamples(); } const ExampleList &getExamples() const override { return getMdAlias()->getExamples(); } bool isPrototype() const override { return getMdAlias()->isPrototype(); } const ArgumentList &argumentList() const override { return getMdAlias()->argumentList(); } const ArgumentList &declArgumentList() const override { return getMdAlias()->declArgumentList(); } const ArgumentList &templateArguments() const override { return getMdAlias()->templateArguments(); } const ArgumentLists &definitionTemplateParameterLists() const override { return getMdAlias()->definitionTemplateParameterLists(); } std::optional<ArgumentList> formalTemplateArguments() const override { return getMdAlias()->formalTemplateArguments(); } int getMemberGroupId() const override { return getMdAlias()->getMemberGroupId(); } MemberGroup *getMemberGroup() const override { return m_memberGroup; } bool fromAnonymousScope() const override { return getMdAlias()->fromAnonymousScope(); } MemberDef *fromAnonymousMember() const override { return getMdAlias()->fromAnonymousMember(); } bool hasCallGraph() const override { return getMdAlias()->hasCallGraph(); } bool hasCallerGraph() const override { return getMdAlias()->hasCallerGraph(); } bool hasReferencesRelation() const override { return getMdAlias()->hasReferencesRelation(); } bool hasReferencedByRelation() const override { return getMdAlias()->hasReferencedByRelation(); } bool hasInlineSource() const override { return getMdAlias()->hasInlineSource(); } QCString sourceRefName() const override { return getMdAlias()->sourceRefName(); } bool hasEnumValues() const override { return getMdAlias()->hasEnumValues(); } StringVector getQualifiers() const override { return getMdAlias()->getQualifiers(); } const MemberDef *templateMaster() const override { return getMdAlias()->templateMaster(); } QCString getScopeString() const override { return getMdAlias()->getScopeString(); } ClassDef *getClassDefOfAnonymousType() const override { return getMdAlias()->getClassDefOfAnonymousType(); } bool isTypedefValCached() const override { return getMdAlias()->isTypedefValCached(); } const ClassDef *getCachedTypedefVal() const override { return getMdAlias()->getCachedTypedefVal(); } QCString getCachedTypedefTemplSpec() const override { return getMdAlias()->getCachedTypedefTemplSpec(); } QCString getCachedResolvedTypedef() const override { return getMdAlias()->getCachedResolvedTypedef(); } MemberDef *memberDefinition() const override { return getMdAlias()->memberDefinition(); } MemberDef *memberDeclaration() const override { return getMdAlias()->memberDeclaration(); } const MemberDef *inheritsDocsFrom() const override { return getMdAlias()->inheritsDocsFrom(); } const MemberDef *getGroupAlias() const override { return getMdAlias()->getGroupAlias(); } ClassDef *category() const override { return getMdAlias()->category(); } const MemberDef *categoryRelation() const override { return getMdAlias()->categoryRelation(); } QCString displayName(bool b=TRUE) const override { return getMdAlias()->displayName(b); } QCString getDeclType() const override { return getMdAlias()->getDeclType(); } StringVector getLabels(const Definition *container) const override { return getMdAlias()->getLabels(container); } const ArgumentList &typeConstraints() const override { return getMdAlias()->typeConstraints(); } QCString documentation() const override { return getMdAlias()->documentation(); } QCString briefDescription(bool /* abbr=FALSE */) const override { return getMdAlias()->briefDescription(); } QCString fieldType() const override { return getMdAlias()->fieldType(); } bool isReference() const override { return getMdAlias()->isReference(); } QCString getDeclFileName() const override { return getMdAlias()->getDeclFileName(); } int getDeclLine() const override { return getMdAlias()->getDeclLine(); } int getDeclColumn() const override { return getMdAlias()->getDeclColumn(); } QCString requiresClause() const override { return getMdAlias()->requiresClause(); } bool visibleInIndex() const override { return getMdAlias()->visibleInIndex(); } void warnIfUndocumented() const override {} void warnIfUndocumentedParams() const override {} void detectUndocumentedParams(bool /* hasParamCommand */,bool /* hasReturnCommand */) const override {} void setMemberGroup(MemberGroup *grp) override { m_memberGroup = grp; } std::unique_ptr<MemberDef> createTemplateInstanceMember(const ArgumentList &formalArgs, const std::unique_ptr<ArgumentList> &actualArgs) const override { return getMdAlias()->createTemplateInstanceMember(formalArgs,actualArgs); } void writeDeclaration(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, bool inGroup, int indentLevel, const ClassDef *inheritFrom=nullptr,const QCString &inheritId=QCString()) const override { getMdAlias()->writeDeclaration(ol,cd,nd,fd,gd,mod,inGroup,indentLevel,inheritFrom,inheritId); } void writeEnumDeclaration(OutputList &typeDecl, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod) const override { getMdAlias()->writeEnumDeclaration(typeDecl,cd,nd,fd,gd,mod); } void writeLink(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, bool onlyText=FALSE) const override { getMdAlias()->writeLink(ol,cd,nd,fd,gd,mod,onlyText); } private: MemberGroup *m_memberGroup; // group's member definition }; std::unique_ptr<MemberDef> createMemberDefAlias(const Definition *newScope,const MemberDef *aliasMd) { auto amd = std::make_unique<MemberDefAliasImpl>(newScope,aliasMd); //printf("amd: name=%s displayName=%s\n",qPrint(amd->name()),qPrint(amd->displayName())); return amd; } //----------------------------------------------------------------------------- static QCString addTemplateNames(const QCString &s,const QCString &n,const QCString &t) { QCString result; QCString clRealName=n; int p=0,i=0; if ((i=clRealName.find('<'))!=-1) { clRealName=clRealName.left(i); // strip template specialization } if ((i=clRealName.findRev("::"))!=-1) { clRealName=clRealName.right(clRealName.length()-i-2); } while ((i=s.find(clRealName,p))!=-1) { result+=s.mid(p,i-p); size_t j=clRealName.length()+i; if (s.length()==j || (s.at(j)!='<' && !isId(s.at(j)))) { // add template names //printf("Adding %s+%s\n",qPrint(clRealName),qPrint(t)); result+=clRealName+t; } else { // template names already present //printf("Adding %s\n",qPrint(clRealName)); result+=clRealName; } p=i+static_cast<int>(clRealName.length()); } result+=s.right(s.length()-p); //printf("addTemplateNames(%s,%s,%s)=%s\n",qPrint(s),qPrint(n),qPrint(t),qPrint(result)); return result; } // ol.startMemberDocName has already been done before this is called. // when this function returns TRUE, ol.endParameterList will be called. // // typical sequence: // ol.startMemberDoc // ol.startMemberDocName // --- enter writeDefArgumentList // ol.endMemberDocName // ol.startParameterList // ... // ol.startParameterType(first=TRUE) // ol.endParameterType // ol.startParameterName // ol.endParameterName // ol.startParameterExtra // ol.startParameterDefVal [optional] // ol.endParameterDefVal [optional] // ol.endParameterExtra(last==FALSE) // ... // ol.startParameterType(first=FALSE) // ol.endParameterType // ol.startParameterName // ol.endParameterName // ol.startParameterExtra // ol.endParameterExtra(last==TRUE) // ... // --- leave writeDefArgumentList with return value TRUE // ol.endParameterList // ol.endMemberDoc(hasArgs=TRUE) // // For an empty list the function should return FALSE, the sequence is // ol.startMemberDoc // ol.startMemberDocName // --- enter writeDefArgumentList // --- leave writeDefArgumentList with return value FALSE // ol.endMemberDocName // ol.endMemberDoc(hasArgs=FALSE); // static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const MemberDef *md) { const ArgumentList &defArgList=(md->isDocsForDefinition()) ? md->argumentList() : md->declArgumentList(); //printf("writeDefArgumentList '%s' isDocsForDefinition()=%d hasParameters()=%d (%s)\n", // qPrint(md->name()),md->isDocsForDefinition(),defArgList.hasParameters(),qPrint(argListToString(defArgList))); if (!defArgList.hasParameters() || md->isProperty() || md->isTypedef()) { return FALSE; // member has no function like argument list } if (!md->isDefine()) ol.docify(" "); //printf("writeDefArgList(%d)\n",defArgList->count()); ol.endMemberDocName(); ol.startParameterList(!md->isObjCMethod()); //printf("===> name=%s isDefine=%d\n",qPrint(md->name()),md->isDefine()); QCString cName; if (scope) { cName=scope->name(); int il=cName.find('<'); int ir=cName.findRev('>'); if (il!=-1 && ir!=-1 && ir>il) { cName=cName.mid(il,ir-il+1); //printf("1. cName=%s\n",qPrint(cName)); } else if (scope->definitionType()==Definition::TypeClass) { cName=tempArgListToString((toClassDef(scope))->templateArguments(), scope->getLanguage()); //printf("2. cName=%s\n",qPrint(cName)); } else // no template specifier { cName.clear(); } } //printf("~~~ %s cName=%s\n",qPrint(md->name()),qPrint(cName)); QCString sep = getLanguageSpecificSeparator(md->getLanguage(),true); bool first=TRUE; bool paramTypeStarted=FALSE; bool isDefine = md->isDefine(); auto alIt = defArgList.begin(); while (alIt!=defArgList.end()) { Argument a = *alIt; if (isDefine || first) { ol.startParameterType(first,QCString()); paramTypeStarted=true; if (isDefine) { ol.endParameterType(); ol.startParameterName(TRUE); } } if (!a.attrib.isEmpty() && !md->isObjCMethod()) // argument has an IDL attribute { ol.docify(a.attrib+" "); } QCString atype = a.type; if (sep!="::") { atype=substitute(atype,"::",sep); } int funcPtrPos=-1; { if (md->isObjCMethod()) { atype.prepend("("); atype.append(")"); } if (atype!="...") { if (!cName.isEmpty() && scope && scope!=Doxygen::globalScope) { atype=addTemplateNames(atype,scope->name(),cName); } funcPtrPos = atype.find("*)("); if (funcPtrPos!=-1) funcPtrPos++; linkifyText(TextGeneratorOLImpl(ol),scope,md->getBodyDef(),md, funcPtrPos==-1 ? atype : atype.left(funcPtrPos)); } } if (!isDefine) { if (paramTypeStarted) { ol.endParameterType(); paramTypeStarted=FALSE; } ol.startParameterName(defArgList.size()<2); } else { ol.endParameterName(); } if (atype=="...") { ol.docify(atype); } else if (!a.name.isEmpty()) // argument has a name { ol.docify(a.name); } if (!isDefine) { if (funcPtrPos!=-1) { ol.writeNonBreakableSpace(1); } ol.endParameterName(); } ol.startParameterExtra(); if (funcPtrPos!=-1) { linkifyText(TextGeneratorOLImpl(ol),scope,md->getBodyDef(),md, atype.mid(funcPtrPos)); } if (!a.array.isEmpty()) { ol.docify(a.array); } if (!a.defval.isEmpty()) // write the default value { QCString n=a.defval; if (scope && scope!=Doxygen::globalScope && !cName.isEmpty()) { n=addTemplateNames(n,scope->name(),cName); } ol.startParameterDefVal(" = "); linkifyText(TextGeneratorOLImpl(ol),scope,md->getBodyDef(),md,n,FALSE,TRUE,TRUE); ol.endParameterDefVal(); } ++alIt; if (alIt!=defArgList.end()) { a = *alIt; if (!md->isObjCMethod()) ol.docify(", "); // there are more arguments if (!isDefine) { QCString key; if (md->isObjCMethod() && a.attrib.length()>=2) { //printf("Found parameter keyword %s\n",a.qPrint(attrib)); // strip [ and ] key=a.attrib.mid(1,a.attrib.length()-2); if (key!=",") key+=":"; // for normal keywords add colon } ol.endParameterExtra(false,false,!md->isObjCMethod()); if (paramTypeStarted) { ol.endParameterType(); } ol.startParameterType(FALSE,key); paramTypeStarted=TRUE; } else // isDefine { ol.endParameterExtra(false,false,true); } } first=FALSE; } if (first) { ol.startParameterName(defArgList.size()<2); ol.endParameterName(); ol.startParameterExtra(); } ol.endParameterExtra(TRUE,defArgList.size()<2,!md->isObjCMethod()); if (!md->extraTypeChars().isEmpty()) { ol.docify(md->extraTypeChars()); } if (defArgList.constSpecifier()) { ol.docify(" const"); } if (defArgList.volatileSpecifier()) { ol.docify(" volatile"); } if (defArgList.refQualifier()==RefQualifierType::LValue) { ol.docify(" &"); } else if (defArgList.refQualifier()==RefQualifierType::RValue) { ol.docify(" &&"); } if (!defArgList.trailingReturnType().isEmpty()) { linkifyText(TextGeneratorOLImpl(ol), // out scope, // scope md->getBodyDef(), // fileScope md, // self defArgList.trailingReturnType(), // text FALSE // autoBreak ); } return TRUE; } static void writeExceptionListImpl( OutputList &ol, const ClassDef *cd, const MemberDef *md, QCString const& exception) { // this is ordinary exception spec - there must be a '(' //printf("exception='%s'\n",qPrint(exception)); int index = exception.find('('); if (index!=-1) { ol.exceptionEntry(exception.left(index),false); ++index; // paren in second column so skip it here for (int comma = exception.find(',', index); comma!=-1; ) { ++comma; // include comma linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md, exception.mid(index,comma-index)); ol.exceptionEntry(QCString(),false); index=comma; comma = exception.find(',', index); } int close = exception.find(')', index); if (close!=-1) { QCString type=removeRedundantWhiteSpace(exception.mid(index,close-index)); linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,type); ol.exceptionEntry(QCString(),true); } else { warn(md->getDefFileName(),md->getDefLine(), "missing ) in exception list on member %s",qPrint(md->name())); } } else // Java Exception { ol.docify(" "); linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,exception); } } static void writeExceptionList(OutputList &ol, const ClassDef *cd, const MemberDef *md) { QCString exception(QCString(md->excpString()).stripWhiteSpace()); if ('{'==exception.at(0)) { // this is an UNO IDL attribute - need special handling int index = exception.find(';'); int oldIndex = 1; while (-1 != index) // there should be no more than 2 (set / get) { // omit '{' and ';' -> "set raises (...)" writeExceptionListImpl(ol,cd,md,exception.mid(oldIndex,index-oldIndex)); oldIndex=index+1; index = exception.find(';',oldIndex); } // the rest is now just '}' - omit that } else { writeExceptionListImpl(ol,cd,md,exception); } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void MemberDefImpl::init(Definition *d, const QCString &t,const QCString &a,const QCString &e, Protection p,Specifier v,bool s,Relationship r, MemberType mt,const ArgumentList &tal, const ArgumentList &al,const QCString &meta ) { m_classDef=nullptr; m_fileDef=nullptr; m_moduleDef=nullptr; m_redefines=nullptr; m_relatedAlso=nullptr; m_accessorClass=nullptr; m_nspace=nullptr; m_memDef=nullptr; m_memDec=nullptr; m_group=nullptr; m_grpId=-1; m_enumScope=nullptr; m_livesInsideEnum=FALSE; m_hasCallGraph = Config_getBool(CALL_GRAPH); m_hasCallerGraph = Config_getBool(CALLER_GRAPH); m_hasReferencedByRelation = Config_getBool(REFERENCED_BY_RELATION); m_hasReferencesRelation = Config_getBool(REFERENCES_RELATION); m_hasEnumValues = Config_getBool(SHOW_ENUM_VALUES); m_hasInlineSource = Config_getBool(INLINE_SOURCES); m_initLines=0; m_type=t; if (mt==MemberType::Typedef) m_type.stripPrefix("typedef "); // type.stripPrefix("struct "); // type.stripPrefix("class " ); // type.stripPrefix("union " ); m_type=removeRedundantWhiteSpace(m_type); m_args=a; m_args=removeRedundantWhiteSpace(m_args); if (m_type.isEmpty()) m_decl=d->name()+m_args; else m_decl=m_type+" "+d->name()+m_args; m_memberGroup=nullptr; m_virt=v; m_prot=p; m_related=r; m_stat=s; m_mtype=mt; m_exception=e; m_proto=FALSE; m_annScope=FALSE; m_memSpec=TypeSpecifier(); m_vhdlSpec=VhdlSpecifier::UNKNOWN; m_annMemb=nullptr; m_annEnumType=nullptr; m_groupAlias=nullptr; m_explExt=FALSE; m_tspec=FALSE; m_cachedAnonymousType=nullptr; m_maxInitLines=Config_getInt(MAX_INITIALIZER_LINES); m_userInitLines=-1; m_docEnumValues=FALSE; // copy function template arguments (if any) m_tArgList = tal; //printf("new member al=%p\n",al); // copy function definition arguments (if any) m_defArgList = al; // convert function declaration arguments (if any) if (!m_args.isEmpty()) { m_declArgList = *stringToArgumentList(d->getLanguage(),m_args,&m_extraTypeChars); //printf("setDeclArgList %s to %s const=%d\n",qPrint(args), // qPrint(argListToString(declArgList)),declArgList->constSpecifier); } m_metaData = meta; m_templateMaster = nullptr; m_docsForDefinition = TRUE; m_isTypedefValCached = FALSE; m_cachedTypedefValue = nullptr; m_implOnly=FALSE; m_groupMember = nullptr; m_hasDocumentedParams = FALSE; m_hasDocumentedReturnType = FALSE; m_docProvider = nullptr; m_isDMember = d->getDefFileName().lower().endsWith(".d"); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- /*! Creates a new member definition. * * \param df File containing the definition of this member. * \param dl Line at which the member definition was found. * \param dc Column at which the member definition was found. * \param t A string representing the type of the member. * \param na A string representing the name of the member. * \param a A string representing the arguments of the member. * \param e A string representing the throw clause of the members. * \param p The protection context of the member, possible values are: * \c Public, \c Protected, \c Private. * \param v The degree of 'virtualness' of the member, possible values are: * \c Normal, \c Virtual, \c Pure. * \param s A boolean that is true iff the member is static. * \param r The relationship between the class and the member. * \param mt The kind of member. See #MemberType for a list of * all types. * \param tal The template arguments of this member. * \param al The arguments of this member. This is a structured form of * the string past as argument \a a. * \param meta Slice metadata. */ MemberDefImpl::MemberDefImpl(const QCString &df,int dl,int dc, const QCString &t,const QCString &na,const QCString &a,const QCString &e, Protection p,Specifier v,bool s,Relationship r,MemberType mt, const ArgumentList &tal,const ArgumentList &al,const QCString &meta ) : DefinitionMixin(df,dl,dc,removeRedundantWhiteSpace(na)) { //printf("MemberDefImpl::MemberDef(%s)\n",qPrint(na)); init(this,t,a,e,p,v,s,r,mt,tal,al,meta); m_isLinkableCached = 0; m_isConstructorCached = 0; m_isDestructorCached = 0; } std::unique_ptr<MemberDef> MemberDefImpl::deepCopy() const { std::unique_ptr<MemberDefImpl> result(new MemberDefImpl( getDefFileName(),getDefLine(),getDefColumn(),m_type,localName(),m_args,m_exception, m_prot,m_virt,m_stat,m_related,m_mtype,m_tArgList,m_defArgList,m_metaData)); // first copy base members result->DefinitionMixin<MemberDefMutable>::operator=(*this); // then copy other members result->m_typeConstraints = m_typeConstraints ; result->m_declArgList = m_declArgList ; result->m_classDef = m_classDef ; result->m_fileDef = m_fileDef ; result->m_moduleDef = m_moduleDef ; result->m_nspace = m_nspace ; result->m_enumScope = m_enumScope ; result->m_livesInsideEnum = m_livesInsideEnum ; result->m_annEnumType = m_annEnumType ; result->m_enumFields = m_enumFields ; result->m_redefines = m_redefines ; result->m_redefinedBy = m_redefinedBy ; result->m_memDef = m_memDef ; result->m_memDec = m_memDec ; result->m_relatedAlso = m_relatedAlso ; result->m_examples = m_examples ; result->m_accessorType = m_accessorType ; result->m_accessorClass = m_accessorClass ; result->m_def = m_def ; result->m_anc = m_anc ; result->m_decl = m_decl ; result->m_bitfields = m_bitfields ; result->m_read = m_read ; result->m_write = m_write ; result->m_exception = m_exception ; result->m_initializer = m_initializer ; result->m_extraTypeChars = m_extraTypeChars ; result->m_enumBaseType = m_enumBaseType ; result->m_requiresClause = m_requiresClause ; result->m_initLines = m_initLines ; result->m_memSpec = m_memSpec ; result->m_vhdlSpec = m_vhdlSpec ; result->m_maxInitLines = m_maxInitLines ; result->m_userInitLines = m_userInitLines ; result->m_annMemb = m_annMemb ; result->m_defArgList = m_defArgList ; result->m_declArgList = m_declArgList ; result->m_tArgList = m_tArgList ; result->m_typeConstraints = m_typeConstraints ; result->m_templateMaster = m_templateMaster ; result->m_formalTemplateArguments = m_formalTemplateArguments ; result->m_defTmpArgLists = m_defTmpArgLists ; result->m_cachedAnonymousType = m_cachedAnonymousType ; result->m_sectionMap = m_sectionMap ; result->m_groupAlias = m_groupAlias ; result->m_grpId = m_grpId ; result->m_memberGroup = m_memberGroup ; result->m_group = m_group ; result->m_grouppri = m_grouppri ; result->m_groupFileName = m_groupFileName ; result->m_groupStartLine = m_groupStartLine ; result->m_groupMember = m_groupMember ; result->m_isTypedefValCached = m_isTypedefValCached ; result->m_cachedTypedefValue = m_cachedTypedefValue ; result->m_cachedTypedefTemplSpec = m_cachedTypedefTemplSpec ; result->m_cachedResolvedType = m_cachedResolvedType ; result->m_docProvider = m_docProvider ; result->m_explicitOutputFileBase = m_explicitOutputFileBase ; result->m_qualifiers = m_qualifiers ; result->m_implOnly = m_implOnly ; result->m_hasDocumentedParams = m_hasDocumentedParams ; result->m_hasDocumentedReturnType = m_hasDocumentedReturnType ; result->m_isDMember = m_isDMember ; result->m_proto = m_proto ; result->m_docEnumValues = m_docEnumValues ; result->m_annScope = m_annScope ; result->m_hasDetailedDescriptionCached = m_hasDetailedDescriptionCached ; result->m_detailedDescriptionCachedValue = m_detailedDescriptionCachedValue ; result->m_hasCallGraph = m_hasCallGraph ; result->m_hasCallerGraph = m_hasCallerGraph ; result->m_hasReferencedByRelation = m_hasReferencedByRelation ; result->m_hasReferencesRelation = m_hasReferencesRelation ; result->m_hasEnumValues = m_hasEnumValues ; result->m_hasInlineSource = m_hasInlineSource ; result->m_explExt = m_explExt ; result->m_tspec = m_tspec ; result->m_groupHasDocs = m_groupHasDocs ; result->m_docsForDefinition = m_docsForDefinition ; result->m_category = m_category ; result->m_categoryRelation = m_categoryRelation ; result->m_declFileName = m_declFileName ; result->m_declLine = m_declLine ; result->m_declColumn = m_declColumn ; result->m_numberOfFlowKW = m_numberOfFlowKW ; result->setDefinitionTemplateParameterLists(m_defTmpArgLists); result->m_isLinkableCached = 0; result->m_isConstructorCached = 0; result->m_isDestructorCached = 0; return result; } void MemberDefImpl::moveTo(Definition *scope) { setOuterScope(scope); if (scope->definitionType()==Definition::TypeClass) { m_classDef = toClassDef(scope); } else if (scope->definitionType()==Definition::TypeFile) { m_fileDef = toFileDef(scope); } else if (scope->definitionType()==Definition::TypeModule) { m_moduleDef = toModuleDef(scope); } else if (scope->definitionType()==Definition::TypeNamespace) { m_nspace = toNamespaceDef(scope); } m_isLinkableCached = 0; m_isConstructorCached = 0; } void MemberDefImpl::setReimplements(MemberDef *md) { m_redefines = md; } void MemberDefImpl::insertReimplementedBy(MemberDef *md) { if (m_templateMaster) { MemberDefMutable *mdm = toMemberDefMutable(m_templateMaster); if (mdm) { mdm->insertReimplementedBy(md); } } if (!m_redefinedBy.contains(md)) { m_redefinedBy.inSort(md); } } const MemberDef *MemberDefImpl::reimplements() const { return m_redefines; } const MemberVector &MemberDefImpl::reimplementedBy() const { return m_redefinedBy; } bool MemberDefImpl::isReimplementedBy(const ClassDef *cd) const { if (cd) { for (const auto &md : m_redefinedBy) { const ClassDef *mcd = md->getClassDef(); if (mcd) { if (cd==mcd || cd->isBaseClass(mcd,TRUE)) { return TRUE; } } } } return FALSE; } void MemberDefImpl::insertEnumField(MemberDef *md) { m_enumFields.push_back(md); } bool MemberDefImpl::addExample(const QCString &anchor,const QCString &nameStr, const QCString &file) { //printf("%s::addExample(%s,%s,%s)\n",qPrint(name()),anchor,nameStr,file); return m_examples.inSort(Example(anchor,nameStr,file)); } bool MemberDefImpl::hasExamples() const { return !m_examples.empty(); } QCString MemberDefImpl::sourceRefName() const { QCString n = name(); QCString s = getScopeString(); if (!s.isEmpty()) { n.prepend(s+"::"); } else if (isStatic() && getFileDef()) { n.prepend(getFileDef()->name()+":"); } if (isCallable()) { n.append(argsString()); } return n; } QCString MemberDefImpl::getOutputFileBase() const { bool separateMemberPages = Config_getBool(SEPARATE_MEMBER_PAGES); bool inlineSimpleClasses = Config_getBool(INLINE_SIMPLE_STRUCTS); QCString baseName; //printf("Member: %s: templateMaster=%p group=%p classDef=%p nspace=%p fileDef=%p\n", // qPrint(name()),m_templateMaster,m_group,m_classDef, // m_nspace,m_fileDef); const NamespaceDef *nspace = getNamespaceDef(); const FileDef *fileDef = getFileDef(); const ClassDef *classDef = getClassDef(); const ModuleDef *moduleDef = getModuleDef(); const GroupDef *groupDef = getGroupDef(); if (!m_explicitOutputFileBase.isEmpty()) { return m_explicitOutputFileBase; } else if (templateMaster()) { return templateMaster()->getOutputFileBase(); } else if (groupDef) { baseName=groupDef->getOutputFileBase(); } else if (classDef) { baseName=classDef->getOutputFileBase(); if (inlineSimpleClasses && classDef->isSimple()) { return baseName; } } else if (nspace && (nspace->isLinkable() || nspace->isAnonymous())) { baseName=nspace->getOutputFileBase(); } else if (fileDef) { baseName=fileDef->getOutputFileBase(); } else if (moduleDef) { baseName=moduleDef->getOutputFileBase(); } if (baseName.isEmpty()) { warn(getDefFileName(),getDefLine(), "Internal inconsistency: member %s does not belong to any" " container!",qPrint(name()) ); return "dummy"; } else if (separateMemberPages && hasDetailedDescription()) { if (getEnumScope()) // enum value, which is part of enum's documentation { baseName+="_"+getEnumScope()->anchor(); } else { baseName+="_"+anchor(); } } return baseName; } QCString MemberDefImpl::getReference() const { QCString ref = DefinitionMixin::getReference(); if (!ref.isEmpty()) { return ref; } const NamespaceDef *nspace = getNamespaceDef(); const FileDef *fileDef = getFileDef(); const ClassDef *classDef = getClassDef(); const ModuleDef *moduleDef = getModuleDef(); const GroupDef *groupDef = getGroupDef(); if (templateMaster()) { return templateMaster()->getReference(); } else if (groupDef) { return groupDef->getReference(); } else if (classDef) { return classDef->getReference(); } else if (nspace) { return nspace->getReference(); } else if (moduleDef) { return moduleDef->getReference(); } else if (fileDef) { return fileDef->getReference(); } return ""; } QCString MemberDefImpl::anchor() const { QCString result=m_anc; if (m_groupAlias) return m_groupAlias->anchor(); if (m_templateMaster) return m_templateMaster->anchor(); if (m_enumScope && m_enumScope!=this) // avoid recursion for C#'s public enum E { E, F } { result.prepend(m_enumScope->anchor()); } if (getGroupDef()) { if (m_groupMember) { result=m_groupMember->anchor(); } else if (getReference().isEmpty()) { result.prepend("g"); } } return result; } void MemberDefImpl::_computeLinkableInProject() { AUTO_TRACE("name={}",qualifiedName()); bool extractStatic = Config_getBool(EXTRACT_STATIC); bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); m_isLinkableCached = 2; // linkable //printf("MemberDefImpl::isLinkableInProject(name=%s)\n",qPrint(name())); if (isHidden()) { AUTO_TRACE_ADD("is hidden"); m_isLinkableCached = 1; return; } if (templateMaster()) { AUTO_TRACE_ADD("has master template"); m_isLinkableCached = templateMaster()->isLinkableInProject() ? 2 : 1; return; } if (isAnonymous()) { AUTO_TRACE_ADD("name invalid"); m_isLinkableCached = 1; // not a valid or a dummy name return; } if (!hasDocumentation() || isReference()) { AUTO_TRACE_ADD("no docs or reference"); m_isLinkableCached = 1; // no documentation return; } const GroupDef *groupDef = getGroupDef(); const ModuleDef *moduleDef = getModuleDef(); const ClassDef *classDef = getClassDef(); if (groupDef && !groupDef->isLinkableInProject()) { AUTO_TRACE_ADD("in not linkable group"); m_isLinkableCached = 1; // group but group not linkable return; } if (!groupDef && classDef && !classDef->isLinkableInProject()) { AUTO_TRACE_ADD("in not linkable class"); m_isLinkableCached = 1; // in class but class not linkable return; } if (!groupDef && moduleDef && !moduleDef->isLinkableInProject()) { AUTO_TRACE_ADD("in not linkable module"); m_isLinkableCached = 1; // in module but module not linkable return; } const NamespaceDef *nspace = getNamespaceDef(); const FileDef *fileDef = getFileDef(); if (!groupDef && nspace /*&& m_related==Relationship::Member*/ && !nspace->isLinkableInProject() && (fileDef==nullptr || !fileDef->isLinkableInProject())) { AUTO_TRACE_ADD("in not linkable namespace"); m_isLinkableCached = 1; // in namespace but namespace not linkable return; } if (!groupDef && !nspace && /*m_related==Relationship::Member &&*/ !classDef && fileDef && !fileDef->isLinkableInProject()) { AUTO_TRACE_ADD("in not linkable file"); m_isLinkableCached = 1; // in file (and not in namespace) but file not linkable return; } if ((!protectionLevelVisible(m_prot) && m_mtype!=MemberType::Friend) && !(m_prot==Protection::Private && (m_virt!=Specifier::Normal || isOverride() || isFinal()) && extractPrivateVirtual)) { AUTO_TRACE_ADD("private and invisible"); m_isLinkableCached = 1; // hidden due to protection return; } if (m_stat && classDef==nullptr && !extractStatic) { AUTO_TRACE_ADD("static and invisible"); m_isLinkableCached = 1; // hidden due to staticness return; } AUTO_TRACE_ADD("linkable"); return; // linkable! } void MemberDefImpl::setDocumentation(const QCString &d,const QCString &docFile,int docLine,bool stripWhiteSpace) { DefinitionMixin::setDocumentation(d,docFile,docLine,stripWhiteSpace); m_isLinkableCached = 0; } void MemberDefImpl::setBriefDescription(const QCString &b,const QCString &briefFile,int briefLine) { DefinitionMixin::setBriefDescription(b,briefFile,briefLine); m_isLinkableCached = 0; } void MemberDefImpl::setInbodyDocumentation(const QCString &d,const QCString &inbodyFile,int inbodyLine) { DefinitionMixin::setInbodyDocumentation(d,inbodyFile,inbodyLine); m_isLinkableCached = 0; } void MemberDefImpl::setHidden(bool b) { DefinitionMixin::setHidden(b); m_isLinkableCached = 0; } bool MemberDefImpl::isLinkableInProject() const { if (m_isLinkableCached==0) { MemberDefImpl *that = const_cast<MemberDefImpl*>(this); that->_computeLinkableInProject(); } ASSERT(m_isLinkableCached>0); return m_isLinkableCached==2; } bool MemberDefImpl::isLinkable() const { if (m_templateMaster) { return m_templateMaster->isLinkable(); } else { return isLinkableInProject() || isReference(); } } void MemberDefImpl::setDefinitionTemplateParameterLists(const ArgumentLists &lists) { m_defTmpArgLists = lists; } void MemberDefImpl::writeLink(OutputList &ol, const ClassDef *,const NamespaceDef *,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, bool onlyText) const { SrcLangExt lang = getLanguage(); bool hideScopeNames = Config_getBool(HIDE_SCOPE_NAMES); QCString sep = getLanguageSpecificSeparator(lang,TRUE); QCString n = name(); const ClassDef *classDef = getClassDef(); const ModuleDef *moduleDef = getModuleDef(); const NamespaceDef *nspace = getNamespaceDef(); if (!hideScopeNames) { if (m_enumScope && m_livesInsideEnum && getGroupDef()!=nullptr) { n.prepend(m_enumScope->displayName()+sep); } if (classDef && gd && !isRelated()) { n.prepend(classDef->displayName()+sep); } else if (nspace && (gd || fd || moduleDef)) { n.prepend(nspace->displayName()+sep); } } if (isObjCMethod()) { if (isStatic()) ol.docify("+ "); else ol.docify("- "); } if (!onlyText && (isLinkable() || hasDetailedDescription())) // write link { if (m_mtype==MemberType::EnumValue && getGroupDef()==nullptr && // enum value is not grouped getEnumScope() && getEnumScope()->getGroupDef()) // but its container is { const GroupDef *enumValGroup = getEnumScope()->getGroupDef(); ol.writeObjectLink(enumValGroup->getReference(), enumValGroup->getOutputFileBase(), anchor(),n); } else { ol.writeObjectLink(getReference(),getOutputFileBase(),anchor(),n); } } else // write only text { ol.startBold(); ol.docify(n); ol.endBold(); } } static std::mutex g_cachedAnonymousTypeMutex; /*! If this member has an anonymous class/struct/union as its type, then * this method will return the ClassDef that describes this return type. */ ClassDef *MemberDefImpl::getClassDefOfAnonymousType() const { std::lock_guard<std::mutex> lock(g_cachedAnonymousTypeMutex); //printf("%s:getClassDefOfAnonymousType() cache=%s\n",qPrint(name()), // m_cachedAnonymousType?qPrint(m_cachedAnonymousType->name()):"<empty>"); if (m_cachedAnonymousType) return m_cachedAnonymousType; QCString cname; if (getClassDef()!=nullptr) { cname=getClassDef()->name(); } else if (getNamespaceDef()!=nullptr) { cname=getNamespaceDef()->name(); } QCString ltype(m_type); // strip 'friend' keyword from ltype ltype.stripPrefix("friend "); // search for the last anonymous scope in the member type ClassDef *annoClassDef=nullptr; // match expression if it contains at least one @1 marker, e.g. // 'struct A::@1::@2::B' matches 'A::@1::@2::B' but 'struct A::B' does not match. std::string stype = ltype.str(); static const reg::Ex r(R"([\w@:]*@\d+[\w@:]*)"); reg::Match match; if (reg::search(stype,match,r)) // found anonymous scope in type { QCString annName = match.str(); // if inside a class or namespace try to prepend the scope name if (!cname.isEmpty() && annName.left(cname.length()+2)!=cname+"::") { QCString ts=stripAnonymousNamespaceScope(cname+"::"+annName); annoClassDef=getClass(ts); } // if not found yet, try without scope name if (annoClassDef==nullptr) { QCString ts=stripAnonymousNamespaceScope(annName); annoClassDef=getClass(ts); } } m_cachedAnonymousType = annoClassDef; return annoClassDef; } /*! This methods returns TRUE iff the brief section (also known as * declaration section) is visible in the documentation. */ bool MemberDefImpl::isBriefSectionVisible() const { bool extractStatic = Config_getBool(EXTRACT_STATIC); bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); bool briefMemberDesc = Config_getBool(BRIEF_MEMBER_DESC); bool repeatBrief = Config_getBool(REPEAT_BRIEF); bool hideFriendCompounds = Config_getBool(HIDE_FRIEND_COMPOUNDS); //printf("Member %s grpId=%d docs=%s file=%s args=%s\n", // qPrint(name()), // 0,"", //grpId,grpId==-1?"<none>":Doxygen::memberDocDict[grpId]->data(), // "", //qPrint(getFileDef()->name()), // argsString()); bool hasDocs = hasDocumentation(); // only include static members with file/namespace scope if // explicitly enabled in the config file bool visibleIfStatic = !(getClassDef()==nullptr && isStatic() && !extractStatic ); // only include members is the are documented or // HIDE_UNDOC_MEMBERS is NO in the config file bool visibleIfDocumented = (!hideUndocMembers || hasDocs || isDocumentedFriendClass() ); // hide members with no detailed description and brief descriptions // explicitly disabled. bool visibleIfEnabled = !(hideUndocMembers && documentation().isEmpty() && !briefMemberDesc && !repeatBrief ); // Hide friend (class|struct|union) declarations if HIDE_FRIEND_COMPOUNDS is true bool visibleIfFriendCompound = !(hideFriendCompounds && isFriend() /*&& (m_type=="friend class" || m_type=="friend struct" || m_type=="friend union" )*/ ); // only include members that are non-private unless EXTRACT_PRIVATE is // set to YES or the member is part of a group. And as a special case, // private *documented* virtual members are shown if EXTRACT_PRIV_VIRTUAL // is set to YES bool visibleIfPrivate = (protectionLevelVisible(protection()) || m_mtype==MemberType::Friend || (m_prot==Protection::Private && (m_virt!=Specifier::Normal || isOverride() || isFinal()) && extractPrivateVirtual && hasDocs) ); // hide member if it overrides a member in a superclass and has no // documentation of its own //bool visibleIfDocVirtual = !reimplements() || // !Config_getBool(INHERIT_DOCS) || // hasDocs; // true if this member is a constructor or destructor bool cOrDTor = isConstructor() || isDestructor(); // hide default constructors or destructors (no args) without // documentation bool visibleIfNotDefaultCDTor = !(cOrDTor && (m_defArgList.empty() || m_defArgList.front().type == "void" ) && !hasDocs ); //printf("visibleIfStatic=%d visibleIfDocumented=%d visibleIfEnabled=%d " // "visibleIfPrivate=%d visibleIfNotDefaultCDTor=%d " // "visibleIfFriendCompound=%d !annScope=%d\n", // visibleIfStatic,visibleIfDocumented, // visibleIfEnabled,visibleIfPrivate,visibleIfNotDefaultCDTor, // visibleIfFriendCompound,!m_annScope); bool visible = visibleIfStatic && visibleIfDocumented && visibleIfEnabled && visibleIfPrivate && /*visibleIfDocVirtual &&*/ visibleIfNotDefaultCDTor && visibleIfFriendCompound && !m_annScope && !isHidden(); //printf("MemberDefImpl::isBriefSectionVisible() %d\n",visible); return visible; } QCString MemberDefImpl::getDeclType() const { SrcLangExt lang = getLanguage(); QCString ltype(m_type); if (lang==SrcLangExt::Cpp && isEnumerate() && isStrong()) { if (isEnumStruct()) { ltype+=" struct"; } else { ltype+=" class"; } } if (isTypedef() && getLanguage() != SrcLangExt::Slice) { ltype.prepend("typedef "); } if (isTypeAlias()) { ltype="using"; } // strip 'friend' keyword from ltype ltype.stripPrefix("friend "); if (ltype=="@") // rename type from enum values { ltype=""; } else { if (isObjCMethod()) { ltype.prepend("("); ltype.append(")"); } } return ltype; } void MemberDefImpl::_writeTemplatePrefix(OutputList &ol, const Definition *def, const ArgumentList &al, bool writeReqClause) const { ol.docify("template<"); for (auto it = al.begin(); it!=al.end();) { Argument a = *it; linkifyText(TextGeneratorOLImpl(ol), // out def, // scope getFileDef(), // fileScope this, // self a.type, // text FALSE // autoBreak ); ol.docify(" "); ol.docify(a.name); if (a.defval.length()!=0) { ol.docify(" = "); ol.docify(a.defval); } ++it; if (it!=al.end()) ol.docify(", "); } ol.docify("> "); if (writeReqClause && !m_requiresClause.isEmpty()) { ol.lineBreak(); ol.docify("requires "); linkifyText(TextGeneratorOLImpl(ol), // out def, // scope getFileDef(), // fileScope this, // self m_requiresClause, // text FALSE // autoBreak ); } } static QCString combineArgsAndException(QCString args,QCString exception) { if (exception.isEmpty()) return args; // no exception, nothing to combine args int pos = args.findRev(')'); int eqPos = pos!=-1 ? args.find('=',pos) : -1; // look for '=' in '(args) = something' if (eqPos==-1) return args+" "+exception; // append exception at the end return args.left(eqPos)+" "+exception+" "+args.mid(eqPos); // insert exception before = } bool MemberDefImpl::_isAnonymousBitField() const { return !m_bitfields.isEmpty() && name().startsWith("__pad"); // anonymous bitfield } void MemberDefImpl::writeDeclaration(OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, bool inGroup, int indentLevel, const ClassDef *inheritedFrom,const QCString &inheritId) const { //printf("> %s MemberDefImpl::writeDeclaration() inGroup=%d inheritId=%s\n",qPrint(qualifiedName()),inGroup,qPrint(inheritId)); // hide enum value, since they appear already as part of the enum, unless they // are explicitly grouped. if (!inGroup && m_mtype==MemberType::EnumValue) return; const Definition *d=nullptr; ASSERT (cd!=nullptr || nd!=nullptr || fd!=nullptr || gd!=nullptr || mod!=nullptr); // member should belong to something if (cd) d=cd; else if (nd) d=nd; else if (mod) d=mod; else if (fd) d=fd; else d=gd; if (d==gd) // see bug 753608 { if (getClassDef()) d = getClassDef(); else if (getNamespaceDef()) d = getNamespaceDef(); else if (getFileDef()) d = getFileDef(); } else if (d==fd) // see issue #9850, namespace member can be shown in file scope as well { if (getNamespaceDef()) d = getNamespaceDef(); } if (d==nullptr) { err("No context could be derived for member '%s'\n",qPrint(name())); return; // should not happen } QCString cname = d->name(); QCString cdname = d->displayName(); QCString cfname = getOutputFileBase(); // search for the last anonymous scope in the member type ClassDef *annoClassDef=getClassDefOfAnonymousType(); ol.startMemberDeclaration(); // start a new member declaration bool isAnonType = annoClassDef || m_annMemb || m_annEnumType; OutputGenerator::MemberItemType anonType = isAnonType ? OutputGenerator::MemberItemType::AnonymousStart : !m_tArgList.empty() ? OutputGenerator::MemberItemType::Templated : OutputGenerator::MemberItemType::Normal; ol.startMemberItem(anchor(), anonType, inheritId); // If there is no detailed description we need to write the anchor here. bool detailsVisible = hasDetailedDescription(); bool writeAnchor = (inGroup || getGroupDef()==nullptr) && // only write anchors for member that have no details and are !detailsVisible && !m_annMemb && // rendered inside the group page or are not grouped at all inheritId.isEmpty(); if (writeAnchor) { QCString doxyArgs=argsString(); QCString doxyName=name(); if (!cname.isEmpty()) { doxyName.prepend(cdname+getLanguageSpecificSeparator(getLanguage())); } ol.startDoxyAnchor(cfname,cname,anchor(),doxyName,doxyArgs); ol.addLabel(cfname,anchor()); } if (!detailsVisible) { ol.pushGeneratorState(); ol.disable(OutputType::Man); ol.disable(OutputType::Latex); ol.disable(OutputType::Docbook); ol.docify("\n"); ol.popGeneratorState(); } if (annoClassDef || m_annMemb) { for (int j=0;j<indentLevel;j++) { ol.writeNonBreakableSpace(3); } } // *** write template lists if (m_tArgList.hasParameters() && getLanguage()==SrcLangExt::Cpp) { if (!isAnonType) ol.startMemberTemplateParams(); _writeTemplatePrefix(ol,d,m_tArgList); if (!isAnonType) ol.endMemberTemplateParams(anchor(),inheritId); } // *** write type QCString ltype(m_type); if (isTypedef() && getLanguage() != SrcLangExt::Slice) { ltype.prepend("typedef "); } if (isTypeAlias()) { ltype="using"; } // strip 'friend' keyword from ltype ltype.stripPrefix("friend "); static const reg::Ex r(R"(@\d+)"); reg::Match match; std::string stype = ltype.str(); bool endAnonScopeNeeded=FALSE; if (reg::search(stype,match,r)) // member has an anonymous type { int i = static_cast<int>(match.position()); int l = static_cast<int>(match.length()); //printf("annoClassDef=%p annMemb=%p scopeName='%s' anonymous='%s'\n", // annoClassDef,annMemb,qPrint(cname),qPrint(ltype.mid(i,l))); if (annoClassDef) // type is an anonymous compound { int ir=i+l; //printf("<<<<<<<<<<<<<<\n"); ol.startAnonTypeScope(indentLevel); annoClassDef->writeDeclaration(ol,m_annMemb,inGroup,indentLevel+1,inheritedFrom,inheritId); //printf(">>>>>>>>>>>>>> startMemberItem(2)\n"); anonType = OutputGenerator::MemberItemType::AnonymousEnd; ol.startMemberItem(anchor(),anonType,inheritId); for (int j=0;j< indentLevel;j++) { ol.writeNonBreakableSpace(3); } QCString varName=ltype.right(ltype.length()-ir).stripWhiteSpace(); //printf(">>>>>> ltype='%s' varName='%s'\n",qPrint(ltype),qPrint(varName)); ol.docify("}"); if (varName.isEmpty() && isAnonymous()) { ol.docify(";"); } else if (!varName.isEmpty() && (varName.at(0)=='*' || varName.at(0)=='&')) { ol.docify(" "); ol.docify(varName); } endAnonScopeNeeded=TRUE; } else { if (getAnonymousEnumType()) // type is an anonymous enum { linkifyText(TextGeneratorOLImpl(ol), // out d, // scope getBodyDef(), // fileScope this, // self ltype.left(i), // text FALSE // autoBreak ); getAnonymousEnumType()->writeEnumDeclaration(ol,cd,nd,fd,gd,mod); //ol+=*getAnonymousEnumType()->enumDecl(); linkifyText(TextGeneratorOLImpl(ol),d,getFileDef(),this,ltype.right(ltype.length()-i-l),TRUE); } else { ltype = ltype.left(i) + " { ... } " + removeAnonymousScopes(ltype.right(ltype.length()-i-l)); linkifyText(TextGeneratorOLImpl(ol), // out d, // scope getBodyDef(), // fileScope this, // self ltype, // text FALSE // autoBreak ); } } } else if (ltype=="@") // rename type from enum values { ltype=""; } else { if (isObjCMethod()) { ltype.prepend("("); ltype.append(")"); } linkifyText(TextGeneratorOLImpl(ol), // out d, // scope getBodyDef(), // fileScope this, // self ltype, // text FALSE // autoBreak ); } bool htmlOn = ol.isEnabled(OutputType::Html); if (htmlOn && !ltype.isEmpty()) { ol.disable(OutputType::Html); } if (!ltype.isEmpty()) ol.docify(" "); if (htmlOn) { ol.enable(OutputType::Html); } if (m_annMemb) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.writeNonBreakableSpace(3); ol.popGeneratorState(); } else { ol.insertMemberAlign(m_tArgList.hasParameters()); } // *** write name if (!isAnonymous() && !_isAnonymousBitField()) // hide anonymous stuff { bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); bool extractStatic = Config_getBool(EXTRACT_STATIC); MemberDefMutable *annMemb = toMemberDefMutable(m_annMemb); bool visibleIfPrivate = (protectionLevelVisible(protection()) || m_mtype==MemberType::Friend || (m_prot==Protection::Private && (m_virt!=Specifier::Normal || isOverride() || isFinal()) && extractPrivateVirtual && hasDocumentation() )); //printf("Member name=`%s gd=%p md->groupDef=%p inGroup=%d isLinkable()=%d hasDocumentation=%d\n",qPrint(name()),gd,getGroupDef(),inGroup,isLinkable(),hasDocumentation()); if (!name().isEmpty() && // name valid (hasDetailedDescription() || isReference()) && // has docs visibleIfPrivate && !(isStatic() && getClassDef()==nullptr && !extractStatic) // hidden due to static-ness ) { if (annMemb) { //printf("anchor=%s ann_anchor=%s\n",anchor(),annMemb->anchor()); annMemb->writeLink(ol, annMemb->getClassDef(), annMemb->getNamespaceDef(), annMemb->getFileDef(), annMemb->getGroupDef(), annMemb->getModuleDef()); } else { //printf("writeLink %s->%d\n",qPrint(name),hasDocumentation()); const ClassDef *rcd = cd; if (isReference() && getClassDef()) rcd = getClassDef(); writeLink(ol,rcd,nd,fd,gd,mod); } } else if (isDocumentedFriendClass()) // if the member is an undocumented friend declaration for some class, // then maybe we can link to the class { writeLink(ol,getClass(name()),nullptr,nullptr,nullptr,nullptr); } else // there is a brief member description and brief member // descriptions are enabled or there is no detailed description. { const ClassDef *rcd = cd; if (isReference() && getClassDef()) rcd = getClassDef(); writeLink(ol,rcd,nd,fd,gd,mod,TRUE); } } // *** write arguments if (!argsString().isEmpty() && !isObjCMethod()) { if (!isDefine() && !isTypedef()) ol.writeString(" "); linkifyText(TextGeneratorOLImpl(ol), // out d, // scope getBodyDef(), // fileScope this, // self isDefine() ? substitute(argsString(),",",", ") : isTypedef() ? substitute(argsString(),")(",") (") : combineArgsAndException(argsString(),excpString()), // text m_annMemb!=nullptr, // autoBreak TRUE, // external FALSE, // keepSpaces indentLevel ); } // *** write bitfields if (!m_bitfields.isEmpty()) // add bitfields { linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_bitfields); } else if (hasOneLineInitializer() //!init.isEmpty() && initLines==0 && // one line initializer //((maxInitLines>0 && userInitLines==-1) || userInitLines>0) // enabled by default or explicitly ) // add initializer { if (isTypeAlias()) // using statement { ol.writeString(" = "); linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_initializer.simplifyWhiteSpace()); } else if (!isDefine()) { //ol.writeString(" = "); ol.writeString(" "); linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_initializer.simplifyWhiteSpace()); } else { ol.writeNonBreakableSpace(3); linkifyText(TextGeneratorOLImpl(ol),d,getBodyDef(),this,m_initializer); } } if ((isObjCMethod() || isObjCProperty()) && isImplementation()) { ol.startTypewriter(); ol.docify(" [implementation]"); ol.endTypewriter(); } bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); if (isProperty() && (isSettable() || isGettable() || isPrivateSettable() || isPrivateGettable() || isProtectedSettable() || isProtectedGettable())) { ol.writeLatexSpacing(); ol.startTypewriter(); ol.docify(" ["); StringVector sl; if (isGettable()) sl.emplace_back("get"); if (isProtectedGettable()) sl.emplace_back("protected get"); if (isSettable()) sl.emplace_back("set"); if (isProtectedSettable()) sl.emplace_back("protected set"); if (extractPrivate) { if (isPrivateGettable()) sl.emplace_back("private get"); if (isPrivateSettable()) sl.emplace_back("private set"); } bool first=true; for (const auto &s : sl) { if (!first) { ol.docify(", "); } first=false; ol.docify(s.c_str()); } ol.docify("]"); ol.endTypewriter(); } if (isEvent() && (isAddable() || isRemovable() || isRaisable())) { ol.writeLatexSpacing(); ol.startTypewriter(); ol.docify(" ["); StringVector sl; if (isAddable()) sl.emplace_back("add"); if (isRemovable()) sl.emplace_back("remove"); if (isRaisable()) sl.emplace_back("raise"); bool first=true; for (const auto &s : sl) { if (!first) { ol.docify(", "); } first=false; ol.docify(s.c_str()); } ol.docify("]"); ol.endTypewriter(); } if (writeAnchor) { ol.endDoxyAnchor(cfname,anchor()); } //printf("endMember %s annoClassDef=%p annEnumType=%p\n", // qPrint(name()),annoClassDef,annEnumType); ol.endMemberItem(anonType); if (endAnonScopeNeeded) { ol.endAnonTypeScope(indentLevel); } // write brief description if (!briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC) ) { auto parser { createDocParser() }; auto ast { validatingParseDoc(*parser.get(), briefFile(),briefLine(), getOuterScope()?getOuterScope():d, this,briefDescription(),TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)) }; if (!ast->isEmpty()) { ol.startMemberDescription(anchor(),inheritId); ol.writeDoc(ast.get(),getOuterScope()?getOuterScope():d,this); if (detailsVisible) // add More.. link only when both brief and details are visible { if (!isAnonymous()) // hide anonymous stuff { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.docify(" "); MemberDefMutable *annMemb = toMemberDefMutable(m_annMemb); if (annMemb) { ol.startTextLink(annMemb->getOutputFileBase(),annMemb->anchor()); ol.parseText(theTranslator->trMore()); ol.endTextLink(); } ol.popGeneratorState(); } } // for RTF we need to add an extra empty paragraph ol.pushGeneratorState(); ol.disableAllBut(OutputType::RTF); ol.startParagraph(); ol.endParagraph(); ol.popGeneratorState(); ol.endMemberDescription(); } } ol.endMemberDeclaration(anchor(),inheritId); warnIfUndocumented(); //printf("< %s MemberDefImpl::writeDeclaration() inGroup=%d\n",qPrint(qualifiedName()),inGroup); } static std::mutex g_hasDetailedDescriptionMutex; bool MemberDefImpl::hasDetailedDescription() const { std::lock_guard<std::mutex> lock(g_hasDetailedDescriptionMutex); //printf(">hasDetailedDescription(cached=%d)\n",m_hasDetailedDescriptionCached); if (!m_hasDetailedDescriptionCached) { bool extractAll = Config_getBool(EXTRACT_ALL); bool alwaysDetailedSec = Config_getBool(ALWAYS_DETAILED_SEC); bool repeatBrief = Config_getBool(REPEAT_BRIEF); bool briefMemberDesc = Config_getBool(BRIEF_MEMBER_DESC); bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); bool extractStatic = Config_getBool(EXTRACT_STATIC); bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); bool inlineSources = hasInlineSource(); // the member has detailed documentation because the user added some comments bool docFilter = // extract all is enabled extractAll || // has detailed docs !documentation().isEmpty() || // has inbody docs !inbodyDocumentation().isEmpty() || // is an enum with values that are documented (isEnumerate() && hasDocumentedEnumValues()) || // is documented enum value (m_mtype==MemberType::EnumValue && !briefDescription().isEmpty()) || // has brief description that is part of the detailed description (!briefDescription().isEmpty() && // has brief docs (alwaysDetailedSec && // they are visible in (repeatBrief || // detailed section or !briefMemberDesc // they are explicitly not ) // shown in brief section ) ) || // has one or more documented arguments (m_templateMaster ? m_templateMaster->argumentList().hasDocumentation() : m_defArgList.hasDocumentation()); // generate function guard // ================== ======= // _writeGroupInclude -> ignored in calculation // multiLineInitializer() -> hasMultiLineInitializer() // _writeReimplements -> _isReimplements() // _writeReimplementedBy -> _countReimplementedBy()>0 // _writeExamples -> hasExamples() // _writeTypeConstraints -> m_typeConstraints.hasParameters() // writeSourceDef -> !getSourceFileBase().isEmpty(); // writeInlineCode -> hasInlineSource() && hasSources() // writeSourceRefs -> hasReferencesRelation() && hasSourceRefs() // writeSourceReffedBy -> hasReferencedByRelation() && hasSourceReffedBy() // _writeCallGraph -> _hasVisibleCallGraph() // _writeCallerGraph -> _hasVisibleCallerGraph() // the member has detailed documentation because there is some generated info bool docInfo = // has a multi-line initialization block (hasMultiLineInitializer()) || // reimplements / reimplemented by _isReimplements() || (_countReimplementedBy() > 0) || // examples hasExamples() || // type constraints m_typeConstraints.hasParameters() || // has source definition !getSourceFileBase().isEmpty() || // has inline sources (inlineSources && hasSources()) || // has references (hasReferencesRelation() && hasSourceRefs()) || (hasReferencedByRelation() && hasSourceReffedBy()) || // call graph _hasVisibleCallGraph() || // caller graph _hasVisibleCallerGraph(); if (!hideUndocMembers) // if HIDE_UNDOC_MEMBERS is NO we also show the detailed section // if there is only some generated info { docFilter = docFilter || docInfo; } // this is not a global static or global statics should be extracted bool staticFilter = getClassDef()!=nullptr || !isStatic() || extractStatic; // only include members that are non-private unless EXTRACT_PRIVATE is // set to YES or the member is part of a group bool privateFilter = protectionLevelVisible(protection()) || m_mtype==MemberType::Friend || (m_prot==Protection::Private && (m_virt!=Specifier::Normal || isOverride() || isFinal()) && extractPrivateVirtual); // hide friend (class|struct|union) member if HIDE_FRIEND_COMPOUNDS // is true bool friendCompoundFilter = !(Config_getBool(HIDE_FRIEND_COMPOUNDS) && isFriend()); m_detailedDescriptionCachedValue = (docFilter && staticFilter && privateFilter && friendCompoundFilter && !isHidden()); //printf("docFilter=%d docInfo=%d staticFilter=%d privateFilter=%d friendCompoundFilter=%d !isHidden()=%d", // docFilter,docInfo,staticFilter,privateFilter,friendCompoundFilter,!isHidden()); m_hasDetailedDescriptionCached = true; } //printf("<hasDetailedDescription(cached=%d)\n",m_hasDetailedDescriptionCached); return m_detailedDescriptionCachedValue; } bool MemberDefImpl::isDetailedSectionVisible(MemberListContainer container) const { bool separateMemPages = Config_getBool(SEPARATE_MEMBER_PAGES); bool inlineSimpleStructs = Config_getBool(INLINE_SIMPLE_STRUCTS); bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); bool groupFilter = getGroupDef()==nullptr || container==MemberListContainer::Group || separateMemPages; bool fileFilter = getNamespaceDef()==nullptr || !getNamespaceDef()->isLinkable() || container!=MemberListContainer::File; bool simpleFilter = (hasBriefDescription() || !hideUndocMembers) && inlineSimpleStructs && getClassDef()!=nullptr && getClassDef()->isSimple(); bool visible = hasDetailedDescription() && groupFilter && fileFilter && !isReference(); bool result = visible || simpleFilter; //printf("%s::isDetailedSectionVisible: %d groupFilter=%d fileFilter=%d\n", // qPrint(name()),result,groupFilter,fileFilter); return result; } StringVector MemberDefImpl::getLabels(const Definition *container) const { StringVector sl; bool inlineInfo = Config_getBool(INLINE_INFO); Specifier lvirt=virtualness(); if ((!isObjCMethod() || isOptional() || isRequired()) && (protection()!=Protection::Public || lvirt!=Specifier::Normal || isFriend() || isRelated() || (isInline() && inlineInfo) || isSignal() || isSlot() || isStatic() || isExternal() || isExported() || (getClassDef() && getClassDef()!=container && container->definitionType()==TypeClass) || TypeSpecifier(m_memSpec).setInline(false)!=TypeSpecifier() ) ) { // write the member specifier list //ol.writeLatexSpacing(); //ol.startTypewriter(); //ol.docify(" ["); SrcLangExt lang = getLanguage(); bool optVhdl = lang==SrcLangExt::VHDL; bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); if (optVhdl) { sl.push_back(theTranslator->trVhdlType(getVhdlSpecifiers(),TRUE).str()); } else { if (isFriend()) sl.emplace_back("friend"); else if (isRelated()) sl.emplace_back("related"); else { if (isExternal()) sl.emplace_back("extern"); if (inlineInfo && isInline()) sl.emplace_back("inline"); if (isExplicit()) sl.emplace_back("explicit"); if (isMutable()) sl.emplace_back("mutable"); if (isStatic()) sl.emplace_back("static"); if (isGettable()) sl.emplace_back("get"); if (isProtectedGettable()) sl.emplace_back("protected get"); if (isSettable()) sl.emplace_back("set"); if (isProtectedSettable()) sl.emplace_back("protected set"); if (extractPrivate) { if (isPrivateGettable()) sl.emplace_back("private get"); if (isPrivateSettable()) sl.emplace_back("private set"); } if (isNoDiscard()) sl.emplace_back("nodiscard"); if (isConstExpr()) sl.emplace_back("constexpr"); if (isConstEval()) sl.emplace_back("consteval"); if (isConstInit()) sl.emplace_back("constinit"); if (isAddable()) sl.emplace_back("add"); if (!isUNOProperty() && isRemovable()) sl.emplace_back("remove"); if (isRaisable()) sl.emplace_back("raise"); if (isReadable()) sl.emplace_back("read"); if (isWritable()) sl.emplace_back("write"); if (isFinal()) sl.emplace_back("final"); if (isAbstract()) sl.emplace_back("abstract"); if (isOverride()) sl.emplace_back("override"); if (isInitonly()) sl.emplace_back("initonly"); if (isSealed()) sl.emplace_back("sealed"); if (isNew()) sl.emplace_back("new"); if (isOptional()) sl.emplace_back("optional"); if (isRequired()) sl.emplace_back("required"); if (isExported()) sl.emplace_back("export"); if (isNonAtomic()) sl.emplace_back("nonatomic"); else if (isObjCProperty()) sl.emplace_back("atomic"); // mutual exclusive Objective 2.0 property attributes if (isAssign()) sl.emplace_back("assign"); else if (isCopy()) sl.emplace_back("copy"); else if (isRetain()) sl.emplace_back("retain"); else if (isWeak()) sl.emplace_back("weak"); else if (lang!=SrcLangExt::CSharp && isStrong()) sl.emplace_back("strong"); else if (isUnretained()) sl.emplace_back("unsafe_unretained"); if (!isObjCMethod()) { if (protection()==Protection::Protected) sl.emplace_back("protected"); else if (protection()==Protection::Private) sl.emplace_back("private"); else if (protection()==Protection::Package) sl.emplace_back("package"); if (lvirt==Specifier::Virtual) sl.emplace_back("virtual"); else if (lvirt==Specifier::Pure) sl.emplace_back("pure virtual"); if (isSignal()) sl.emplace_back("signal"); if (isSlot()) sl.emplace_back("slot"); if (isDefault()) sl.emplace_back("default"); if (isDelete()) sl.emplace_back("delete"); if (isNoExcept()) sl.emplace_back("noexcept"); if (isAttribute()) sl.emplace_back("attribute"); if (isUNOProperty()) sl.emplace_back("property"); if (isReadonly()) sl.emplace_back("readonly"); if (isBound()) sl.emplace_back("bound"); if (isUNOProperty() && isRemovable()) sl.emplace_back("removable"); if (isConstrained()) sl.emplace_back("constrained"); if (isTransient()) sl.emplace_back("transient"); if (isMaybeVoid()) sl.emplace_back("maybevoid"); if (isMaybeDefault()) sl.emplace_back("maybedefault"); if (isMaybeAmbiguous()) sl.emplace_back("maybeambiguous"); if (isPublished()) sl.emplace_back("published"); // enum } if (isObjCProperty() && isImplementation()) { sl.emplace_back("implementation"); } } if (getClassDef() && container->definitionType()==TypeClass && getClassDef()!=container && !isRelated() ) { sl.emplace_back("inherited"); } } } else if (isObjCMethod() && isImplementation()) { sl.emplace_back("implementation"); } for (const auto &sx : m_qualifiers) { bool alreadyAdded = std::find(sl.begin(), sl.end(), sx) != sl.end(); if (!alreadyAdded) { sl.push_back(sx); } } return sl; } void MemberDefImpl::_writeCallGraph(OutputList &ol) const { // write call graph if (_hasVisibleCallGraph()) { DotCallGraph callGraph(this,FALSE); if (callGraph.isTooBig()) { warn_uncond("Call graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", qPrint(qualifiedName()), callGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callGraph.isTrivial()) { msg("Generating call graph for function %s\n",qPrint(qualifiedName())); ol.disable(OutputType::Man); ol.startCallGraph(); ol.parseText(theTranslator->trCallGraph()); ol.endCallGraph(callGraph); ol.enableAll(); } } } void MemberDefImpl::_writeCallerGraph(OutputList &ol) const { if (_hasVisibleCallerGraph()) { DotCallGraph callerGraph(this, TRUE); if (callerGraph.isTooBig()) { warn_uncond("Caller graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", qPrint(qualifiedName()), callerGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callerGraph.isTrivial()) { msg("Generating caller graph for function %s\n",qPrint(qualifiedName())); ol.disable(OutputType::Man); ol.startCallGraph(); ol.parseText(theTranslator->trCallerGraph()); ol.endCallGraph(callerGraph); ol.enableAll(); } } } bool MemberDefImpl::_isReimplements() const { const MemberDef *bmd=reimplements(); const ClassDef *bcd=nullptr; if (bmd && (bcd=bmd->getClassDef())) { // write class that contains a member that is reimplemented by this one if (bcd->isLinkable()) { return true; } } return false; } void MemberDefImpl::_writeReimplements(OutputList &ol) const { const MemberDef *bmd=reimplements(); const ClassDef *bcd=nullptr; if (bmd && (bcd=bmd->getClassDef())) { // write class that contains a member that is reimplemented by this one if (bcd->isLinkable()) { ol.startParagraph(); QCString reimplFromLine; if (bmd->virtualness()!=Specifier::Pure && bcd->compoundType()!=ClassDef::Interface) { reimplFromLine = theTranslator->trReimplementedFromList(1); } else { reimplFromLine = theTranslator->trImplementedFromList(1); } int markerPos = reimplFromLine.find("@0"); if (markerPos!=-1) // should always pass this. { ol.parseText(reimplFromLine.left(markerPos)); //text left from marker if (bmd->isLinkable()) // replace marker with link { //Definition *bd=bmd->group; //if (bd==0) bd=bcd; ol.writeObjectLink(bmd->getReference(),bmd->getOutputFileBase(), bmd->anchor(),bcd->displayName()); //ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), // bmd->anchor(),bcd->name()); if ( bmd->isLinkableInProject() ) { writePageRef(ol,bmd->getOutputFileBase(),bmd->anchor()); } } else { ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), QCString(),bcd->displayName()); if (bcd->isLinkableInProject()/* && !Config_getBool(PDF_HYPERLINKS)*/ ) { writePageRef(ol,bcd->getOutputFileBase(),bcd->anchor()); } } ol.parseText(reimplFromLine.right( reimplFromLine.length()-markerPos-2)); // text right from marker } else { err("translation error: no marker in trReimplementsFromList()\n"); } ol.endParagraph(); } } } size_t MemberDefImpl::_countReimplementedBy() const { const MemberVector &bml=reimplementedBy(); size_t count=0; for (const auto &bmd : bml) { const ClassDef *bcd=bmd->getClassDef(); // count the members that directly inherit from md and for // which the member and class are visible in the docs. if ( bcd && bmd->isLinkable() && bcd->isLinkable() ) { count++; } } return count; } void MemberDefImpl::_writeReimplementedBy(OutputList &ol) const { const MemberVector &bml=reimplementedBy(); size_t count = _countReimplementedBy(); if (count>0) { auto replaceFunc = [&bml,&ol](size_t entryIndex) { size_t cnt=0; auto it = bml.begin(); // find the entryIndex-th documented entry in the inheritance list. const MemberDef *bmd = nullptr; const ClassDef *bcd = nullptr; while (it!=bml.end()) { bmd = *it; bcd = bmd->getClassDef(); if ( bmd->isLinkable() && bcd->isLinkable()) { if (cnt==entryIndex) break; cnt++; } ++it; } if (bcd && bmd) // write link for marker { //ol.writeObjectLink(bcd->getReference(),bcd->getOutputFileBase(), // bmd->anchor(),bcd->name()); ol.writeObjectLink(bmd->getReference(),bmd->getOutputFileBase(), bmd->anchor(),bcd->displayName()); if (bmd->isLinkableInProject() ) { writePageRef(ol,bmd->getOutputFileBase(),bmd->anchor()); } } }; QCString reimplInLine; if (m_virt==Specifier::Pure || (getClassDef() && getClassDef()->compoundType()==ClassDef::Interface)) { reimplInLine = theTranslator->trImplementedInList(static_cast<int>(count)); } else { reimplInLine = theTranslator->trReimplementedInList(static_cast<int>(count)); } // write the list of classes that overwrite this member ol.startParagraph(); writeMarkerList(ol, reimplInLine.str(), count, replaceFunc); ol.endParagraph(); } } void MemberDefImpl::_writeCategoryRelation(OutputList &ol) const { if (getClassDef()) // this should be a member of a class/category { //printf("%s: category %s relation %s class=%s categoryOf=%s\n", // qPrint(name()), // m_category ? qPrint(m_category->name()) : "<none>", // m_categoryRelation ? qPrint(m_categoryRelation->name()) : "<none>", // qPrint(m_classDef->name()), // m_classDef->categoryOf() ? qPrint(m_classDef->categoryOf()->name()) : "<none>" // ); QCString text; QCString ref; QCString file; QCString anc; QCString name; int i=-1; if (m_categoryRelation && m_categoryRelation->isLinkable()) { if (m_category) { // this member is in a normal class and implements method categoryRelation from category // so link to method 'categoryRelation' with 'provided by category 'category' text. text = theTranslator->trProvidedByCategory(); name = m_category->displayName(); } else if (getClassDef()->categoryOf()) { // this member is part of a category so link to the corresponding class member of the class we extend // so link to method 'categoryRelation' with 'extends class 'classDef->categoryOf()' text = theTranslator->trExtendsClass(); name = getClassDef()->categoryOf()->displayName(); } i=text.find("@0"); if (i!=-1) { const MemberDef *md = m_categoryRelation; ref = md->getReference(); file = md->getOutputFileBase(); anc = md->anchor(); } } if (i!=-1 && !name.isEmpty()) { ol.startParagraph(); ol.parseText(text.left(i)); ol.writeObjectLink(ref,file,anc,name); ol.parseText(text.mid(i+2)); ol.endParagraph(); } } } void MemberDefImpl::_writeExamples(OutputList &ol) const { // write the list of examples that use this member if (hasExamples()) { ol.startExamples(); ol.startDescForItem(); writeExamples(ol,m_examples); ol.endDescForItem(); ol.endExamples(); } } void MemberDefImpl::_writeTypeConstraints(OutputList &ol) const { if (m_typeConstraints.hasParameters()) { writeTypeConstraints(ol,this,m_typeConstraints); } } void MemberDefImpl::_writeEnumValues(OutputList &ol,const Definition *container, const QCString &cfname,const QCString &ciname, const QCString &cname) const { // For enum, we also write the documented enum values if (isEnumerate()) { bool first=true; //printf("** %s: enum values=%zu\n",qPrint(name()),enumFieldList().size()); bool hasInits = false; if (hasEnumValues()) { for (const auto &fmd : enumFieldList()) { if (fmd->isLinkable()) { if (!fmd->initializer().isEmpty()) { hasInits = true; break; } } } } for (const auto &fmd : enumFieldList()) { //printf("Enum %p: isLinkable()=%d\n",fmd,fmd->isLinkable()); if (fmd->isLinkable()) { if (first) { ol.startDescTable(theTranslator->trEnumerationValues(),hasInits); first=false; } ol.startDescTableRow(); ol.addIndexItem(fmd->name(),ciname); ol.addIndexItem(ciname,fmd->name()); ol.startDescTableTitle(); ol.startDoxyAnchor(cfname,cname,fmd->anchor(),fmd->name(),fmd->argsString()); ol.addLabel(cfname,fmd->anchor()); ol.docify(fmd->name()); ol.disableAllBut(OutputType::Man); ol.writeString(" "); ol.enableAll(); ol.endDoxyAnchor(cfname,fmd->anchor()); ol.endDescTableTitle(); if (hasInits) { ol.startDescTableInit(); if (!fmd->initializer().isEmpty()) { QCString initStr = fmd->initializer().stripWhiteSpace(); if (initStr.startsWith("=")) initStr = initStr.mid(1).stripWhiteSpace(); ol.disableAllBut(OutputType::Man); ol.writeString("("); ol.enableAll(); ol.docify(initStr); ol.disableAllBut(OutputType::Man); ol.writeString(")"); ol.enableAll(); } ol.endDescTableInit(); } ol.startDescTableData(); bool hasBrief = !fmd->briefDescription().isEmpty(); bool hasDetails = !fmd->documentation().isEmpty(); if (hasBrief) { ol.generateDoc(fmd->briefFile(),fmd->briefLine(), getOuterScope()?getOuterScope():container, fmd,fmd->briefDescription(),TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (hasDetails) { ol.generateDoc(fmd->docFile(),fmd->docLine(), getOuterScope()?getOuterScope():container, fmd,fmd->documentation()+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } ol.endDescTableData(); ol.endDescTableRow(); } } if (!first) { ol.endDescTable(); } } } // match from the start of the scope until the last marker static const reg::Ex reAnonymous(R"([\w:@]*@\d+)"); QCString MemberDefImpl::displayDefinition() const { QCString ldef = definition(); QCString title = name(); if (isEnumerate()) { if (isAnonymous()) { ldef = title = "anonymous enum"; if (!m_enumBaseType.isEmpty()) { ldef+=" : "+m_enumBaseType; } } else { ldef.prepend("enum "); if (isSliceLocal()) { ldef.prepend("local "); } } } else if (isEnumValue()) { if (isAnonymous()) { ldef=ldef.mid(2); } } std::string sdef = ldef.str(); reg::Match match; if (reg::search(sdef,match,reAnonymous)) { ldef = match.prefix().str() + " { ... } " + removeAnonymousScopes(match.suffix().str()); } const ClassDef *cd=getClassDef(); if (cd && cd->isObjectiveC()) { // strip scope name int ep = ldef.find("::"); if (ep!=-1) { int sp=ldef.findRev(' ',ep); if (sp!=-1) { ldef=ldef.left(sp+1)+ldef.mid(ep+2); } } // strip keywords int dp = ldef.find(':'); if (dp!=-1) { ldef=ldef.left(dp+1); } int l=static_cast<int>(ldef.length()); //printf("start >%s<\n",qPrint(ldef)); int i=l-1; while (i>=0 && (isId(ldef.at(i)) || ldef.at(i)==':')) i--; while (i>=0 && isspace(static_cast<uint8_t>(ldef.at(i)))) i--; if (i>0) { // insert branches around the type ldef = "("+ldef.left(i+1)+")"+ldef.mid(i+1); } //printf("end >%s< i=%d\n",qPrint(ldef),i); if (isStatic()) ldef.prepend("+ "); else ldef.prepend("- "); } SrcLangExt lang = getLanguage(); QCString sep = getLanguageSpecificSeparator(lang,TRUE); return substitute(ldef,"::",sep); } void MemberDefImpl::_writeGroupInclude(OutputList &ol,bool inGroup) const { // only write out the include file if this is not part of a class or file // definition bool showGroupedMembInc = Config_getBool(SHOW_GROUPED_MEMB_INC); const FileDef *fd = getFileDef(); QCString nm; if (fd) nm = getFileDef()->docName(); if (inGroup && fd && showGroupedMembInc && !nm.isEmpty()) { ol.startParagraph(); ol.startTypewriter(); SrcLangExt lang = getLanguage(); bool isIDLorJava = lang==SrcLangExt::IDL || lang==SrcLangExt::Java; if (isIDLorJava) { ol.docify("import "); } else { ol.docify("#include "); } if (isIDLorJava) ol.docify("\""); else ol.docify("<"); if (fd->isLinkable()) { ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),fd->anchor(),nm); } else { ol.docify(nm); } if (isIDLorJava) ol.docify("\""); else ol.docify(">"); ol.endTypewriter(); ol.endParagraph(); } } void MemberDefImpl::_writeMultiLineInitializer(OutputList &ol,const QCString &scopeName) const { //printf("md=%s initLines=%d init='%s'\n",qPrint(name()),initLines,qPrint(init)); ol.startBold(); if (m_mtype==MemberType::Define) ol.parseText(theTranslator->trDefineValue()); else ol.parseText(theTranslator->trInitialValue()); ol.endBold(); QCString langCorrected = getDefFileExtension(); SrcLangExt srcLangExt = getLanguageFromFileName(getDefFileExtension()); if (srcLangExt == SrcLangExt::Lex) { langCorrected = ".doxygen_lex_c"; srcLangExt = SrcLangExt::Cpp; } auto intf = Doxygen::parserManager->getCodeParser(langCorrected); intf->resetCodeParserState(); auto &codeOL = ol.codeGenerators(); codeOL.startCodeFragment("DoxyCode"); intf->parseCode(codeOL,scopeName,m_initializer,srcLangExt,Config_getBool(STRIP_CODE_COMMENTS),FALSE,QCString(),getFileDef(), -1,-1,TRUE,this,FALSE,this); codeOL.endCodeFragment("DoxyCode"); } /*! Writes the "detailed documentation" section of this member to * all active output formats. */ void MemberDefImpl::writeDocumentation(const MemberList *ml, int memCount,int memTotal, OutputList &ol, const QCString &scName, const Definition *container, bool inGroup, bool /* showEnumValues */, bool showInline ) const { // if this member is in a group find the real scope name. bool hasParameterList = FALSE; //printf("MemberDefImpl::writeDocumentation(): name='%s' hasDocs='%d' containerType=%d inGroup=%d sectionLinkable=%d\n", // qPrint(name()),hasDocs,container->definitionType(),inGroup,hasDetailedDescription()); //if ( !hasDocs ) return; //if (isEnumValue() && !showEnumValues) return; SrcLangExt lang = getLanguage(); //printf("member=%s lang=%d\n",qPrint(name()),lang); bool optVhdl = lang==SrcLangExt::VHDL; QCString sep = getLanguageSpecificSeparator(lang,TRUE); QCString scopeName = scName; QCString memAnchor = anchor(); QCString ciname = container->displayName(); const Definition *scopedContainer = container; // see bug 753608 if (container->definitionType()==TypeGroup) { if (getClassDef()) { scopeName=getClassDef()->displayName(); scopedContainer=getClassDef(); } else if (getNamespaceDef()) { scopeName=getNamespaceDef()->displayName(); scopedContainer=getNamespaceDef(); } else if (getFileDef()) { scopeName=getFileDef()->displayName(); scopedContainer=getFileDef(); } ciname = (toGroupDef(container))->groupTitle(); } else if (container->definitionType()==TypeFile && getNamespaceDef() && getNamespaceDef()->isLinkable()) { // member is in a namespace, but is written as part of the file documentation // as well, so we need to make sure its anchor is unique (it is not really used). memAnchor.prepend("file_"); } QCString cname = container->name(); QCString cfname = getOutputFileBase(); // get member name QCString doxyName=name(); // prepend scope if there is any. TODO: make this optional for C only docs if (!scopeName.isEmpty()) { doxyName.prepend(scopeName+sep); } QCString doxyArgs=argsString(); QCString ldef = definition(); QCString title = name(); //printf("member '%s' def='%s'\n",qPrint(name()),qPrint(ldef)); if (isEnumerate()) { if (title.at(0)=='@') { ldef = title = "anonymous enum"; if (!m_enumBaseType.isEmpty()) { ldef+=" : "+m_enumBaseType; } } else { if (lang==SrcLangExt::Cpp) { if (isEnumStruct()) ldef.prepend("struct "); else if (isStrong()) ldef.prepend("class "); } ldef.prepend("enum "); if (isSliceLocal()) { ldef.prepend("local "); } } } else if (isEnumValue()) { if (ldef.at(0)=='@') { ldef=ldef.mid(2); } } else if (isFunction() && !isObjCMethod()) { title += "()"; } if (lang == SrcLangExt::Slice) { // Remove the container scope from the member name. QCString prefix = scName + sep; int pos = ldef.findRev(prefix.data()); if(pos != -1) { ldef.remove(pos, prefix.length()); } } ldef.stripPrefix("constexpr "); ldef.stripPrefix("consteval "); ldef.stripPrefix("constinit "); //---------------------------------------- ol.pushGeneratorState(); bool htmlEndLabelTable=FALSE; StringVector sl = getLabels(scopedContainer); static const reg::Ex r(R"(@\d+)"); reg::Match match; std::string sdef = ldef.str(); if ((isVariable() || isTypedef()) && reg::search(sdef,match,r)) { // find enum type and insert it in the definition bool found=false; for (const auto &vmd : *ml) { if (vmd->isEnumerate() && match.str()==vmd->name()) { ol.startDoxyAnchor(cfname, cname, memAnchor, doxyName, doxyArgs); ol.startMemberDoc(ciname,name(),memAnchor,name(),memCount,memTotal,showInline); ol.addLabel(cfname, memAnchor); std::string prefix = match.prefix().str(); std::string suffix = match.suffix().str(); linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,prefix.c_str()); vmd->writeEnumDeclaration(ol,getClassDef(),getNamespaceDef(),getFileDef(),getGroupDef(),getModuleDef()); linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,suffix.c_str()); found=true; break; } } if (!found) // anonymous compound { ClassDef *annoClassDef=getClassDefOfAnonymousType(); QCString typeName; if (annoClassDef) typeName=annoClassDef->compoundTypeString(); ol.startDoxyAnchor(cfname, cname, memAnchor, doxyName, doxyArgs); ol.startMemberDoc(ciname,name(),memAnchor,"["+typeName+"]",memCount,memTotal,showInline); ol.addLabel(cfname, memAnchor); // search for the last anonymous compound name in the definition ol.startMemberDocName(isObjCMethod()); if (reg::search(sdef,match,reAnonymous)) { std::string prefix = match.prefix().str(); std::string suffix = match.suffix().str(); ol.docify(prefix.c_str()); ol.docify(" { ... } "); linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,removeAnonymousScopes(suffix.c_str())); } else { linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,ldef); } } } else // not an enum value or anonymous compound { ol.startDoxyAnchor(cfname, cname, memAnchor, doxyName, doxyArgs); ol.startMemberDoc(ciname,name(),memAnchor,title,memCount,memTotal,showInline); ol.addLabel(cfname, memAnchor); if (!m_metaData.isEmpty() && getLanguage()==SrcLangExt::Slice) { ol.startMemberDocPrefixItem(); ol.docify(m_metaData); ol.endMemberDocPrefixItem(); } const ClassDef *cd=getClassDef(); const NamespaceDef *nd=getNamespaceDef(); bool first=TRUE; if (!m_defTmpArgLists.empty() && lang==SrcLangExt::Cpp) // definition has explicit template parameter declarations { for (const ArgumentList &tal : m_defTmpArgLists) { if (!tal.empty()) { if (!first) ol.docify(" "); ol.startMemberDocPrefixItem(); _writeTemplatePrefix(ol,scopedContainer,tal); ol.endMemberDocPrefixItem(); } } } else // definition gets it template parameters from its class // (since no definition was found) { if (cd && lang==SrcLangExt::Cpp && !isTemplateSpecialization()) { for (const ArgumentList &tal : cd->getTemplateParameterLists()) { if (!tal.empty()) { if (!first) ol.docify(" "); ol.startMemberDocPrefixItem(); _writeTemplatePrefix(ol,scopedContainer,tal,false); ol.endMemberDocPrefixItem(); } } } if (m_tArgList.hasParameters() && lang==SrcLangExt::Cpp) // function template prefix { ol.startMemberDocPrefixItem(); _writeTemplatePrefix(ol,scopedContainer,m_tArgList); ol.endMemberDocPrefixItem(); } } if (!sl.empty()) { ol.pushGeneratorState(); ol.disableAll(); ol.enable(OutputType::Html); ol.writeString("<table class=\"mlabels\">\n"); ol.writeString(" <tr>\n"); ol.writeString(" <td class=\"mlabels-left\">\n"); ol.popGeneratorState(); htmlEndLabelTable=TRUE; } ol.startMemberDocName(isObjCMethod()); if (cd && cd->isObjectiveC()) { // strip scope name int ep = ldef.find("::"); if (ep!=-1) { int sp=ldef.findRev(' ',ep); if (sp!=-1) { ldef=ldef.left(sp+1)+ldef.mid(ep+2); } else { ldef=ldef.mid(ep+2); } } // strip keywords int dp = ldef.find(':'); if (dp!=-1) { ldef=ldef.left(dp+1); } int dl=static_cast<int>(ldef.length()); //printf("start >%s<\n",qPrint(ldef)); int i=dl-1; while (i>=0 && (isId(ldef.at(i)) || ldef.at(i)==':')) i--; while (i>=0 && isspace(static_cast<uint8_t>(ldef.at(i)))) i--; if (i>0) { // insert branches around the type ldef="("+ldef.left(i+1)+")"+ldef.mid(i+1); } //printf("end >%s< i=%d\n",qPrint(ldef),i); if (isStatic()) ldef.prepend("+ "); else ldef.prepend("- "); } if (optVhdl) { hasParameterList=VhdlDocGen::writeVHDLTypeDocumentation(this,scopedContainer,ol); } else if (lang==SrcLangExt::Slice) { // Eliminate the self-reference. int pos = ldef.findRev(' '); if (pos<0) pos=0; if (pos>0) { linkifyText(TextGeneratorOLImpl(ol), scopedContainer, getBodyDef(), this, ldef.left(pos) ); } ol.docify(ldef.mid(pos)); const Definition *scope = cd; if (scope==nullptr) scope = nd; hasParameterList=writeDefArgumentList(ol,scope,this); } else { linkifyText(TextGeneratorOLImpl(ol), scopedContainer, getBodyDef(), this, substitute(ldef,"::",sep) ); const Definition *scope = cd; if (scope==nullptr) scope = nd; hasParameterList=writeDefArgumentList(ol,scope,this); } if (hasOneLineInitializer()) // add initializer { if (isTypeAlias()) { ol.docify(" = "); QCString init = m_initializer.simplifyWhiteSpace(); linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,init); } else if (!isDefine()) { ol.docify(" "); QCString init = m_initializer.simplifyWhiteSpace(); linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,init); } else { ol.writeNonBreakableSpace(3); linkifyText(TextGeneratorOLImpl(ol),scopedContainer,getBodyDef(),this,m_initializer); } } if (!excpString().isEmpty()) // add exception list { writeExceptionList(ol,cd,this); hasParameterList=true; // call endParameterList below } } ol.pushGeneratorState(); ol.disable(OutputType::Html); if (!sl.empty()) { ol.startLabels(); size_t count=0; for (const auto &s : sl) { count++; ol.writeLabel(s.c_str(),count==sl.size()); } ol.endLabels(); } ol.popGeneratorState(); if (hasParameterList) { ol.endParameterList(); ol.endMemberDoc(TRUE); } else { ol.endMemberDocName(); ol.endMemberDoc(FALSE); } // for HTML write the labels here ol.pushGeneratorState(); ol.disableAll(); ol.enable(OutputType::Html); if (htmlEndLabelTable) { ol.writeString(" </td>\n"); ol.writeString(" <td class=\"mlabels-right\">\n"); ol.startLabels(); size_t count=0; for (const auto &s : sl) { count++; ol.writeLabel(s.c_str(),count==sl.size()); } ol.endLabels(); ol.writeString(" </td>\n"); ol.writeString(" </tr>\n"); ol.writeString("</table>\n"); } ol.writeString("</div>"); ol.popGeneratorState(); ol.endDoxyAnchor(cfname,memAnchor); ol.startIndent(); _writeGroupInclude(ol,inGroup); /* write multi-line initializer (if any) */ if (hasMultiLineInitializer()) _writeMultiLineInitializer(ol,scopeName); /* write brief description */ QCString brief = briefDescription(); if (!brief.isEmpty() && (Config_getBool(REPEAT_BRIEF) || !Config_getBool(BRIEF_MEMBER_DESC) ) ) { ol.startParagraph(); ol.generateDoc(briefFile(),briefLine(), scopedContainer,this, brief,FALSE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endParagraph(); } /* write detailed description */ QCString detailed = documentation(); if (!detailed.isEmpty() || !inbodyDocumentation().isEmpty()) { // write vhdl inline code with or without option INLINE_SOURCE if (optVhdl && VhdlDocGen::isMisc(this)) { VhdlDocGen::writeSource(this,ol,cname); return; } else { ol.generateDoc(docFile(),docLine(),scopedContainer,this,detailed+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } if (!inbodyDocumentation().isEmpty()) { ol.generateDoc(inbodyFile(),inbodyLine(), scopedContainer,this, inbodyDocumentation()+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } } else if (!brief.isEmpty() && (Config_getBool(REPEAT_BRIEF) || !Config_getBool(BRIEF_MEMBER_DESC))) { if (!inbodyDocumentation().isEmpty()) { ol.generateDoc(inbodyFile(),inbodyLine(),scopedContainer,this,inbodyDocumentation()+"\n",TRUE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } } //printf("***** defArgList=%p name=%s docs=%s hasDocs=%d\n", // defArgList, // defArgList?defArgList->hasDocumentation():-1); const ArgumentList &docArgList = m_templateMaster ? m_templateMaster->argumentList() : m_defArgList; ol.generateDoc( docFile(),docLine(), scopedContainer, this, // memberDef inlineArgListToDoc(docArgList), // docStr TRUE, // indexWords FALSE, // isExample QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT) ); _writeEnumValues(ol,scopedContainer,cfname,ciname,cname); _writeReimplements(ol); _writeReimplementedBy(ol); _writeCategoryRelation(ol); _writeExamples(ol); _writeTypeConstraints(ol); QCString scopeStr = getScopeString(); writeSourceDef(ol); writeInlineCode(ol,scopeStr); if (hasReferencesRelation()) writeSourceRefs(ol,scopeStr); if (hasReferencedByRelation()) writeSourceReffedBy(ol,scopeStr); _writeCallGraph(ol); _writeCallerGraph(ol); ol.endIndent(); // enable LaTeX again //if (Config_getBool(EXTRACT_ALL) && !hasDocs) ol.enable(OutputType::Latex); ol.popGeneratorState(); warnIfUndocumentedParams(); } // strip scope and field name from the type // example: "struct N<K::J>::S.v.c" will become "struct v" static QCString simplifyTypeForTable(const QCString &s) { QCString ts=removeAnonymousScopes(s); if (ts.endsWith("::")) ts = ts.left(ts.length()-2); static const reg::Ex re1(R"(\a\w*::)"); // non-template version static const reg::Ex re2(R"(\a\w*<[^>]*>::)"); // template version reg::Match match; std::string t = ts.str(); while (reg::search(t,match,re2) || reg::search(t,match,re1)) { t = match.prefix().str() + match.suffix().str(); // remove the matched part } //printf("simplifyTypeForTable(%s)->%s\n",qPrint(s),t.c_str()); return QCString(t); } QCString MemberDefImpl::fieldType() const { QCString type = m_accessorType; if (type.isEmpty()) { type = m_type; } if (isTypedef() && getLanguage() != SrcLangExt::Slice) type.prepend("typedef "); return simplifyTypeForTable(type); } void MemberDefImpl::writeMemberDocSimple(OutputList &ol, const Definition *container) const { Definition *scope = getOuterScope(); QCString doxyName = name(); QCString doxyArgs = argsString(); QCString memAnchor = anchor(); QCString cfname = getOutputFileBase(); QCString cname; if (scope) cname = scope->name(); if (doxyName.at(0)=='@') { doxyName="__unnamed__"; } ClassDef *cd = m_accessorClass; //printf("===> %s::anonymous: %s\n",qPrint(name()),cd?qPrint(cd->name()):"<none>"); if (container && container->definitionType()==Definition::TypeClass && !(toClassDef(container))->isJavaEnum()) { ol.startInlineMemberType(); ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs); ol.addLabel(cfname,memAnchor); QCString ts = fieldType(); if (isFunctionPtr()) ts = m_type + m_args; if (cd) // cd points to an anonymous struct pointed to by this member // so we add a link to it from the type column. { int i=0; const char *prefixes[] = { "struct ","union ","class ", nullptr }; const char **p = prefixes; while (*p) { int l=qstrlen(*p); if (ts.left(l)==*p) { ol.writeString(*p); i=l; } p++; } ol.writeObjectLink(cd->getReference(), cd->getOutputFileBase(), cd->anchor(),ts.mid(i)); } else // use standard auto linking { linkifyText(TextGeneratorOLImpl(ol), // out scope, // scope getBodyDef(), // fileScope this, // self ts // text ); } ol.endDoxyAnchor(cfname,memAnchor); ol.endInlineMemberType(); } ol.startInlineMemberName(); ol.docify(doxyName); if (isVariable() && !argsString().isEmpty() && !isObjCMethod() && !isFunctionPtr()) { linkifyText(TextGeneratorOLImpl(ol),getOuterScope(),getBodyDef(),this,argsString()); } if (!m_bitfields.isEmpty()) // add bitfields { linkifyText(TextGeneratorOLImpl(ol),getOuterScope(),getBodyDef(),this,m_bitfields); } if (hasOneLineInitializer() && !isDefine()) { ol.writeString(" "); linkifyText(TextGeneratorOLImpl(ol),getOuterScope(),getBodyDef(),this,m_initializer.simplifyWhiteSpace()); } ol.endInlineMemberName(); ol.startInlineMemberDoc(); QCString brief = briefDescription(); QCString detailed = documentation(); /* write brief description */ if (!brief.isEmpty()) { ol.generateDoc(briefFile(),briefLine(), getOuterScope()?getOuterScope():container,this, brief,FALSE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } /* write detailed description */ if (!detailed.isEmpty()) { if (!brief.isEmpty()) { ol.disable(OutputType::Html); ol.lineBreak(); ol.enable(OutputType::Html); } ol.generateDoc(docFile(),docLine(), getOuterScope()?getOuterScope():container,this, detailed+"\n",FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); } ol.endInlineMemberDoc(); } QCString MemberDefImpl::memberTypeName() const { switch (m_mtype) { case MemberType::Define: return "macro definition"; case MemberType::Function: return "function"; case MemberType::Variable: return "variable"; case MemberType::Typedef: return "typedef"; case MemberType::Enumeration: return "enumeration"; case MemberType::EnumValue: return "enumvalue"; case MemberType::Signal: return "signal"; case MemberType::Slot: return "slot"; case MemberType::Friend: return "friend"; case MemberType::DCOP: return "dcop"; case MemberType::Property: return "property"; case MemberType::Event: return "event"; case MemberType::Interface: return "interface"; case MemberType::Service: return "service"; case MemberType::Sequence: return "sequence"; case MemberType::Dictionary: return "dictionary"; default: return "unknown"; } } void MemberDefImpl::warnIfUndocumented() const { /* * Removed bug_303020: * if (m_memberGroup) return; */ const ClassDef *cd = getClassDef(); const NamespaceDef *nd = getNamespaceDef(); const FileDef *fd = getFileDef(); const GroupDef *gd = getGroupDef(); const Definition *d=nullptr; QCString t; if (cd) { t=cd->compoundTypeString(); d=cd; } else if (nd) { t=nd->compoundTypeString(); d=nd; } else if (gd) { t="group"; d=gd; } else { t="file"; d=fd; } bool extractAll = Config_getBool(EXTRACT_ALL); //printf("%s:warnIfUndoc: hasUserDocs=%d isFriendClass=%d protection=%d isRef=%d isDel=%d\n", // qPrint(name()), // hasUserDocumentation(),isFriendClass(),protectionLevelVisible(m_prot),isReference(),isDeleted()); if ((!hasUserDocumentation() && !extractAll) && !isFriendClass() && name().find('@')==-1 && d && d->name().find('@')==-1 && !_isAnonymousBitField() && protectionLevelVisible(m_prot) && !isReference() && !isDeleted() ) { SrcLangExt lang = getLanguage(); QCString sep = getLanguageSpecificSeparator(lang,TRUE); warn_undoc(getDefFileName(),getDefLine(),"Member %s%s (%s) of %s %s is not documented.", qPrint(name()),qPrint(argsString()),qPrint(memberTypeName()),qPrint(t), qPrint(substitute(d->name(),"::",sep))); } else if (!hasDetailedDescription()) { warnIfUndocumentedParams(); } // if it is an enum, we check that its members are documented if (!extractAll && isEnumerate() && Config_getBool(WARN_IF_UNDOC_ENUM_VAL)) { for (const auto &fmd : enumFieldList()) { if (!fmd->isLinkableInProject()) { SrcLangExt lang = getLanguage(); QCString sep = getLanguageSpecificSeparator(lang,TRUE); warn(fmd->getDefFileName(),fmd->getDefLine(), "Documentation for enum member '%s%s%s' is missing.", qPrint(qualifiedName()),qPrint(sep),qPrint(fmd->name())); } } } } bool MemberDefImpl::visibleInIndex() const { bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); bool extractStatic = Config_getBool(EXTRACT_STATIC); return (!isAnonymous() && (!hideUndocMembers || hasDocumentation()) && (!isStatic() || extractStatic) && isLinkable() ); } static QCString stripTrailingReturn(const QCString &trailRet) { QCString ret = trailRet; ret = ret.stripWhiteSpace(); if (ret.startsWith("->")) { ret = ret.mid(2).stripWhiteSpace(); return ret; } return trailRet; } static std::mutex g_detectUndocumentedParamsMutex; void MemberDefImpl::detectUndocumentedParams(bool hasParamCommand,bool hasReturnCommand) const { bool isPython = getLanguage()==SrcLangExt::Python; // this function is called while parsing the documentation. A member can have multiple // documentation blocks, which could be handled by multiple threads, hence this guard. std::lock_guard<std::mutex> lock(g_detectUndocumentedParamsMutex); if (!m_hasDocumentedParams && hasParamCommand) { //printf("%s:hasDocumentedParams=TRUE;\n",qPrint(name())); m_hasDocumentedParams = true; } else if (!m_hasDocumentedParams) { const ArgumentList &al = argumentList(); const ArgumentList &declAl = declArgumentList(); bool allDoc=TRUE; // no parameter => all parameters are documented if ( // member has parameters al.hasParameters() // with at least one parameter (that is not void) ) { // see if all parameters have documentation for (auto it = al.begin(); it!=al.end() && allDoc; ++it) { Argument a = *it; if (!a.name.isEmpty() && a.type!="void" && !(isPython && (a.name=="self" || a.name=="cls")) ) { allDoc = !a.docs.isEmpty(); } //printf("a->type=%s a->name=%s doc=%s\n", // qPrint(a->type),qPrint(a->name),qPrint(a->docs)); } if (!allDoc && declAl.empty()) // try declaration arguments as well { allDoc=true; for (auto it = al.begin(); it!=al.end() && allDoc; ++it) { Argument a = *it; if (!a.name.isEmpty() && a.type!="void" && !(isPython && (a.name=="self" || a.name=="cls")) ) { allDoc = !a.docs.isEmpty(); } //printf("a->name=%s doc=%s\n",qPrint(a->name),qPrint(a->docs)); } } } if (allDoc) { //printf("%s:hasDocumentedParams=TRUE;\n",qPrint(name())); m_hasDocumentedParams = true; } } //printf("Member %s hasDocumentedReturnType=%d hasReturnCommand=%d\n", // qPrint(name()),m_hasDocumentedReturnType,hasReturnCommand); m_hasDocumentedReturnType = m_hasDocumentedReturnType || hasReturnCommand; } void MemberDefImpl::warnIfUndocumentedParams() const { QCString returnType = typeString(); bool isFortran = getLanguage()==SrcLangExt::Fortran; bool isFortranSubroutine = isFortran && returnType.find("subroutine")!=-1; bool isVoidReturn = returnType=="void" || returnType.endsWith(" void"); if (!isVoidReturn && (returnType=="auto" || returnType.endsWith(" auto"))) { const ArgumentList &defArgList=isDocsForDefinition() ? argumentList() : declArgumentList(); if (!defArgList.trailingReturnType().isEmpty()) { QCString strippedTrailingReturn = stripTrailingReturn(defArgList.trailingReturnType()); isVoidReturn = (strippedTrailingReturn=="void") || (strippedTrailingReturn.endsWith(" void")); } } if (!Config_getBool(EXTRACT_ALL) && Config_getBool(WARN_IF_UNDOCUMENTED) && Config_getBool(WARN_NO_PARAMDOC) && isFunction() && !isDeleted() && !isReference() && !Doxygen::suppressDocWarnings) { if (!m_hasDocumentedParams) { warn_doc_error(docFile(),docLine(), "parameters of member %s are not documented", qPrint(qualifiedName())); } if (!m_hasDocumentedReturnType && hasDocumentation() && !returnType.isEmpty() && !( // not one of the cases where nothing is returned isVoidReturn || // void return type isFortranSubroutine || // fortran subroutine isConstructor() || // a constructor isDestructor() // or destructor ) ) { warn_doc_error(docFile(),docLine(), "return type of member %s is not documented", qPrint(qualifiedName())); } } if (Config_getBool(WARN_IF_DOC_ERROR) && m_hasDocumentedReturnType && (isVoidReturn || // void return type isFortranSubroutine || // fortran subroutine isConstructor() || // a constructor isDestructor())) // or destructor { warn_doc_error(docFile(),docLine(),"found documented return type for %s that does not return anything", qPrint(qualifiedName())); } } bool MemberDefImpl::isDocumentedFriendClass() const { ClassDef *fcd=nullptr; QCString baseName=name(); int i=baseName.find('<'); if (i!=-1) baseName=baseName.left(i); return (isFriendClass() && (fcd=getClass(baseName)) && fcd->isLinkable()); } bool MemberDefImpl::isDeleted() const { return m_defArgList.isDeleted(); } bool MemberDefImpl::hasDocumentation() const { return DefinitionMixin::hasDocumentation() || (m_mtype==MemberType::Enumeration && m_docEnumValues) || // has enum values (m_defArgList.hasDocumentation()); // has doc arguments } void MemberDefImpl::setMemberGroup(MemberGroup *grp) { m_memberGroup = grp; } QCString MemberDefImpl::getScopeString() const { QCString result; if (isStrong()) result=name(); else if (getClassDef()) result=getClassDef()->displayName(); else if (getNamespaceDef()) result=getNamespaceDef()->displayName(); return result; } void MemberDefImpl::setAnchor() { QCString memAnchor = name(); if (!m_args.isEmpty()) memAnchor+=m_args; if (m_memSpec.isAlias()) // this is for backward compatibility { memAnchor.prepend(" = "+m_initializer); } memAnchor.prepend(definition()); // actually the method name is now included // twice, which is silly, but we keep it this way for backward // compatibility. // include number of template arguments as well, // to distinguish between two template // specializations that only differ in the template parameters. if (m_tArgList.hasParameters()) { char buf[20]; qsnprintf(buf,20,"%d:",static_cast<int>(m_tArgList.size())); buf[19]='\0'; memAnchor.prepend(buf); } if (!m_requiresClause.isEmpty()) { memAnchor+=" "+m_requiresClause; } // convert to md5 hash uint8_t md5_sig[16]; char sigStr[33]; MD5Buffer(memAnchor.data(),static_cast<unsigned int>(memAnchor.length()),md5_sig); MD5SigToString(md5_sig,sigStr); m_anc = QCString("a")+sigStr; } void MemberDefImpl::setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine, bool hasDocs,MemberDef *member) { //printf("%s MemberDefImpl::setGroupDef(%s)\n",qPrint(name()),qPrint(gd->name())); m_group=gd; m_grouppri=pri; m_groupFileName=fileName; m_groupStartLine=startLine; m_groupHasDocs=hasDocs; m_groupMember=member; m_isLinkableCached = 0; } void MemberDefImpl::setEnumScope(MemberDef *md,bool livesInsideEnum) { m_enumScope=md; m_livesInsideEnum=livesInsideEnum; if (md->getGroupDef()) { m_group = md->getGroupDef(); m_grouppri = md->getGroupPri(); m_groupFileName = md->getGroupFileName(); m_groupStartLine = md->getGroupStartLine(); m_groupHasDocs = md->getGroupHasDocs(); m_isLinkableCached = 0; } } void MemberDefImpl::setMemberClass(ClassDef *cd) { m_classDef=cd; m_isLinkableCached = 0; m_isConstructorCached = 0; setOuterScope(cd); } void MemberDefImpl::setNamespace(NamespaceDef *nd) { m_nspace=nd; setOuterScope(nd); } std::unique_ptr<MemberDef> MemberDefImpl::createTemplateInstanceMember( const ArgumentList &formalArgs,const std::unique_ptr<ArgumentList> &actualArgs) const { //printf(" Member %s %s %s\n",qPrint(typeString()),qPrint(name()),qPrint(argsString())); std::unique_ptr<ArgumentList> actualArgList = std::make_unique<ArgumentList>(m_defArgList); if (!m_defArgList.empty()) { // replace formal arguments with actuals for (Argument &arg : *actualArgList) { arg.type = substituteTemplateArgumentsInString(arg.type,formalArgs,actualArgs.get()); } actualArgList->setTrailingReturnType( substituteTemplateArgumentsInString(actualArgList->trailingReturnType(),formalArgs,actualArgs.get())); } QCString methodName=name(); if (methodName.startsWith("operator ")) // conversion operator { methodName=substituteTemplateArgumentsInString(methodName,formalArgs,actualArgs.get()); } auto imd = createMemberDef( getDefFileName(),getDefLine(),getDefColumn(), substituteTemplateArgumentsInString(m_type,formalArgs,actualArgs.get()), methodName, substituteTemplateArgumentsInString(m_args,formalArgs,actualArgs.get()), m_exception, m_prot, m_virt, m_stat, m_related, m_mtype, ArgumentList(), ArgumentList(), "" ); auto mmd = toMemberDefMutable(imd.get()); mmd->moveArgumentList(std::move(actualArgList)); mmd->setDefinition(substituteTemplateArgumentsInString(m_def,formalArgs,actualArgs.get())); mmd->setBodyDef(getBodyDef()); mmd->setBodySegment(getDefLine(),getStartBodyLine(),getEndBodyLine()); mmd->setFormalTemplateArguments(formalArgs); // TODO: init other member variables (if needed). // TODO: reimplemented info return imd; } bool MemberDefImpl::hasOneLineInitializer() const { //printf("%s: init=%s, initLines=%d maxInitLines=%d userInitLines=%d\n", // qPrint(name()),qPrint(m_initializer),m_initLines, // m_maxInitLines,m_userInitLines); bool isFuncLikeMacro = m_mtype==MemberType::Define && m_defArgList.hasParameters(); return !m_initializer.isEmpty() && m_initLines==0 && // one line initializer !isFuncLikeMacro && ((m_maxInitLines>0 && m_userInitLines==-1) || m_userInitLines>0); // enabled by default or explicitly } bool MemberDefImpl::hasMultiLineInitializer() const { //printf("initLines=%d userInitLines=%d maxInitLines=%d\n", // initLines,userInitLines,maxInitLines); bool isFuncLikeMacro = m_mtype==MemberType::Define && m_defArgList.hasParameters(); return (m_initLines>0 || (!m_initializer.isEmpty() && isFuncLikeMacro)) && ((m_initLines<m_maxInitLines && m_userInitLines==-1) // implicitly enabled || m_initLines<m_userInitLines // explicitly enabled ); } void MemberDefImpl::setInitializer(const QCString &initializer) { m_initializer=initializer; int l=static_cast<int>(m_initializer.length()); int p=l-1; while (p>=0 && isspace(static_cast<uint8_t>(m_initializer.at(p)))) p--; m_initializer=m_initializer.left(p+1); m_initLines=m_initializer.contains('\n'); //printf("%s::setInitializer(%s)\n",qPrint(name()),qPrint(m_initializer)); } void MemberDefImpl::addListReference(Definition *) { bool optimizeOutputForC = Config_getBool(OPTIMIZE_OUTPUT_FOR_C); //bool hideScopeNames = Config_getBool(HIDE_SCOPE_NAMES); //bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); SrcLangExt lang = getLanguage(); if (!isLinkableInProject()) return; QCString memLabel; if (optimizeOutputForC) { memLabel=theTranslator->trGlobal(TRUE,TRUE); } else if (lang==SrcLangExt::Fortran) { memLabel=theTranslator->trSubprogram(TRUE,TRUE); } else { memLabel=theTranslator->trMember(TRUE,TRUE); } QCString memName = name(); Definition *pd=getOuterScope(); QCString pdName = pd->definitionType()==Definition::TypeClass ? (toClassDef(pd))->displayName() : pd->name(); QCString sep = getLanguageSpecificSeparator(lang,TRUE); QCString memArgs; if (!isRelated() /* && commented out as a result of bug 597016 ( (!hideScopeNames && // there is a scope pd && pd!=Doxygen::globalScope) // and we can show it || (pd=getClassDef()) // it's a class so we // show the scope anyway ) */ ) { if (isObjCMethod()) { memName = "[" + pd->name() + " " + name() + "]"; } else { if (pd!=Doxygen::globalScope) memName.prepend(pdName+sep); memArgs = argsString(); } } const RefItemVector &xrefItems = xrefListItems(); if (sep!="::") { memName = substitute(memName,"::",sep); } addRefItem(xrefItems, qualifiedName()+argsString(), // argsString is needed for overloaded functions (see bug 609624) memLabel, getOutputFileBase()+"#"+anchor(),memName,memArgs,pd); } const MemberList *MemberDefImpl::getSectionList(const Definition *container) const { auto it = m_sectionMap.find(container); return it!=m_sectionMap.end() ? it->second : nullptr; } void MemberDefImpl::setSectionList(const Definition *container,const MemberList *sl) { //printf("MemberDefImpl::setSectionList(%s,%p) name=%s\n",qPrint(d->name()),sl,qPrint(name())); m_sectionMap.emplace(container,sl); } Specifier MemberDefImpl::virtualness(int count) const { if (count>25) { warn(getDefFileName(),getDefLine(), "Internal inconsistency: recursion detected in overload relation for member %s!" ,qPrint(name()) ); return Specifier::Normal; } Specifier v = m_virt; const MemberDef *rmd = reimplements(); while (rmd && v==Specifier::Normal) { v = rmd->virtualness(count+1)==Specifier::Normal ? Specifier::Normal : Specifier::Virtual; rmd = rmd->reimplements(); } return v; } void MemberDefImpl::writeTagFile(TextStream &tagFile,bool useQualifiedName,bool showNamespaceMembers) const { if (!isLinkableInProject()) return; if (!showNamespaceMembers && getNamespaceDef()) return; tagFile << " <member kind=\""; switch (m_mtype) { case MemberType::Define: tagFile << "define"; break; case MemberType::EnumValue: tagFile << "enumvalue"; break; case MemberType::Property: tagFile << "property"; break; case MemberType::Event: tagFile << "event"; break; case MemberType::Variable: tagFile << "variable"; break; case MemberType::Typedef: tagFile << "typedef"; break; case MemberType::Enumeration: tagFile << "enumeration"; break; case MemberType::Function: tagFile << "function"; break; case MemberType::Signal: tagFile << "signal"; break; case MemberType::Friend: tagFile << "friend"; break; case MemberType::DCOP: tagFile << "dcop"; break; case MemberType::Slot: tagFile << "slot"; break; case MemberType::Interface: tagFile << "interface"; break; case MemberType::Service: tagFile << "service"; break; case MemberType::Sequence: tagFile << "sequence"; break; case MemberType::Dictionary: tagFile << "dictionary"; break; } if (m_prot!=Protection::Public) { tagFile << "\" protection=\""; if (m_prot==Protection::Protected) tagFile << "protected"; else if (m_prot==Protection::Package) tagFile << "package"; else /* Private */ tagFile << "private"; } if (m_virt!=Specifier::Normal) { tagFile << "\" virtualness=\""; if (m_virt==Specifier::Virtual) tagFile << "virtual"; else /* Pure */ tagFile << "pure"; } if (isStatic()) { tagFile << "\" static=\"yes"; } tagFile << "\">\n"; if (typeString()!=QCString("@")) { tagFile << " <type>" << convertToXML(typeString()) << "</type>\n"; } QCString fn = getOutputFileBase(); addHtmlExtensionIfMissing(fn); tagFile << " <name>" << convertToXML(useQualifiedName ? qualifiedName() : name()) << "</name>\n"; tagFile << " <anchorfile>" << convertToXML(fn) << "</anchorfile>\n"; tagFile << " <anchor>" << convertToXML(anchor()) << "</anchor>\n"; QCString idStr = id(); if (!idStr.isEmpty()) { tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>\n"; } tagFile << " <arglist>" << convertToXML(argsString()) << "</arglist>\n"; if (isStrong()) { for (const auto &fmd : m_enumFields) { if (!fmd->isReference()) { tagFile << " <enumvalue file=\"" << convertToXML(fn); tagFile << "\" anchor=\"" << convertToXML(fmd->anchor()); idStr = fmd->id(); if (!idStr.isEmpty()) { tagFile << "\" clangid=\"" << convertToXML(idStr); } tagFile << "\">" << convertToXML(fmd->name()) << "</enumvalue>\n"; } } } writeDocAnchorsToTagFile(tagFile); tagFile << " </member>\n"; } void MemberDefImpl::_computeIsConstructor() { m_isConstructorCached=1; // FALSE if (getClassDef()) { if (m_isDMember) // for D { m_isConstructorCached = name()=="this" ? 2 : 1; return; } else if (getLanguage()==SrcLangExt::PHP) // for PHP { m_isConstructorCached = name()=="__construct" ? 2 : 1; return; } else if (name()=="__init__" && getLanguage()==SrcLangExt::Python) // for Python { m_isConstructorCached = 2; // TRUE return; } else // for other languages { QCString locName = getClassDef()->localName(); int i=locName.find('<'); if (i==-1) // not a template class { m_isConstructorCached = name()==locName ? 2 : 1; } else { m_isConstructorCached = name()==locName.left(i) ? 2 : 1; } return; } } } bool MemberDefImpl::isConstructor() const { if (m_isConstructorCached==0) { MemberDefImpl *that = const_cast<MemberDefImpl*>(this); that->_computeIsConstructor(); } ASSERT(m_isConstructorCached>0); return m_isConstructorCached==2; } void MemberDefImpl::_computeIsDestructor() { bool isDestructor = false; if (m_isDMember) // for D { isDestructor = name()=="~this"; } else if (getLanguage()==SrcLangExt::PHP) // for PHP { isDestructor = name()=="__destruct"; } else if (name()=="__del__" && getLanguage()==SrcLangExt::Python) // for Python { isDestructor = true; } else if (getLanguage()==SrcLangExt::Fortran) // for Fortran { isDestructor = typeString()=="final"; } else // other languages { isDestructor = (name().find('~')!=-1 || name().find('!')!=-1) // The ! is for C++/CLI && name().find("operator")==-1; } m_isDestructorCached = isDestructor ? 2 : 1; } bool MemberDefImpl::isDestructor() const { if (m_isDestructorCached==0) { MemberDefImpl *that=const_cast<MemberDefImpl*>(this); that->_computeIsDestructor(); } ASSERT(m_isDestructorCached>0); return m_isDestructorCached==2; } void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod) const { int enumMemCount=0; uint32_t numVisibleEnumValues=0; for (const auto &fmd : m_enumFields) { if (fmd->isBriefSectionVisible()) numVisibleEnumValues++; } if (numVisibleEnumValues==0 && !isBriefSectionVisible()) { return; } QCString n = name(); int i=n.findRev("::"); if (i!=-1) n=n.right(n.length()-i-2); // strip scope (TODO: is this needed?) if (n[0]!='@') // not an anonymous enum { if (isLinkableInProject() || hasDocumentedEnumValues()) { //_writeTagData(compoundType); writeLink(typeDecl,cd,nd,fd,gd,mod); } else { typeDecl.startBold(); typeDecl.docify(n); typeDecl.endBold(); } typeDecl.writeChar(' '); } if (!m_enumBaseType.isEmpty()) { typeDecl.writeChar(':'); typeDecl.writeChar(' '); typeDecl.docify(m_enumBaseType); typeDecl.writeChar(' '); } uint32_t enumValuesPerLine = static_cast<uint32_t>(Config_getInt(ENUM_VALUES_PER_LINE)); if (numVisibleEnumValues>0 && enumValuesPerLine>0) { typeDecl.docify("{ "); auto it = m_enumFields.begin(); if (it!=m_enumFields.end()) { const MemberDef *fmd=*it; bool fmdVisible = fmd->isBriefSectionVisible(); bool first=true; while (fmd) { if (fmdVisible) { if (!first) { typeDecl.writeString(", "); } /* in html we start a new line after a number of items */ if (numVisibleEnumValues>enumValuesPerLine && (enumMemCount%enumValuesPerLine)==0 ) { typeDecl.pushGeneratorState(); typeDecl.disableAllBut(OutputType::Html); typeDecl.enable(OutputType::Latex); typeDecl.enable(OutputType::Docbook); typeDecl.lineBreak(); typeDecl.disable(OutputType::Latex); typeDecl.disable(OutputType::Docbook); typeDecl.writeString("&#160;&#160;"); typeDecl.popGeneratorState(); } if (fmd->hasDocumentation()) // enum value has docs { fmd->writeLink(typeDecl,cd,nd,fd,gd,mod); } else // no docs for this enum value { typeDecl.startBold(); typeDecl.docify(fmd->name()); typeDecl.endBold(); } if (fmd->hasOneLineInitializer()) // enum value has initializer { //typeDecl.writeString(" = "); typeDecl.writeString(" "); typeDecl.parseText(fmd->initializer()); } first=false; } bool prevVisible = fmdVisible; ++it; if (it!=m_enumFields.end()) { fmd=*it; } else { fmd=nullptr; } if (prevVisible) { typeDecl.disable(OutputType::Man); typeDecl.writeString("\n"); // to prevent too long lines in LaTeX typeDecl.enable(OutputType::Man); enumMemCount++; } } if (numVisibleEnumValues>enumValuesPerLine) { typeDecl.pushGeneratorState(); typeDecl.disableAllBut(OutputType::Html); typeDecl.lineBreak(); typeDecl.popGeneratorState(); } } typeDecl.docify(" }"); } } void MemberDefImpl::moveArgumentList(std::unique_ptr<ArgumentList> al) { m_defArgList = *al; } void MemberDefImpl::moveDeclArgumentList(std::unique_ptr<ArgumentList> al) { m_declArgList = *al; } void MemberDefImpl::setTypeConstraints(const ArgumentList &al) { m_typeConstraints = al; } void MemberDefImpl::setType(const QCString &t) { m_type = t; } void MemberDefImpl::setAccessorType(ClassDef *cd,const QCString &t) { m_accessorClass = cd; m_accessorType = t; } ClassDef *MemberDefImpl::accessorClass() const { return m_accessorClass; } void MemberDefImpl::findSectionsInDocumentation() { docFindSections(briefDescription(),this,docFile()); docFindSections(documentation(),this,docFile()); docFindSections(inbodyDocumentation(),this,docFile()); } void MemberDefImpl::overrideCallGraph(bool e) { m_hasCallGraph=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } void MemberDefImpl::overrideCallerGraph(bool e) { m_hasCallerGraph=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } void MemberDefImpl::overrideReferencedByRelation(bool e) { m_hasReferencedByRelation=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } void MemberDefImpl::overrideReferencesRelation(bool e) { m_hasReferencesRelation=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } void MemberDefImpl::overrideEnumValues(bool e) { m_hasEnumValues=e; } void MemberDefImpl::overrideInlineSource(bool e) { m_hasInlineSource=e; } bool MemberDefImpl::isObjCMethod() const { if (getClassDef() && getClassDef()->isObjectiveC() && isFunction()) return TRUE; return FALSE; } bool MemberDefImpl::isObjCProperty() const { if (getClassDef() && getClassDef()->isObjectiveC() && isProperty()) return TRUE; return FALSE; } bool MemberDefImpl::isCSharpProperty() const { if (getClassDef() && getClassDef()->isCSharp() && isProperty()) return TRUE; return FALSE; } QCString MemberDefImpl::qualifiedName() const { if (isObjCMethod()) { QCString qm; if (isStatic()) qm="+"; else qm="-"; qm+="["; qm+=getClassDef()->name()+" "; qm+=name(); qm+="]"; return qm; } else if (m_enumScope && m_enumScope->isStrong()) { return m_enumScope->qualifiedName()+ getLanguageSpecificSeparator(getLanguage())+ localName(); } else { return DefinitionMixin::qualifiedName(); } } void MemberDefImpl::setTagInfo(const TagInfo *ti) { if (ti) { //printf("%s: Setting tag name=%s anchor=%s\n",qPrint(name()),qPrint(ti->tagName),qPrint(ti->anchor)); m_anc=ti->anchor; setReference(ti->tagName); m_explicitOutputFileBase = stripExtension(ti->fileName); } } QCString MemberDefImpl::objCMethodName(bool localLink,bool showStatic) const { QCString qm; if (showStatic) { if (isStatic()) qm="+ "; else qm="- "; } qm+=name(); if (!localLink) // link to method of same class { qm+=" ("; qm+=getClassDef()->name(); qm+=")"; } return qm; } QCString MemberDefImpl::declaration() const { return m_decl; } QCString MemberDefImpl::definition() const { return m_def; } QCString MemberDefImpl::extraTypeChars() const { return m_extraTypeChars; } QCString MemberDefImpl::typeString() const { return m_type; } QCString MemberDefImpl::argsString() const { return m_args; } QCString MemberDefImpl::excpString() const { return m_exception; } QCString MemberDefImpl::bitfieldString() const { return m_bitfields; } const QCString &MemberDefImpl::initializer() const { return m_initializer; } int MemberDefImpl::initializerLines() const { return m_initLines; } TypeSpecifier MemberDefImpl::getMemberSpecifiers() const { return m_memSpec; } VhdlSpecifier MemberDefImpl::getVhdlSpecifiers() const { return m_vhdlSpec; } const ClassDef *MemberDefImpl::getClassDef() const { return m_classDef; } ClassDef *MemberDefImpl::getClassDef() { return m_classDef; } ClassDefMutable *MemberDefImpl::getClassDefMutable() { return toClassDefMutable(m_classDef); } const FileDef *MemberDefImpl::getFileDef() const { return m_fileDef; } FileDef *MemberDefImpl::getFileDef() { return m_fileDef; } const NamespaceDef* MemberDefImpl::getNamespaceDef() const { return m_nspace; } NamespaceDef* MemberDefImpl::getNamespaceDef() { return m_nspace; } QCString MemberDefImpl::getReadAccessor() const { return m_read; } QCString MemberDefImpl::getWriteAccessor() const { return m_write; } const GroupDef *MemberDefImpl::getGroupDef() const { return m_group; } GroupDef *MemberDefImpl::getGroupDef() { return m_group; } const ModuleDef *MemberDefImpl::getModuleDef() const { return m_moduleDef; } Grouping::GroupPri_t MemberDefImpl::getGroupPri() const { return m_grouppri; } QCString MemberDefImpl::getGroupFileName() const { return m_groupFileName; } int MemberDefImpl::getGroupStartLine() const { return m_groupStartLine; } bool MemberDefImpl::getGroupHasDocs() const { return m_groupHasDocs; } Protection MemberDefImpl::protection() const { return m_prot; } MemberType MemberDefImpl::memberType() const { return m_mtype; } bool MemberDefImpl::isSignal() const { return m_mtype==MemberType::Signal; } bool MemberDefImpl::isSlot() const { return m_mtype==MemberType::Slot; } bool MemberDefImpl::isVariable() const { return m_mtype==MemberType::Variable; } bool MemberDefImpl::isEnumerate() const { return m_mtype==MemberType::Enumeration; } bool MemberDefImpl::isEnumValue() const { return m_mtype==MemberType::EnumValue; } bool MemberDefImpl::isTypedef() const { return m_mtype==MemberType::Typedef; } bool MemberDefImpl::isSequence() const { return m_mtype==MemberType::Sequence; } bool MemberDefImpl::isDictionary() const { return m_mtype==MemberType::Dictionary; } bool MemberDefImpl::isFunction() const { return m_mtype==MemberType::Function; } bool MemberDefImpl::isFunctionPtr() const { return m_mtype==MemberType::Variable && QCString(argsString()).find(")(")!=-1; } bool MemberDefImpl::isDefine() const { return m_mtype==MemberType::Define; } bool MemberDefImpl::isFriend() const { return m_mtype==MemberType::Friend; } bool MemberDefImpl::isDCOP() const { return m_mtype==MemberType::DCOP; } bool MemberDefImpl::isProperty() const { return m_mtype==MemberType::Property; } bool MemberDefImpl::isEvent() const { return m_mtype==MemberType::Event; } bool MemberDefImpl::isRelated() const { return m_related == Relationship::Related; } bool MemberDefImpl::isForeign() const { return m_related == Relationship::Foreign; } bool MemberDefImpl::isStatic() const { return m_stat; } bool MemberDefImpl::isInline() const { return m_memSpec.isInline(); } bool MemberDefImpl::isExplicit() const { return m_memSpec.isExplicit(); } bool MemberDefImpl::isMutable() const { return m_memSpec.isMutable(); } bool MemberDefImpl::isGettable() const { return m_memSpec.isGettable(); } bool MemberDefImpl::isPrivateGettable() const { return m_memSpec.isPrivateGettable(); } bool MemberDefImpl::isProtectedGettable() const { return m_memSpec.isProtectedGettable(); } bool MemberDefImpl::isSettable() const { return m_memSpec.isSettable(); } bool MemberDefImpl::isPrivateSettable() const { return m_memSpec.isPrivateSettable(); } bool MemberDefImpl::isProtectedSettable() const { return m_memSpec.isProtectedSettable(); } bool MemberDefImpl::isAddable() const { return m_memSpec.isAddable(); } bool MemberDefImpl::isRemovable() const { return m_memSpec.isRemovable(); } bool MemberDefImpl::isRaisable() const { return m_memSpec.isRaisable(); } bool MemberDefImpl::isReadable() const { return m_memSpec.isReadable(); } bool MemberDefImpl::isWritable() const { return m_memSpec.isWritable(); } bool MemberDefImpl::isFinal() const { return m_memSpec.isFinal(); } bool MemberDefImpl::isNew() const { return m_memSpec.isNew(); } bool MemberDefImpl::isSealed() const { return m_memSpec.isSealed(); } bool MemberDefImpl::isOverride() const { return m_memSpec.isOverride(); } bool MemberDefImpl::isInitonly() const { return m_memSpec.isInitonly(); } bool MemberDefImpl::isAbstract() const { return m_memSpec.isAbstract(); } bool MemberDefImpl::isOptional() const { return m_memSpec.isOptional(); } bool MemberDefImpl::isRequired() const { return m_memSpec.isRequired(); } bool MemberDefImpl::isNonAtomic() const { return m_memSpec.isNonAtomic(); } bool MemberDefImpl::isCopy() const { return m_memSpec.isCopy(); } bool MemberDefImpl::isAssign() const { return m_memSpec.isAssign(); } bool MemberDefImpl::isRetain() const { return m_memSpec.isRetain(); } bool MemberDefImpl::isWeak() const { return m_memSpec.isWeak(); } bool MemberDefImpl::isStrong() const { return m_memSpec.isStrong(); } bool MemberDefImpl::isEnumStruct() const { return m_memSpec.isEnumStruct(); } bool MemberDefImpl::isStrongEnumValue() const { return m_mtype==MemberType::EnumValue && m_enumScope && m_enumScope->isStrong(); } bool MemberDefImpl::isUnretained() const { return m_memSpec.isUnretained(); } bool MemberDefImpl::isTypeAlias() const { return m_memSpec.isAlias(); } bool MemberDefImpl::isDefault() const { return m_memSpec.isDefault(); } bool MemberDefImpl::isDelete() const { return m_memSpec.isDelete(); } bool MemberDefImpl::isNoExcept() const { return m_memSpec.isNoExcept(); } bool MemberDefImpl::isAttribute() const { return m_memSpec.isAttribute(); } bool MemberDefImpl::isUNOProperty() const { return m_memSpec.isProperty(); } bool MemberDefImpl::isReadonly() const { return m_memSpec.isReadonly(); } bool MemberDefImpl::isBound() const { return m_memSpec.isBound(); } bool MemberDefImpl::isConstrained() const { return m_memSpec.isConstrained(); } bool MemberDefImpl::isTransient() const { return m_memSpec.isTransient(); } bool MemberDefImpl::isMaybeVoid() const { return m_memSpec.isMaybeVoid(); } bool MemberDefImpl::isMaybeDefault() const { return m_memSpec.isMaybeDefault(); } bool MemberDefImpl::isMaybeAmbiguous() const { return m_memSpec.isMaybeAmbiguous(); } bool MemberDefImpl::isPublished() const { return m_memSpec.isPublished(); } bool MemberDefImpl::isImplementation() const { return m_implOnly; } bool MemberDefImpl::isExternal() const { return m_explExt; } bool MemberDefImpl::isTemplateSpecialization() const { return m_tspec; } bool MemberDefImpl::isCallable() const { return isFunction() || isSlot() || isSignal() || isConstructor() || isDestructor() || isObjCMethod() || isFriend(); } ClassDef *MemberDefImpl::relatedAlso() const { return m_relatedAlso; } bool MemberDefImpl::hasDocumentedEnumValues() const { return m_docEnumValues; } const MemberDef *MemberDefImpl::getAnonymousEnumType() const { return m_annEnumType; } bool MemberDefImpl::isDocsForDefinition() const { return m_docsForDefinition; } const MemberDef *MemberDefImpl::getEnumScope() const { return m_enumScope; } bool MemberDefImpl::livesInsideEnum() const { return m_livesInsideEnum; } bool MemberDefImpl::isSliceLocal() const { return m_memSpec.isLocal(); } bool MemberDefImpl::isNoDiscard() const { return m_memSpec.isNoDiscard(); } bool MemberDefImpl::isConstExpr() const { return m_memSpec.isConstExpr(); } bool MemberDefImpl::isConstEval() const { return m_memSpec.isConstEval(); } bool MemberDefImpl::isConstInit() const { return m_memSpec.isConstInit(); } const MemberVector &MemberDefImpl::enumFieldList() const { return m_enumFields; } const ExampleList &MemberDefImpl::getExamples() const { return m_examples; } bool MemberDefImpl::isPrototype() const { return m_proto; } const ArgumentList &MemberDefImpl::argumentList() const { return m_defArgList; } const ArgumentList &MemberDefImpl::declArgumentList() const { return m_declArgList; } void MemberDefImpl::resolveUnnamedParameters(const MemberDef *md) { ArgumentList &decAl = m_declArgList; ArgumentList &defAl = m_defArgList; const ArgumentList &decAlSrc = md->declArgumentList(); const ArgumentList &defAlSrc = md->argumentList(); auto decSrc = decAlSrc.begin(), defSrc = defAlSrc.begin(); for (auto decIt = decAl.begin(), defIt = defAl.begin(); decIt != decAl.end() && defIt != defAl.end() && decSrc != decAlSrc.end() && defSrc != defAlSrc.end(); ++decIt, ++defIt, ++decSrc, ++defSrc++) { Argument &decA = *decIt; Argument &defA = *defIt; const Argument &decAS = *decSrc; const Argument &defAS = *defSrc; if (decA.name.isEmpty()) { if (!defA.name.isEmpty()) { decA.name = defA.name; } else if (!decAS.name.isEmpty()) { decA.name = decAS.name; } else if (!defAS.name.isEmpty()) { decA.name = defAS.name; } } if (defA.name.isEmpty()) { if (!decA.name.isEmpty()) { defA.name = decA.name; } else if (!decAS.name.isEmpty()) { defA.name = decAS.name; } else if (!defAS.name.isEmpty()) { defA.name = defAS.name; } } } } const ArgumentList &MemberDefImpl::templateArguments() const { return m_tArgList; } const ArgumentLists &MemberDefImpl::definitionTemplateParameterLists() const { return m_defTmpArgLists; } int MemberDefImpl::getMemberGroupId() const { return m_grpId; } MemberGroup *MemberDefImpl::getMemberGroup() const { return m_memberGroup; } bool MemberDefImpl::fromAnonymousScope() const { return m_annScope; } bool MemberDefImpl::hasCallGraph() const { return m_hasCallGraph; } bool MemberDefImpl::_hasVisibleCallGraph() const { bool enabled = m_hasCallGraph && (isFunction() || isSlot() || isSignal()) && Config_getBool(HAVE_DOT); if (enabled) { bool trivial = DotCallGraph::isTrivial(this,FALSE); return !trivial; } return FALSE; } bool MemberDefImpl::hasCallerGraph() const { return m_hasCallerGraph; } bool MemberDefImpl::_hasVisibleCallerGraph() const { bool enabled = m_hasCallerGraph && (isFunction() || isSlot() || isSignal()) && Config_getBool(HAVE_DOT); if (enabled) { bool trivial = DotCallGraph::isTrivial(this,TRUE); return !trivial; } return FALSE; } bool MemberDefImpl::hasReferencedByRelation() const { return m_hasReferencedByRelation; } bool MemberDefImpl::hasReferencesRelation() const { return m_hasReferencesRelation; } bool MemberDefImpl::hasInlineSource() const { return m_hasInlineSource; } bool MemberDefImpl::hasEnumValues() const { return m_hasEnumValues; } const MemberDef *MemberDefImpl::templateMaster() const { return m_templateMaster; } std::optional<ArgumentList> MemberDefImpl::formalTemplateArguments() const { return m_formalTemplateArguments; } bool MemberDefImpl::isTypedefValCached() const { return m_isTypedefValCached; } const ClassDef *MemberDefImpl::getCachedTypedefVal() const { return m_cachedTypedefValue; } QCString MemberDefImpl::getCachedTypedefTemplSpec() const { return m_cachedTypedefTemplSpec; } QCString MemberDefImpl::getCachedResolvedTypedef() const { //printf("MemberDefImpl::getCachedResolvedTypedef()=%s m_impl=%p\n",qPrint(m_cachedResolvedType),m_impl); return m_cachedResolvedType; } MemberDef *MemberDefImpl::memberDefinition() const { return m_memDef; } MemberDef *MemberDefImpl::memberDeclaration() const { return m_memDec; } const MemberDef *MemberDefImpl::inheritsDocsFrom() const { return m_docProvider; } const MemberDef *MemberDefImpl::getGroupAlias() const { return m_groupAlias; } QCString MemberDefImpl::getDeclFileName() const { return m_declFileName; } int MemberDefImpl::getDeclLine() const { return m_declLine; } int MemberDefImpl::getDeclColumn() const { return m_declColumn; } //---------------------------------------------- void MemberDefImpl::setMemberType(MemberType t) { m_mtype=t; m_isLinkableCached = 0; } void MemberDefImpl::setDefinition(const QCString &d) { m_def=d; } void MemberDefImpl::setFileDef(FileDef *fd) { m_fileDef=fd; m_isLinkableCached = 0; m_isConstructorCached = 0; m_isDestructorCached = 0; } void MemberDefImpl::setModuleDef(ModuleDef *mod) { m_moduleDef=mod; } void MemberDefImpl::setProtection(Protection p) { m_prot=p; m_isLinkableCached = 0; } void MemberDefImpl::setMemberSpecifiers(TypeSpecifier s) { m_memSpec=s; } void MemberDefImpl::setVhdlSpecifiers(VhdlSpecifier s) { m_vhdlSpec=s; } void MemberDefImpl::mergeMemberSpecifiers(TypeSpecifier s) { m_memSpec.merge(s); } StringVector MemberDefImpl::getQualifiers() const { return m_qualifiers; } void MemberDefImpl::addQualifiers(const StringVector &qualifiers) { for (const auto &sx : qualifiers) { bool alreadyAdded = std::find(m_qualifiers.begin(), m_qualifiers.end(), sx) != m_qualifiers.end(); if (!alreadyAdded) { m_qualifiers.push_back(sx); } } } void MemberDefImpl::setBitfields(const QCString &s) { m_bitfields = QCString(s).simplifyWhiteSpace(); } void MemberDefImpl::setMaxInitLines(int lines) { if (lines!=-1) { m_userInitLines=lines; } } void MemberDefImpl::setReadAccessor(const QCString &r) { m_read=r; } void MemberDefImpl::setWriteAccessor(const QCString &w) { m_write=w; } void MemberDefImpl::setTemplateSpecialization(bool b) { m_tspec=b; } void MemberDefImpl::makeRelated() { m_related = Relationship::Related; m_isLinkableCached = 0; } void MemberDefImpl::makeForeign() { m_related = Relationship::Foreign; m_isLinkableCached = 0; } void MemberDefImpl::setInheritsDocsFrom(const MemberDef *md) { m_docProvider = md; } void MemberDefImpl::setArgsString(const QCString &as) { m_args = as; } void MemberDefImpl::setRelatedAlso(ClassDef *cd) { m_relatedAlso=cd; } void MemberDefImpl::setEnumClassScope(ClassDef *cd) { m_classDef = cd; m_isLinkableCached = 0; m_isConstructorCached = 0; } void MemberDefImpl::setDocumentedEnumValues(bool value) { m_docEnumValues=value; } void MemberDefImpl::setAnonymousEnumType(const MemberDef *md) { m_annEnumType = md; } void MemberDefImpl::setPrototype(bool p,const QCString &df,int line,int column) { m_proto=p; if (p) { setDeclFile(df,line,column); } else { setDefFile(df,line,column); } } void MemberDefImpl::setExplicitExternal(bool b,const QCString &df,int line,int column) { m_explExt=b; if (b) { setDeclFile(df,line,column); } else { setDefFile(df,line,column); } } void MemberDefImpl::setDeclFile(const QCString &df,int line,int column) { m_declFileName = df; m_declLine = line; m_declColumn = column; } void MemberDefImpl::setMemberGroupId(int id) { m_grpId=id; } void MemberDefImpl::makeImplementationDetail() { m_implOnly=TRUE; } void MemberDefImpl::setFromAnonymousScope(bool b) { m_annScope=b; } void MemberDefImpl::setFromAnonymousMember(MemberDef *m) { m_annMemb=m; } MemberDef *MemberDefImpl::fromAnonymousMember() const { return m_annMemb; } void MemberDefImpl::setTemplateMaster(MemberDef *mt) { m_templateMaster=mt; m_isLinkableCached = 0; } void MemberDefImpl::setFormalTemplateArguments(const ArgumentList &al) { m_formalTemplateArguments = al; } void MemberDefImpl::setDocsForDefinition(bool b) { m_docsForDefinition = b; } void MemberDefImpl::setGroupAlias(const MemberDef *md) { m_groupAlias = md; } void MemberDefImpl::invalidateTypedefValCache() { m_isTypedefValCached=FALSE; } void MemberDefImpl::setMemberDefinition(MemberDef *md) { m_memDef=md; } void MemberDefImpl::setMemberDeclaration(MemberDef *md) { m_memDec=md; } ClassDef *MemberDefImpl::category() const { return m_category; } void MemberDefImpl::setCategory(ClassDef *def) { m_category = def; } const MemberDef *MemberDefImpl::categoryRelation() const { return m_categoryRelation; } void MemberDefImpl::setCategoryRelation(const MemberDef *md) { m_categoryRelation = md; } void MemberDefImpl::setEnumBaseType(const QCString &type) { m_enumBaseType = type; } QCString MemberDefImpl::enumBaseType() const { return m_enumBaseType; } void MemberDefImpl::setRequiresClause(const QCString &req) { m_requiresClause = req; } QCString MemberDefImpl::requiresClause() const { return m_requiresClause; } void MemberDefImpl::cacheTypedefVal(const ClassDef*val, const QCString & templSpec, const QCString &resolvedType) { m_isTypedefValCached=TRUE; m_cachedTypedefValue=val; m_cachedTypedefTemplSpec=templSpec; m_cachedResolvedType=resolvedType; //printf("MemberDefImpl::cacheTypedefVal=%s m_impl=%p\n",qPrint(m_cachedResolvedType),m_impl); } void MemberDefImpl::copyArgumentNames(const MemberDef *bmd) { { const ArgumentList &srcAl = bmd->argumentList(); ArgumentList &dstAl = m_defArgList; auto srcIt = srcAl.begin(); auto dstIt = dstAl.begin(); while ( srcIt!=srcAl.end() && dstIt!=dstAl.end()) { Argument &argDst = *dstIt; const Argument &argSrc = *srcIt; argDst.name = argSrc.name; argDst.docs = argSrc.docs; ++srcIt; ++dstIt; } } { const ArgumentList &srcAl = bmd->declArgumentList(); ArgumentList &dstAl = m_declArgList; auto srcIt = srcAl.begin(); auto dstIt = dstAl.begin(); while ( srcIt!=srcAl.end() && dstIt!=dstAl.end()) { Argument &argDst = *dstIt; const Argument &argSrc = *srcIt; argDst.name = argSrc.name; argDst.docs = argSrc.docs; ++srcIt; ++dstIt; } } } static void invalidateCachedTypesInArgumentList(ArgumentList &al) { for (Argument &a : al) { a.canType.clear(); } } void MemberDefImpl::invalidateCachedArgumentTypes() { invalidateCachedTypesInArgumentList(m_defArgList); invalidateCachedTypesInArgumentList(m_declArgList); } void MemberDefImpl::incrementFlowKeyWordCount() { m_numberOfFlowKW++; } int MemberDefImpl::numberOfFlowKeyWords() const { return m_numberOfFlowKW; } //---------------- QCString MemberDefImpl::displayName(bool) const { return DefinitionMixin::name(); } //---------------- static void transferArgumentDocumentation(ArgumentList &decAl,ArgumentList &defAl) { for (auto decIt = decAl.begin(), defIt = defAl.begin(); decIt!= decAl.end() && defIt!= defAl.end(); ++decIt, ++defIt) { Argument &decA = *decIt; Argument &defA = *defIt; if (decA.docs.isEmpty() && !defA.docs.isEmpty()) { decA.docs = defA.docs; } else if (defA.docs.isEmpty() && !decA.docs.isEmpty()) { defA.docs = decA.docs; } if (Config_getBool(RESOLVE_UNNAMED_PARAMS)) { if (decA.name.isEmpty() && !defA.name.isEmpty()) { decA.name = defA.name; } else if (defA.name.isEmpty() && !decA.name.isEmpty()) { defA.name = decA.name; } } } } void combineDeclarationAndDefinition(MemberDefMutable *mdec,MemberDefMutable *mdef) { AUTO_TRACE("mdec='{}' mdef='{}' mdec.isPrototype={} mdef.isPrototype={}", mdec->name(), mdef->name(), mdec->isPrototype(), mdef->isPrototype()); if ( (mdef->isFunction() && !mdef->isStatic() && !mdef->isPrototype()) || (mdef->isVariable() && !mdef->isExternal() && !mdef->isStatic()) ) { bool sameNumTemplateArgs = mdef->templateArguments().size()==mdec->templateArguments().size(); ArgumentList &mdefAl = const_cast<ArgumentList&>(mdef->argumentList()); ArgumentList &mdecAl = const_cast<ArgumentList&>(mdec->argumentList()); if (sameNumTemplateArgs && matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),&mdefAl, mdec->getOuterScope(),mdec->getFileDef(),&mdecAl, TRUE,mdef->getLanguage() ) ) /* match found */ { AUTO_TRACE_ADD("combining definition and declaration"); if (Config_getBool(RESOLVE_UNNAMED_PARAMS)) { mdec->resolveUnnamedParameters(mdef); } // first merge argument documentation transferArgumentDocumentation(mdecAl,mdefAl); /* copy documentation between function definition and declaration */ if (!mdec->briefDescription().isEmpty()) { mdef->setBriefDescription(mdec->briefDescription(),mdec->briefFile(),mdec->briefLine()); } else if (!mdef->briefDescription().isEmpty()) { mdec->setBriefDescription(mdef->briefDescription(),mdef->briefFile(),mdef->briefLine()); } if (!mdef->documentation().isEmpty()) { //printf("transferring docs mdef->mdec (%s->%s)\n",mdef->argsString(),mdec->argsString()); mdec->setDocumentation(mdef->documentation(),mdef->docFile(),mdef->docLine()); mdec->setDocsForDefinition(mdef->isDocsForDefinition()); if (mdefAl.hasParameters()) { auto mdefAlComb = stringToArgumentList(mdef->getLanguage(),mdef->argsString()); transferArgumentDocumentation(mdefAl,*mdefAlComb); mdec->moveArgumentList(std::move(mdefAlComb)); } } else if (!mdec->documentation().isEmpty()) { //printf("transferring docs mdec->mdef (%s->%s)\n",mdec->argsString(),mdef->argsString()); mdef->setDocumentation(mdec->documentation(),mdec->docFile(),mdec->docLine()); mdef->setDocsForDefinition(mdec->isDocsForDefinition()); if (mdecAl.hasParameters()) { auto mdecAlComb = stringToArgumentList(mdec->getLanguage(),mdec->argsString()); transferArgumentDocumentation(mdecAl,*mdecAlComb); mdef->moveDeclArgumentList(std::move(mdecAlComb)); } } if (!mdef->inbodyDocumentation().isEmpty()) { mdec->setInbodyDocumentation(mdef->inbodyDocumentation(),mdef->inbodyFile(),mdef->inbodyLine()); } else if (!mdec->inbodyDocumentation().isEmpty()) { mdef->setInbodyDocumentation(mdec->inbodyDocumentation(),mdec->inbodyFile(),mdec->inbodyLine()); } if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1) { //printf("body mdec->mdef %d-%d\n",mdec->getStartBodyLine(),mdef->getEndBodyLine()); mdef->setBodySegment(mdec->getDefLine(),mdec->getStartBodyLine(),mdec->getEndBodyLine()); mdef->setBodyDef(mdec->getBodyDef()); //mdef->setBodyMember(mdec); } else if (mdef->getStartBodyLine()!=-1 && mdec->getStartBodyLine()==-1) { //printf("body mdef->mdec %d-%d\n",mdef->getStartBodyLine(),mdec->getEndBodyLine()); mdec->setBodySegment(mdef->getDefLine(),mdef->getStartBodyLine(),mdef->getEndBodyLine()); mdec->setBodyDef(mdef->getBodyDef()); //mdec->setBodyMember(mdef); } mdec->mergeMemberSpecifiers(mdef->getMemberSpecifiers()); mdef->mergeMemberSpecifiers(mdec->getMemberSpecifiers()); // copy group info. if (mdec->getGroupDef()==nullptr && mdef->getGroupDef()!=nullptr) { mdec->setGroupDef(mdef->getGroupDef(), mdef->getGroupPri(), mdef->docFile(), mdef->docLine(), mdef->hasDocumentation(), mdef ); } else if (mdef->getGroupDef()==nullptr && mdec->getGroupDef()!=nullptr) { mdef->setGroupDef(mdec->getGroupDef(), mdec->getGroupPri(), mdec->docFile(), mdec->docLine(), mdec->hasDocumentation(), mdec ); } mdec->mergeRefItems(mdef); mdef->mergeRefItems(mdec); mdef->setMemberDeclaration(mdec); mdec->setMemberDefinition(mdef); mergeMemberOverrideOptions(mdec,mdef); mdef->addQualifiers(mdec->getQualifiers()); mdec->addQualifiers(mdef->getQualifiers()); } } } QCString MemberDefImpl::briefDescription(bool abbr) const { if (m_templateMaster) { return m_templateMaster->briefDescription(abbr); } else { return DefinitionMixin::briefDescription(abbr); } } QCString MemberDefImpl::documentation() const { if (m_templateMaster) { return m_templateMaster->documentation(); } else { return DefinitionMixin::documentation(); } } bool MemberDefImpl::hasUserDocumentation() const { if (m_templateMaster) { return m_templateMaster->hasUserDocumentation(); } else { return DefinitionMixin::hasUserDocumentation(); } } const ArgumentList &MemberDefImpl::typeConstraints() const { return m_typeConstraints; } bool MemberDefImpl::isFriendToHide() const { bool hideFriendCompounds = Config_getBool(HIDE_FRIEND_COMPOUNDS); bool isFriendToHide = hideFriendCompounds && (m_type=="friend class" || m_type=="friend struct" || m_type=="friend union"); return isFriendToHide; } bool MemberDefImpl::isFriendClass() const { return (isFriend() && (m_type=="friend class" || m_type=="friend struct" || m_type=="friend union")); } bool MemberDefImpl::isNotFriend() const { return !(isFriend() && isFriendToHide()); } bool MemberDefImpl::isFunctionOrSignalSlot() const { return isFunction() || isSlot() || isSignal(); } bool MemberDefImpl::isRelatedOrFriend() const { return isRelated() || isForeign() || (isFriend() && !isFriendToHide()); } bool MemberDefImpl::isReference() const { return DefinitionMixin::isReference() || (m_templateMaster && m_templateMaster->isReference()); } CodeSymbolType MemberDefImpl::codeSymbolType() const { switch (memberType()) { case MemberType::Define: return CodeSymbolType::Define; case MemberType::Function: return CodeSymbolType::Function; case MemberType::Variable: return CodeSymbolType::Variable; case MemberType::Typedef: return CodeSymbolType::Typedef; case MemberType::Enumeration: return CodeSymbolType::Enumeration; case MemberType::EnumValue: return CodeSymbolType::EnumValue; case MemberType::Signal: return CodeSymbolType::Signal; case MemberType::Slot: return CodeSymbolType::Slot; case MemberType::Friend: return CodeSymbolType::Friend; case MemberType::DCOP: return CodeSymbolType::DCOP; case MemberType::Property: return CodeSymbolType::Property; case MemberType::Event: return CodeSymbolType::Event; case MemberType::Interface: return CodeSymbolType::Interface; case MemberType::Service: return CodeSymbolType::Service; case MemberType::Sequence: return CodeSymbolType::Sequence; case MemberType::Dictionary: return CodeSymbolType::Dictionary; } return CodeSymbolType::Default; } //------------------------------------------------------------------------------- // Helpers static std::mutex g_docCrossReferenceMutex; void addDocCrossReference(const MemberDef *s,const MemberDef *d) { MemberDefMutable *src = toMemberDefMutable(const_cast<MemberDef*>(s)); MemberDefMutable *dst = toMemberDefMutable(const_cast<MemberDef*>(d)); if (src==nullptr || dst==nullptr) return; //printf("--> addDocCrossReference src=%s,dst=%s\n",qPrint(src->name()),qPrint(dst->name())); if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) && src->isCallable() ) { QCString sourceRefName = src->sourceRefName(); MemberDefMutable *mdDef = toMemberDefMutable(dst->memberDefinition()); MemberDefMutable *mdDecl = toMemberDefMutable(dst->memberDeclaration()); // ---- critical section std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); dst->addSourceReferencedBy(src,sourceRefName); if (mdDef) { mdDef->addSourceReferencedBy(src,sourceRefName); } if (mdDecl) { mdDecl->addSourceReferencedBy(src,sourceRefName); } // ---- end critical section } if ((src->hasReferencesRelation() || src->hasCallGraph()) && src->isCallable() ) { QCString sourceRefName = dst->sourceRefName(); MemberDefMutable *mdDef = toMemberDefMutable(src->memberDefinition()); MemberDefMutable *mdDecl = toMemberDefMutable(src->memberDeclaration()); // ---- critical section std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex); src->addSourceReferences(dst,sourceRefName); if (mdDef) { mdDef->addSourceReferences(dst,sourceRefName); } if (mdDecl) { mdDecl->addSourceReferences(dst,sourceRefName); } // ---- end critical section } } // --- Cast functions // MemberDef *toMemberDef(Definition *d) { if (d && (typeid(*d)==typeid(MemberDefImpl) || typeid(*d)==typeid(MemberDefAliasImpl))) { return static_cast<MemberDef*>(d); } else { return nullptr; } } MemberDef *toMemberDef(DefinitionMutable *md) { Definition *d = toDefinition(md); if (d && typeid(*d)==typeid(MemberDefImpl)) { return static_cast<MemberDef*>(d); } else { return nullptr; } } const MemberDef *toMemberDef(const Definition *d) { if (d && (typeid(*d)==typeid(MemberDefImpl) || typeid(*d)==typeid(MemberDefAliasImpl))) { return static_cast<const MemberDef*>(d); } else { return nullptr; } } MemberDefMutable *toMemberDefMutable(Definition *d) { if (d && typeid(*d)==typeid(MemberDefImpl)) { return static_cast<MemberDefMutable*>(d); } else { return nullptr; } }
208,377
C++
.cpp
5,930
29.881619
175
0.64441
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,485
mangen.cpp
doxygen_doxygen/src/mangen.cpp
/****************************************************************************** * * Copyright (C) 1997-2022 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. * */ /* http://www.cubic.org/source/archive/fileform/txt/man/ has some nice introductions to groff and man pages. */ #include <stdlib.h> #include <string.h> #include "message.h" #include "mangen.h" #include "config.h" #include "util.h" #include "doxygen.h" #include "docparser.h" #include "mandocvisitor.h" #include "language.h" #include "dir.h" #include "utf8.h" #include "datetime.h" #include "portable.h" #include "outputlist.h" static QCString getExtension() { /* * [.][number][rest] * in case of . missing, just ignore it * in case number missing, just place a 3 in front of it */ QCString ext = Config_getString(MAN_EXTENSION); if (ext.isEmpty()) { ext = "3"; } else { if (ext.at(0)=='.') { if (ext.length()==1) { ext = "3"; } else // strip . { ext = ext.mid(1); } } if (ext.at(0)<'0' || ext.at(0)>'9') { ext.prepend("3"); } } return ext; } static QCString getSubdir() { QCString dir = Config_getString(MAN_SUBDIR); if (dir.isEmpty()) { dir = "man" + getExtension(); } return dir; } static QCString docifyToString(const QCString &str) { QCString result; result.reserve(str.length()); if (!str.isEmpty()) { const char *p=str.data(); char c=0; while ((c=*p++)) { switch(c) { case '-': result += "\\-"; break; // see bug747780 case '.': result += "\\&."; break; // see bug652277 case '\\': result += "\\\\"; break; case '\n': result += "\n"; break; case '\"': c = '\''; // no break! default: result += c; break; } } //printf("%s",str);fflush(stdout); } return result; } static QCString objectLinkToString(const QCString &text) { return "\\fB" + docifyToString(text) + "\\fP"; } //------------------------------------------------------------------------------- ManCodeGenerator::ManCodeGenerator(TextStream *t) : m_t(t) { } void ManCodeGenerator::startCodeFragment(const QCString &) { *m_t << "\n"; *m_t << ".nf\n"; } void ManCodeGenerator::endCodeFragment(const QCString &) { if (m_col>0) *m_t << "\n"; *m_t << ".PP\n"; *m_t << ".fi\n"; m_col=0; } void ManCodeGenerator::writeLineNumber(const QCString &,const QCString &,const QCString &,int l, bool) { if (m_hide) return; *m_t << l << " "; m_col=0; } void ManCodeGenerator::writeCodeLink(CodeSymbolType, const QCString &,const QCString &, const QCString &, const QCString &name, const QCString &) { if (m_hide) return; if (!name.isEmpty()) { const char *p=name.data(); char c=0; while ((c=*p++)) { switch(c) { case '-': *m_t << "\\-"; break; // see bug747780 case '.': *m_t << "\\&."; break; // see bug652277 case '\\': *m_t << "\\\\"; m_col++; break; case '\n': *m_t << "\n"; m_col=0; break; case '\"': c = '\''; // no break! default: *m_t << c; m_col++; break; } } //printf("%s",str);fflush(stdout); } } void ManCodeGenerator::codify(const QCString &str) { const int tabSize = Config_getInt(TAB_SIZE); const size_t stripAmount = m_stripIndentAmount; if (!str.isEmpty()) { char c; const char *p=str.data(); if (m_hide) { m_col = updateColumnCount(p,m_col); } else { while ((c=*p++)) { switch(c) { case '-': *m_t << "\\-"; break; // see bug747780 case '.': *m_t << "\\&."; break; // see bug652277 case '\t': { int spacesToNextTabStop = tabSize - (m_col%tabSize); while (spacesToNextTabStop--) { if (m_col>=stripAmount) *m_t << " "; m_col++; } } break; case ' ': if (m_col>=stripAmount) *m_t << " "; m_col++; break; case '\n': *m_t << "\n"; m_col=0; break; case '\\': *m_t << "\\\\"; m_col++; break; case '\"': // no break! default: p=writeUTF8Char(*m_t,p-1); m_col++; break; } } //printf("%s",str);fflush(stdout); } } } void ManCodeGenerator::stripCodeComments(bool b) { m_stripCodeComments = b; } void ManCodeGenerator::startSpecialComment() { m_hide = m_stripCodeComments; } void ManCodeGenerator::endSpecialComment() { m_hide = false; } void ManCodeGenerator::setStripIndentAmount(size_t amount) { m_stripIndentAmount = amount; } //------------------------------------------------------------------------------- ManGenerator::ManGenerator() : OutputGenerator(Config_getString(MAN_OUTPUT)+"/"+getSubdir()) , m_codeList(std::make_unique<OutputCodeList>()) { m_codeGen = m_codeList->add<ManCodeGenerator>(&m_t); } ManGenerator::ManGenerator(const ManGenerator &og) : OutputGenerator(og.m_dir), OutputGenIntf() { m_codeList = std::make_unique<OutputCodeList>(*og.m_codeList); m_codeGen = m_codeList->get<ManCodeGenerator>(OutputType::Man); m_codeGen->setTextStream(&m_t); m_firstCol = og.m_firstCol; m_col = og.m_col; m_paragraph = og.m_paragraph; m_upperCase = og.m_upperCase; m_insideTabbing = og.m_insideTabbing; m_inHeader = og.m_inHeader; } ManGenerator &ManGenerator::operator=(const ManGenerator &og) { if (this!=&og) { m_dir = og.m_dir; m_codeList = std::make_unique<OutputCodeList>(*og.m_codeList); m_codeGen = m_codeList->get<ManCodeGenerator>(OutputType::Man); m_codeGen->setTextStream(&m_t); m_firstCol = og.m_firstCol; m_col = og.m_col; m_paragraph = og.m_paragraph; m_upperCase = og.m_upperCase; m_insideTabbing = og.m_insideTabbing; m_inHeader = og.m_inHeader; } return *this; } ManGenerator::~ManGenerator() = default; void ManGenerator::addCodeGen(OutputCodeList &list) { list.add<ManCodeGeneratorDefer>(m_codeGen); } void ManGenerator::init() { QCString manOutput = Config_getString(MAN_OUTPUT); Dir d(manOutput.str()); if (!d.exists() && !d.mkdir(manOutput.str())) { term("Could not create output directory %s\n",qPrint(manOutput)); } std::string manDir = manOutput.str()+"/"+getSubdir().str(); if (!d.exists(manDir) && !d.mkdir(manDir)) { term("Could not create output directory %s/%s\n",qPrint(manOutput), qPrint(getSubdir())); } createSubDirs(d); } void ManGenerator::cleanup() { QCString dname = Config_getString(MAN_OUTPUT); Dir d(dname.str()); clearSubDirs(d); } static QCString buildFileName(const QCString &name) { QCString fileName; if (name.isEmpty()) return "noname"; const char *p=name.data(); char c = 0; 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 ManGenerator::startFile(const QCString &,const QCString &manName,const QCString &,int,int) { startPlainFile( buildFileName( manName ) ); m_firstCol=TRUE; } void ManGenerator::endFile() { m_t << "\n"; endPlainFile(); } void ManGenerator::endTitleHead(const QCString &,const QCString &name) { m_t << ".TH \"" << name << "\" " << getExtension() << " \""; switch (Config_getEnum(TIMESTAMP)) { case TIMESTAMP_t::YES: case TIMESTAMP_t::DATETIME: m_t << dateToString(DateTimeType::DateTime) << "\" \""; break; case TIMESTAMP_t::DATE: m_t << dateToString(DateTimeType::Date) << "\" \""; break; case TIMESTAMP_t::NO: break; } if (!Config_getString(PROJECT_NUMBER).isEmpty()) m_t << "Version " << Config_getString(PROJECT_NUMBER) << "\" \""; if (Config_getString(PROJECT_NAME).isEmpty()) m_t << "Doxygen"; else m_t << Config_getString(PROJECT_NAME); m_t << "\" \\\" -*- nroff -*-\n"; m_t << ".ad l\n"; m_t << ".nh\n"; m_t << ".SH NAME\n"; m_t << name; m_firstCol=FALSE; m_paragraph=TRUE; m_inHeader=TRUE; } void ManGenerator::newParagraph() { if (!m_paragraph) { if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_firstCol=TRUE; } m_paragraph=TRUE; } void ManGenerator::startParagraph(const QCString &) { if (!m_paragraph) { if (!m_firstCol) m_t << "\n"; m_t << ".PP\n"; m_firstCol=TRUE; } m_paragraph=TRUE; } void ManGenerator::endParagraph() { } void ManGenerator::writeString(const QCString &text) { docify(text); } void ManGenerator::startIndexItem(const QCString &,const QCString &) { } void ManGenerator::endIndexItem(const QCString &,const QCString &) { } void ManGenerator::writeStartAnnoItem(const QCString &,const QCString &, const QCString &,const QCString &) { } void ManGenerator::writeObjectLink(const QCString &,const QCString &, const QCString &, const QCString &name) { startBold(); docify(name); endBold(); } void ManGenerator::startGroupHeader(int) { if (!m_firstCol) m_t << "\n"; m_t << ".SH \""; m_upperCase=TRUE; m_firstCol=FALSE; } void ManGenerator::endGroupHeader(int) { m_t << "\"\n.PP \n"; m_firstCol=TRUE; m_paragraph=TRUE; m_upperCase=FALSE; } void ManGenerator::startMemberHeader(const QCString &,int) { if (!m_firstCol) m_t << "\n"; m_t << ".SS \""; } void ManGenerator::endMemberHeader() { m_t << "\"\n"; m_firstCol=TRUE; m_paragraph=FALSE; } void ManGenerator::docify(const QCString &str) { if (!str.isEmpty()) { const char *p=str.data(); char c=0; while ((c=*p++)) { switch(c) { case '-': m_t << "\\-"; break; // see bug747780 case '.': m_t << "\\&."; break; // see bug652277 case '\\': m_t << "\\\\"; m_col++; break; case '\n': m_t << "\n"; m_col=0; break; case '\"': c = '\''; // no break! default: m_t << c; m_col++; break; } } m_firstCol=(c=='\n'); //printf("%s",str);fflush(stdout); } m_paragraph=FALSE; } void ManGenerator::writeChar(char c) { m_firstCol=(c=='\n'); if (m_firstCol) m_col=0; else m_col++; switch (c) { case '\\': m_t << "\\\\"; break; case '\"': c = '\''; // no break! default: m_t << c; break; } //printf("%c",c);fflush(stdout); m_paragraph=FALSE; } void ManGenerator::startTitle() { if (!m_firstCol) m_t << "\n"; m_t << ".SH \""; m_firstCol=FALSE; m_paragraph=FALSE; } void ManGenerator::endTitle() { m_t << "\""; } void ManGenerator::startItemListItem() { if (!m_firstCol) m_t << "\n"; m_t << ".TP\n"; m_firstCol=TRUE; m_paragraph=FALSE; m_col=0; } void ManGenerator::endItemListItem() { } void ManGenerator::startMemberDoc(const QCString &,const QCString &,const QCString &,const QCString &,int,int,bool) { if (!m_firstCol) m_t << "\n"; m_t << ".SS \""; m_firstCol=FALSE; m_paragraph=FALSE; } void ManGenerator::startDoxyAnchor(const QCString &,const QCString &manName, const QCString &, const QCString &name, const QCString &) { // 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,qPrint(baseName),qPrint(buildFileName(baseName))); // - remove dangerous characters and append suffix, then add dir prefix QCString fileName=dir()+"/"+buildFileName( baseName ); FileInfo fi(fileName.str()); if (!fi.exists()) { std::ofstream linkStream = Portable::openOutputStream(fileName); if (linkStream.is_open()) { linkStream << ".so " << getSubdir() << "/" << buildFileName( manName ) << "\n"; } } } void ManGenerator::addLabel(const QCString &,const QCString &) { } void ManGenerator::endMemberDoc(bool) { m_t << "\"\n"; } void ManGenerator::startCompoundTemplateParams() { if (!m_firstCol) m_t << "\n"; m_t << "\n.SS \""; m_firstCol=FALSE; m_paragraph=FALSE; } void ManGenerator::endCompoundTemplateParams() { m_t << "\""; } void ManGenerator::writeSynopsis() { if (!m_firstCol) m_t << "\n"; m_t << ".SH SYNOPSIS\n.br\n.PP\n"; m_firstCol=TRUE; m_paragraph=FALSE; } void ManGenerator::startDescForItem() { if (!m_firstCol) m_t << "\n"; if (!m_paragraph) m_t << ".in -1c\n"; m_t << ".in +1c\n"; m_firstCol=TRUE; m_paragraph=FALSE; m_col=0; } void ManGenerator::endDescForItem() { } void ManGenerator::startAnonTypeScope(int indentLevel) { if (indentLevel==0) { m_insideTabbing=TRUE; } } void ManGenerator::endAnonTypeScope(int indentLevel) { if (indentLevel==0) { m_insideTabbing=FALSE; } } void ManGenerator::startMemberItem(const QCString &,MemberItemType,const QCString &) { if (m_firstCol && !m_insideTabbing) m_t << ".in +1c\n"; m_t << "\n.ti -1c\n.RI \""; m_firstCol=FALSE; } void ManGenerator::endMemberItem(MemberItemType) { m_t << "\"\n.br"; } void ManGenerator::startMemberList() { if (!m_insideTabbing) { m_t << "\n.in +1c"; m_firstCol=FALSE; } } void ManGenerator::endMemberList() { if (!m_insideTabbing) { m_t << "\n.in -1c"; m_firstCol=FALSE; } } void ManGenerator::startMemberGroupHeader(bool) { m_t << "\n.PP\n.RI \"\\fB"; } void ManGenerator::endMemberGroupHeader() { m_t << "\\fP\"\n.br\n"; m_firstCol=TRUE; } void ManGenerator::startMemberGroupDocs() { } void ManGenerator::endMemberGroupDocs() { m_t << "\n.PP"; } void ManGenerator::startMemberGroup() { m_t << "\n.in +1c"; } void ManGenerator::endMemberGroup(bool) { m_t << "\n.in -1c"; m_firstCol=FALSE; } void ManGenerator::startSection(const QCString &,const QCString &,SectionType type) { if( !m_inHeader ) { switch(type.level()) { case SectionType::Page: // fall through case SectionType::Section: startGroupHeader(0); break; case SectionType::Subsection: // fall through case SectionType::Subsubsection: // fall through case SectionType::Paragraph: // fall through case SectionType::Subparagraph: // fall through case SectionType::Subsubparagraph: startMemberHeader(QCString(), -1); break; default: ASSERT(0); break; } } } void ManGenerator::endSection(const QCString &,SectionType type) { if( !m_inHeader ) { switch(type.level()) { case SectionType::Page: // fall through case SectionType::Section: endGroupHeader(0); break; case SectionType::Subsection: // fall through case SectionType::Subsubsection: // fall through case SectionType::Paragraph: // fall through case SectionType::Subparagraph: // fall through case SectionType::Subsubparagraph: endMemberHeader(); break; default: ASSERT(0); break; } } else { m_t << "\n.PP\n"; m_firstCol=TRUE; m_paragraph=FALSE; m_inHeader=FALSE; } } void ManGenerator::startExamples() { if (!m_firstCol) { m_t << "\n" << ".PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } m_paragraph=FALSE; startBold(); docify(theTranslator->trExamples()); endBold(); m_paragraph=TRUE; } void ManGenerator::endExamples() { } void ManGenerator::startDescTable(const QCString &title,const bool hasInits) { if (!m_firstCol) { m_t << "\n.PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } m_paragraph=FALSE; startBold(); docify(title); endBold(); m_paragraph=TRUE; startDescForItem(); } void ManGenerator::endDescTable() { endDescForItem(); } void ManGenerator::writeDoc(const IDocNodeAST *ast,const Definition *ctx,const MemberDef *,int) { const DocNodeAST *astImpl = dynamic_cast<const DocNodeAST *>(ast); if (astImpl) { ManDocVisitor visitor(m_t,*m_codeList,ctx?ctx->getDefFileExtension():QCString("")); std::visit(visitor,astImpl->root); } m_firstCol=FALSE; m_paragraph = FALSE; } void ManGenerator::startConstraintList(const QCString &header) { if (!m_firstCol) { m_t << "\n.PP\n"; m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } m_paragraph=FALSE; startBold(); docify(header); endBold(); m_paragraph=TRUE; } void ManGenerator::startConstraintParam() { startItemListItem(); startEmphasis(); } void ManGenerator::endConstraintParam() { endEmphasis(); endItemListItem(); m_t << " : "; } void ManGenerator::startConstraintType() { startEmphasis(); } void ManGenerator::endConstraintType() { endEmphasis(); } void ManGenerator::startConstraintDocs() { } void ManGenerator::endConstraintDocs() { m_t << "\n"; m_firstCol=TRUE; } void ManGenerator::endConstraintList() { } void ManGenerator::startInlineHeader() { if (!m_firstCol) { m_t << "\n.PP\n" << ".in -1c\n"; } m_t << ".RI \"\\fB"; } void ManGenerator::endInlineHeader() { m_t << "\\fP\"\n" << ".in +1c\n"; m_firstCol = FALSE; } void ManGenerator::startMemberDocSimple(bool isEnum) { if (!m_firstCol) { m_t << "\n.PP\n"; } m_t << "\\fB"; if (isEnum) { docify(theTranslator->trEnumerationValues()); } else { docify(theTranslator->trCompoundMembers()); } m_t << ":\\fP\n"; m_t << ".RS 4\n"; } void ManGenerator::endMemberDocSimple(bool) { if (!m_firstCol) m_t << "\n"; m_t << ".RE\n"; m_t << ".PP\n"; m_firstCol=TRUE; } void ManGenerator::startInlineMemberType() { } void ManGenerator::endInlineMemberType() { m_t << " "; } void ManGenerator::startInlineMemberName() { m_t << "\\fI"; } void ManGenerator::endInlineMemberName() { m_t << "\\fP "; } void ManGenerator::startInlineMemberDoc() { } void ManGenerator::endInlineMemberDoc() { if (!m_firstCol) m_t << "\n"; m_t << ".br\n"; m_t << ".PP\n"; m_firstCol=TRUE; } void ManGenerator::startLabels() { } void ManGenerator::writeLabel(const QCString &l,bool isLast) { m_t << "\\fR [" << l << "]\\fP"; if (!isLast) m_t << ", "; } void ManGenerator::endLabels() { } void ManGenerator::endHeaderSection() { } void ManGenerator::writeInheritedSectionTitle( const QCString &/*id*/, const QCString &/*ref*/, const QCString &/*file*/, const QCString &/*anchor*/, const QCString &title, const QCString &name) { m_t << "\n\n"; m_t << theTranslator->trInheritedFrom(docifyToString(title), objectLinkToString(name)); m_firstCol = FALSE; } void ManGenerator::startParameterList(bool openBracket) { if (openBracket) m_t << "("; } void ManGenerator::endParameterExtra(bool last,bool /* emptyList */, bool closeBracket) { if (last && closeBracket) { m_t << ")"; } } void ManGenerator::endParameterType() { m_t << " "; }
20,147
C++
.cpp
833
20.372149
115
0.603833
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,486
dotdirdeps.cpp
doxygen_doxygen/src/dotdirdeps.cpp
/****************************************************************************** * * Copyright (C) 1997-2019 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 "dotdirdeps.h" #include "util.h" #include "doxygen.h" #include "config.h" #include "image.h" #include "dotnode.h" #include <algorithm> #include <iterator> #include <utility> #include <cstdint> #include <math.h> #include <cassert> #include <map> #include <memory> #include <string> #include <vector> using DirDefMap = std::map<std::string,const DirDef *>; /** Properties are used to format the directories in the graph distinctively. */ struct DotDirProperty { bool isIncomplete = false; //!< true if not all successors of a cluster are drawn bool isOrphaned = false; //!< true if parent is not drawn bool isTruncated = false; //!< true has successors, none is drawn bool isOriginal = false; //!< true if is the directory for which the graph is drawn bool isPeripheral = false; //!< true if no successor of parent of original directory }; /** Builder helper to create instances of the DotDirProperty struct */ class DotDirPropertyBuilder { public: DotDirPropertyBuilder &makeIncomplete(bool b=true) { m_property.isIncomplete=b; return *this; } DotDirPropertyBuilder &makeOrphaned (bool b=true) { m_property.isOrphaned =b; return *this; } DotDirPropertyBuilder &makeTruncated (bool b=true) { m_property.isTruncated =b; return *this; } DotDirPropertyBuilder &makeOriginal (bool b=true) { m_property.isOriginal =b; return *this; } DotDirPropertyBuilder &makePeripheral(bool b=true) { m_property.isPeripheral=b; return *this; } operator DotDirProperty() { return std::move(m_property); } private: DotDirProperty m_property; }; /** Elements consist of (1) directory relation and (2) whether it is pointing only to inherited dependees. */ typedef std::vector< std::pair< std::unique_ptr<DirRelation>, bool> > DirRelations; /** Returns a DOT color name according to the directory depth. */ static QCString getDirectoryBackgroundColor(int depthIndex) { int hue = Config_getInt(HTML_COLORSTYLE_HUE); int sat = Config_getInt(HTML_COLORSTYLE_SAT); int gamma = Config_getInt(HTML_COLORSTYLE_GAMMA); assert(depthIndex>=0 && depthIndex<=Config_getInt(DIR_GRAPH_MAX_DEPTH)); float fraction = static_cast<float>(depthIndex)/static_cast<float>(Config_getInt(DIR_GRAPH_MAX_DEPTH)); const char hex[] = "0123456789abcdef"; int range = 0x40; // range from darkest color to lightest color int luma = 0xef-static_cast<int>(fraction*static_cast<float>(range)); // interpolation double r=0, g=0, b=0; ColoredImage::hsl2rgb(hue/360.0,sat/255.0, pow(luma/255.0,gamma/100.0),&r,&g,&b); int red = static_cast<int>(r*255.0); int green = static_cast<int>(g*255.0); int blue = static_cast<int>(b*255.0); assert(red>=0 && red<=255); assert(green>=0 && green<=255); assert(blue>=0 && blue<=255); char colStr[8]; colStr[0]='#'; colStr[1]=hex[red>>4]; colStr[2]=hex[red&0xf]; colStr[3]=hex[green>>4]; colStr[4]=hex[green&0xf]; colStr[5]=hex[blue>>4]; colStr[6]=hex[blue&0xf]; colStr[7]=0; //printf("i=%d max=%d fraction=%f luma=%d %02x %02x %02x -> color=%s\n", // depthIndex,Config_getInt(DIR_GRAPH_MAX_DEPTH),fraction,luma,red,green,blue,colStr); return colStr; } /** Returns a DOT color name according to the directory properties. */ static const char* getDirectoryBorderColor(const DotDirProperty &property) { if (property.isTruncated && property.isOrphaned) { return "red"; } else if (property.isTruncated) { return "red"; } else if (property.isOrphaned) { return "grey50"; } else { return "grey25"; } } /** Returns a DOT node style according to the directory properties. */ static std::string getDirectoryBorderStyle(const DotDirProperty &property) { std::string style = "filled"; if (property.isOriginal) { style += ",bold"; } if (property.isIncomplete) { style += ",dashed"; } else if (property.isTruncated && property.isOrphaned) { style += ",dashed"; } return style; } static TextStream &common_attributes(TextStream &t, const DirDef *const dir, const DotDirProperty &prop) { QCString url = dir->getOutputFileBase(); addHtmlExtensionIfMissing(url); return t << "style=\"" << getDirectoryBorderStyle(prop) << "\", " "URL=\"" << url << "\"," "tooltip=\"" << escapeTooltip(dir->briefDescriptionAsTooltip()) << "\""; } /** * Puts DOT code for drawing directory to stream and adds it to the list. * @param[in,out] t stream to which the DOT code is written to * @param[in] directory will be mapped to a node in DOT code * @param[in] property are evaluated for formatting * @param[in,out] directoriesInGraph lists the directories which have been written to the output stream * @param[in] startLevel current level to calculate relative distances from to determine the background color */ static void drawDirectory(TextStream &t, const DirDef *const directory, const DotDirProperty &property, DirDefMap &directoriesInGraph,int startLevel) { t << " " << directory->getOutputFileBase() << " [" "label=\"" << DotNode::convertLabel(directory->shortName()) << "\", " "fillcolor=\"" << getDirectoryBackgroundColor(directory->level()-startLevel) << "\", " "color=\"" << getDirectoryBorderColor(property) << "\", "; common_attributes(t, directory, property) << "];\n"; directoriesInGraph.emplace(directory->getOutputFileBase().str(), directory); } /** Checks, if the directory is a the maximum drawn directory level. */ static bool isAtMaxDepth(const DirDef *const directory, const int startLevel) { return (directory->level() - startLevel) >= Config_getInt(DIR_GRAPH_MAX_DEPTH); } /** * Writes DOT code for opening a cluster subgraph to stream. * * Ancestor clusters directly get a label. Other clusters get a plain text node with a label instead. * This is because the plain text node can be used to draw dependency relationships. */ static void drawClusterOpening(TextStream &outputStream, const DirDef *const directory, const DotDirProperty &directoryProperty, DirDefMap &directoriesInGraph, const bool isAncestor,int startLevel) { outputStream << " subgraph cluster" << directory->getOutputFileBase() << " {\n" " graph [ " "bgcolor=\"" << getDirectoryBackgroundColor(directory->level()-startLevel) << "\", " "pencolor=\"" << getDirectoryBorderColor(directoryProperty) << "\", " "label=\""; if (isAncestor) { outputStream << DotNode::convertLabel(directory->shortName()); } outputStream << "\", " << Config_getString(DOT_COMMON_ATTR) << " "; common_attributes(outputStream, directory, directoryProperty) << "]\n"; if (!isAncestor) { outputStream << " " << directory->getOutputFileBase() << " [shape=plaintext, " "label=\"" << DotNode::convertLabel(directory->shortName()) << "\"" "];\n"; directoriesInGraph.emplace(directory->getOutputFileBase().str(), directory); } } static void drawClusterClosing(TextStream &t) { t << " }\n"; } /** * Assembles a list of the directory relations and whether or not they result from "inheritance". * @param dependencies Array to add the dependencies to. * @param srcDir is the source of the dependency. * @param isLeaf true, if no children are drawn for this directory. */ static void addDependencies(DirRelations &dependencies,const DirDef *const srcDir, bool isLeaf) { for (const auto &usedDirectory : srcDir->usedDirs()) { const auto dstDir = usedDirectory->dir(); if (!dstDir->isParentOf(srcDir) && (isLeaf || usedDirectory->hasDirectSrcDeps())) { QCString relationName; relationName.sprintf("dir_%06d_%06d", srcDir->dirIndex(), dstDir->dirIndex()); bool directRelation = isLeaf ? usedDirectory->hasDirectDstDeps() : usedDirectory->hasDirectDeps(); dependencies.emplace_back( std::make_unique<DirRelation>(relationName, srcDir, usedDirectory.get()), directRelation); } } } /** Recursively draws directory tree. */ static void drawTree(DirRelations &dependencies, TextStream &t, const DirDef *const directory, int startLevel, DirDefMap &directoriesInGraph, const bool isTreeRoot) { if (!directory->hasSubdirs()) { const DotDirProperty directoryProperty = DotDirPropertyBuilder().makeOriginal(isTreeRoot); drawDirectory(t, directory, directoryProperty, directoriesInGraph,startLevel); addDependencies(dependencies, directory, true); } else { if (isAtMaxDepth(directory, startLevel)) // maximum nesting level reached { const DotDirProperty directoryProperty = DotDirPropertyBuilder().makeOriginal(isTreeRoot); drawDirectory(t, directory, directoryProperty, directoriesInGraph,startLevel); addDependencies(dependencies, directory, true); } else // start a new nesting level { // open cluster { const DotDirProperty directoryProperty = DotDirPropertyBuilder().makeOriginal(isTreeRoot); drawClusterOpening(t, directory, directoryProperty, directoriesInGraph, false, startLevel); addDependencies(dependencies, directory, false); } // process all sub directories for (const auto subDirectory : directory->subDirs()) { drawTree(dependencies, t, subDirectory, startLevel, directoriesInGraph, false); } // close cluster { drawClusterClosing(t); } } } } /** * Write DOT code for directory dependency graph. * * Code is generated for a directory. Successors (sub-directories) of this directory are recursively drawn. * Recursion is limited by `DIR_GRAPH_MAX_DEPTH`. The dependencies of those directories * are drawn. * * If a dependee is not part of directory tree above, then the dependency is drawn to the first parent of the * dependee, whose parent is an ancestor (sub-directory) of the original directory. * * @param t stream where the DOT code is written to * @param dd directory for which the graph is generated for * @param linkRelations if true, hyperlinks to the list of file dependencies are added */ void writeDotDirDepGraph(TextStream &t,const DirDef *dd,bool linkRelations) { DirDefMap dirsInGraph; dirsInGraph.emplace(dd->getOutputFileBase().str(),dd); std::vector<const DirDef *> usedDirsNotDrawn, usedDirsDrawn; for (const auto& usedDir : dd->usedDirs()) { usedDirsNotDrawn.push_back(usedDir->dir()); } auto moveDrawnDirs = [&usedDirsDrawn,&usedDirsNotDrawn](const std::vector<const DirDef *>::iterator &newEnd) { // usedDirsNotDrawn is split into two segments: [begin()....newEnd-1] and [newEnd....end()] // where the second segment starting at newEnd has been drawn, so append this segment to the usedDirsDrawn list and // remove it from the usedDirsNotDrawn list. std::move(newEnd, std::end(usedDirsNotDrawn), std::back_inserter(usedDirsDrawn)); usedDirsNotDrawn.erase(newEnd, usedDirsNotDrawn.end()); }; // if dd has a parent draw it as the outer layer const auto parent = dd->parent(); if (parent) { const DotDirProperty parentDirProperty = DotDirPropertyBuilder(). makeIncomplete(). makeOrphaned(parent->parent()!=nullptr); drawClusterOpening(t, parent, parentDirProperty, dirsInGraph, true, parent->level()); { // draw all directories which have `dd->parent()` as parent and `dd` as dependent const auto newEnd = std::stable_partition(usedDirsNotDrawn.begin(), usedDirsNotDrawn.end(), [&](const DirDef *const usedDir) { if (dd!=usedDir && dd->parent()==usedDir->parent()) // usedDir and dd share the same parent { const DotDirProperty usedDirProperty = DotDirPropertyBuilder().makeTruncated(usedDir->hasSubdirs()); drawDirectory(t, usedDir, usedDirProperty, dirsInGraph, parent->level()); return false; // part of the drawn partition } return true; // part of the not-drawn partition }); moveDrawnDirs(newEnd); } } // draw the directory tree with dd as root DirRelations dependencies; drawTree(dependencies, t, dd, dd->level(), dirsInGraph, true); if (parent) { drawClusterClosing(t); } // add nodes for other used directories (i.e. outside of the cluster of directories directly connected to dd) { const auto newEnd = std::stable_partition(usedDirsNotDrawn.begin(), usedDirsNotDrawn.end(), [&](const DirDef *const usedDir) // for each used dir (=directly used or a parent of a directly used dir) { const DirDef *dir=dd; while (dir) { if (dir!=usedDir && dir->parent()==usedDir->parent()) // include if both have the same parent (or no parent) { const DotDirProperty usedDirProperty = DotDirPropertyBuilder(). makeOrphaned(usedDir->parent()!=nullptr). makeTruncated(usedDir->hasSubdirs()). makePeripheral(); drawDirectory(t, usedDir, usedDirProperty, dirsInGraph, dir->level()); return false; // part of the drawn partition } dir=dir->parent(); } return true; // part of the not-drawn partition }); moveDrawnDirs(newEnd); } // add relations between all selected directories { for (const auto &relationPair : dependencies) { const auto &relation = relationPair.first; const bool directRelation = relationPair.second; const auto udir = relation->destination(); const auto usedDir = udir->dir(); const bool destIsSibling = std::find(std::begin(usedDirsDrawn), std::end(usedDirsDrawn), usedDir) != std::end(usedDirsDrawn); const bool destIsDrawn = dirsInGraph.find(usedDir->getOutputFileBase().str())!=dirsInGraph.end(); // only point to nodes that are in the graph const bool atMaxDepth = isAtMaxDepth(usedDir, dd->level()); if (destIsSibling || (destIsDrawn && (directRelation || atMaxDepth))) { const auto relationName = relation->getOutputFileBase(); const auto dir = relation->source(); Doxygen::dirRelations.add(relationName, std::make_unique<DirRelation>( relationName,dir,udir)); size_t nrefs = udir->filePairs().size(); t << " " << dir->getOutputFileBase() << "->" << usedDir->getOutputFileBase(); t << " [headlabel=\"" << nrefs << "\", labeldistance=1.5"; if (linkRelations) { QCString fn = relationName; addHtmlExtensionIfMissing(fn); t << " headhref=\"" << fn << "\""; t << " href=\"" << fn << "\""; } t << " color=\"steelblue1\" fontcolor=\"steelblue1\"];\n"; } } } } DotDirDeps::DotDirDeps(const DirDef *dir) : m_dir(dir) { } DotDirDeps::~DotDirDeps() { } QCString DotDirDeps::getBaseName() const { return m_dir->getOutputFileBase()+"_dep"; } void DotDirDeps::computeTheGraph() { // compute md5 checksum of the graph were are about to generate TextStream md5stream; writeGraphHeader(md5stream, m_dir->displayName()); md5stream << " compound=true\n"; writeDotDirDepGraph(md5stream,m_dir,m_linkRelations); writeGraphFooter(md5stream); m_theGraph = md5stream.str(); } QCString DotDirDeps::getMapLabel() const { return escapeCharsInString(m_baseName,FALSE); } QCString DotDirDeps::getImgAltText() const { return convertToXML(m_dir->displayName()); } QCString DotDirDeps::writeGraph(TextStream &out, GraphOutputFormat graphFormat, EmbeddedOutputFormat textFormat, const QCString &path, const QCString &fileName, const QCString &relPath, bool generateImageMap, int graphId, bool linkRelations) { m_linkRelations = linkRelations; m_urlOnly = TRUE; return DotGraph::writeGraph(out, graphFormat, textFormat, path, fileName, relPath, generateImageMap, graphId); } bool DotDirDeps::isTrivial() const { return m_dir->depGraphIsTrivial(); }
16,890
C++
.cpp
412
36.245146
154
0.685401
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,487
docbookvisitor.cpp
doxygen_doxygen/src/docbookvisitor.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 "docbookvisitor.h" #include "docparser.h" #include "language.h" #include "doxygen.h" #include "outputgen.h" #include "docbookgen.h" #include "dot.h" #include "message.h" #include "util.h" #include "parserintf.h" #include "filename.h" #include "config.h" #include "filedef.h" #include "msc.h" #include "dia.h" #include "htmlentity.h" #include "emoji.h" #include "plantuml.h" #include "growbuf.h" #include "fileinfo.h" #include "portable.h" #include "codefragment.h" #if 0 #define DB_VIS_C DB_VIS_C1(m_t) #define DB_VIS_C1(x) x << "<!-- DB_VIS_C " << __LINE__ << " -->\n"; #define DB_VIS_C2(y) DB_VIS_C2a(m_t,y) #define DB_VIS_C2a(x,y) x << "<!-- DB_VIS_C " << __LINE__ << " " << y << " -->\n"; #else #define DB_VIS_C #define DB_VIS_C1(x) #define DB_VIS_C2(y) #define DB_VIS_C2a(x,y) #endif static QCString filterId(const QCString &s) { if (s.isEmpty()) return s; GrowBuf growBuf; growBuf.clear(); const char *p=s.data(); char c=0; while ((c=*p++)) { switch (c) { case ':': growBuf.addStr("_1"); break; default: growBuf.addChar(c); break; } } growBuf.addChar(0); return growBuf.get(); } static bool supportedHtmlAttribute(const QCString &name) { return (name=="align" || name=="bgcolor" || name=="border" || name=="cellpadding" || name=="cellspacing" || name=="class" || name=="frame" || name=="label" || name=="style" || name=="width" || name=="tabstyle" || name=="title"); } static QCString makeShortName(const QCString &baseName) { QCString result = baseName; int i = result.findRev('/'); if (i!=-1) { result=result.mid(i+1); } return result; } static QCString makeBaseName(const QCString &name) { QCString result = makeShortName(name); int i = result.find('.'); if (i!=-1) { result=result.left(i); } return result; } void DocbookDocVisitor::visitCaption(const DocNodeList &children) { for (const auto &n : children) { std::visit(*this,n); } } void DocbookDocVisitor::visitPreStart(TextStream &t, const DocNodeList &children, bool hasCaption, const QCString &name, const QCString &width, const QCString &height, bool inlineImage) { if (hasCaption && !inlineImage) { t << " <figure>\n"; t << " <title>\n"; visitCaption(children); t << " </title>\n"; } else { t << " <informalfigure>\n"; } t << " <mediaobject>\n"; t << " <imageobject>\n"; t << " <imagedata"; if (!width.isEmpty()) { t << " width=\"" << convertToDocBook(width) << "\""; } else { if (!height.isEmpty() && !inlineImage) t << " width=\"50%\""; } if (!height.isEmpty()) { t << " depth=\"" << convertToDocBook(height) << "\""; } t << " align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << name << "\">"; t << "</imagedata>\n"; t << " </imageobject>\n"; if (hasCaption && !inlineImage) { t << " <!--\n"; // Needed for general formatting with title for other formats } } void DocbookDocVisitor::visitPostEnd(TextStream &t, bool hasCaption, bool inlineImage) { t << "\n"; if (hasCaption && !inlineImage) { t << " -->\n"; // Needed for general formatting with title for other formats } t << " </mediaobject>\n"; if (hasCaption && !inlineImage) { t << " </figure>\n"; } else { t << " </informalfigure>\n"; } } DocbookDocVisitor::DocbookDocVisitor(TextStream &t,OutputCodeList &ci,const QCString &langExt) : m_t(t), m_ci(ci),m_langExt(langExt) { DB_VIS_C // m_t << "<section>\n"; } //-------------------------------------- // visitor functions for leaf nodes //-------------------------------------- void DocbookDocVisitor::operator()(const DocWord &w) { DB_VIS_C if (m_hide) return; filter(w.word()); } void DocbookDocVisitor::operator()(const DocLinkedWord &w) { DB_VIS_C if (m_hide) return; startLink(w.file(),w.anchor()); filter(w.word()); endLink(); } void DocbookDocVisitor::operator()(const DocWhiteSpace &w) { DB_VIS_C if (m_hide) return; if (m_insidePre) { m_t << w.chars(); } else { m_t << " "; } } void DocbookDocVisitor::operator()(const DocSymbol &s) { DB_VIS_C if (m_hide) return; const char *res = HtmlEntityMapper::instance().docbook(s.symbol()); if (res) { m_t << res; } else { err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance().html(s.symbol(),TRUE)); } } void DocbookDocVisitor::operator()(const DocEmoji &s) { DB_VIS_C if (m_hide) return; const char *res = EmojiEntityMapper::instance().unicode(s.index()); if (res) { m_t << res; } else { m_t << s.name(); } } void DocbookDocVisitor::operator()(const DocURL &u) { DB_VIS_C if (m_hide) return; m_t << "<link xlink:href=\""; if (u.isEmail()) m_t << "mailto:"; filter(u.url()); m_t << "\">"; filter(u.url()); m_t << "</link>"; } void DocbookDocVisitor::operator()(const DocLineBreak &) { DB_VIS_C if (m_hide) return; m_t << "<?linebreak?>"; // gives nicer results but gives problems as it is not allowed in <pare> and also problems with dblatex // m_t << "\n" << "<sbr/>\n"; } void DocbookDocVisitor::operator()(const DocHorRuler &) { DB_VIS_C if (m_hide) return; m_t << "<informaltable frame='bottom'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>\n"; m_t << "</entry></row></tbody></tgroup></informaltable>\n"; } void DocbookDocVisitor::operator()(const DocStyleChange &s) { DB_VIS_C if (m_hide) return; switch (s.style()) { case DocStyleChange::Bold: if (s.enable()) m_t << "<emphasis role=\"bold\">"; else m_t << "</emphasis>"; break; case DocStyleChange::Italic: if (s.enable()) m_t << "<emphasis>"; else m_t << "</emphasis>"; break; case DocStyleChange::Kbd: case DocStyleChange::Code: if (s.enable()) m_t << "<computeroutput>"; else m_t << "</computeroutput>"; break; case DocStyleChange::Subscript: if (s.enable()) m_t << "<subscript>"; else m_t << "</subscript>"; break; case DocStyleChange::Superscript: if (s.enable()) m_t << "<superscript>"; else m_t << "</superscript>"; break; case DocStyleChange::Center: if (s.enable()) m_t << "<informaltable frame='none'><tgroup cols='1'><colspec align='center'/><tbody><row><entry align='center'>"; else m_t << "</entry></row></tbody></tgroup></informaltable>"; break; case DocStyleChange::Preformatted: if (s.enable()) { m_t << "<literallayout>"; m_insidePre=TRUE; } else { m_t << "</literallayout>"; m_insidePre=FALSE; } break; /* There is no equivalent Docbook tag for rendering Small text */ case DocStyleChange::Small: /* XSLT Stylesheets can be used */ break; /* HTML only */ case DocStyleChange::Cite: break; case DocStyleChange::S: break; case DocStyleChange::Strike: break; case DocStyleChange::Del: break; case DocStyleChange::Underline: break; case DocStyleChange::Ins: break; case DocStyleChange::Div: /* HTML only */ break; case DocStyleChange::Span: /* HTML only */ break; } } void DocbookDocVisitor::operator()(const DocVerbatim &s) { DB_VIS_C if (m_hide) return; QCString lang = m_langExt; if (!s.language().isEmpty()) // explicit language setting { lang = s.language(); } SrcLangExt langExt = getLanguageFromCodeLang(lang); switch(s.type()) { case DocVerbatim::Code: m_t << "<literallayout><computeroutput>"; getCodeParser(m_langExt).parseCode(m_ci,s.context(), s.text(), langExt, Config_getBool(STRIP_CODE_COMMENTS), s.isExample(), s.exampleFile()); m_t << "</computeroutput></literallayout>"; break; case DocVerbatim::Verbatim: m_t << "<literallayout><computeroutput>"; filter(s.text()); m_t << "</computeroutput></literallayout>"; break; case DocVerbatim::JavaDocLiteral: filter(s.text(), true); break; case DocVerbatim::JavaDocCode: m_t << "<computeroutput>"; filter(s.text(), true); m_t << "</computeroutput>"; break; case DocVerbatim::HtmlOnly: break; case DocVerbatim::RtfOnly: break; case DocVerbatim::ManOnly: break; case DocVerbatim::LatexOnly: break; case DocVerbatim::XmlOnly: break; case DocVerbatim::DocbookOnly: m_t << s.text(); break; case DocVerbatim::Dot: { static int dotindex = 1; QCString baseName(4096, QCString::ExplicitSize); QCString name; QCString stext = s.text(); m_t << "<para>\n"; name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex); baseName.sprintf("%s%d", qPrint(Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_"), dotindex++ ); QCString fileName = baseName+".dot"; std::ofstream file = Portable::openOutputStream(fileName); if (!file.is_open()) { err("Could not open file %s for writing\n",qPrint(fileName)); } file.write( stext.data(), stext.length() ); file.close(); writeDotFile(baseName, s); m_t << "</para>\n"; if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName.str()); } break; case DocVerbatim::Msc: { static int mscindex = 1; QCString baseName(4096, QCString::ExplicitSize); QCString name; QCString stext = s.text(); m_t << "<para>\n"; name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex); baseName.sprintf("%s%d", (Config_getString(DOCBOOK_OUTPUT)+"/inline_mscgraph_").data(), mscindex++ ); QCString fileName = baseName+".msc"; std::ofstream file = Portable::openOutputStream(fileName); if (!file.is_open()) { err("Could not open file %s for writing\n",qPrint(fileName)); } QCString text = "msc {"; text+=stext; text+="}"; file.write( text.data(), text.length() ); file.close(); writeMscFile(baseName,s); m_t << "</para>\n"; if (Config_getBool(DOT_CLEANUP)) Dir().remove(fileName.str()); } break; case DocVerbatim::PlantUML: { QCString docbookOutput = Config_getString(DOCBOOK_OUTPUT); QCString baseName = PlantumlManager::instance().writePlantUMLSource(docbookOutput, s.exampleFile(),s.text(),PlantumlManager::PUML_BITMAP, s.engine(),s.srcFile(),s.srcLine(),true); QCString shortName = makeShortName(baseName); m_t << "<para>\n"; writePlantUMLFile(baseName,s); m_t << "</para>\n"; } break; } } void DocbookDocVisitor::operator()(const DocAnchor &anc) { DB_VIS_C if (m_hide) return; m_t << "<anchor xml:id=\"_" << stripPath(anc.file()) << "_1" << filterId(anc.anchor()) << "\"/>"; } void DocbookDocVisitor::operator()(const DocInclude &inc) { DB_VIS_C if (m_hide) return; SrcLangExt langExt = getLanguageFromFileName(inc.extension()); switch(inc.type()) { case DocInclude::IncWithLines: { m_t << "<literallayout><computeroutput>"; FileInfo cfi( inc.file().str() ); auto fd = createFileDef( cfi.dirPath(), cfi.fileName() ); getCodeParser(inc.extension()).parseCode(m_ci,inc.context(), inc.text(), langExt, inc.stripCodeComments(), inc.isExample(), inc.exampleFile(), fd.get()); m_t << "</computeroutput></literallayout>"; } break; case DocInclude::Include: m_t << "<literallayout><computeroutput>"; getCodeParser(inc.extension()).parseCode(m_ci,inc.context(), inc.text(), langExt, inc.stripCodeComments(), inc.isExample(), inc.exampleFile()); m_t << "</computeroutput></literallayout>"; break; case DocInclude::DontInclude: case DocInclude::DontIncWithLines: case DocInclude::HtmlInclude: case DocInclude::LatexInclude: case DocInclude::RtfInclude: case DocInclude::ManInclude: case DocInclude::XmlInclude: break; case DocInclude::DocbookInclude: m_t << inc.text(); break; case DocInclude::VerbInclude: m_t << "<literallayout>"; filter(inc.text()); m_t << "</literallayout>"; break; case DocInclude::Snippet: case DocInclude::SnippetWithLines: m_t << "<literallayout><computeroutput>"; CodeFragmentManager::instance().parseCodeFragment(m_ci, inc.file(), inc.blockId(), inc.context(), inc.type()==DocInclude::SnippetWithLines, inc.trimLeft(), inc.stripCodeComments() ); m_t << "</computeroutput></literallayout>"; break; } } void DocbookDocVisitor::operator()(const DocIncOperator &op) { DB_VIS_C if (op.isFirst()) { if (!m_hide) { m_t << "<programlisting linenumbering=\"unnumbered\">"; } pushHidden(m_hide); m_hide = TRUE; } QCString locLangExt = getFileNameExtension(op.includeFileName()); if (locLangExt.isEmpty()) locLangExt = m_langExt; SrcLangExt langExt = getLanguageFromFileName(locLangExt); if (op.type()!=DocIncOperator::Skip) { m_hide = popHidden(); if (!m_hide) { std::unique_ptr<FileDef> fd; if (!op.includeFileName().isEmpty()) { FileInfo cfi( op.includeFileName().str() ); fd = createFileDef( cfi.dirPath(), cfi.fileName() ); } getCodeParser(locLangExt).parseCode(m_ci,op.context(), op.text(),langExt, op.stripCodeComments(), op.isExample(), op.exampleFile(), fd.get(), // fileDef op.line(), // startLine -1, // endLine FALSE, // inline fragment nullptr, // memberDef op.showLineNo() // show line numbers ); } pushHidden(m_hide); m_hide=TRUE; } if (op.isLast()) { m_hide = popHidden(); if (!m_hide) m_t << "</programlisting>"; } else { if (!m_hide) m_t << "\n"; } } void DocbookDocVisitor::operator()(const DocFormula &f) { DB_VIS_C if (m_hide) return; if (f.isInline()) m_t << "<inlinemediaobject>\n"; else m_t << " <mediaobject>\n"; m_t << " <imageobject>\n"; m_t << " <imagedata "; m_t << "align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << f.relPath() << f.name() << ".png\"/>\n"; m_t << " </imageobject>\n"; if (f.isInline()) m_t << "</inlinemediaobject>\n"; else m_t << " </mediaobject>\n"; } void DocbookDocVisitor::operator()(const DocIndexEntry &ie) { DB_VIS_C if (m_hide) return; m_t << "<indexterm><primary>"; filter(ie.entry()); m_t << "</primary></indexterm>\n"; } void DocbookDocVisitor::operator()(const DocSimpleSectSep &) { DB_VIS_C // m_t << "<simplesect/>"; } void DocbookDocVisitor::operator()(const DocCite &cite) { DB_VIS_C if (m_hide) return; if (!cite.file().isEmpty()) startLink(cite.file(),filterId(cite.anchor())); filter(cite.text()); if (!cite.file().isEmpty()) endLink(); } //-------------------------------------- // visitor functions for compound nodes //-------------------------------------- void DocbookDocVisitor::operator()(const DocAutoList &l) { DB_VIS_C if (m_hide) return; if (l.isEnumList()) { m_t << "<orderedlist>\n"; } else { m_t << "<itemizedlist>\n"; } visitChildren(l); if (l.isEnumList()) { m_t << "</orderedlist>\n"; } else { m_t << "</itemizedlist>\n"; } } void DocbookDocVisitor::operator()(const DocAutoListItem &li) { DB_VIS_C if (m_hide) return; switch (li.itemNumber()) { case DocAutoList::Unchecked: // unchecked m_t << "<listitem override=\"unchecked\">"; break; case DocAutoList::Checked_x: // checked with x case DocAutoList::Checked_X: // checked with X m_t << "<listitem override=\"checked\">"; break; default: m_t << "<listitem>"; break; } visitChildren(li); m_t << "</listitem>"; } void DocbookDocVisitor::operator()(const DocPara &p) { DB_VIS_C if (m_hide) return; m_t << "\n"; m_t << "<para>"; visitChildren(p); m_t << "</para>"; m_t << "\n"; } void DocbookDocVisitor::operator()(const DocRoot &r) { DB_VIS_C visitChildren(r); } void DocbookDocVisitor::operator()(const DocSimpleSect &s) { DB_VIS_C if (m_hide) return; switch(s.type()) { case DocSimpleSect::See: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trSeeAlso() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trSeeAlso()) << "</title>\n"; } break; case DocSimpleSect::Return: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trReturns()<< "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trReturns()) << "</title>\n"; } break; case DocSimpleSect::Author: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, TRUE) << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trAuthor(TRUE, TRUE)) << "</title>\n"; } break; case DocSimpleSect::Authors: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, FALSE) << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trAuthor(TRUE, FALSE)) << "</title>\n"; } break; case DocSimpleSect::Version: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trVersion() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trVersion()) << "</title>\n"; } break; case DocSimpleSect::Since: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trSince() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trSince()) << "</title>\n"; } break; case DocSimpleSect::Date: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trDate() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trDate()) << "</title>\n"; } break; case DocSimpleSect::Note: if (m_insidePre) { m_t << "<note><title>" << theTranslator->trNote() << "</title>\n"; } else { m_t << "<note><title>" << convertToDocBook(theTranslator->trNote()) << "</title>\n"; } break; case DocSimpleSect::Warning: if (m_insidePre) { m_t << "<warning><title>" << theTranslator->trWarning() << "</title>\n"; } else { m_t << "<warning><title>" << convertToDocBook(theTranslator->trWarning()) << "</title>\n"; } break; case DocSimpleSect::Pre: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trPrecondition() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trPrecondition()) << "</title>\n"; } break; case DocSimpleSect::Post: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trPostcondition() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trPostcondition()) << "</title>\n"; } break; case DocSimpleSect::Copyright: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trCopyright() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trCopyright()) << "</title>\n"; } break; case DocSimpleSect::Invar: if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trInvariant() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trInvariant()) << "</title>\n"; } break; case DocSimpleSect::Remark: // <remark> is miising the <title> possibility if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trRemarks() << "</title>\n"; } else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trRemarks()) << "</title>\n"; } break; case DocSimpleSect::Attention: if (m_insidePre) { m_t << "<caution><title>" << theTranslator->trAttention() << "</title>\n"; } else { m_t << "<caution><title>" << convertToDocBook(theTranslator->trAttention()) << "</title>\n"; } break; case DocSimpleSect::Important: if (m_insidePre) { m_t << "<important><title>" << theTranslator->trImportant() << "</title>\n"; } else { m_t << "<important><title>" << convertToDocBook(theTranslator->trImportant()) << "</title>\n"; } break; case DocSimpleSect::User: case DocSimpleSect::Rcs: case DocSimpleSect::Unknown: if (s.hasTitle()) m_t << "<formalpara>\n"; else m_t << "<para>\n"; break; } if (s.title()) { std::visit(*this,*s.title()); } visitChildren(s); switch(s.type()) { case DocSimpleSect::User: case DocSimpleSect::Rcs: case DocSimpleSect::Unknown: if (s.hasTitle()) m_t << "</formalpara>\n"; else m_t << "</para>\n"; break; case DocSimpleSect::Note: m_t << "</note>\n"; break; case DocSimpleSect::Attention: m_t << "</caution>\n"; break; case DocSimpleSect::Important: m_t << "</important>\n"; break; case DocSimpleSect::Warning: m_t << "</warning>\n"; break; default: m_t << "</formalpara>\n"; break; } } void DocbookDocVisitor::operator()(const DocTitle &t) { DB_VIS_C if (m_hide) return; if (t.hasTitle()) m_t << "<title>"; visitChildren(t); if (t.hasTitle()) m_t << "</title>"; } void DocbookDocVisitor::operator()(const DocSimpleList &l) { DB_VIS_C if (m_hide) return; m_t << "<itemizedlist>\n"; visitChildren(l); m_t << "</itemizedlist>\n"; } void DocbookDocVisitor::operator()(const DocSimpleListItem &li) { DB_VIS_C if (m_hide) return; m_t << "<listitem>"; if (li.paragraph()) { visit(*this,*li.paragraph()); } m_t << "</listitem>\n"; } void DocbookDocVisitor::operator()(const DocSection &s) { DB_VIS_C if (m_hide) return; m_t << "<section xml:id=\"_" << stripPath(s.file()); if (!s.anchor().isEmpty()) m_t << "_1" << s.anchor(); m_t << "\">\n"; if (s.title()) { std::visit(*this,*s.title()); } visitChildren(s); m_t << "</section>\n"; } void DocbookDocVisitor::operator()(const DocHtmlList &s) { DB_VIS_C if (m_hide) return; if (s.children().empty()) return; // opening tag for ordered list will be handled in DocHtmlListItem // due to (re-)numbering possibilities if (s.type()!=DocHtmlList::Ordered) m_t << "<itemizedlist>\n"; visitChildren(s); if (s.type()==DocHtmlList::Ordered) m_t << "</orderedlist>\n"; else m_t << "</itemizedlist>\n"; } void DocbookDocVisitor::operator()(const DocHtmlListItem &s) { DB_VIS_C if (m_hide) return; const DocHtmlList *l = std::get_if<DocHtmlList>(s.parent()); if (l->type()==DocHtmlList::Ordered) { bool isFirst = &std::get<DocHtmlListItem>(l->children().front())==&s; int value = 0; QCString type; for (const auto &opt : s.attribs()) { if (opt.name=="value") { bool ok = false; int val = opt.value.toInt(&ok); if (ok) value = val; } } if (value>0 || isFirst) { for (const auto &opt : l->attribs()) { if (opt.name=="type") { if (opt.value=="1") type = " numeration=\"arabic\""; else if (opt.value=="a") type = " numeration=\"loweralpha\""; else if (opt.value=="A") type = " numeration=\"upperalpha\""; else if (opt.value=="i") type = " numeration=\"lowerroman\""; else if (opt.value=="I") type = " numeration=\"upperroman\""; } else if (value==0 && opt.name=="start") { bool ok = false; int val = opt.value.toInt(&ok); if (ok) value = val; } } } if (value>0 && !isFirst) { m_t << "</orderedlist>\n"; } if (value>0 || isFirst) { m_t << "<orderedlist"; if (!type.isEmpty()) m_t << type.data(); if (value>0) m_t << " startingnumber=\"" << value << "\""; m_t << ">\n"; } } m_t << "<listitem>\n"; visitChildren(s); m_t << "</listitem>\n"; } void DocbookDocVisitor::operator()(const DocHtmlDescList &l) { DB_VIS_C if (m_hide) return; m_t << "<variablelist>\n"; visitChildren(l); m_t << "</variablelist>\n"; } void DocbookDocVisitor::operator()(const DocHtmlDescTitle &dt) { DB_VIS_C if (m_hide) return; m_t << "<varlistentry><term>"; visitChildren(dt); m_t << "</term></varlistentry>\n"; } void DocbookDocVisitor::operator()(const DocHtmlDescData &dd) { DB_VIS_C if (m_hide) return; m_t << "<listitem>"; visitChildren(dd); m_t << "</listitem>\n"; } void DocbookDocVisitor::operator()(const DocHtmlTable &t) { DB_VIS_C m_bodySet.push(false); if (m_hide) return; m_t << "<informaltable frame=\"all\">\n"; m_t << " <tgroup cols=\"" << t.numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n"; for (uint32_t i = 0; i <t.numColumns(); i++) { // do something with colwidth based of cell width specification (be aware of possible colspan in the header)? m_t << " <colspec colname='c" << i+1 << "'/>\n"; } if (t.caption()) { std::visit(*this,*t.caption()); } visitChildren(t); if (m_bodySet.top()) m_t << " </tbody>\n"; m_bodySet.pop(); m_t << " </tgroup>\n"; m_t << "</informaltable>\n"; } void DocbookDocVisitor::operator()(const DocHtmlRow &tr) { DB_VIS_C m_colCnt = 0; if (m_hide) return; if (tr.isHeading()) { if (m_bodySet.top()) m_t << "</tbody>\n"; m_bodySet.top() = false; m_t << "<thead>\n"; } else if (!m_bodySet.top()) { m_bodySet.top() = true; m_t << "<tbody>\n"; } m_t << " <row "; for (const auto &opt : tr.attribs()) { if (supportedHtmlAttribute(opt.name)) { // process supported attributes only m_t << " " << opt.name << "='" << convertToDocBook(opt.value) << "'"; } } m_t << ">\n"; visitChildren(tr); m_t << "</row>\n"; if (tr.isHeading()) { m_t << "</thead><tbody>\n"; m_bodySet.top() = true; } } void DocbookDocVisitor::operator()(const DocHtmlCell &c) { DB_VIS_C m_colCnt++; if (m_hide) return; m_t << "<entry"; for (const auto &opt : c.attribs()) { if (opt.name=="colspan") { m_t << " namest='c" << m_colCnt << "'"; int cols = opt.value.toInt(); m_colCnt += (cols - 1); m_t << " nameend='c" << m_colCnt << "'"; } else if (opt.name=="rowspan") { int extraRows = opt.value.toInt() - 1; m_t << " morerows='" << extraRows << "'"; } else if (opt.name=="class") { if (opt.value.startsWith("markdownTable")) // handle markdown generated attributes { if (opt.value.endsWith("Right")) { m_t << " align='right'"; } else if (opt.value.endsWith("Left")) { m_t << " align='left'"; } else if (opt.value.endsWith("Center")) { m_t << " align='center'"; } // skip 'markdownTable*' value ending with "None" } else { m_t << " class='" << convertToDocBook(opt.value) << "'"; } } else if (supportedHtmlAttribute(opt.name)) { // process supported attributes only m_t << " " << opt.name << "='" << convertToDocBook(opt.value) << "'"; } } m_t << ">"; visitChildren(c); m_t << "</entry>"; } void DocbookDocVisitor::operator()(const DocHtmlCaption &c) { DB_VIS_C if (m_hide) return; m_t << "<caption>"; if (!c.file().isEmpty()) { m_t << "<anchor xml:id=\"_" << stripPath(c.file()) << "_1" << filterId(c.anchor()) << "\"/>"; } visitChildren(c); m_t << "</caption>\n"; } void DocbookDocVisitor::operator()(const DocInternal &i) { DB_VIS_C if (m_hide) return; visitChildren(i); } void DocbookDocVisitor::operator()(const DocHRef &href) { DB_VIS_C if (m_hide) return; if (href.url().at(0) != '#') { m_t << "<link xlink:href=\"" << convertToDocBook(href.url()) << "\">"; } else { startLink(href.file(),filterId(href.url().mid(1))); } visitChildren(href); m_t << "</link>"; } void DocbookDocVisitor::operator()(const DocHtmlSummary &s) { DB_VIS_C if (m_hide) return; m_t << "<para><emphasis role=\"bold\">"; visitChildren(s); m_t << "</emphasis></para>"; } void DocbookDocVisitor::operator()(const DocHtmlDetails &d) { DB_VIS_C if (m_hide) return; m_t << "\n"; auto summary = d.summary(); if (summary) { std::visit(*this,*summary); } m_t << "<para>"; visitChildren(d); m_t << "</para>"; m_t << "\n"; } void DocbookDocVisitor::operator()(const DocHtmlHeader &h) { DB_VIS_C if (m_hide) return; m_t << "<formalpara><title>"; visitChildren(h); m_t << "</title></formalpara>\n"; } void DocbookDocVisitor::operator()(const DocImage &img) { DB_VIS_C if (img.type()==DocImage::DocBook) { if (m_hide) return; m_t << "\n"; QCString baseName=makeShortName(img.name()); visitPreStart(m_t, img.children(), img.hasCaption(), img.relPath() + baseName, img.width(), img.height(), img.isInlineImage()); visitChildren(img); visitPostEnd(m_t, img.hasCaption(),img.isInlineImage()); QCString file; bool ambig = false; FileDef *fd=findFileDef(Doxygen::imageNameLinkedMap, baseName, ambig); if (fd) { file=fd->absFilePath(); } copyFile(file,Config_getString(DOCBOOK_OUTPUT)+"/"+baseName); } else // skip other formats { } } void DocbookDocVisitor::operator()(const DocDotFile &df) { DB_VIS_C if (m_hide) return; if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file())); startDotFile(df.file(),df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine()); visitChildren(df); endDotFile(df.hasCaption()); } void DocbookDocVisitor::operator()(const DocMscFile &df) { DB_VIS_C if (m_hide) return; if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file())); startMscFile(df.file(),df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine()); visitChildren(df); endMscFile(df.hasCaption()); } void DocbookDocVisitor::operator()(const DocDiaFile &df) { DB_VIS_C if (m_hide) return; if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file())); startDiaFile(df.file(),df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine()); visitChildren(df); endDiaFile(df.hasCaption()); } void DocbookDocVisitor::operator()(const DocPlantUmlFile &df) { DB_VIS_C if (m_hide) return; if (!Config_getBool(DOT_CLEANUP)) copyFile(df.file(),Config_getString(DOCBOOK_OUTPUT)+"/"+stripPath(df.file())); startPlantUmlFile(df.file(),df.relPath(),df.width(),df.height(),df.hasCaption(),df.children(),df.srcFile(),df.srcLine()); visitChildren(df); endPlantUmlFile(df.hasCaption()); } void DocbookDocVisitor::operator()(const DocLink &lnk) { DB_VIS_C if (m_hide) return; startLink(lnk.file(),lnk.anchor()); visitChildren(lnk); endLink(); } void DocbookDocVisitor::operator()(const DocRef &ref) { DB_VIS_C if (m_hide) return; if (ref.isSubPage()) { startLink(QCString(),ref.anchor()); } else { if (!ref.file().isEmpty()) startLink(ref.file(),ref.anchor()); } if (!ref.hasLinkText()) filter(ref.targetTitle()); visitChildren(ref); if (!ref.file().isEmpty()) endLink(); } void DocbookDocVisitor::operator()(const DocSecRefItem &ref) { DB_VIS_C if (m_hide) return; //m_t << "<tocentry xml:idref=\"_" << stripPath(ref->file()) << "_1" << ref->anchor() << "\">"; m_t << "<tocentry>"; visitChildren(ref); m_t << "</tocentry>\n"; } void DocbookDocVisitor::operator()(const DocSecRefList &l) { DB_VIS_C if (m_hide) return; m_t << "<toc>\n"; visitChildren(l); m_t << "</toc>\n"; } void DocbookDocVisitor::operator()(const DocParamSect &s) { DB_VIS_C if (m_hide) return; m_t << "\n"; m_t << " <formalpara>\n"; m_t << " <title>\n"; switch(s.type()) { case DocParamSect::Param: m_t << theTranslator->trParameters(); break; case DocParamSect::RetVal: m_t << theTranslator->trReturnValues(); break; case DocParamSect::Exception: m_t << theTranslator->trExceptions(); break; case DocParamSect::TemplateParam: m_t << theTranslator->trTemplateParameters(); break; default: ASSERT(0); } m_t << "</title>\n"; m_t << " <para>\n"; m_t << " <table frame=\"all\">\n"; int ncols = 2; if (s.type() == DocParamSect::Param) { bool hasInOutSpecs = s.hasInOutSpecifier(); bool hasTypeSpecs = s.hasTypeSpecifier(); if (hasInOutSpecs && hasTypeSpecs) ncols += 2; else if (hasInOutSpecs || hasTypeSpecs) ncols += 1; } m_t << " <tgroup cols=\"" << ncols << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">\n"; for (int i = 1; i <= ncols; i++) { if (i == ncols) m_t << " <colspec colwidth=\"4*\"/>\n"; else m_t << " <colspec colwidth=\"1*\"/>\n"; } m_t << " <tbody>\n"; visitChildren(s); m_t << " </tbody>\n"; m_t << " </tgroup>\n"; m_t << " </table>\n"; m_t << " </para>\n"; m_t << " </formalpara>\n"; m_t << " "; } void DocbookDocVisitor::operator()(const DocSeparator &sep) { DB_VIS_C if (m_hide) return; m_t << " " << sep.chars() << " "; } void DocbookDocVisitor::operator()(const DocParamList &pl) { DB_VIS_C if (m_hide) return; m_t << " <row>\n"; const DocParamSect *sect = std::get_if<DocParamSect>(pl.parent()); if (sect && sect->hasInOutSpecifier()) { m_t << "<entry>"; if (pl.direction()!=DocParamSect::Unspecified) { if (pl.direction()==DocParamSect::In) { m_t << "in"; } else if (pl.direction()==DocParamSect::Out) { m_t << "out"; } else if (pl.direction()==DocParamSect::InOut) { m_t << "in,out"; } } m_t << "</entry>"; } if (sect && sect->hasTypeSpecifier()) { m_t << "<entry>"; for (const auto &type : pl.paramTypes()) { std::visit(*this,type); } m_t << "</entry>"; } if (pl.parameters().empty()) { m_t << "<entry></entry>\n"; } else { m_t << "<entry>"; int cnt = 0; for (const auto &param : pl.parameters()) { if (cnt) { m_t << ", "; } std::visit(*this,param); cnt++; } m_t << "</entry>"; } m_t << "<entry>"; for (const auto &par : pl.paragraphs()) { std::visit(*this,par); } m_t << "</entry>\n"; m_t << " </row>\n"; } void DocbookDocVisitor::operator()(const DocXRefItem &x) { DB_VIS_C if (m_hide) return; if (x.title().isEmpty()) return; m_t << "<para><link linkend=\"_"; m_t << stripPath(x.file()) << "_1" << x.anchor(); m_t << "\">"; filter(x.title()); m_t << "</link>"; m_t << " "; visitChildren(x); if (x.title().isEmpty()) return; m_t << "</para>"; } void DocbookDocVisitor::operator()(const DocInternalRef &ref) { DB_VIS_C if (m_hide) return; startLink(ref.file(),ref.anchor()); visitChildren(ref); endLink(); m_t << " "; } void DocbookDocVisitor::operator()(const DocText &t) { DB_VIS_C visitChildren(t); } void DocbookDocVisitor::operator()(const DocHtmlBlockQuote &q) { DB_VIS_C if (m_hide) return; m_t << "<blockquote>"; visitChildren(q); m_t << "</blockquote>"; } void DocbookDocVisitor::operator()(const DocVhdlFlow &) { DB_VIS_C // TODO: to be implemented } void DocbookDocVisitor::operator()(const DocParBlock &b) { DB_VIS_C if (m_hide) return; visitChildren(b); } void DocbookDocVisitor::filter(const QCString &str, const bool retainNewLine) { DB_VIS_C m_t << convertToDocBook(str, retainNewLine); } void DocbookDocVisitor::startLink(const QCString &file,const QCString &anchor) { DB_VIS_C m_t << "<link linkend=\"_" << stripPath(file); if (!anchor.isEmpty()) { if (!file.isEmpty()) m_t << "_1"; m_t << anchor; } m_t << "\">"; } void DocbookDocVisitor::endLink() { DB_VIS_C m_t << "</link>"; } void DocbookDocVisitor::writeMscFile(const QCString &baseName, const DocVerbatim &s) { DB_VIS_C QCString shortName = makeShortName(baseName); QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MscOutputFormat::BITMAP,s.srcFile(),s.srcLine()); visitPreStart(m_t, s.children(), s.hasCaption(), s.relPath() + shortName + ".png", s.width(), s.height()); visitCaption(s.children()); visitPostEnd(m_t, s.hasCaption()); } void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName, const DocVerbatim &s) { DB_VIS_C QCString shortName = makeShortName(baseName); QCString outDir = Config_getString(DOCBOOK_OUTPUT); PlantumlManager::instance().generatePlantUMLOutput(baseName,outDir,PlantumlManager::PUML_BITMAP); visitPreStart(m_t, s.children(), s.hasCaption(), s.relPath() + shortName + ".png", s.width(),s.height()); visitCaption(s.children()); visitPostEnd(m_t, s.hasCaption()); } void DocbookDocVisitor::startPlantUmlFile(const QCString &fileName, const QCString &relPath, const QCString &width, const QCString &height, bool hasCaption, const DocNodeList &children, const QCString &srcFile, int srcLine ) { DB_VIS_C QCString outDir = Config_getString(DOCBOOK_OUTPUT); std::string inBuf; readInputFile(fileName,inBuf); QCString baseName = PlantumlManager::instance().writePlantUMLSource(outDir, QCString(),inBuf.c_str(),PlantumlManager::PUML_BITMAP,QCString(),srcFile,srcLine,false); baseName=makeBaseName(baseName); PlantumlManager::instance().generatePlantUMLOutput(baseName,outDir,PlantumlManager::PUML_BITMAP); m_t << "<para>\n"; visitPreStart(m_t, children, hasCaption, relPath + baseName + ".png", width, height); } void DocbookDocVisitor::endPlantUmlFile(bool hasCaption) { DB_VIS_C if (m_hide) return; m_t << "\n"; visitPostEnd(m_t, hasCaption); m_t << "</para>\n"; } void DocbookDocVisitor::startMscFile(const QCString &fileName, const QCString &relPath, const QCString &width, const QCString &height, bool hasCaption, const DocNodeList &children, const QCString &srcFile, int srcLine ) { DB_VIS_C QCString baseName=makeBaseName(fileName); baseName.prepend("msc_"); QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeMscGraphFromFile(fileName,outDir,baseName,MscOutputFormat::BITMAP,srcFile,srcLine); m_t << "<para>\n"; visitPreStart(m_t, children, hasCaption, relPath + baseName + ".png", width, height); } void DocbookDocVisitor::endMscFile(bool hasCaption) { DB_VIS_C if (m_hide) return; visitPostEnd(m_t, hasCaption); m_t << "</para>\n"; } void DocbookDocVisitor::writeDiaFile(const QCString &baseName, const DocVerbatim &s) { DB_VIS_C QCString shortName = makeShortName(baseName); QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DiaOutputFormat::BITMAP,s.srcFile(),s.srcLine()); visitPreStart(m_t, s.children(), s.hasCaption(), shortName, s.width(),s.height()); visitCaption(s.children()); visitPostEnd(m_t, s.hasCaption()); } void DocbookDocVisitor::startDiaFile(const QCString &fileName, const QCString &relPath, const QCString &width, const QCString &height, bool hasCaption, const DocNodeList &children, const QCString &srcFile, int srcLine ) { DB_VIS_C QCString baseName=makeBaseName(fileName); baseName.prepend("dia_"); QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDiaGraphFromFile(fileName,outDir,baseName,DiaOutputFormat::BITMAP,srcFile,srcLine); m_t << "<para>\n"; visitPreStart(m_t, children, hasCaption, relPath + baseName + ".png", width, height); } void DocbookDocVisitor::endDiaFile(bool hasCaption) { DB_VIS_C if (m_hide) return; visitPostEnd(m_t, hasCaption); m_t << "</para>\n"; } void DocbookDocVisitor::writeDotFile(const QCString &baseName, const DocVerbatim &s) { DB_VIS_C QCString shortName = makeShortName(baseName); QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GraphOutputFormat::BITMAP,s.srcFile(),s.srcLine()); visitPreStart(m_t, s.children(), s.hasCaption(), s.relPath() + shortName + "." + getDotImageExtension(), s.width(),s.height()); visitCaption(s.children()); visitPostEnd(m_t, s.hasCaption()); } void DocbookDocVisitor::startDotFile(const QCString &fileName, const QCString &relPath, const QCString &width, const QCString &height, bool hasCaption, const DocNodeList &children, const QCString &srcFile, int srcLine ) { DB_VIS_C QCString baseName=makeBaseName(fileName); baseName.prepend("dot_"); QCString outDir = Config_getString(DOCBOOK_OUTPUT); QCString imgExt = getDotImageExtension(); writeDotGraphFromFile(fileName,outDir,baseName,GraphOutputFormat::BITMAP,srcFile,srcLine); m_t << "<para>\n"; visitPreStart(m_t, children, hasCaption, relPath + baseName + "." + imgExt, width, height); } void DocbookDocVisitor::endDotFile(bool hasCaption) { DB_VIS_C if (m_hide) return; m_t << "\n"; visitPostEnd(m_t, hasCaption); m_t << "</para>\n"; }
44,967
C++
.cpp
1,583
23.23626
136
0.580033
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,488
debug.cpp
doxygen_doxygen/src/debug.cpp
/****************************************************************************** * * Copyright (C) 1997-2020 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 <stdarg.h> #include <algorithm> #include <stdio.h> #include <map> #include <string> #include <chrono> #include "debug.h" #include "message.h" #include "qcstring.h" //------------------------------------------------------------------------ static std::map< std::string, Debug::DebugMask > s_labels = { { "preprocessor", Debug::Preprocessor }, { "nolineno", Debug::NoLineNo }, { "commentcnv", Debug::CommentCnv }, { "commentscan", Debug::CommentScan }, { "formula", Debug::Formula }, { "printtree", Debug::PrintTree }, { "time", Debug::Time }, { "extcmd", Debug::ExtCmd }, { "markdown", Debug::Markdown }, { "filteroutput", Debug::FilterOutput }, { "plantuml", Debug::Plantuml }, { "fortranfixed2free", Debug::FortranFixed2Free }, { "cite", Debug::Cite }, { "rtf", Debug::Rtf }, { "qhp", Debug::Qhp }, { "tag", Debug::Tag }, { "alias", Debug::Alias }, { "entries", Debug::Entries }, { "sections", Debug::Sections }, { "stderr", Debug::Stderr }, { "layout", Debug::Layout }, { "lex", Debug::Lex }, { "lex:code", Debug::Lex_code }, { "lex:commentcnv", Debug::Lex_commentcnv }, { "lex:commentscan", Debug::Lex_commentscan }, { "lex:configimpl", Debug::Lex_configimpl }, { "lex:constexp", Debug::Lex_constexp }, { "lex:declinfo", Debug::Lex_declinfo }, { "lex:defargs", Debug::Lex_defargs }, { "lex:doctokenizer", Debug::Lex_doctokenizer }, { "lex:fortrancode", Debug::Lex_fortrancode }, { "lex:fortranscanner", Debug::Lex_fortranscanner }, { "lex:lexcode", Debug::Lex_lexcode }, { "lex:lexscanner", Debug::Lex_lexscanner }, { "lex:pre", Debug::Lex_pre }, { "lex:pycode", Debug::Lex_pycode }, { "lex:pyscanner", Debug::Lex_pyscanner }, { "lex:scanner", Debug::Lex_scanner }, { "lex:sqlcode", Debug::Lex_sqlcode }, { "lex:vhdlcode", Debug::Lex_vhdlcode }, { "lex:xml", Debug::Lex_xml }, { "lex:xmlcode", Debug::Lex_xmlcode }, }; //------------------------------------------------------------------------ static FILE *g_debugFile = stdout; Debug::DebugMask Debug::curMask = Debug::Quiet; int Debug::curPrio = 0; void Debug::print(DebugMask mask,int prio,const char *fmt,...) { if ((curMask&mask) && prio<=curPrio) { va_list args; va_start(args,fmt); vfprintf(g_debugFile, fmt, args); va_end(args); } } static char asciiToLower(char in) { if (in <= 'Z' && in >= 'A') return in - ('Z' - 'z'); return in; } static uint64_t labelToEnumValue(const QCString &l) { std::string s = l.str(); std::transform(s.begin(),s.end(),s.begin(),asciiToLower); auto it = s_labels.find(s); return (it!=s_labels.end()) ? it->second : Debug::DebugMask::Quiet; } bool Debug::setFlagStr(const QCString &lab) { uint64_t retVal = labelToEnumValue(lab); if (retVal == Debug::Stderr) { g_debugFile = stderr; } else { curMask = static_cast<DebugMask>(curMask | retVal); } return retVal!=0; } void Debug::setFlag(const DebugMask mask) { curMask = static_cast<DebugMask>(curMask | mask); } void Debug::clearFlag(const DebugMask mask) { curMask = static_cast<DebugMask>(curMask & ~mask); } void Debug::setPriority(int p) { curPrio = p; } bool Debug::isFlagSet(const DebugMask mask) { return (curMask & mask)!=0; } void Debug::printFlags() { for (const auto &v : s_labels) { msg("\t%s\n",v.first.c_str()); } } //------------------------------------------------------------------------ DebugLex::DebugLex(Debug::DebugMask mask,const char *lexName,const char *fileName) : m_mask(mask), m_lexName(lexName), m_fileName(fileName) { print(m_mask,"Entering",qPrint(m_lexName),qPrint(m_fileName)); } DebugLex::~DebugLex() { print(m_mask,"Finished",qPrint(m_lexName),qPrint(m_fileName)); } void DebugLex::print(Debug::DebugMask mask,const char *state,const char *lexName,const char *fileName) { if (fileName && *fileName) { if (Debug::isFlagSet(mask)) { fprintf(stderr,"%s lexical analyzer: %s (for: %s)\n",state, lexName, fileName); } } else { if (Debug::isFlagSet(mask)) { fprintf(stderr,"%s lexical analyzer: %s\n",state, lexName); } } } //------------------------------------------------------------------------ class Timer { public: void start() { m_startTime = std::chrono::steady_clock::now(); } double elapsedTimeS() { return static_cast<double>( std::chrono::duration_cast< std::chrono::microseconds>( std::chrono::steady_clock::now() - m_startTime).count()) / 1000000.0; } private: std::chrono::time_point<std::chrono::steady_clock> m_startTime; }; static Timer g_runningTime; void Debug::startTimer() { g_runningTime.start(); } double Debug::elapsedTime() { return g_runningTime.elapsedTimeS(); }
6,177
C++
.cpp
184
30.61413
139
0.54448
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,489
docnode.cpp
doxygen_doxygen/src/docnode.cpp
/****************************************************************************** * * Copyright (C) 1997-2022 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 "docnode.h" #include "docparser_p.h" #include "htmlentity.h" #include "configimpl.h" #include "configoptions.h" #include "emoji.h" #include "message.h" #include "doxygen.h" #include "cite.h" #include "util.h" #include "formula.h" #include "markdown.h" #include "pagedef.h" #include "namespacedef.h" #include "groupdef.h" #include "cmdmapper.h" #include "config.h" #include "vhdldocgen.h" #include "doctokenizer.h" #include "plantuml.h" #include "language.h" #include "datetime.h" #include "trace.h" #include "anchor.h" #include "aliases.h" #if !ENABLE_DOCPARSER_TRACING #undef AUTO_TRACE #undef AUTO_TRACE_ADD #undef AUTO_TRACE_EXIT #define AUTO_TRACE(...) (void)0 #define AUTO_TRACE_ADD(...) (void)0 #define AUTO_TRACE_EXIT(...) (void)0 #endif #define INTERNAL_ASSERT(x) do {} while(0) //#define INTERNAL_ASSERT(x) if (!(x)) TRACE("INTERNAL_ASSERT({}) failed retval={:#x}: file={} line={}",#x,retval,__FILE__,__LINE__) //--------------------------------------------------------------------------- static const char *g_sectionLevelToName[] = { "page", "section", "subsection", "subsubsection", "paragraph", "subparagraph" }; //--------------------------------------------------------------------------- static const StringUnorderedSet g_plantumlEngine { "uml", "bpm", "wire", "dot", "ditaa", "salt", "math", "latex", "gantt", "mindmap", "wbs", "yaml", "creole", "json", "flow", "board", "git", "hcl", "regex", "ebnf", "files", "chen", "chronology" }; //--------------------------------------------------------------------------- // replaces { with < and } with > and also // replaces &gt; with < and &gt; with > within string s static void unescapeCRef(QCString &s) { QCString result; const char *p = s.data(); if (p) { char c = 0; while ((c=*p++)) { if (c=='{') c='<'; else if (c=='}') c='>'; result+=c; } } result=substitute(result,"&lt;","<"); result=substitute(result,"&gt;",">"); s = result; } //--------------------------------------------------------------------------- /*! Strips known html and tex extensions from \a text. */ static QCString stripKnownExtensions(const QCString &text) { QCString result=text; if (result.endsWith(".tex")) { result=result.left(result.length()-4); } else if (result.right(Doxygen::htmlFileExtension.length())== QCString(Doxygen::htmlFileExtension)) { result=result.left(result.length()-Doxygen::htmlFileExtension.length()); } return result; } static void setParent(DocNodeVariant *n,DocNodeVariant *newParent) { std::visit([&](auto &&x)->decltype(auto) { return x.setParent(newParent); }, *n); } //----------- DocStyleChange const char *DocStyleChange::styleString() const { switch (m_style) { case DocStyleChange::Bold: return "b"; case DocStyleChange::Italic: return "em"; case DocStyleChange::Code: return "code"; case DocStyleChange::Center: return "center"; case DocStyleChange::Small: return "small"; case DocStyleChange::Cite: return "cite"; case DocStyleChange::Subscript: return "subscript"; case DocStyleChange::Superscript: return "superscript"; case DocStyleChange::Preformatted: return "pre"; case DocStyleChange::Div: return "div"; case DocStyleChange::Span: return "span"; case DocStyleChange::Strike: return "strike"; case DocStyleChange::S: return "s"; case DocStyleChange::Del: return "del"; case DocStyleChange::Underline: return "u"; case DocStyleChange::Ins: return "ins"; case DocStyleChange::Kbd: return "kbd"; } return "<invalid>"; } //----------- DocSymbol HtmlEntityMapper::SymType DocSymbol::decodeSymbol(const QCString &symName) { return HtmlEntityMapper::instance().name2sym(symName); } //----------- DocEmoji DocEmoji::DocEmoji(DocParser *parser,DocNodeVariant *parent,const QCString &symName) : DocNode(parser,parent), m_symName(symName), m_index(-1) { QCString locSymName = symName; size_t len=locSymName.length(); if (len>0) { if (locSymName.at(len-1)!=':') locSymName.append(":"); if (locSymName.at(0)!=':') locSymName.prepend(":"); } m_symName = locSymName; m_index = EmojiEntityMapper::instance().symbol2index(m_symName.str()); if (m_index==-1) { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Found unsupported emoji symbol '%s'",qPrint(m_symName)); } } //--------------------------------------------------------------------------- DocWord::DocWord(DocParser *parser,DocNodeVariant *parent,const QCString &word) : DocNode(parser,parent), m_word(word) { //printf("new word %s url=%s\n",qPrint(word),qPrint(parser->context.searchUrl)); if (Doxygen::searchIndex.enabled() && !parser->context.searchUrl.isEmpty()) { Doxygen::searchIndex.addWord(word,false); } } //--------------------------------------------------------------------------- DocLinkedWord::DocLinkedWord(DocParser *parser,DocNodeVariant *parent,const QCString &word, const QCString &ref,const QCString &file, const QCString &anchor,const QCString &tooltip) : DocNode(parser,parent), m_word(word), m_ref(ref), m_file(file), m_relPath(parser->context.relPath), m_anchor(anchor), m_tooltip(tooltip) { //printf("DocLinkedWord: new word %s url=%s tooltip='%s'\n", // qPrint(word),qPrint(parser->context.searchUrl),qPrint(tooltip)); if (Doxygen::searchIndex.enabled() && !parser->context.searchUrl.isEmpty()) { Doxygen::searchIndex.addWord(word,false); } } //--------------------------------------------------------------------------- DocAnchor::DocAnchor(DocParser *parser,DocNodeVariant *parent,const QCString &id,bool newAnchor) : DocNode(parser,parent) { if (id.isEmpty()) { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Empty anchor label"); return; } const CitationManager &ct = CitationManager::instance(); QCString anchorPrefix = ct.anchorPrefix(); if (id.left(anchorPrefix.length()) == anchorPrefix) { const CiteInfo *cite = ct.find(id.mid(anchorPrefix.length())); if (cite) { m_file = convertNameToFile(ct.fileName(),FALSE,TRUE); m_anchor = id; } else { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Invalid cite anchor id '%s'",qPrint(id)); m_anchor = "invalid"; m_file = "invalid"; } } else if (newAnchor) // found <a name="label"> { m_anchor = id; } else // found \anchor label { const SectionInfo *sec = SectionManager::instance().find(id); if (sec) { //printf("Found anchor %s\n",qPrint(id)); m_file = sec->fileName(); m_anchor = sec->label(); } else { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Invalid anchor id '%s'",qPrint(id)); m_anchor = "invalid"; m_file = "invalid"; } } } //--------------------------------------------------------------------------- DocVerbatim::DocVerbatim(DocParser *parser,DocNodeVariant *parent,const QCString &context, const QCString &text, Type t,bool isExample, const QCString &exampleFile,bool isBlock,const QCString &lang) : DocNode(parser,parent), p(std::make_unique<Private>(context, text, t, isExample, exampleFile, parser->context.relPath, lang, isBlock)) { } //--------------------------------------------------------------------------- void DocInclude::parse() { AUTO_TRACE("file={} text={}",m_file,Trace::trunc(m_text)); switch(m_type) { case DontIncWithLines: // fall through case IncWithLines: // fall through case Include: // fall through case DontInclude: parser()->readTextFileByName(m_file,m_text); parser()->context.includeFileName = m_file; parser()->context.includeFileText = m_text; parser()->context.includeFileOffset = 0; parser()->context.includeFileLength = m_text.length(); parser()->context.includeFileLine = 0; parser()->context.includeFileShowLineNo = (m_type == DontIncWithLines || m_type == IncWithLines); parser()->context.stripCodeComments = m_stripCodeComments; //printf("parser->context.includeFile=<<%s>>\n",qPrint(parser->context.includeFileText)); break; case VerbInclude: // fall through case HtmlInclude: case LatexInclude: case DocInclude::RtfInclude: case DocInclude::ManInclude: case DocInclude::XmlInclude: case DocInclude::DocbookInclude: parser()->readTextFileByName(m_file,m_text); break; case Snippet: case SnippetWithLines: parser()->readTextFileByName(m_file,m_text); // check here for the existence of the blockId inside the file, so we // only generate the warning once. int count = 0; if (!m_blockId.isEmpty() && (count=m_text.contains(m_blockId.data()))!=2) { warn_doc_error(parser()->context.fileName, parser()->tokenizer.getLineNr(), "block marked with %s for \\snippet should appear twice in file %s, found it %d times", qPrint(m_blockId),qPrint(m_file),count); } break; } } //--------------------------------------------------------------------------- void DocIncOperator::parse() { if (parser()->context.includeFileName.isEmpty()) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(), "No previous '\\include' or '\\dontinclude' command for '\\%s' present", typeAsString()); } bool found = false; m_includeFileName = parser()->context.includeFileName; const char *p = parser()->context.includeFileText.data(); size_t l = parser()->context.includeFileLength; size_t o = parser()->context.includeFileOffset; int il = parser()->context.includeFileLine; AUTO_TRACE("text={} off={} len={}",Trace::trunc(p),o,l); size_t so = o, bo = 0; bool nonEmpty = FALSE; switch(type()) { case Line: while (o<l) { char c = p[o]; if (c=='\n') { parser()->context.includeFileLine++; if (nonEmpty) break; // we have a pattern to match so=o+1; // no pattern, skip empty line } else if (!isspace(static_cast<uint8_t>(c))) // no white space char { nonEmpty=TRUE; } o++; } if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1) { m_line = il; m_text = parser()->context.includeFileText.mid(so,o-so); found = true; AUTO_TRACE_ADD("\\line {}",Trace::trunc(m_text)); } parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line m_showLineNo = parser()->context.includeFileShowLineNo; m_stripCodeComments = parser()->context.stripCodeComments; break; case SkipLine: while (o<l) { so=o; while (o<l) { char c = p[o]; if (c=='\n') { parser()->context.includeFileLine++; if (nonEmpty) break; // we have a pattern to match so=o+1; // no pattern, skip empty line } else if (!isspace(static_cast<uint8_t>(c))) // no white space char { nonEmpty=TRUE; } o++; } if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1) { m_line = il; m_text = parser()->context.includeFileText.mid(so,o-so); found = true; AUTO_TRACE_ADD("\\skipline {}",Trace::trunc(m_text)); break; } o++; // skip new line } parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line m_showLineNo = parser()->context.includeFileShowLineNo; m_stripCodeComments = parser()->context.stripCodeComments; break; case Skip: while (o<l) { so=o; while (o<l) { char c = p[o]; if (c=='\n') { parser()->context.includeFileLine++; if (nonEmpty) break; // we have a pattern to match so=o+1; // no pattern, skip empty line } else if (!isspace(static_cast<uint8_t>(c))) // no white space char { nonEmpty=TRUE; } o++; } if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1) { found = true; break; } o++; // skip new line } parser()->context.includeFileOffset = so; // set pointer to start of new line m_showLineNo = parser()->context.includeFileShowLineNo; m_stripCodeComments = parser()->context.stripCodeComments; break; case Until: bo=o; while (o<l) { so=o; while (o<l) { char c = p[o]; if (c=='\n') { parser()->context.includeFileLine++; if (nonEmpty) break; // we have a pattern to match so=o+1; // no pattern, skip empty line } else if (!isspace(static_cast<uint8_t>(c))) // no white space char { nonEmpty=TRUE; } o++; } if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1) { m_line = il; m_text = parser()->context.includeFileText.mid(bo,o-bo); found = true; AUTO_TRACE_ADD("\\until {}",Trace::trunc(m_text)); break; } o++; // skip new line } parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line m_showLineNo = parser()->context.includeFileShowLineNo; m_stripCodeComments = parser()->context.stripCodeComments; break; } if (!found) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(), "referenced pattern '%s' for command '\\%s' not found",qPrint(m_pattern),typeAsString()); } } //--------------------------------------------------------------------------- DocXRefItem::DocXRefItem(DocParser *parser,DocNodeVariant *parent,int id,const QCString &key) : DocCompoundNode(parser,parent), m_id(id), m_key(key), m_relPath(parser->context.relPath) { } bool DocXRefItem::parse() { RefList *refList = RefListManager::instance().find(m_key); if (refList && refList->isEnabled()) { RefItem *item = refList->find(m_id); ASSERT(item!=nullptr); if (item) { if (parser()->context.memberDef && parser()->context.memberDef->name().at(0)=='@') { m_file = "@"; // can't cross reference anonymous enum m_anchor = "@"; } else { m_file = refList->fileName(); m_anchor = item->anchor(); } m_title = refList->sectionTitle(); //printf("DocXRefItem: file=%s anchor=%s title=%s\n", // qPrint(m_file),qPrint(m_anchor),qPrint(m_title)); if (!item->text().isEmpty()) { parser()->pushContext(); parser()->internalValidatingParseDoc(thisVariant(),children(),item->text()); parser()->popContext(); } } return TRUE; } return FALSE; } //--------------------------------------------------------------------------- DocFormula::DocFormula(DocParser *parser,DocNodeVariant *parent,int id) : DocNode(parser,parent), m_relPath(parser->context.relPath) { const Formula *formula = FormulaManager::instance().findFormula(id); if (formula && !formula->text().isEmpty()) { m_id = id; m_name.sprintf("form_%d",m_id); m_text = formula->text(); } else // wrong \_form#<n> command { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Wrong formula id %d",id); m_id = -1; } } //--------------------------------------------------------------------------- DocSecRefItem::DocSecRefItem(DocParser *parser,DocNodeVariant *parent,const QCString &target) : DocCompoundNode(parser,parent), m_target(target), m_relPath(parser->context.relPath) { } void DocSecRefItem::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); parser()->tokenizer.setStateTitle(); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"\\refitem"); } tok = parser()->tokenizer.lex(); } parser()->tokenizer.setStatePara(); parser()->handlePendingStyleCommands(thisVariant(),children()); if (!m_target.isEmpty()) { const SectionInfo *sec = SectionManager::instance().find(m_target); if (sec==nullptr && parser()->context.lang==SrcLangExt::Markdown) // lookup as markdown file { sec = SectionManager::instance().find(markdownFileNameToId(m_target)); } if (sec) // ref to section or anchor { // set defaults m_ref = sec->ref(); m_file = stripKnownExtensions(sec->fileName()); m_refType = Section; m_anchor = sec->label(); m_isSubPage = false; // adjust if needed switch (sec->type().level()) { case SectionType::Page: { PageDef *pd = Doxygen::pageLinkedMap->find(m_target); m_isSubPage = pd && pd->hasParentPage(); if (!m_isSubPage) { m_anchor=""; } } break; case SectionType::Anchor: m_refType = Anchor; break; case SectionType::Table: m_refType = Table; break; default: break; } //printf("m_ref=%s,m_file=%s,type=%d\n", // qPrint(m_ref),qPrint(m_file),m_refType); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"reference to unknown section %s", qPrint(m_target)); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"reference to empty target"); } } //--------------------------------------------------------------------------- void DocSecRefList::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); Token tok=parser()->tokenizer.lex(); // skip white space while (tok.is_any_of(TokenRetval::TK_WHITESPACE, TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex(); // handle items while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (tok.is_any_of(TokenRetval::TK_COMMAND_AT, TokenRetval::TK_COMMAND_BS)) { switch (Mappers::cmdMapper->map(parser()->context.token->name)) { case CommandType::CMD_SECREFITEM: { tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\refitem command"); break; } tok=parser()->tokenizer.lex(); if (!tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of \\refitem", tok.to_string()); break; } children().append<DocSecRefItem>(parser(),thisVariant(),parser()->context.token->name); children().get_last<DocSecRefItem>()->parse(); } break; case CommandType::CMD_ENDSECREFLIST: return; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal command '%c%s' as part of a \\secreflist", tok.command_to_char(),qPrint(parser()->context.token->name)); return; } } else if (tok.is(TokenRetval::TK_WHITESPACE)) { // ignore whitespace } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s inside section reference list", tok.to_string()); return; } tok=parser()->tokenizer.lex(); } } //--------------------------------------------------------------------------- DocInternalRef::DocInternalRef(DocParser *parser,DocNodeVariant *parent,const QCString &ref) : DocCompoundNode(parser,parent), m_relPath(parser->context.relPath) { int i=ref.find('#'); if (i!=-1) { m_anchor = ref.right(static_cast<int>(ref.length())-i-1); m_file = ref.left(i); } else { m_file = ref; } } void DocInternalRef::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"\\ref"); } tok=parser()->tokenizer.lex(); } parser()->handlePendingStyleCommands(thisVariant(),children()); } //--------------------------------------------------------------------------- DocRef::DocRef(DocParser *parser,DocNodeVariant *parent,const QCString &target,const QCString &context) : DocCompoundNode(parser,parent), m_refType(Unknown), m_isSubPage(FALSE) { const Definition *compound = nullptr; QCString anchor; //printf("DocRef::DocRef(target=%s,context=%s)\n",qPrint(target),qPrint(context)); ASSERT(!target.isEmpty()); m_relPath = parser->context.relPath; const SectionInfo *sec = SectionManager::instance().find(parser->context.prefix+target); if (sec==nullptr && getLanguageFromFileName(target)==SrcLangExt::Markdown) // lookup as markdown file { sec = SectionManager::instance().find(markdownFileNameToId(target)); } if (sec) // ref to section or anchor { PageDef *pd = nullptr; int secLevel = sec->type().level(); if (secLevel==SectionType::Page) { pd = Doxygen::pageLinkedMap->find(target); } m_text = sec->title(); if (m_text.isEmpty()) m_text = sec->label(); m_ref = sec->ref(); m_file = stripKnownExtensions(sec->fileName()); if (secLevel==SectionType::Anchor) { m_refType = Anchor; } else if (secLevel==SectionType::Table) { m_refType = Table; } else { m_refType = Section; } m_isSubPage = pd && pd->hasParentPage(); if (secLevel!=SectionType::Page || m_isSubPage) m_anchor = sec->label(); m_sectionType = sec->type(); //printf("m_text=%s,m_ref=%s,m_file=%s,type=%d\n", // qPrint(m_text),qPrint(m_ref),qPrint(m_file),m_refType); return; } else if (resolveLink(context,target,true,&compound,anchor,parser->context.prefix)) { bool isFile = compound ? (compound->definitionType()==Definition::TypeFile || compound->definitionType()==Definition::TypePage ? TRUE : FALSE) : FALSE; m_text = linkToText(parser->context.lang,target,isFile); m_anchor = anchor; if (compound && compound->isLinkable()) // ref to compound { if (anchor.isEmpty() && /* compound link */ compound->definitionType()==Definition::TypeGroup && /* is group */ !toGroupDef(compound)->groupTitle().isEmpty() /* with title */ ) { m_text=(toGroupDef(compound))->groupTitle(); // use group's title as link } else if (compound->definitionType()==Definition::TypeMember && toMemberDef(compound)->isObjCMethod()) { // Objective C Method const MemberDef *member = toMemberDef(compound); bool localLink = parser->context.memberDef ? member->getClassDef()==parser->context.memberDef->getClassDef() : FALSE; m_text = member->objCMethodName(localLink,parser->context.inSeeBlock); } else if (Config_getBool(HIDE_SCOPE_NAMES)) { m_text=stripScope(m_text); } m_file = compound->getOutputFileBase(); m_ref = compound->getReference(); //printf("isFile=%d compound=%s (%d)\n",isFile,qPrint(compound->name()), // compound->definitionType()); return; } else if (compound && compound->definitionType()==Definition::TypeFile && toFileDef(compound)->generateSourceFile() ) // undocumented file that has source code we can link to { m_file = compound->getSourceFileBase(); m_ref = compound->getReference(); return; } } m_text = target; warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"unable to resolve reference to '%s' for \\ref command", qPrint(target)); } void DocNodeList::move_append(DocNodeList &elements) { for (auto &&elem : elements) { emplace_back(std::move(elem)); } elements.clear(); } static void flattenParagraphs(DocNodeVariant *root,DocNodeList &children) { DocNodeList newChildren; for (auto &dn : children) { DocPara *para = std::get_if<DocPara>(&dn); if (para) { //// move the children of the paragraph to the end of the newChildren list newChildren.move_append(para->children()); } } // replace the children list by the newChildren list children.clear(); children.move_append(newChildren); // reparent the children for (auto &cn : children) { setParent(&cn,root); // we also need to set the parent for each child of cn, as cn's address may have changed. auto opt_children = call_method_children(&cn); if (opt_children) { for (auto &ccn : *opt_children) { setParent(&ccn,&cn); } } } } void DocRef::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { switch (tok.value()) { case TokenRetval::TK_HTMLTAG: break; default: parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"\\ref"); break; } } tok=parser()->tokenizer.lex(); } if (children().empty() && !m_text.isEmpty()) { QCString text = m_text; if (parser()->context.insideHtmlLink) { // we already in a link/title only output anchor text = m_anchor; warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Potential recursion while resolving \\ref command!"); } parser()->context.insideHtmlLink=TRUE; parser()->pushContext(); parser()->internalValidatingParseDoc(thisVariant(),children(),text); parser()->popContext(); parser()->context.insideHtmlLink=FALSE; parser()->tokenizer.setStatePara(); flattenParagraphs(thisVariant(),children()); } parser()->handlePendingStyleCommands(thisVariant(),children()); } //--------------------------------------------------------------------------- DocCite::DocCite(DocParser *parser,DocNodeVariant *parent,const QCString &target,const QCString &) : DocNode(parser,parent) { size_t numBibFiles = Config_getList(CITE_BIB_FILES).size(); //printf("DocCite::DocCite(target=%s)\n",qPrint(target)); ASSERT(!target.isEmpty()); m_relPath = parser->context.relPath; const CitationManager &ct = CitationManager::instance(); const CiteInfo *cite = ct.find(target); //printf("cite=%p text='%s' numBibFiles=%d\n",cite,cite?qPrint(cite->text):"<null>",numBibFiles); if (numBibFiles>0 && cite && !cite->text().isEmpty()) // ref to citation { m_text = cite->text(); m_ref = ""; m_anchor = ct.anchorPrefix()+cite->label(); m_file = convertNameToFile(ct.fileName(),FALSE,TRUE); //printf("CITE ==> m_text=%s,m_ref=%s,m_file=%s,m_anchor=%s\n", // qPrint(m_text),qPrint(m_ref),qPrint(m_file),qPrint(m_anchor)); return; } m_text = target; if (numBibFiles==0) { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"\\cite command found but no bib files specified via CITE_BIB_FILES!"); } else if (cite==nullptr) { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"unable to resolve reference to '%s' for \\cite command", qPrint(target)); } else { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"\\cite command to '%s' does not have an associated number", qPrint(target)); } } //--------------------------------------------------------------------------- DocLink::DocLink(DocParser *parser,DocNodeVariant *parent,const QCString &target) : DocCompoundNode(parser,parent) { const Definition *compound = nullptr; QCString anchor; m_refText = target; m_relPath = parser->context.relPath; if (!m_refText.isEmpty() && m_refText.at(0)=='#') { m_refText = m_refText.right(m_refText.length()-1); } if (resolveLink(parser->context.context,stripKnownExtensions(target),parser->context.inSeeBlock,&compound,anchor,parser->context.prefix)) { m_anchor = anchor; if (compound && compound->isLinkable()) { m_file = compound->getOutputFileBase(); m_ref = compound->getReference(); } else if (compound && compound->definitionType()==Definition::TypeFile && (toFileDef(compound))->generateSourceFile() ) // undocumented file that has source code we can link to { m_file = compound->getSourceFileBase(); m_ref = compound->getReference(); } return; } // bogus link target warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"unable to resolve link to '%s' for \\link command", qPrint(target)); } QCString DocLink::parse(bool isJavaLink,bool isXmlLink) { AUTO_TRACE(); QCString result; auto ns = AutoNodeStack(parser(),thisVariant()); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children(),FALSE)) { switch (tok.value()) { case TokenRetval::TK_COMMAND_AT: // fall through case TokenRetval::TK_COMMAND_BS: switch (Mappers::cmdMapper->map(parser()->context.token->name)) { case CommandType::CMD_ENDLINK: if (isJavaLink) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"'{@link...' ended with '%c%s' command", tok.command_to_char(),qPrint(parser()->context.token->name)); } goto endlink; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal command '%c%s' as part of a \\link", tok.command_to_char(),qPrint(parser()->context.token->name)); break; } break; case TokenRetval::TK_SYMBOL: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '%s' found as part of a \\link", qPrint(parser()->context.token->name)); break; case TokenRetval::TK_HTMLTAG: if (parser()->context.token->name!="see" || !isXmlLink) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected xml/html command %s found as part of a \\link", qPrint(parser()->context.token->name)); } goto endlink; case TokenRetval::TK_LNKWORD: case TokenRetval::TK_WORD: if (isJavaLink) // special case to detect closing } { QCString w = parser()->context.token->name; int p = 0; if (w=="}") { goto endlink; } else if ((p=w.find('}'))!=-1) { int l = static_cast<int>(w.length()); children().append<DocWord>(parser(),thisVariant(),w.left(p)); if (p<l-1) // something left after the } (for instance a .) { result=w.right(l-p-1); } goto endlink; } } children().append<DocWord>(parser(),thisVariant(),parser()->context.token->name); break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s",tok.to_string()); break; } } tok = parser()->tokenizer.lex(); } if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName, parser()->tokenizer.getLineNr(), "Unexpected end of comment while inside link command"); } endlink: if (children().empty()) // no link text { children().append<DocWord>(parser(),thisVariant(),m_refText); } parser()->handlePendingStyleCommands(thisVariant(),children()); return result; } //--------------------------------------------------------------------------- DocDotFile::DocDotFile(DocParser *parser,DocNodeVariant *parent,const QCString &name,const QCString &context, const QCString &srcFile,int srcLine) : DocDiagramFileBase(parser,parent,name,context,srcFile,srcLine) { p->relPath = parser->context.relPath; } bool DocDotFile::parse() { bool ok = false; parser()->defaultHandleTitleAndSize(CommandType::CMD_DOTFILE,thisVariant(),children(),p->width,p->height); bool ambig = false; FileDef *fd = findFileDef(Doxygen::dotFileNameLinkedMap,p->name,ambig); if (fd==nullptr && !p->name.endsWith(".dot")) // try with .dot extension as well { fd = findFileDef(Doxygen::dotFileNameLinkedMap,p->name+".dot",ambig); } if (fd) { p->file = fd->absFilePath(); ok = true; if (ambig) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dot file name '%s' is ambiguous.\n" "Possible candidates:\n%s",qPrint(p->name), qPrint(showFileDefMatches(Doxygen::dotFileNameLinkedMap,p->name)) ); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dot file '%s' is not found " "in any of the paths specified via DOTFILE_DIRS!",qPrint(p->name)); } return ok; } DocMscFile::DocMscFile(DocParser *parser,DocNodeVariant *parent,const QCString &name,const QCString &context, const QCString &srcFile, int srcLine) : DocDiagramFileBase(parser,parent,name,context,srcFile,srcLine) { p->relPath = parser->context.relPath; } bool DocMscFile::parse() { bool ok = false; parser()->defaultHandleTitleAndSize(CommandType::CMD_MSCFILE,thisVariant(),children(),p->width,p->height); bool ambig = false; FileDef *fd = findFileDef(Doxygen::mscFileNameLinkedMap,p->name,ambig); if (fd==nullptr && !p->name.endsWith(".msc")) // try with .msc extension as well { fd = findFileDef(Doxygen::mscFileNameLinkedMap,p->name+".msc",ambig); } if (fd) { p->file = fd->absFilePath(); ok = true; if (ambig) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included msc file name '%s' is ambiguous.\n" "Possible candidates:\n%s",qPrint(p->name), qPrint(showFileDefMatches(Doxygen::mscFileNameLinkedMap,p->name)) ); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included msc file '%s' is not found " "in any of the paths specified via MSCFILE_DIRS!",qPrint(p->name)); } return ok; } //--------------------------------------------------------------------------- DocDiaFile::DocDiaFile(DocParser *parser,DocNodeVariant *parent,const QCString &name,const QCString &context, const QCString &srcFile,int srcLine) : DocDiagramFileBase(parser,parent,name,context,srcFile,srcLine) { p->relPath = parser->context.relPath; } bool DocDiaFile::parse() { bool ok = false; parser()->defaultHandleTitleAndSize(CommandType::CMD_DIAFILE,thisVariant(),children(),p->width,p->height); bool ambig = false; FileDef *fd = findFileDef(Doxygen::diaFileNameLinkedMap,p->name,ambig); if (fd==nullptr && !p->name.endsWith(".dia")) // try with .dia extension as well { fd = findFileDef(Doxygen::diaFileNameLinkedMap,p->name+".dia",ambig); } if (fd) { p->file = fd->absFilePath(); ok = true; if (ambig) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dia file name '%s' is ambiguous.\n" "Possible candidates:\n%s",qPrint(p->name), qPrint(showFileDefMatches(Doxygen::diaFileNameLinkedMap,p->name)) ); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dia file '%s' is not found " "in any of the paths specified via DIAFILE_DIRS!",qPrint(p->name)); } return ok; } //--------------------------------------------------------------------------- DocPlantUmlFile::DocPlantUmlFile(DocParser *parser,DocNodeVariant *parent,const QCString &name,const QCString &context, const QCString &srcFile,int srcLine) : DocDiagramFileBase(parser,parent,name,context,srcFile,srcLine) { p->relPath = parser->context.relPath; } bool DocPlantUmlFile::parse() { bool ok = false; parser()->defaultHandleTitleAndSize(CommandType::CMD_PLANTUMLFILE,thisVariant(),children(),p->width,p->height); bool ambig = false; FileDef *fd = findFileDef(Doxygen::plantUmlFileNameLinkedMap,p->name,ambig); if (fd==nullptr && !p->name.endsWith(".puml")) // try with .puml extension as well { fd = findFileDef(Doxygen::plantUmlFileNameLinkedMap,p->name+".puml",ambig); if (fd==nullptr && !p->name.endsWith(".pu")) // try with .pu extension as well { fd = findFileDef(Doxygen::plantUmlFileNameLinkedMap,p->name+".pu",ambig); } } if (fd) { p->file = fd->absFilePath(); ok = true; if (ambig) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included uml file name '%s' is ambiguous.\n" "Possible candidates:\n%s",qPrint(p->name), qPrint(showFileDefMatches(Doxygen::plantUmlFileNameLinkedMap,p->name)) ); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included uml file '%s' is not found " "in any of the paths specified via PLANTUMLFILE_DIRS!",qPrint(p->name)); } return ok; } //--------------------------------------------------------------------------- DocVhdlFlow::DocVhdlFlow(DocParser *parser,DocNodeVariant *parent) : DocCompoundNode(parser,parent) { } void DocVhdlFlow::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); parser()->tokenizer.setStateTitle(); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"\\vhdlflow"); } tok = parser()->tokenizer.lex(); } parser()->tokenizer.lex(); parser()->tokenizer.setStatePara(); parser()->handlePendingStyleCommands(thisVariant(),children()); VhdlDocGen::createFlowChart(parser()->context.memberDef); } //--------------------------------------------------------------------------- DocImage::DocImage(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs,const QCString &name, Type t,const QCString &url, bool inlineImage) : DocCompoundNode(parser,parent), p(std::make_unique<Private>(attribs, name, t, parser->context.relPath, url, inlineImage)) { } bool DocImage::isSVG() const { QCString locName = p->url.isEmpty() ? p->name : p->url; int len = static_cast<int>(locName.length()); int fnd = locName.find('?'); // ignore part from ? until end if (fnd==-1) fnd=len; return fnd>=4 && locName.mid(fnd-4,4)==".svg"; } void DocImage::parse() { parser()->defaultHandleTitleAndSize(CommandType::CMD_IMAGE,thisVariant(),children(),p->width,p->height); } //--------------------------------------------------------------------------- Token DocHtmlHeader::parse() { AUTO_TRACE(); Token retval(TokenRetval::RetVal_OK); auto ns = AutoNodeStack(parser(),thisVariant()); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { switch (tok.value()) { case TokenRetval::TK_HTMLTAG: { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_H1 && parser()->context.token->endTag) // found </h1> tag { if (m_level!=1) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h%d> ended with </h1>", m_level); } goto endheader; } else if (tagId==HtmlTagType::HTML_H2 && parser()->context.token->endTag) // found </h2> tag { if (m_level!=2) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h%d> ended with </h2>", m_level); } goto endheader; } else if (tagId==HtmlTagType::HTML_H3 && parser()->context.token->endTag) // found </h3> tag { if (m_level!=3) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h%d> ended with </h3>", m_level); } goto endheader; } else if (tagId==HtmlTagType::HTML_H4 && parser()->context.token->endTag) // found </h4> tag { if (m_level!=4) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h%d> ended with </h4>", m_level); } goto endheader; } else if (tagId==HtmlTagType::HTML_H5 && parser()->context.token->endTag) // found </h5> tag { if (m_level!=5) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h%d> ended with </h5>", m_level); } goto endheader; } else if (tagId==HtmlTagType::HTML_H6 && parser()->context.token->endTag) // found </h6> tag { if (m_level!=6) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"<h%d> ended with </h6>", m_level); } goto endheader; } else if (tagId==HtmlTagType::HTML_A) { if (!parser()->context.token->endTag) { parser()->handleAHref(thisVariant(),children(),parser()->context.token->attribs); } } else if (tagId==HtmlTagType::HTML_BR) { children().append<DocLineBreak>(parser(),thisVariant(),parser()->context.token->attribs); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <%s%s> found within <h%d> context", parser()->context.token->endTag?"/":"",qPrint(parser()->context.token->name),m_level); } } break; default: char tmp[20]; qsnprintf(tmp,20,"<h%d>tag",m_level); parser()->errorHandleDefaultToken(thisVariant(),tok,children(),tmp); } } tok = parser()->tokenizer.lex(); } if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside" " <h%d> tag",m_level); } endheader: parser()->handlePendingStyleCommands(thisVariant(),children()); return retval; } //--------------------------------------------------------------------------- void DocHtmlSummary::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); parser()->tokenizer.setStateTitle(); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { HtmlTagType tagId = HtmlTagType::UNKNOWN; // check of </summary> if (tok.value()==TokenRetval::TK_HTMLTAG && (tagId=Mappers::htmlTagMapper->map(parser()->context.token->name))==HtmlTagType::XML_SUMMARY && parser()->context.token->endTag ) { break; } else if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"summary section"); } tok = parser()->tokenizer.lex(); } parser()->tokenizer.setStatePara(); if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside" " <summary> tag"); } } //--------------------------------------------------------------------------- Token DocHtmlDetails::parse() { AUTO_TRACE(); Token retval(TokenRetval::TK_NONE); auto ns = AutoNodeStack(parser(),thisVariant()); // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=nullptr; do { children().append<DocPara>(parser(),thisVariant()); par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); } while (retval.is(TokenRetval::TK_NEWPARA)); if (par) par->markLast(); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while inside <details> block"); } if (!summary()) { HtmlAttribList summaryAttribs; m_summary = createDocNode<DocHtmlSummary>(parser(),thisVariant(),summaryAttribs); DocHtmlSummary *summary = &std::get<DocHtmlSummary>(*m_summary); summary->children().append<DocWord>(parser(),thisVariant(),theTranslator->trDetails()); } AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval.is(TokenRetval::RetVal_EndHtmlDetails) ? Token::make_RetVal_OK() : retval; } void DocHtmlDetails::parseSummary(DocNodeVariant *parent,HtmlAttribList &attribs) { AUTO_TRACE(); m_summary = createDocNode<DocHtmlSummary>(parser(),parent,attribs); DocHtmlSummary *summary = &std::get<DocHtmlSummary>(*m_summary); summary->parse(); } //--------------------------------------------------------------------------- Token DocHRef::parse() { AUTO_TRACE(); Token retval(TokenRetval::RetVal_OK); auto ns = AutoNodeStack(parser(),thisVariant()); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { switch (tok.value()) { case TokenRetval::TK_HTMLTAG: { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_A && parser()->context.token->endTag) // found </a> tag { goto endhref; } else if (tagId==HtmlTagType::HTML_BR) { children().append<DocLineBreak>(parser(),thisVariant(),parser()->context.token->attribs); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <%s%s> found within <a href=...> context", parser()->context.token->endTag?"/":"",qPrint(parser()->context.token->name)); } } break; default: parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"<a>..</a> block"); break; } } tok = parser()->tokenizer.lex(); } if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside" " <a href=...> tag"); } endhref: parser()->handlePendingStyleCommands(thisVariant(),children()); return retval; } //--------------------------------------------------------------------------- Token DocInternal::parse(int level) { AUTO_TRACE(); Token retval(TokenRetval::RetVal_OK); auto ns = AutoNodeStack(parser(),thisVariant()); // first parse any number of paragraphs bool isFirst=TRUE; DocPara *lastPar=nullptr; do { children().append<DocPara>(parser(),thisVariant()); DocPara *par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); if (!par->isEmpty()) { if (lastPar) lastPar->markLast(FALSE); lastPar=par; } else { children().pop_back(); } if (retval.is(TokenRetval::TK_LISTITEM)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid list item found"); } } while (!retval.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF, TokenRetval::RetVal_Section, TokenRetval::RetVal_Subsection, TokenRetval::RetVal_Subsubsection, TokenRetval::RetVal_Paragraph, TokenRetval::RetVal_SubParagraph, TokenRetval::RetVal_SubSubParagraph, TokenRetval::RetVal_EndInternal)); if (lastPar) lastPar->markLast(); // then parse any number of level-n sections while ((level==1 && retval.is(TokenRetval::RetVal_Section)) || (level==2 && retval.is(TokenRetval::RetVal_Subsection)) || (level==3 && retval.is(TokenRetval::RetVal_Subsubsection)) || (level==4 && retval.is(TokenRetval::RetVal_Paragraph)) || (level==5 && retval.is(TokenRetval::RetVal_SubParagraph)) || (level==6 && retval.is(TokenRetval::RetVal_SubSubParagraph)) ) { children().append<DocSection>(parser(),thisVariant(), level, parser()->context.token->sectionId); retval = children().get_last<DocSection>()->parse(); } if (retval.is(TokenRetval::RetVal_Internal)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"\\internal command found inside internal section"); } AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } //--------------------------------------------------------------------------- Token DocIndexEntry::parse() { AUTO_TRACE(); Token retval(TokenRetval::RetVal_OK); auto ns = AutoNodeStack(parser(),thisVariant()); Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\addindex command"); goto endindexentry; } parser()->tokenizer.setStateTitle(); m_entry=""; tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { switch (tok.value()) { case TokenRetval::TK_WHITESPACE: m_entry+=" "; break; case TokenRetval::TK_WORD: case TokenRetval::TK_LNKWORD: m_entry+=parser()->context.token->name; break; case TokenRetval::TK_SYMBOL: { HtmlEntityMapper::SymType s = DocSymbol::decodeSymbol(parser()->context.token->name); switch (s) { case HtmlEntityMapper::Sym_BSlash: m_entry+='\\'; break; case HtmlEntityMapper::Sym_At: m_entry+='@'; break; case HtmlEntityMapper::Sym_Less: m_entry+='<'; break; case HtmlEntityMapper::Sym_Greater: m_entry+='>'; break; case HtmlEntityMapper::Sym_Amp: m_entry+='&'; break; case HtmlEntityMapper::Sym_Dollar: m_entry+='$'; break; case HtmlEntityMapper::Sym_Hash: m_entry+='#'; break; case HtmlEntityMapper::Sym_Percent: m_entry+='%'; break; case HtmlEntityMapper::Sym_apos: m_entry+='\''; break; case HtmlEntityMapper::Sym_Quot: m_entry+='"'; break; case HtmlEntityMapper::Sym_lsquo: m_entry+='`'; break; case HtmlEntityMapper::Sym_rsquo: m_entry+='\''; break; case HtmlEntityMapper::Sym_ldquo: m_entry+="``"; break; case HtmlEntityMapper::Sym_rdquo: m_entry+="''"; break; case HtmlEntityMapper::Sym_ndash: m_entry+="--"; break; case HtmlEntityMapper::Sym_mdash: m_entry+="---"; break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected symbol '%s' found as argument of \\addindex",qPrint(parser()->context.token->name)); break; } } break; case TokenRetval::TK_COMMAND_AT: // fall through case TokenRetval::TK_COMMAND_BS: switch (Mappers::cmdMapper->map(parser()->context.token->name)) { case CommandType::CMD_BSLASH: m_entry+='\\'; break; case CommandType::CMD_AT: m_entry+='@'; break; case CommandType::CMD_LESS: m_entry+='<'; break; case CommandType::CMD_GREATER: m_entry+='>'; break; case CommandType::CMD_AMP: m_entry+='&'; break; case CommandType::CMD_DOLLAR: m_entry+='$'; break; case CommandType::CMD_HASH: m_entry+='#'; break; case CommandType::CMD_DCOLON: m_entry+="::"; break; case CommandType::CMD_PERCENT: m_entry+='%'; break; case CommandType::CMD_NDASH: m_entry+="--"; break; case CommandType::CMD_MDASH: m_entry+="---"; break; case CommandType::CMD_QUOTE: m_entry+='"'; break; case CommandType::CMD_PUNT: m_entry+='.'; break; case CommandType::CMD_PLUS: m_entry+='+'; break; case CommandType::CMD_MINUS: m_entry+='-'; break; case CommandType::CMD_EQUAL: m_entry+='='; break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command %s found as argument of \\addindex", qPrint(parser()->context.token->name)); break; } break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s", tok.to_string()); break; } tok = parser()->tokenizer.lex(); } parser()->tokenizer.setStatePara(); m_entry = m_entry.stripWhiteSpace(); endindexentry: AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } //--------------------------------------------------------------------------- DocHtmlCaption::DocHtmlCaption(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocCompoundNode(parser,parent) { m_hasCaptionId = FALSE; for (const auto &opt : attribs) { if (opt.name=="id" && !opt.value.isEmpty()) // interpret id attribute as an anchor { const SectionInfo *sec = SectionManager::instance().find(opt.value); if (sec) { //printf("Found anchor %s\n",qPrint(id)); m_file = sec->fileName(); m_anchor = sec->label(); m_hasCaptionId = TRUE; } else { warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Invalid caption id '%s'",qPrint(opt.value)); } } else // copy attribute { m_attribs.push_back(opt); } } } Token DocHtmlCaption::parse() { AUTO_TRACE(); Token retval = Token::make_TK_NONE(); auto ns = AutoNodeStack(parser(),thisVariant()); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { switch (tok.value()) { case TokenRetval::TK_HTMLTAG: { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_CAPTION && parser()->context.token->endTag) // found </caption> tag { retval = Token::make_RetVal_OK(); goto endcaption; } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <%s%s> found within <caption> context", parser()->context.token->endTag?"/":"",qPrint(parser()->context.token->name)); } } break; default: parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"<caption> tag"); break; } } tok = parser()->tokenizer.lex(); } if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside" " <caption> tag"); } endcaption: parser()->handlePendingStyleCommands(thisVariant(),children()); return retval; } //--------------------------------------------------------------------------- Token DocHtmlCell::parse() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=nullptr; do { children().append<DocPara>(parser(),thisVariant()); par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); if (retval.is(TokenRetval::TK_HTMLTAG)) { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_TD && parser()->context.token->endTag) // found </td> tag { retval = Token::make_TK_NEWPARA(); // ignore the tag } else if (tagId==HtmlTagType::HTML_TH && parser()->context.token->endTag) // found </th> tag { retval = Token::make_TK_NEWPARA(); // ignore the tag } } } while (retval.is_any_of(TokenRetval::TK_NEWPARA,TokenRetval::RetVal_EndParBlock)); if (par) par->markLast(); return retval; } Token DocHtmlCell::parseXml() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=nullptr; do { children().append<DocPara>(parser(),thisVariant()); par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); if (retval.is(TokenRetval::TK_HTMLTAG)) { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::XML_ITEM && parser()->context.token->endTag) // found </item> tag { retval = Token::make_TK_NEWPARA(); // ignore the tag } else if (tagId==HtmlTagType::XML_DESCRIPTION && parser()->context.token->endTag) // found </description> tag { retval = Token::make_TK_NEWPARA(); // ignore the tag } } } while (retval.is(TokenRetval::TK_NEWPARA)); if (par) par->markLast(); return retval; } uint32_t DocHtmlCell::rowSpan() const { for (const auto &attr : attribs()) { if (attr.name.lower()=="rowspan") { return attr.value.toUInt(); } } return 0; } uint32_t DocHtmlCell::colSpan() const { for (const auto &attr : attribs()) { if (attr.name.lower()=="colspan") { return std::max(1u,attr.value.toUInt()); } } return 1; } DocHtmlCell::Alignment DocHtmlCell::alignment() const { for (const auto &attr : attribs()) { QCString attrName = attr.name.lower(); QCString attrValue = attr.value.lower(); if (attrName=="align") { if (attrValue=="center") return Center; else if (attrValue=="right") return Right; else return Left; } else if (attrName=="class" && attrValue.startsWith("markdowntable")) { if (attrValue=="markdowntableheadcenter") return Center; else if (attrValue=="markdowntableheadright") return Right; else if (attrValue=="markdowntableheadleft") return Left; else if (attrValue=="markdowntableheadnone") return Center; else if (attrValue=="markdowntablebodycenter") return Center; else if (attrValue=="markdowntablebodyright") return Right; else if (attrValue=="markdowntablebodyleft") return Left; else if (attrValue=="markdowntablebodynone") return Left; else return Left; } } return Left; } DocHtmlCell::Valignment DocHtmlCell::valignment() const { for (const auto &attr : attribs()) { QCString attrName = attr.name.lower(); QCString attrValue = attr.value.lower(); if (attrName=="valign") { if (attrValue=="top") return Top; else if (attrValue=="bottom") return Bottom; else if (attrValue=="middle") return Middle; else return Middle; } } return Middle; } //--------------------------------------------------------------------------- bool DocHtmlRow::isHeading() const { // a row is a table heading if all cells are marked as such bool heading=TRUE; for (const auto &n : children()) { const DocHtmlCell *cell = std::get_if<DocHtmlCell>(&n); if (cell && !cell->isHeading()) { heading = FALSE; break; } } return !children().empty() && heading; } Token DocHtmlRow::parse() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); bool isHeading=FALSE; bool isFirst=TRUE; DocHtmlCell *cell=nullptr; // get next token Token tok=parser()->tokenizer.lex(); // skip whitespace while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex(); // should find a html tag now if (tok.is(TokenRetval::TK_HTMLTAG)) { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_TD && !parser()->context.token->endTag) // found <td> tag { } else if (tagId==HtmlTagType::HTML_TH && !parser()->context.token->endTag) // found <th> tag { isHeading=TRUE; } else // found some other tag { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <td> or <th> tag but " "found <%s> instead!",qPrint(parser()->context.token->name)); parser()->tokenizer.pushBackHtmlTag(parser()->context.token->name); goto endrow; } } else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking" " for a html description title"); goto endrow; } else // token other than html token { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <td> or <th> tag but found %s token instead!", tok.to_string()); goto endrow; } // parse one or more cells do { children().append<DocHtmlCell>(parser(),thisVariant(), parser()->context.token->attribs, isHeading); cell = children().get_last<DocHtmlCell>(); cell->markFirst(isFirst); isFirst=FALSE; retval=cell->parse(); isHeading = retval.is(TokenRetval::RetVal_TableHCell); } while (retval.is_any_of(TokenRetval::RetVal_TableCell,TokenRetval::RetVal_TableHCell)); cell->markLast(TRUE); endrow: return retval; } Token DocHtmlRow::parseXml(bool isHeading) { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); bool isFirst=TRUE; DocHtmlCell *cell=nullptr; // get next token Token tok=parser()->tokenizer.lex(); // skip whitespace while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex(); // should find a html tag now if (tok.is(TokenRetval::TK_HTMLTAG)) { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::XML_TERM && !parser()->context.token->endTag) // found <term> tag { } else if (tagId==HtmlTagType::XML_DESCRIPTION && !parser()->context.token->endTag) // found <description> tag { } else // found some other tag { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <term> or <description> tag but " "found <%s> instead!",qPrint(parser()->context.token->name)); parser()->tokenizer.pushBackHtmlTag(parser()->context.token->name); goto endrow; } } else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking" " for a html description title"); goto endrow; } else // token other than html token { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <td> or <th> tag but found %s token instead!", tok.to_string()); goto endrow; } do { children().append<DocHtmlCell>(parser(),thisVariant(),parser()->context.token->attribs,isHeading); cell = children().get_last<DocHtmlCell>(); cell->markFirst(isFirst); isFirst=FALSE; retval=cell->parseXml(); } while (retval.is_any_of(TokenRetval::RetVal_TableCell,TokenRetval::RetVal_TableHCell)); cell->markLast(TRUE); endrow: return retval; } //--------------------------------------------------------------------------- bool DocHtmlTable::hasCaption() const { return m_caption!=nullptr; } const DocNodeVariant *DocHtmlTable::caption() const { return m_caption.get(); } const DocNodeVariant *DocHtmlTable::firstRow() const { if (!children().empty() && std::holds_alternative<DocHtmlRow>(children().front())) { return &children().front(); } return nullptr; } Token DocHtmlTable::parse() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); getrow: // get next token Token tok=parser()->tokenizer.lex(); // skip whitespace while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex(); // should find a html tag now if (tok.is(TokenRetval::TK_HTMLTAG)) { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_THEAD && !parser()->context.token->endTag) // found <thead> tag { goto getrow; } else if (tagId==HtmlTagType::HTML_TBODY && !parser()->context.token->endTag) // found <tbody> tag { goto getrow; } else if (tagId==HtmlTagType::HTML_TFOOT && !parser()->context.token->endTag) // found <tfoot> tag { goto getrow; } else if (tagId==HtmlTagType::HTML_TR && !parser()->context.token->endTag) // found <tr> tag { // no caption, just rows retval = Token::make_RetVal_TableRow(); } else if (tagId==HtmlTagType::HTML_CAPTION && !parser()->context.token->endTag) // found <caption> tag { if (m_caption) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"table already has a caption, found another one"); } else { m_caption = createDocNode<DocHtmlCaption>(parser(),thisVariant(),parser()->context.token->attribs); retval=std::get<DocHtmlCaption>(*m_caption).parse(); if (retval.is(TokenRetval::RetVal_OK)) // caption was parsed ok { goto getrow; } } } else // found wrong token { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <tr> or <caption> tag but " "found <%s%s> instead!", parser()->context.token->endTag ? "/" : "", qPrint(parser()->context.token->name)); } } else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking" " for a <tr> or <caption> tag"); } else // token other than html token { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <tr> tag but found %s token instead!", tok.to_string()); } // parse one or more rows while (retval.is(TokenRetval::RetVal_TableRow)) { children().append<DocHtmlRow>(parser(),thisVariant(),parser()->context.token->attribs); retval = children().get_last<DocHtmlRow>()->parse(); } computeTableGrid(); return retval.is(TokenRetval::RetVal_EndTable) ? Token::make_RetVal_OK() : retval; } Token DocHtmlTable::parseXml() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); // get next token Token tok=parser()->tokenizer.lex(); // skip whitespace while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex(); // should find a html tag now HtmlTagType tagId=HtmlTagType::UNKNOWN; bool isHeader=FALSE; if (tok.is(TokenRetval::TK_HTMLTAG)) { tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::XML_ITEM && !parser()->context.token->endTag) // found <item> tag { retval = Token::make_RetVal_TableRow(); } if (tagId==HtmlTagType::XML_LISTHEADER && !parser()->context.token->endTag) // found <listheader> tag { retval = Token::make_RetVal_TableRow(); isHeader=TRUE; } } // parse one or more rows while (retval.is(TokenRetval::RetVal_TableRow)) { children().append<DocHtmlRow>(parser(),thisVariant(),parser()->context.token->attribs); DocHtmlRow *tr = children().get_last<DocHtmlRow>(); retval=tr->parseXml(isHeader); isHeader=FALSE; } computeTableGrid(); tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); return tagId==HtmlTagType::XML_LIST && parser()->context.token->endTag ? Token::make_RetVal_OK() : retval; } /** Helper class to compute the grid for an HTML style table */ struct ActiveRowSpan { ActiveRowSpan(uint32_t rows,uint32_t col) : rowsLeft(rows), column(col) {} uint32_t rowsLeft; uint32_t column; }; /** List of ActiveRowSpan classes. */ typedef std::vector<ActiveRowSpan> RowSpanList; /** determines the location of all cells in a grid, resolving row and column spans. For each the total number of visible cells is computed, and the total number of visible columns over all rows is stored. */ void DocHtmlTable::computeTableGrid() { //printf("computeTableGrid()\n"); RowSpanList rowSpans; uint32_t maxCols=0; uint32_t rowIdx=1; for (auto &rowNode : children()) { uint32_t colIdx=1; uint32_t cells=0; DocHtmlRow *row = std::get_if<DocHtmlRow>(&rowNode); if (row) { for (auto &cellNode : row->children()) { DocHtmlCell *cell = std::get_if<DocHtmlCell>(&cellNode); if (cell) { uint32_t rs = cell->rowSpan(); uint32_t cs = cell->colSpan(); for (size_t i=0;i<rowSpans.size();i++) { if (rowSpans[i].rowsLeft>0 && rowSpans[i].column==colIdx) { colIdx=rowSpans[i].column+1; cells++; } } if (rs>0) rowSpans.emplace_back(rs,colIdx); //printf("found cell at (%d,%d)\n",rowIdx,colIdx); cell->setRowIndex(rowIdx); cell->setColumnIndex(colIdx); colIdx+=cs; cells++; } } for (size_t i=0;i<rowSpans.size();i++) { if (rowSpans[i].rowsLeft>0) rowSpans[i].rowsLeft--; } row->setVisibleCells(cells); row->setRowIndex(rowIdx); rowIdx++; } if (colIdx-1>maxCols) maxCols=colIdx-1; } m_numCols = maxCols; } //--------------------------------------------------------------------------- Token DocHtmlDescTitle::parse() { AUTO_TRACE(); Token retval = Token::make_TK_NONE(); auto ns = AutoNodeStack(parser(),thisVariant()); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { switch (tok.value()) { case TokenRetval::TK_COMMAND_AT: // fall through case TokenRetval::TK_COMMAND_BS: { QCString cmdName=parser()->context.token->name; bool isJavaLink=FALSE; switch (Mappers::cmdMapper->map(cmdName)) { case CommandType::CMD_REF: { tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command", tok.command_to_char(),qPrint(cmdName)); } else { parser()->tokenizer.setStateRef(); tok=parser()->tokenizer.lex(); // get the reference id if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of '%c%s' command", tok.to_string(),tok.command_to_char(),qPrint(cmdName)); } else { children().append<DocRef>(parser(),thisVariant(),parser()->context.token->name,parser()->context.context); children().get_last<DocRef>()->parse(); } parser()->tokenizer.setStatePara(); } } break; case CommandType::CMD_JAVALINK: isJavaLink=TRUE; // fall through case CommandType::CMD_LINK: { tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command", qPrint(cmdName)); } else { parser()->tokenizer.setStateLink(); tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of \\%s command", tok.to_string(),qPrint(cmdName)); } else { parser()->tokenizer.setStatePara(); children().append<DocLink>(parser(),thisVariant(),parser()->context.token->name); DocLink *lnk = children().get_last<DocLink>(); QCString leftOver = lnk->parse(isJavaLink); if (!leftOver.isEmpty()) { children().append<DocWord>(parser(),thisVariant(),leftOver); } } } } break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal command '%c%s' found as part of a <dt> tag", tok.command_to_char(),qPrint(cmdName)); } } break; case TokenRetval::TK_SYMBOL: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '%s' found as part of a <dt> tag", qPrint(parser()->context.token->name)); break; case TokenRetval::TK_HTMLTAG: { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_DD && !parser()->context.token->endTag) // found <dd> tag { retval = Token::make_RetVal_DescData(); goto endtitle; } else if (tagId==HtmlTagType::HTML_DT && parser()->context.token->endTag) { // ignore </dt> tag. } else if (tagId==HtmlTagType::HTML_DT) { // missing <dt> tag. retval = Token::make_RetVal_DescTitle(); goto endtitle; } else if (tagId==HtmlTagType::HTML_DL && parser()->context.token->endTag) { retval = Token::make_RetVal_EndDesc(); goto endtitle; } else if (tagId==HtmlTagType::HTML_A) { if (!parser()->context.token->endTag) { parser()->handleAHref(thisVariant(),children(),parser()->context.token->attribs); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <%s%s> found within <dt> context", parser()->context.token->endTag?"/":"",qPrint(parser()->context.token->name)); } } break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s found as part of a <dt> tag", tok.to_string()); break; } } tok = parser()->tokenizer.lex(); } if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside" " <dt> tag"); } endtitle: parser()->handlePendingStyleCommands(thisVariant(),children()); return retval; } //--------------------------------------------------------------------------- Token DocHtmlDescData::parse() { AUTO_TRACE(); m_attribs = parser()->context.token->attribs; Token retval = Token::make_TK_NONE(); auto ns = AutoNodeStack(parser(),thisVariant()); bool isFirst=TRUE; DocPara *par=nullptr; do { children().append<DocPara>(parser(),thisVariant()); par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); } while (retval.is(TokenRetval::TK_NEWPARA)); if (par) par->markLast(); return retval; } //--------------------------------------------------------------------------- Token DocHtmlDescList::parse() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); // get next token Token tok=parser()->tokenizer.lex(); // skip whitespace while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex(); // should find a html tag now if (tok.is(TokenRetval::TK_HTMLTAG)) { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_DT && !parser()->context.token->endTag) // found <dt> tag { // continue } else // found some other tag { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <dt> tag but " "found <%s> instead!",qPrint(parser()->context.token->name)); parser()->tokenizer.pushBackHtmlTag(parser()->context.token->name); goto enddesclist; } } else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking" " for a html description title"); goto enddesclist; } else // token other than html token { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <dt> tag but found %s token instead!", tok.to_string()); goto enddesclist; } do { children().append<DocHtmlDescTitle>(parser(),thisVariant(),parser()->context.token->attribs); DocHtmlDescTitle *dt = children().get_last<DocHtmlDescTitle>(); children().append<DocHtmlDescData>(parser(),thisVariant()); DocHtmlDescData *dd = children().get_last<DocHtmlDescData>(); retval=dt->parse(); if (retval.is(TokenRetval::RetVal_DescData)) { retval=dd->parse(); while (retval.is(TokenRetval::RetVal_DescData)) { children().append<DocHtmlDescData>(parser(),thisVariant()); dd = children().get_last<DocHtmlDescData>(); retval=dd->parse(); } } else if (!retval.is(TokenRetval::RetVal_DescTitle)) { // error break; } } while (retval.is(TokenRetval::RetVal_DescTitle)); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while inside <dl> block"); } enddesclist: return retval.is(TokenRetval::RetVal_EndDesc) ? Token::make_RetVal_OK() : retval; } //--------------------------------------------------------------------------- Token DocHtmlListItem::parse() { AUTO_TRACE(); Token retval = Token::make_TK_NONE(); auto ns = AutoNodeStack(parser(),thisVariant()); // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=nullptr; do { children().append<DocPara>(parser(),thisVariant()); par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); } while (retval.is(TokenRetval::TK_NEWPARA)); if (par) par->markLast(); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } Token DocHtmlListItem::parseXml() { AUTO_TRACE(); Token retval = Token::make_TK_NONE(); auto ns = AutoNodeStack(parser(),thisVariant()); // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=nullptr; do { children().append<DocPara>(parser(),thisVariant()); par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break; //printf("new item: retval=%x parser()->context.token->name=%s parser()->context.token->endTag=%d\n", // retval,qPrint(parser()->context.token->name),parser()->context.token->endTag); if (retval.is(TokenRetval::RetVal_ListItem)) { break; } } while (!retval.is(TokenRetval::RetVal_CloseXml)); if (par) par->markLast(); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } //--------------------------------------------------------------------------- Token DocHtmlList::parse() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); int num=1; auto ns = AutoNodeStack(parser(),thisVariant()); // get next token Token tok=parser()->tokenizer.lex(); // skip whitespace and paragraph breaks while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex(); // should find a html tag now if (tok.is(TokenRetval::TK_HTMLTAG)) { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); if (tagId==HtmlTagType::HTML_LI && !parser()->context.token->endTag) // found <li> tag { // ok, we can go on. } else if (((m_type==Unordered && tagId==HtmlTagType::HTML_UL) || (m_type==Ordered && tagId==HtmlTagType::HTML_OL) ) && parser()->context.token->endTag ) // found empty list { // add dummy item to obtain valid HTML children().append<DocHtmlListItem>(parser(),thisVariant(),HtmlAttribList(),1); warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"empty list!"); retval = Token::make_RetVal_EndList(); goto endlist; } else // found some other tag { // add dummy item to obtain valid HTML children().append<DocHtmlListItem>(parser(),thisVariant(),HtmlAttribList(),1); warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <li> tag but " "found <%s%s> instead!",parser()->context.token->endTag?"/":"",qPrint(parser()->context.token->name)); parser()->tokenizer.pushBackHtmlTag(parser()->context.token->name); goto endlist; } } else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment { // add dummy item to obtain valid HTML children().append<DocHtmlListItem>(parser(),thisVariant(),HtmlAttribList(),1); warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking" " for a html list item"); goto endlist; } else // token other than html token { // add dummy item to obtain valid HTML children().append<DocHtmlListItem>(parser(),thisVariant(),HtmlAttribList(),1); warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <li> tag but found %s token instead!", tok.to_string()); goto endlist; } do { children().append<DocHtmlListItem>(parser(),thisVariant(),parser()->context.token->attribs,num++); DocHtmlListItem *li = children().get_last<DocHtmlListItem>(); retval=li->parse(); } while (retval.is(TokenRetval::RetVal_ListItem)); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while inside <%cl> block", m_type==Unordered ? 'u' : 'o'); } endlist: AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval.is(TokenRetval::RetVal_EndList) ? Token::make_RetVal_OK() : retval; } Token DocHtmlList::parseXml() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); int num=1; auto ns = AutoNodeStack(parser(),thisVariant()); // get next token Token tok=parser()->tokenizer.lex(); // skip whitespace and paragraph breaks while (tok.is_any_of(TokenRetval::TK_WHITESPACE,TokenRetval::TK_NEWPARA)) tok=parser()->tokenizer.lex(); // should find a html tag now if (tok.is(TokenRetval::TK_HTMLTAG)) { HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name); //printf("parser()->context.token->name=%s parser()->context.token->endTag=%d\n",qPrint(parser()->context.token->name),parser()->context.token->endTag); if (tagId==HtmlTagType::XML_ITEM && !parser()->context.token->endTag) // found <item> tag { // ok, we can go on. } else // found some other tag { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <item> tag but " "found <%s> instead!",qPrint(parser()->context.token->name)); parser()->tokenizer.pushBackHtmlTag(parser()->context.token->name); goto endlist; } } else if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while looking" " for a html list item"); goto endlist; } else // token other than html token { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected <item> tag but found %s token instead!", tok.to_string()); goto endlist; } do { children().append<DocHtmlListItem>(parser(),thisVariant(),parser()->context.token->attribs,num++); DocHtmlListItem *li = children().get_last<DocHtmlListItem>(); retval=li->parseXml(); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break; //printf("retval=%x parser()->context.token->name=%s\n",retval,qPrint(parser()->context.token->name)); } while (retval.is(TokenRetval::RetVal_ListItem)); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while inside <list type=\"%s\"> block", m_type==Unordered ? "bullet" : "number"); } endlist: AUTO_TRACE_EXIT("retval={}",retval.to_string()); return (retval.is_any_of(TokenRetval::RetVal_EndList,TokenRetval::RetVal_CloseXml) || parser()->context.token->name=="list") ? Token::make_RetVal_OK() : retval; } //-------------------------------------------------------------------------- Token DocHtmlBlockQuote::parse() { AUTO_TRACE(); Token retval = Token::make_TK_NONE(); auto ns = AutoNodeStack(parser(),thisVariant()); // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=nullptr; do { children().append<DocPara>(parser(),thisVariant()); par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); } while (retval.is(TokenRetval::TK_NEWPARA)); if (par) par->markLast(); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment while inside <blockquote> block"); } AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval.is(TokenRetval::RetVal_EndBlockQuote) ? Token::make_RetVal_OK() : retval; } //--------------------------------------------------------------------------- Token DocParBlock::parse() { AUTO_TRACE(); Token retval = Token::make_TK_NONE(); auto ns = AutoNodeStack(parser(),thisVariant()); // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=nullptr; do { children().append<DocPara>(parser(),thisVariant()); par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); } while (retval.is(TokenRetval::TK_NEWPARA)); if (par) par->markLast(); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval.is(TokenRetval::RetVal_EndBlockQuote) ? Token::make_RetVal_OK() : retval; } //--------------------------------------------------------------------------- DocSimpleListItem::DocSimpleListItem(DocParser *parser,DocNodeVariant *parent) : DocNode(parser,parent) { } Token DocSimpleListItem::parse() { auto ns = AutoNodeStack(parser(),thisVariant()); m_paragraph = createDocNode<DocPara>(parser(),thisVariant()); DocPara *par = &std::get<DocPara>(*m_paragraph); Token rv=par->parse(); par->markFirst(); par->markLast(); return rv; } //-------------------------------------------------------------------------- Token DocSimpleList::parse() { auto ns = AutoNodeStack(parser(),thisVariant()); Token rv = Token::make_TK_NONE(); do { children().append<DocSimpleListItem>(parser(),thisVariant()); DocSimpleListItem *li = children().get_last<DocSimpleListItem>(); rv=li->parse(); } while (rv.is(TokenRetval::RetVal_ListItem)); return (!rv.is(TokenRetval::TK_NEWPARA)) ? rv : Token::make_RetVal_OK(); } //-------------------------------------------------------------------------- DocAutoListItem::DocAutoListItem(DocParser *parser,DocNodeVariant *parent,int indent,int num) : DocCompoundNode(parser,parent), m_indent(indent), m_itemNum(num) { } Token DocAutoListItem::parse() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); // first parse any number of paragraphs bool isFirst=TRUE; DocPara *lastPar=nullptr; do { children().append<DocPara>(parser(),thisVariant()); DocPara *par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); if (!par->isEmpty()) { if (lastPar) lastPar->markLast(FALSE); lastPar=par; } else { children().pop_back(); } // next paragraph should be more indented than the - marker to belong // to this item } while (retval.is(TokenRetval::TK_NEWPARA) && parser()->context.token->indent>m_indent); if (lastPar) lastPar->markLast(); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } //-------------------------------------------------------------------------- DocAutoList::DocAutoList(DocParser *parser,DocNodeVariant *parent,int indent,bool isEnumList, int depth, bool isCheckedList): DocCompoundNode(parser,parent), m_indent(indent), m_isEnumList(isEnumList), m_isCheckedList(isCheckedList), m_depth(depth) { } Token DocAutoList::parse() { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); int num=1; auto ns = AutoNodeStack(parser(),thisVariant()); parser()->tokenizer.startAutoList(); // first item or sub list => create new list do { switch (parser()->context.token->id) { case -1: break; case DocAutoList::Unchecked: // unchecked case DocAutoList::Checked_x: // checked with x case DocAutoList::Checked_X: // checked with X num = parser()->context.token->id; break; default: // explicitly numbered list num=parser()->context.token->id; // override num with real number given break; } children().append<DocAutoListItem>(parser(),thisVariant(),m_indent,num++); retval = children().get_last<DocAutoListItem>()->parse(); //printf("DocAutoList::parse(): retval=0x%x parser()->context.token->indent=%d m_indent=%d " // "m_isEnumList=%d parser()->context.token->isEnumList=%d parser()->context.token->name=%s\n", // retval,parser()->context.token->indent,m_indent,m_isEnumList,parser()->context.token->isEnumList, // qPrint(parser()->context.token->name)); //printf("num=%d parser()->context.token->id=%d\n",num,parser()->context.token->id); } while (retval.is(TokenRetval::TK_LISTITEM) && // new list item m_indent==parser()->context.token->indent && // at same indent level m_isEnumList==parser()->context.token->isEnumList && // of the same kind m_isCheckedList==parser()->context.token->isCheckedList && // of the same kind (parser()->context.token->id==-1 || parser()->context.token->id>=num) // increasing number (or no number or checked list) ); parser()->tokenizer.endAutoList(); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } //-------------------------------------------------------------------------- void DocTitle::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); parser()->tokenizer.setStateTitle(); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) { if (!parser()->defaultHandleToken(thisVariant(),tok,children())) { parser()->errorHandleDefaultToken(thisVariant(),tok,children(),"title section"); } tok = parser()->tokenizer.lex(); } parser()->tokenizer.setStatePara(); parser()->handlePendingStyleCommands(thisVariant(),children()); } void DocTitle::parseFromString(DocNodeVariant *parent,const QCString &text) { parser()->context.insideHtmlLink=TRUE; parser()->pushContext(); // this will create a new parser->context.token parser()->internalValidatingParseDoc(thisVariant(),children(),text); parser()->popContext(); // this will restore the old parser->context.token parser()->context.insideHtmlLink=FALSE; parser()->tokenizer.setStatePara(); flattenParagraphs(thisVariant(),children()); } //-------------------------------------------------------------------------- DocSimpleSect::DocSimpleSect(DocParser *parser,DocNodeVariant *parent,Type t) : DocCompoundNode(parser,parent), m_type(t) { } bool DocSimpleSect::hasTitle() const { return m_title && std::get<DocTitle>(*m_title).hasTitle(); } Token DocSimpleSect::parse(bool userTitle,bool needsSeparator) { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); // handle case for user defined title if (userTitle) { m_title = createDocNode<DocTitle>(parser(),thisVariant()); std::get_if<DocTitle>(m_title.get())->parse(); } // add new paragraph as child if (!children().empty() && std::holds_alternative<DocPara>(children().back())) { std::get<DocPara>(children().back()).markLast(FALSE); } bool markFirst = children().empty(); if (needsSeparator) { children().append<DocSimpleSectSep>(parser(),thisVariant()); } children().append<DocPara>(parser(),thisVariant()); DocPara *par = children().get_last<DocPara>(); if (markFirst) { par->markFirst(); } par->markLast(); // parse the contents of the paragraph Token retval = par->parse(); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; // 0==EOF, TokenRetval::TK_NEWPARA, TokenRetval::TK_LISTITEM, TokenRetval::TK_ENDLIST, TokenRetval::RetVal_SimpleSec } Token DocSimpleSect::parseRcs() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); m_title = createDocNode<DocTitle>(parser(),thisVariant()); DocTitle *title = &std::get<DocTitle>(*m_title); title->parseFromString(thisVariant(),parser()->context.token->name); QCString text = parser()->context.token->text; parser()->pushContext(); // this will create a new parser->context.token parser()->internalValidatingParseDoc(thisVariant(),children(),text); parser()->popContext(); // this will restore the old parser->context.token return Token::make_RetVal_OK(); } Token DocSimpleSect::parseXml() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); Token retval = Token::make_RetVal_OK(); for (;;) { // add new paragraph as child if (!children().empty() && std::holds_alternative<DocPara>(children().back())) { std::get<DocPara>(children().back()).markLast(false); } bool markFirst = children().empty(); children().append<DocPara>(parser(),thisVariant()); DocPara *par = children().get_last<DocPara>(); if (markFirst) { par->markFirst(); } par->markLast(); // parse the contents of the paragraph retval = par->parse(); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break; if (retval.is(TokenRetval::RetVal_CloseXml)) { retval = Token::make_RetVal_OK(); break; } } AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } void DocSimpleSect::appendLinkWord(const QCString &word) { DocPara *p=nullptr; if (children().empty() || (p=std::get_if<DocPara>(&children().back()))==nullptr) { children().append<DocPara>(parser(),thisVariant()); p = children().get_last<DocPara>(); } else { // Comma-separate <seealso> links. p->injectToken(Token::make_TK_WORD(),","); p->injectToken(Token::make_TK_WHITESPACE()," "); } parser()->context.inSeeBlock=TRUE; p->injectToken(Token::make_TK_LNKWORD(),word); parser()->context.inSeeBlock=FALSE; } QCString DocSimpleSect::typeString() const { switch (m_type) { case Unknown: break; case See: return "see"; case Return: return "return"; case Author: // fall through case Authors: return "author"; case Version: return "version"; case Since: return "since"; case Date: return "date"; case Note: return "note"; case Warning: return "warning"; case Pre: return "pre"; case Post: return "post"; case Copyright: return "copyright"; case Invar: return "invariant"; case Remark: return "remark"; case Attention: return "attention"; case Important: return "important"; case User: return "user"; case Rcs: return "rcs"; } return "unknown"; } //-------------------------------------------------------------------------- Token DocParamList::parse(const QCString &cmdName) { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); DocPara *par=nullptr; QCString saveCmdName = cmdName; Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command", qPrint(saveCmdName)); retval = Token::make_RetVal_EndParBlock(); goto endparamlist; } parser()->tokenizer.setStateParam(); tok=parser()->tokenizer.lex(); while (tok.is(TokenRetval::TK_WORD)) /* there is a parameter name */ { if (m_type==DocParamSect::Param) { int typeSeparator = parser()->context.token->name.find('#'); // explicit type position if (typeSeparator!=-1) { parser()->handleParameterType(thisVariant(),m_paramTypes,parser()->context.token->name.left(typeSeparator)); parser()->context.token->name = parser()->context.token->name.mid(typeSeparator+1); parser()->context.hasParamCommand=TRUE; parser()->checkArgumentName(); if (parent() && std::holds_alternative<DocParamSect>(*parent())) { std::get<DocParamSect>(*parent()).m_hasTypeSpecifier=true; } } else { parser()->context.hasParamCommand=TRUE; parser()->checkArgumentName(); } } else if (m_type==DocParamSect::RetVal) { parser()->context.hasReturnCommand=TRUE; parser()->checkRetvalName(); } //m_params.append(parser()->context.token->name); parser()->handleLinkedWord(thisVariant(),m_params); tok=parser()->tokenizer.lex(); } parser()->tokenizer.setStatePara(); if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the " "argument of command %s",qPrint(saveCmdName)); retval = Token::make_RetVal_EndParBlock(); goto endparamlist; } if (!tok.is(TokenRetval::TK_WHITESPACE)) /* premature end of comment block */ { if (!tok.is(TokenRetval::TK_NEWPARA)) /* empty param description */ { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s in comment block while parsing the " "argument of command %s",tok.to_string(),qPrint(saveCmdName)); } retval = Token::make_RetVal_EndParBlock(); goto endparamlist; } m_paragraphs.append<DocPara>(parser(),thisVariant()); par = m_paragraphs.get_last<DocPara>(); retval = par->parse(); par->markFirst(); par->markLast(); endparamlist: AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } Token DocParamList::parseXml(const QCString &paramName) { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); parser()->context.token->name = paramName; if (m_type==DocParamSect::Param) { parser()->context.hasParamCommand=TRUE; parser()->checkArgumentName(); } else if (m_type==DocParamSect::RetVal) { parser()->context.hasReturnCommand=TRUE; parser()->checkRetvalName(); } parser()->handleLinkedWord(thisVariant(),m_params); do { m_paragraphs.append<DocPara>(parser(),thisVariant()); DocPara *par = m_paragraphs.get_last<DocPara>(); retval = par->parse(); if (par->isEmpty()) // avoid adding an empty paragraph for the whitespace // after </para> and before </param> { m_paragraphs.pop_back(); break; } else // append the paragraph to the list { if (!m_paragraphs.empty()) { m_paragraphs.get_last<DocPara>()->markLast(FALSE); } bool markFirst = m_paragraphs.empty(); par = &std::get<DocPara>(m_paragraphs.back()); if (markFirst) { par->markFirst(); } par->markLast(); } if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break; } while (retval.is(TokenRetval::RetVal_CloseXml) && Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_PARAM && Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_TYPEPARAM && Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_EXCEPTION); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) /* premature end of comment block */ { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unterminated param or exception tag"); } else { retval = Token::make_RetVal_OK(); } AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } //-------------------------------------------------------------------------- Token DocParamSect::parse(const QCString &cmdName,bool xmlContext, Direction d) { AUTO_TRACE(); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); if (d!=Unspecified) { m_hasInOutSpecifier=TRUE; } if (!children().empty() && std::holds_alternative<DocParamList>(children().back())) { DocParamList &lastPl = std::get<DocParamList>(children().back()); lastPl.markLast(false); } bool markFirst = children().empty(); children().append<DocParamList>(parser(),thisVariant(),m_type,d); DocParamList *pl = children().get_last<DocParamList>(); if (markFirst) { pl->markFirst(); } pl->markLast(); if (xmlContext) { retval = pl->parseXml(cmdName); } else { retval = pl->parse(cmdName); } if (retval.is(TokenRetval::RetVal_EndParBlock)) { retval = Token::make_RetVal_OK(); } AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } //-------------------------------------------------------------------------- DocPara::DocPara(DocParser *parser,DocNodeVariant *parent) : DocCompoundNode(parser,parent), m_isFirst(FALSE), m_isLast(FALSE) { } Token DocPara::handleSimpleSection(DocSimpleSect::Type t, bool xmlContext) { AUTO_TRACE(); DocSimpleSect *ss=nullptr; bool needsSeparator = FALSE; if (!children().empty() && // has previous element (ss=children().get_last<DocSimpleSect>()) && // was a simple sect ss->type()==t && // of same type t!=DocSimpleSect::User) // but not user defined { // append to previous section needsSeparator = TRUE; } else // start new section { children().append<DocSimpleSect>(parser(),thisVariant(),t); ss = children().get_last<DocSimpleSect>(); } Token rv = Token::make_RetVal_OK(); if (xmlContext) { return ss->parseXml(); } else { rv = ss->parse(t==DocSimpleSect::User,needsSeparator); } return (!rv.is(TokenRetval::TK_NEWPARA)) ? rv : Token::make_RetVal_OK(); } Token DocPara::handleParamSection(const QCString &cmdName, DocParamSect::Type t, bool xmlContext=FALSE, int direction=DocParamSect::Unspecified) { AUTO_TRACE(); DocParamSect *ps = nullptr; if (!children().empty() && // previous element (ps=children().get_last<DocParamSect>()) && // was a param sect ps->type()==t) // of same type { // append to previous section ps } else // start new section { children().append<DocParamSect>(parser(),thisVariant(),t); ps = children().get_last<DocParamSect>(); } Token rv=ps->parse(cmdName,xmlContext, static_cast<DocParamSect::Direction>(direction)); AUTO_TRACE_EXIT("retval={}",rv.to_string()); return (!rv.is(TokenRetval::TK_NEWPARA)) ? rv : Token::make_RetVal_OK(); } void DocPara::handleCite(char cmdChar,const QCString &cmdName) { AUTO_TRACE(); // get the argument of the cite command. Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command", cmdChar,qPrint(cmdName)); return; } parser()->tokenizer.setStateCite(); tok=parser()->tokenizer.lex(); if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the " "argument of command '%c%s'",cmdChar,qPrint(cmdName)); return; } else if (!tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of '%c%s'", tok.to_string(),cmdChar,qPrint(cmdName)); return; } parser()->context.token->sectionId = parser()->context.token->name; children().append<DocCite>( parser(),thisVariant(),parser()->context.token->name,parser()->context.context); parser()->tokenizer.setStatePara(); } void DocPara::handleEmoji(char cmdChar,const QCString &cmdName) { AUTO_TRACE(); // get the argument of the emoji command. Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command", cmdChar,qPrint(cmdName)); return; } parser()->tokenizer.setStateEmoji(); tok=parser()->tokenizer.lex(); if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"no emoji name given or unexpected end of comment block while parsing the " "argument of command '%c%s'",cmdChar,qPrint(cmdName)); parser()->tokenizer.setStatePara(); return; } else if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of '%c%s'", tok.to_string(),cmdChar,qPrint(cmdName)); parser()->tokenizer.setStatePara(); return; } children().append<DocEmoji>(parser(),thisVariant(),parser()->context.token->name); parser()->tokenizer.setStatePara(); } void DocPara::handleDoxyConfig(char cmdChar,const QCString &cmdName) { // get the argument of the cite command. Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command", cmdChar,qPrint(cmdName)); return; } parser()->tokenizer.setStateDoxyConfig(); tok=parser()->tokenizer.lex(); if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the " "argument of command '%c%s'",cmdChar,qPrint(cmdName)); return; } else if (!tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of '%c%s'", tok.to_string(),cmdChar,qPrint(cmdName)); return; } ConfigOption * opt = ConfigImpl::instance()->get(parser()->context.token->name); if (opt) { QCString optionValue; switch (opt->kind()) { case ConfigOption::O_Bool: optionValue = *(static_cast<ConfigBool*>(opt)->valueStringRef()); break; case ConfigOption::O_String: optionValue = *(static_cast<ConfigString*>(opt)->valueRef()); break; case ConfigOption::O_Enum: optionValue = *(static_cast<ConfigEnum*>(opt)->valueRef()); break; case ConfigOption::O_Int: optionValue = *(static_cast<ConfigInt*>(opt)->valueStringRef()); break; case ConfigOption::O_List: { StringVector *lst = static_cast<ConfigList*>(opt)->valueRef(); optionValue=""; if (!lst->empty()) { std::string lstFormat = theTranslator->trWriteList(static_cast<int>(lst->size())).str(); static const reg::Ex marker(R"(@(\d+))"); reg::Iterator it(lstFormat,marker); reg::Iterator end; size_t index=0; // now replace all markers with the real text for ( ; it!=end ; ++it) { const auto &match = *it; size_t newIndex = match.position(); size_t matchLen = match.length(); optionValue += lstFormat.substr(index,newIndex-index); unsigned long entryIndex = std::stoul(match[1].str()); if (entryIndex<(unsigned long)lst->size()) { optionValue += lst->at(entryIndex); } index=newIndex+matchLen; } optionValue+=lstFormat.substr(index); } } break; case ConfigOption::O_Obsolete: warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Obsolete setting for '%c%s': '%s'", cmdChar,qPrint(cmdName),qPrint(parser()->context.token->name)); break; case ConfigOption::O_Disabled: warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Disabled setting (i.e. not supported in this doxygen executable) for '%c%s': '%s'", cmdChar,qPrint(cmdName),qPrint(parser()->context.token->name)); break; case ConfigOption::O_Info: // nothing to show here break; } if (!optionValue.isEmpty()) { children().append<DocWord>(parser(),thisVariant(),optionValue); } } else { warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Unknown option for '%c%s': '%s'", cmdChar,qPrint(cmdName),qPrint(parser()->context.token->name)); children().append<DocWord>(parser(),thisVariant(),parser()->context.token->name); } parser()->tokenizer.setStatePara(); } Token DocPara::handleXRefItem() { AUTO_TRACE(); Token retval=parser()->tokenizer.lex(); ASSERT(retval.is(TokenRetval::TK_WHITESPACE)); parser()->tokenizer.setStateXRefItem(); retval=parser()->tokenizer.lex(); if (retval.is(TokenRetval::RetVal_OK)) { children().append<DocXRefItem>(parser(),thisVariant(), parser()->context.token->id,parser()->context.token->name); DocXRefItem *ref = children().get_last<DocXRefItem>(); if (!ref->parse()) { children().pop_back(); } } parser()->tokenizer.setStatePara(); return retval; } void DocPara::handleShowDate(char cmdChar,const QCString &cmdName) { AUTO_TRACE(); QCString fmt; QCString date; Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command", cmdChar,qPrint(cmdName)); return; } parser()->tokenizer.setStateQuotedString(); tok = parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid <format> argument for command '%c%s'", cmdChar,qPrint(cmdName)); parser()->tokenizer.setStatePara(); return; } fmt = parser()->context.token->name; parser()->tokenizer.setStateShowDate(); tok = parser()->tokenizer.lex(); QCString specDateRaw = tok.is(TokenRetval::TK_WORD) ? parser()->context.token->name : QCString(); QCString specDate = specDateRaw.stripWhiteSpace(); bool specDateOnlyWS = !specDateRaw.isEmpty() && specDate.isEmpty(); if (!specDate.isEmpty() && !tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid <date_time> argument for command '%c%s'", cmdChar,qPrint(cmdName)); parser()->tokenizer.setStatePara(); return; } std::tm dat{}; int specFormat=0; QCString err = dateTimeFromString(specDate,dat,specFormat); if (!err.isEmpty()) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid <date_time> argument for command '%c%s': %s", cmdChar,qPrint(cmdName),qPrint(err)); parser()->tokenizer.setStatePara(); return; } int usedFormat=0; QCString dateTimeStr = formatDateTime(fmt,dat,usedFormat); // warn the user if the format contains markers that are not explicitly filled in for (int i=0;i<SF_NumBits;i++) { int bitMask = 1<<i; if ((usedFormat&bitMask) && !(specFormat&bitMask)) // a part was used in the format string but its value was not specified. { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"'%c%s' <format> parameter '%s' has %s related markers which are not specified in the <date_time> parameter '%s'. Filling in the current value for %s instead.", cmdChar,qPrint(cmdName), qPrint(fmt),SF_bit2str(i),qPrint(specDate),SF_bit2str(i)); } } children().append<DocWord>(parser(),thisVariant(),dateTimeStr); if (specDateOnlyWS) // specDate is only whitespace { children().append<DocWhiteSpace>(parser(),thisVariant()," "); } parser()->tokenizer.setStatePara(); } void DocPara::handleILine(char cmdChar,const QCString &cmdName) { AUTO_TRACE(); parser()->tokenizer.setStateILine(); Token tok = parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"invalid argument for command '%c%s'", cmdChar,qPrint(cmdName)); return; } parser()->tokenizer.setStatePara(); } void DocPara::handleIFile(char cmdChar,const QCString &cmdName) { AUTO_TRACE(); Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command", cmdChar,qPrint(cmdName)); return; } parser()->tokenizer.setStateFile(); tok=parser()->tokenizer.lex(); parser()->tokenizer.setStatePara(); if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of '%c%s'", tok.to_string(),cmdChar,qPrint(cmdName)); return; } parser()->context.fileName = parser()->context.token->name; parser()->tokenizer.setStatePara(); } void DocPara::handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type t) { AUTO_TRACE("cmdName={}",cmdName); QCString saveCmdName = cmdName; Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command", qPrint(saveCmdName)); return; } parser()->tokenizer.setStatePattern(); tok=parser()->tokenizer.lex(); parser()->tokenizer.setStatePara(); if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the " "argument of command %s", qPrint(saveCmdName)); return; } else if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of %s", tok.to_string(),qPrint(saveCmdName)); return; } auto it1 = children().size()>=1 ? std::prev(children().end()) : children().end(); auto it2 = children().size()>=2 ? std::prev(it1) : children().end(); DocNodeVariant *n1 = it1!=children().end() ? &(*it1) : nullptr; DocNodeVariant *n2 = it2!=children().end() ? &(*it2) : nullptr; //TODO get from context the stripCodeComments() bool stripCodeComments = Config_getBool(STRIP_CODE_COMMENTS); children().append<DocIncOperator>(parser(),thisVariant(),t, parser()->context.token->name, parser()->context.context, stripCodeComments, parser()->context.isExample, parser()->context.exampleName ); DocIncOperator *op = children().get_last<DocIncOperator>(); DocIncOperator *n1_docIncOp = std::get_if<DocIncOperator>(n1); DocWhiteSpace *n1_docWs = std::get_if<DocWhiteSpace >(n1); DocIncOperator *n2_docIncOp = std::get_if<DocIncOperator>(n2); bool isFirst = !n1 || // no last node (!n1_docIncOp && !n1_docWs) || // last node is not operator or whitespace (n1_docWs && n2 && !n2_docIncOp); // last node is not operator op->markFirst(isFirst); op->markLast(true); if (n1_docIncOp) { n1_docIncOp->markLast(false); } else if (n1_docWs && n2_docIncOp) { n2_docIncOp->markLast(false); } op->parse(); } template<class T> void DocPara::handleFile(const QCString &cmdName) { AUTO_TRACE("cmdName={}",cmdName); QCString saveCmdName = cmdName; Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command", qPrint(saveCmdName)); return; } parser()->tokenizer.setStateFile(); tok=parser()->tokenizer.lex(); parser()->tokenizer.setStatePara(); if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of %s", tok.to_string(),qPrint(saveCmdName)); return; } QCString name = parser()->context.token->name; children().append<T>(parser(),thisVariant(),name, parser()->context.context, parser()->context.fileName, parser()->tokenizer.getLineNr()); auto df = children().get_last<T>(); if (!df->parse()) { children().pop_back(); } } void DocPara::handleVhdlFlow() { AUTO_TRACE(); children().append<DocVhdlFlow>(parser(),thisVariant()); children().get_last<DocVhdlFlow>()->parse(); } void DocPara::handleLink(const QCString &cmdName,bool isJavaLink) { AUTO_TRACE("cmdName={} isJavaLink={}",cmdName,isJavaLink); QCString saveCmdName = cmdName; Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command", qPrint(saveCmdName)); return; } parser()->tokenizer.setStateLink(); tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"%s as the argument of %s", tok.to_string(),qPrint(saveCmdName)); return; } if (saveCmdName == "javalink") { children().append<DocStyleChange>(parser(),thisVariant(), parser()->context.nodeStack.size(), DocStyleChange::Code,cmdName,TRUE); } parser()->tokenizer.setStatePara(); children().append<DocLink>(parser(),thisVariant(),parser()->context.token->name); DocLink *lnk = children().get_last<DocLink>(); if (saveCmdName == "javalink") { children().append<DocStyleChange>(parser(),thisVariant(), parser()->context.nodeStack.size(), DocStyleChange::Code,cmdName,FALSE); } QCString leftOver = lnk->parse(isJavaLink); if (!leftOver.isEmpty()) { children().append<DocWord>(parser(),thisVariant(),leftOver); } } void DocPara::handleRef(char cmdChar,const QCString &cmdName) { AUTO_TRACE("cmdName={}",cmdName); QCString saveCmdName = cmdName; Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command", cmdChar,qPrint(saveCmdName)); return; } parser()->tokenizer.setStateRef(); tok=parser()->tokenizer.lex(); // get the reference id if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of '%c%s'", tok.to_string(),cmdChar,qPrint(saveCmdName)); goto endref; } children().append<DocRef>(parser(),thisVariant(), parser()->context.token->name, parser()->context.context); children().get_last<DocRef>()->parse(); endref: parser()->tokenizer.setStatePara(); } void DocPara::handleInclude(const QCString &cmdName,DocInclude::Type t) { AUTO_TRACE("cmdName={}",cmdName); QCString saveCmdName = cmdName; Token tok=parser()->tokenizer.lex(); bool isBlock = false; bool trimLeft = false; bool localScope = false; bool stripCodeComments = Config_getBool(STRIP_CODE_COMMENTS); if (tok.is(TokenRetval::TK_WORD) && parser()->context.token->name=="{") { parser()->tokenizer.setStateOptions(); parser()->tokenizer.lex(); parser()->tokenizer.setStatePara(); StringVector optList=split(parser()->context.token->name.str(),","); auto contains = [&optList](const char *kw) { return std::find(optList.begin(),optList.end(),kw)!=optList.end(); }; localScope = contains("local"); if (contains("nostrip")) { stripCodeComments = false; } else if (contains("strip")) { stripCodeComments = true; } if (t==DocInclude::Snippet && contains("trimleft")) { trimLeft = true; } if (contains("lineno")) { if (t==DocInclude::Include) t = DocInclude::IncWithLines; else if (t==DocInclude::Snippet) t = DocInclude::SnippetWithLines; else if (t==DocInclude::DontInclude) t = DocInclude::DontIncWithLines; } tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command", qPrint(saveCmdName)); return; } } else if (tok.is(TokenRetval::TK_WORD) && parser()->context.token->name=="[") { parser()->tokenizer.setStateBlock(); parser()->tokenizer.lex(); isBlock = (parser()->context.token->name.stripWhiteSpace() == "block"); parser()->tokenizer.setStatePara(); parser()->tokenizer.lex(); } else if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command", qPrint(saveCmdName)); return; } parser()->tokenizer.setStateFile(); tok=parser()->tokenizer.lex(); parser()->tokenizer.setStatePara(); if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the " "argument of command %s",qPrint(saveCmdName)); return; } else if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of %s", tok.to_string(),qPrint(saveCmdName)); return; } QCString fileName = parser()->context.token->name; QCString blockId; if (t==DocInclude::Snippet || t==DocInclude::SnippetWithLines) { if (fileName == "this") fileName=parser()->context.fileName; parser()->tokenizer.setStateSnippet(); tok=parser()->tokenizer.lex(); parser()->tokenizer.setStatePara(); if (!tok.is(TokenRetval::TK_WORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected block identifier, but found token %s instead while parsing the %s command", tok.to_string(),qPrint(saveCmdName)); return; } blockId = "["+parser()->context.token->name+"]"; } children().append<DocInclude>(parser(), thisVariant(), fileName, localScope ? parser()->context.context : "", t, stripCodeComments, parser()->context.isExample, parser()->context.exampleName, blockId,isBlock,trimLeft); children().get_last<DocInclude>()->parse(); } void DocPara::handleSection(char cmdChar,const QCString &cmdName) { AUTO_TRACE("cmdName={}",cmdName); QCString saveCmdName = cmdName; // get the argument of the section command. Token tok=parser()->tokenizer.lex(); if (!tok.is(TokenRetval::TK_WHITESPACE)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command", cmdChar,qPrint(saveCmdName)); return; } tok=parser()->tokenizer.lex(); if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the " "argument of command '%c%s'", cmdChar,qPrint(saveCmdName)); return; } else if (!tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of '%c%s'", tok.to_string(),cmdChar,qPrint(saveCmdName)); return; } parser()->context.token->sectionId = parser()->context.token->name; parser()->tokenizer.setStateSkipTitle(); parser()->tokenizer.lex(); parser()->tokenizer.setStatePara(); } Token DocPara::handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level) { AUTO_TRACE(); children().append<DocHtmlHeader>(parser(),thisVariant(),tagHtmlAttribs,level); Token retval = children().get_last<DocHtmlHeader>()->parse(); return retval.is(TokenRetval::RetVal_OK) ? Token::make_TK_NEWPARA() : retval; } // For XML tags whose content is stored in attributes rather than // contained within the element, we need a way to inject the attribute // text into the current paragraph. bool DocPara::injectToken(Token tok,const QCString &tokText) { AUTO_TRACE(); parser()->context.token->name = tokText; return parser()->defaultHandleToken(thisVariant(),tok,children()); } Token DocPara::handleStartCode() { AUTO_TRACE(); Token retval = parser()->tokenizer.lex(); QCString lang = parser()->context.token->name; if (!lang.isEmpty() && lang.at(0)!='.') { lang="."+lang; } if (parser()->context.xmlComment) { parser()->context.token->verb = substitute(substitute(parser()->context.token->verb,"&lt;","<"),"&gt;",">"); } // search for the first non-whitespace line, index is stored in li size_t i=0,li=0,l=parser()->context.token->verb.length(); while (i<l && (parser()->context.token->verb.at(i)==' ' || parser()->context.token->verb.at(i)=='\n')) { if (parser()->context.token->verb.at(i)=='\n') li=i+1; i++; } children().append<DocVerbatim>(parser(),thisVariant(), parser()->context.context, stripIndentation(parser()->context.token->verb.mid(li)), DocVerbatim::Code, parser()->context.isExample, parser()->context.exampleName, FALSE,lang); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"code section ended without end marker"); } parser()->tokenizer.setStatePara(); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } void DocPara::handleInheritDoc() { if (parser()->context.memberDef) // inheriting docs from a member { const MemberDef *reMd = parser()->context.memberDef->reimplements(); if (reMd) // member from which was inherited. { const MemberDef *thisMd = parser()->context.memberDef; //printf("{InheritDocs:%s=>%s}\n",qPrint(parser()->context.memberDef->qualifiedName()),qPrint(reMd->qualifiedName())); parser()->pushContext(); parser()->context.scope=reMd->getOuterScope(); if (parser()->context.scope!=Doxygen::globalScope) { parser()->context.context=parser()->context.scope->name(); } parser()->context.memberDef=reMd; while (!parser()->context.styleStack.empty()) parser()->context.styleStack.pop(); while (!parser()->context.nodeStack.empty()) parser()->context.nodeStack.pop(); parser()->context.copyStack.push_back(reMd); parser()->internalValidatingParseDoc(thisVariant(),children(),reMd->briefDescription()); parser()->internalValidatingParseDoc(thisVariant(),children(),reMd->documentation()); parser()->context.copyStack.pop_back(); auto hasParamCommand = parser()->context.hasParamCommand; auto hasReturnCommand = parser()->context.hasReturnCommand; auto retvalsFound = parser()->context.retvalsFound; auto paramsFound = parser()->context.paramsFound; parser()->popContext(); parser()->context.hasParamCommand = hasParamCommand; parser()->context.hasReturnCommand = hasReturnCommand; parser()->context.retvalsFound = retvalsFound; parser()->context.paramsFound = paramsFound; parser()->context.memberDef = thisMd; } } } Token DocPara::handleCommand(char cmdChar, const QCString &cmdName) { AUTO_TRACE("cmdName={}",cmdName); Token retval = Token::make_RetVal_OK(); CommandType cmdId = Mappers::cmdMapper->map(cmdName); switch (cmdId) { case CommandType::UNKNOWN: { std::string str{cmdChar}; children().append<DocWord>(parser(),thisVariant(),str.c_str() + cmdName); if (isAliasCmd(cmdName.view())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Found unexpanded alias '%c%s'. Check if number of arguments passed is correct.",cmdChar,qPrint(cmdName)); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Found unknown command '%c%s'",cmdChar,qPrint(cmdName)); } } break; case CommandType::CMD_EMPHASIS: children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Italic,cmdName,TRUE); retval=parser()->handleStyleArgument(thisVariant(),children(),cmdName); children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Italic,cmdName,FALSE); if (!retval.is(TokenRetval::TK_WORD)) children().append<DocWhiteSpace>(parser(),thisVariant()," "); break; case CommandType::CMD_BOLD: children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Bold,cmdName,TRUE); retval=parser()->handleStyleArgument(thisVariant(),children(),cmdName); children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Bold,cmdName,FALSE); if (!retval.is(TokenRetval::TK_WORD)) children().append<DocWhiteSpace>(parser(),thisVariant()," "); break; case CommandType::CMD_CODE: children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Code,cmdName,TRUE); retval=parser()->handleStyleArgument(thisVariant(),children(),cmdName); children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Code,cmdName,FALSE); if (!retval.is(TokenRetval::TK_WORD)) children().append<DocWhiteSpace>(parser(),thisVariant()," "); break; case CommandType::CMD_BSLASH: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_BSlash); break; case CommandType::CMD_AT: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_At); break; case CommandType::CMD_LESS: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Less); break; case CommandType::CMD_GREATER: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Greater); break; case CommandType::CMD_AMP: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Amp); break; case CommandType::CMD_DOLLAR: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Dollar); break; case CommandType::CMD_HASH: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Hash); break; case CommandType::CMD_PIPE: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Pipe); break; case CommandType::CMD_DCOLON: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_DoubleColon); break; case CommandType::CMD_PERCENT: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Percent); break; case CommandType::CMD_NDASH: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); break; case CommandType::CMD_MDASH: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); break; case CommandType::CMD_QUOTE: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Quot); break; case CommandType::CMD_PUNT: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Dot); break; case CommandType::CMD_PLUS: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Plus); break; case CommandType::CMD_MINUS: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); break; case CommandType::CMD_EQUAL: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Equal); break; case CommandType::CMD_SA: parser()->context.inSeeBlock=TRUE; retval = handleSimpleSection(DocSimpleSect::See); parser()->context.inSeeBlock=FALSE; break; case CommandType::CMD_RETURN: retval = handleSimpleSection(DocSimpleSect::Return); parser()->context.hasReturnCommand=TRUE; break; case CommandType::CMD_AUTHOR: retval = handleSimpleSection(DocSimpleSect::Author); break; case CommandType::CMD_AUTHORS: retval = handleSimpleSection(DocSimpleSect::Authors); break; case CommandType::CMD_VERSION: retval = handleSimpleSection(DocSimpleSect::Version); break; case CommandType::CMD_SINCE: retval = handleSimpleSection(DocSimpleSect::Since); break; case CommandType::CMD_DATE: retval = handleSimpleSection(DocSimpleSect::Date); break; case CommandType::CMD_NOTE: retval = handleSimpleSection(DocSimpleSect::Note); break; case CommandType::CMD_WARNING: retval = handleSimpleSection(DocSimpleSect::Warning); break; case CommandType::CMD_PRE: retval = handleSimpleSection(DocSimpleSect::Pre); break; case CommandType::CMD_POST: retval = handleSimpleSection(DocSimpleSect::Post); break; case CommandType::CMD_COPYRIGHT: retval = handleSimpleSection(DocSimpleSect::Copyright); break; case CommandType::CMD_INVARIANT: retval = handleSimpleSection(DocSimpleSect::Invar); break; case CommandType::CMD_REMARK: retval = handleSimpleSection(DocSimpleSect::Remark); break; case CommandType::CMD_ATTENTION: retval = handleSimpleSection(DocSimpleSect::Attention); break; case CommandType::CMD_IMPORTANT: retval = handleSimpleSection(DocSimpleSect::Important); break; case CommandType::CMD_PAR: retval = handleSimpleSection(DocSimpleSect::User); break; case CommandType::CMD_LI: { children().append<DocSimpleList>(parser(),thisVariant()); retval = children().get_last<DocSimpleList>()->parse(); } break; case CommandType::CMD_SECTION: { handleSection(cmdChar,cmdName); retval = Token::make_RetVal_Section(); } break; case CommandType::CMD_SUBSECTION: { handleSection(cmdChar,cmdName); retval = Token::make_RetVal_Subsection(); } break; case CommandType::CMD_SUBSUBSECTION: { handleSection(cmdChar,cmdName); retval = Token::make_RetVal_Subsubsection(); } break; case CommandType::CMD_PARAGRAPH: { handleSection(cmdChar,cmdName); retval = Token::make_RetVal_Paragraph(); } break; case CommandType::CMD_SUBPARAGRAPH: { handleSection(cmdChar,cmdName); retval = Token::make_RetVal_SubParagraph(); } break; case CommandType::CMD_SUBSUBPARAGRAPH: { handleSection(cmdChar,cmdName); retval = Token::make_RetVal_SubSubParagraph(); } break; case CommandType::CMD_ISTARTCODE: { parser()->tokenizer.setStateICode(); retval = handleStartCode(); } break; case CommandType::CMD_STARTCODE: { parser()->tokenizer.setStateCode(); retval = handleStartCode(); } break; case CommandType::CMD_HTMLONLY: { parser()->tokenizer.setStateHtmlOnly(); retval = parser()->tokenizer.lex(); children().append<DocVerbatim>(parser(),thisVariant(),parser()->context.context,parser()->context.token->verb,DocVerbatim::HtmlOnly,parser()->context.isExample,parser()->context.exampleName,parser()->context.token->name=="block"); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"htmlonly section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_MANONLY: { parser()->tokenizer.setStateManOnly(); retval = parser()->tokenizer.lex(); children().append<DocVerbatim>(parser(),thisVariant(),parser()->context.context,parser()->context.token->verb,DocVerbatim::ManOnly,parser()->context.isExample,parser()->context.exampleName); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"manonly section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_RTFONLY: { parser()->tokenizer.setStateRtfOnly(); retval = parser()->tokenizer.lex(); children().append<DocVerbatim>(parser(),thisVariant(),parser()->context.context,parser()->context.token->verb,DocVerbatim::RtfOnly,parser()->context.isExample,parser()->context.exampleName); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"rtfonly section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_LATEXONLY: { parser()->tokenizer.setStateLatexOnly(); retval = parser()->tokenizer.lex(); children().append<DocVerbatim>(parser(),thisVariant(),parser()->context.context,parser()->context.token->verb,DocVerbatim::LatexOnly,parser()->context.isExample,parser()->context.exampleName); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"latexonly section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_XMLONLY: { parser()->tokenizer.setStateXmlOnly(); retval = parser()->tokenizer.lex(); children().append<DocVerbatim>(parser(),thisVariant(),parser()->context.context,parser()->context.token->verb,DocVerbatim::XmlOnly,parser()->context.isExample,parser()->context.exampleName); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"xmlonly section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_DBONLY: { parser()->tokenizer.setStateDbOnly(); retval = parser()->tokenizer.lex(); children().append<DocVerbatim>(parser(),thisVariant(),parser()->context.context,parser()->context.token->verb,DocVerbatim::DocbookOnly,parser()->context.isExample,parser()->context.exampleName); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"docbookonly section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_ILITERAL: { DocVerbatim::Type t = DocVerbatim::JavaDocLiteral; parser()->tokenizer.setStateILiteralOpt(); parser()->tokenizer.lex(); QCString fullMatch = parser()->context.token->verb; int idx = fullMatch.find('{'); int idxEnd = fullMatch.find("}",idx+1); StringVector optList; if (idx != -1) // options present { QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace(); optList = split(optStr.str(),","); for (const auto &opt : optList) { if (opt.empty()) continue; QCString locOpt(opt); locOpt = locOpt.stripWhiteSpace().lower(); if (locOpt == "code") { t = DocVerbatim::JavaDocCode; } else if (!locOpt.isEmpty()) { warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Unknown option '%s' for '\\iliteral'",qPrint(opt)); } } } parser()->tokenizer.setStateILiteral(); retval = parser()->tokenizer.lex(); children().append<DocVerbatim>(parser(),thisVariant(),parser()->context.context,parser()->context.token->verb,t,parser()->context.isExample,parser()->context.exampleName); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { if (t == DocVerbatim::JavaDocCode) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"javadoc code section ended without end marker"); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"javadoc literal section ended without end marker"); } } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_IVERBATIM: case CommandType::CMD_VERBATIM: { if (cmdId == CommandType::CMD_VERBATIM) { parser()->tokenizer.setStateVerbatim(); } else { parser()->tokenizer.setStateIVerbatim(); } retval = parser()->tokenizer.lex(); children().append<DocVerbatim>(parser(),thisVariant(),parser()->context.context,parser()->context.token->verb,DocVerbatim::Verbatim,parser()->context.isExample,parser()->context.exampleName); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"verbatim section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_DOT: { children().append<DocVerbatim>(parser(),thisVariant(), parser()->context.context, parser()->context.token->verb, DocVerbatim::Dot, parser()->context.isExample, parser()->context.exampleName); DocVerbatim *dv = children().get_last<DocVerbatim>(); parser()->tokenizer.setStatePara(); QCString width,height; parser()->defaultHandleTitleAndSize(CommandType::CMD_DOT,&children().back(),dv->children(),width,height); parser()->tokenizer.setStateDot(); retval = parser()->tokenizer.lex(); dv->setText(parser()->context.token->verb); dv->setWidth(width); dv->setHeight(height); dv->setLocation(parser()->context.fileName,parser()->tokenizer.getLineNr()); if (!Config_getBool(HAVE_DOT)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"ignoring \\dot command because HAVE_DOT is not set"); children().pop_back(); } if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"dot section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_MSC: { children().append<DocVerbatim>(parser(),thisVariant(), parser()->context.context, parser()->context.token->verb, DocVerbatim::Msc, parser()->context.isExample, parser()->context.exampleName); DocVerbatim *dv = children().get_last<DocVerbatim>(); parser()->tokenizer.setStatePara(); QCString width,height; parser()->defaultHandleTitleAndSize(CommandType::CMD_MSC,&children().back(),dv->children(),width,height); parser()->tokenizer.setStateMsc(); retval = parser()->tokenizer.lex(); dv->setText(parser()->context.token->verb); dv->setWidth(width); dv->setHeight(height); dv->setLocation(parser()->context.fileName,parser()->tokenizer.getLineNr()); if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"msc section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_STARTUML: { QCString jarPath = Config_getString(PLANTUML_JAR_PATH); parser()->tokenizer.setStatePlantUMLOpt(); parser()->tokenizer.lex(); QCString fullMatch = parser()->context.token->sectionId; QCString sectionId = ""; int idx = fullMatch.find('{'); int idxEnd = fullMatch.find("}",idx+1); StringVector optList; QCString engine; if (idx != -1) // options present { QCString optStr = fullMatch.mid(idx+1,idxEnd-idx-1).stripWhiteSpace(); optList = split(optStr.str(),","); for (const auto &opt : optList) { if (opt.empty()) continue; bool found = false; QCString locOpt(opt); locOpt = locOpt.stripWhiteSpace().lower(); if (g_plantumlEngine.find(locOpt.str())!=g_plantumlEngine.end()) { if (!engine.isEmpty()) { warn(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Multiple definition of engine for '\\startuml'"); } engine = locOpt; found = true; } if (!found) { if (sectionId.isEmpty()) { sectionId = opt; } else { warn(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Multiple use of filename for '\\startuml'"); } } } } else { sectionId = parser()->context.token->sectionId; } if (engine.isEmpty()) engine = "uml"; if (sectionId.isEmpty()) { parser()->tokenizer.setStatePlantUMLOpt(); retval = parser()->tokenizer.lex(); assert(retval.is(TokenRetval::RetVal_OK)); sectionId = parser()->context.token->sectionId; sectionId = sectionId.stripWhiteSpace(); } QCString plantFile(sectionId); children().append<DocVerbatim>(parser(),thisVariant(), parser()->context.context, parser()->context.token->verb, DocVerbatim::PlantUML, FALSE,plantFile); DocVerbatim *dv = children().get_last<DocVerbatim>(); dv->setEngine(engine); parser()->tokenizer.setStatePara(); QCString width,height; parser()->defaultHandleTitleAndSize(CommandType::CMD_STARTUML,&children().back(),dv->children(),width,height); parser()->tokenizer.setStatePlantUML(); retval = parser()->tokenizer.lex(); int line = 0; QCString trimmedVerb = stripLeadingAndTrailingEmptyLines(parser()->context.token->verb,line); if (engine == "ditaa") { dv->setUseBitmap(true); } else if (engine == "uml") { int i = trimmedVerb.find('\n'); QCString firstLine = i==-1 ? trimmedVerb : trimmedVerb.left(i); if (firstLine.stripWhiteSpace() == "ditaa") dv->setUseBitmap(true); } dv->setText(trimmedVerb); dv->setWidth(width); dv->setHeight(height); dv->setLocation(parser()->context.fileName,parser()->tokenizer.getLineNr()); if (jarPath.isEmpty()) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"ignoring \\startuml command because PLANTUML_JAR_PATH is not set"); children().pop_back(); } if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"startuml section ended without end marker"); } parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_ENDPARBLOCK: retval = Token::make_RetVal_EndParBlock(); break; case CommandType::CMD_ENDICODE: case CommandType::CMD_ENDCODE: case CommandType::CMD_ENDHTMLONLY: case CommandType::CMD_ENDMANONLY: case CommandType::CMD_ENDRTFONLY: case CommandType::CMD_ENDLATEXONLY: case CommandType::CMD_ENDXMLONLY: case CommandType::CMD_ENDDBONLY: case CommandType::CMD_ENDLINK: case CommandType::CMD_ENDVERBATIM: case CommandType::CMD_ENDIVERBATIM: case CommandType::CMD_ENDILITERAL: case CommandType::CMD_ENDDOT: case CommandType::CMD_ENDMSC: case CommandType::CMD_ENDUML: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected command %s",qPrint(parser()->context.token->name)); break; case CommandType::CMD_PARAM: retval = handleParamSection(cmdName,DocParamSect::Param,FALSE,parser()->context.token->paramDir); break; case CommandType::CMD_TPARAM: retval = handleParamSection(cmdName,DocParamSect::TemplateParam,FALSE,parser()->context.token->paramDir); break; case CommandType::CMD_RETVAL: retval = handleParamSection(cmdName,DocParamSect::RetVal); break; case CommandType::CMD_EXCEPTION: retval = handleParamSection(cmdName,DocParamSect::Exception); break; case CommandType::CMD_XREFITEM: retval = handleXRefItem(); break; case CommandType::CMD_LINEBREAK: { children().append<DocLineBreak>(parser(),thisVariant()); } break; case CommandType::CMD_IANCHOR: case CommandType::CMD_ANCHOR: { parser()->handleAnchor(thisVariant(),children()); } break; case CommandType::CMD_IPREFIX: { parser()->handlePrefix(thisVariant(),children()); } break; case CommandType::CMD_ADDINDEX: { children().append<DocIndexEntry>(parser(),thisVariant(), parser()->context.scope!=Doxygen::globalScope?parser()->context.scope:nullptr, parser()->context.memberDef); retval = children().get_last<DocIndexEntry>()->parse(); } break; case CommandType::CMD_INTERNAL: retval = Token::make_RetVal_Internal(); break; case CommandType::CMD_ENDINTERNAL: retval = Token::make_RetVal_EndInternal(); break; case CommandType::CMD_PARBLOCK: { children().append<DocParBlock>(parser(),thisVariant()); retval = children().get_last<DocParBlock>()->parse(); } break; case CommandType::CMD_COPYDOC: // fall through case CommandType::CMD_COPYBRIEF: // fall through case CommandType::CMD_COPYDETAILS: //retval = Token::make_RetVal_CopyDoc(); // these commands should already be resolved by processCopyDoc() break; case CommandType::CMD_INCLUDE: handleInclude(cmdName,DocInclude::Include); break; case CommandType::CMD_INCWITHLINES: handleInclude(cmdName,DocInclude::IncWithLines); break; case CommandType::CMD_DONTINCLUDE: handleInclude(cmdName,DocInclude::DontInclude); break; case CommandType::CMD_HTMLINCLUDE: handleInclude(cmdName,DocInclude::HtmlInclude); break; case CommandType::CMD_LATEXINCLUDE: handleInclude(cmdName,DocInclude::LatexInclude); break; case CommandType::CMD_RTFINCLUDE: handleInclude(cmdName,DocInclude::RtfInclude); break; case CommandType::CMD_MANINCLUDE: handleInclude(cmdName,DocInclude::ManInclude); break; case CommandType::CMD_XMLINCLUDE: handleInclude(cmdName,DocInclude::XmlInclude); break; case CommandType::CMD_DOCBOOKINCLUDE: handleInclude(cmdName,DocInclude::DocbookInclude); break; case CommandType::CMD_VERBINCLUDE: handleInclude(cmdName,DocInclude::VerbInclude); break; case CommandType::CMD_SNIPPET: handleInclude(cmdName,DocInclude::Snippet); break; case CommandType::CMD_SNIPWITHLINES: handleInclude(cmdName,DocInclude::SnippetWithLines); break; case CommandType::CMD_SKIP: handleIncludeOperator(cmdName,DocIncOperator::Skip); break; case CommandType::CMD_UNTIL: handleIncludeOperator(cmdName,DocIncOperator::Until); break; case CommandType::CMD_SKIPLINE: handleIncludeOperator(cmdName,DocIncOperator::SkipLine); break; case CommandType::CMD_LINE: handleIncludeOperator(cmdName,DocIncOperator::Line); break; case CommandType::CMD_IMAGE: parser()->handleImage(thisVariant(),children()); break; case CommandType::CMD_DOTFILE: if (!Config_getBool(HAVE_DOT)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(), "ignoring \\dotfile command because HAVE_DOT is not set"); } else { handleFile<DocDotFile>(cmdName); } break; case CommandType::CMD_VHDLFLOW: handleVhdlFlow(); break; case CommandType::CMD_MSCFILE: handleFile<DocMscFile>(cmdName); break; case CommandType::CMD_DIAFILE: handleFile<DocDiaFile>(cmdName); break; case CommandType::CMD_PLANTUMLFILE: handleFile<DocPlantUmlFile>(cmdName); break; case CommandType::CMD_LINK: handleLink(cmdName,FALSE); break; case CommandType::CMD_JAVALINK: handleLink(cmdName,TRUE); break; case CommandType::CMD_CITE: handleCite(cmdChar,cmdName); break; case CommandType::CMD_EMOJI: handleEmoji(cmdChar,cmdName); break; case CommandType::CMD_DOXYCONFIG: handleDoxyConfig(cmdChar,cmdName); break; case CommandType::CMD_REF: // fall through case CommandType::CMD_SUBPAGE: handleRef(cmdChar,cmdName); break; case CommandType::CMD_SECREFLIST: { children().append<DocSecRefList>(parser(),thisVariant()); children().get_last<DocSecRefList>()->parse(); } break; case CommandType::CMD_SECREFITEM: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected command '%c%s'",cmdChar,qPrint(parser()->context.token->name)); break; case CommandType::CMD_ENDSECREFLIST: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected command '%c%s'",cmdChar,qPrint(parser()->context.token->name)); break; case CommandType::CMD_FORMULA: { children().append<DocFormula>(parser(),thisVariant(),parser()->context.token->id); } break; //case CommandType::CMD_LANGSWITCH: // retval = handleLanguageSwitch(); // break; case CommandType::CMD_INTERNALREF: //warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected command %s",qPrint(parser()->context.token->name)); { parser()->handleInternalRef(thisVariant(),children()); parser()->tokenizer.setStatePara(); } break; case CommandType::CMD_INHERITDOC: handleInheritDoc(); break; case CommandType::CMD_SHOWDATE: handleShowDate(cmdChar,cmdName); break; case CommandType::CMD_ILINE: handleILine(cmdChar,cmdName); break; case CommandType::CMD_IFILE: handleIFile(cmdChar,cmdName); break; case CommandType::CMD_SETSCOPE: { parser()->tokenizer.setStateSetScope(); (void)parser()->tokenizer.lex(); parser()->context.context = parser()->context.token->name; //printf("Found scope='%s'\n",qPrint(parser()->context.context)); parser()->tokenizer.setStatePara(); } break; default: // we should not get here! warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command '%s' in paragraph context",qPrint(cmdName)); break; } INTERNAL_ASSERT(retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_OK,TokenRetval::RetVal_SimpleSec TokenRetval::TK_LISTITEM,TokenRetval::TK_ENDLIST,TokenRetval::TK_NEWPARA TokenRetval::RetVal_Section,TokenRetval::RetVal_EndList TokenRetval::RetVal_Internal,TokenRetval::RetVal_SwitchLang TokenRetval::RetVal_EndInternal) ); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } static bool findAttribute(const HtmlAttribList &tagHtmlAttribs, const char *attrName, QCString *result) { for (const auto &opt : tagHtmlAttribs) { if (opt.name==attrName) { *result = opt.value; return TRUE; } } return FALSE; } Token DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &tagHtmlAttribs) { AUTO_TRACE("tagName={} #tagHtmlAttrs={}",tagName,tagHtmlAttribs.size()); Token retval = Token::make_RetVal_OK(); HtmlTagType tagId = Mappers::htmlTagMapper->map(tagName); if (parser()->context.token->emptyTag && !(tagId>HtmlTagType::XML_CmdMask) && tagId!=HtmlTagType::UNKNOWN && tagId!=HtmlTagType::HTML_IMG && tagId!=HtmlTagType::HTML_BR && tagId!=HtmlTagType::HTML_HR && tagId!=HtmlTagType::HTML_P && tagId!=HtmlTagType::HTML_DIV && tagId!=HtmlTagType::HTML_SPAN) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"HTML tag ('<%s/>') may not use the 'empty tag' XHTML syntax.", qPrint(tagName)); } switch (tagId) { case HtmlTagType::HTML_UL: if (!parser()->context.token->emptyTag) { children().append<DocHtmlList>(parser(),thisVariant(), tagHtmlAttribs,DocHtmlList::Unordered); retval=children().get_last<DocHtmlList>()->parse(); } break; case HtmlTagType::HTML_OL: if (!parser()->context.token->emptyTag) { children().append<DocHtmlList>(parser(),thisVariant(), tagHtmlAttribs,DocHtmlList::Ordered); retval=children().get_last<DocHtmlList>()->parse(); } break; case HtmlTagType::HTML_LI: if (parser()->context.token->emptyTag) break; if (!insideUL(thisVariant()) && !insideOL(thisVariant())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"lonely <li> tag found"); } else { retval = Token::make_RetVal_ListItem(); } break; case HtmlTagType::HTML_BOLD: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Bold,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_S: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::S,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_STRIKE: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Strike,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_DEL: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Del,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_UNDERLINE: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Underline,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_INS: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Ins,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_CODE: if (parser()->context.token->emptyTag) break; if (parser()->context.xmlComment) // for C# source or inside a <summary> or <remark> section we // treat <code> as an XML tag (so similar to @code) { parser()->tokenizer.setStateXmlCode(); retval = handleStartCode(); } else // normal HTML markup { parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Code,tagName,&parser()->context.token->attribs); } break; case HtmlTagType::HTML_KBD: parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Kbd,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_EMPHASIS: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Italic,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_DIV: parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Div,tagName,&parser()->context.token->attribs); if (parser()->context.token->emptyTag) parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Div,tagName); break; case HtmlTagType::HTML_SPAN: parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Span,tagName,&parser()->context.token->attribs); if (parser()->context.token->emptyTag) parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Span,tagName); break; case HtmlTagType::HTML_SUB: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Subscript,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_SUP: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Superscript,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_CENTER: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Center,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_SMALL: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Small,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_CITE: if (!parser()->context.token->emptyTag) parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Cite,tagName,&parser()->context.token->attribs); break; case HtmlTagType::HTML_PRE: if (parser()->context.token->emptyTag) break; parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Preformatted,tagName,&parser()->context.token->attribs); setInsidePreformatted(TRUE); parser()->tokenizer.setInsidePre(TRUE); break; case HtmlTagType::HTML_P: retval = Token::make_TK_NEWPARA(); break; case HtmlTagType::HTML_DL: if (!parser()->context.token->emptyTag) { children().append<DocHtmlDescList>(parser(),thisVariant(),tagHtmlAttribs); retval=children().get_last<DocHtmlDescList>()->parse(); } break; case HtmlTagType::HTML_DT: if (insideDL(thisVariant())) { retval = Token::make_RetVal_DescTitle(); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag <dt> found"); } break; case HtmlTagType::HTML_DD: if (insideDL(thisVariant())) { retval = Token::make_RetVal_DescData(); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag <dd> found"); } break; case HtmlTagType::HTML_TABLE: if (!parser()->context.token->emptyTag) { children().append<DocHtmlTable>(parser(),thisVariant(),tagHtmlAttribs); retval=children().get_last<DocHtmlTable>()->parse(); } break; case HtmlTagType::HTML_TR: retval = Token::make_RetVal_TableRow(); break; case HtmlTagType::HTML_TD: retval = Token::make_RetVal_TableCell(); break; case HtmlTagType::HTML_TH: retval = Token::make_RetVal_TableHCell(); break; case HtmlTagType::HTML_THEAD: case HtmlTagType::HTML_TBODY: case HtmlTagType::HTML_TFOOT: // for time being ignore </t....> tag break; case HtmlTagType::HTML_CAPTION: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag <caption> found"); break; case HtmlTagType::HTML_BR: { children().append<DocLineBreak>(parser(),thisVariant(),tagHtmlAttribs); } break; case HtmlTagType::HTML_HR: { children().append<DocHorRuler>(parser(),thisVariant(),tagHtmlAttribs); } break; case HtmlTagType::HTML_A: retval = parser()->handleAHref(thisVariant(),children(),tagHtmlAttribs); break; case HtmlTagType::HTML_H1: if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,1); break; case HtmlTagType::HTML_H2: if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,2); break; case HtmlTagType::HTML_H3: if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,3); break; case HtmlTagType::HTML_H4: if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,4); break; case HtmlTagType::HTML_H5: if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,5); break; case HtmlTagType::HTML_H6: if (!parser()->context.token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,6); break; case HtmlTagType::HTML_IMG: { parser()->handleImg(thisVariant(),children(),tagHtmlAttribs); } break; case HtmlTagType::HTML_DETAILS: if (!parser()->context.token->emptyTag) { children().append<DocHtmlDetails>(parser(),thisVariant(),tagHtmlAttribs); retval=children().get_last<DocHtmlDetails>()->parse(); } break; case HtmlTagType::HTML_BLOCKQUOTE: if (!parser()->context.token->emptyTag) { children().append<DocHtmlBlockQuote>(parser(),thisVariant(),tagHtmlAttribs); retval = children().get_last<DocHtmlBlockQuote>()->parse(); } break; case HtmlTagType::XML_SUMMARY: if (insideDetails(thisVariant())) { if (!parser()->context.token->emptyTag) { DocNodeVariant *n=parent(); while (n && !std::holds_alternative<DocHtmlDetails>(*n)) n=::parent(n); DocHtmlDetails *d = std::get_if<DocHtmlDetails>(n); if (d) { if (!d->summary()) // details section does not have a summary yet { d->parseSummary(n,parser()->context.token->attribs); } else { retval = Token::make_TK_NEWPARA(); } } } } break; case HtmlTagType::XML_REMARKS: case HtmlTagType::XML_EXAMPLE: parser()->context.xmlComment=TRUE; // fall through case HtmlTagType::XML_VALUE: case HtmlTagType::XML_PARA: if (!children().empty()) { retval = Token::make_TK_NEWPARA(); } break; case HtmlTagType::XML_DESCRIPTION: if (insideTable(thisVariant())) { retval = Token::make_RetVal_TableCell(); } break; case HtmlTagType::XML_C: parser()->handleStyleEnter(thisVariant(),children(),DocStyleChange::Code,tagName,&parser()->context.token->attribs); break; case HtmlTagType::XML_PARAM: case HtmlTagType::XML_TYPEPARAM: { parser()->context.xmlComment=TRUE; QCString paramName; if (findAttribute(tagHtmlAttribs,"name",&paramName)) { if (paramName.isEmpty()) { if (Config_getBool(WARN_NO_PARAMDOC)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"empty 'name' attribute for <param%s> tag.",tagId==HtmlTagType::XML_PARAM?"":"type"); } } else { retval = handleParamSection(paramName, tagId==HtmlTagType::XML_PARAM ? DocParamSect::Param : DocParamSect::TemplateParam, TRUE); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'name' attribute from <param%s> tag.",tagId==HtmlTagType::XML_PARAM?"":"type"); } } break; case HtmlTagType::XML_PARAMREF: case HtmlTagType::XML_TYPEPARAMREF: { QCString paramName; if (findAttribute(tagHtmlAttribs,"name",&paramName)) { //printf("paramName=%s\n",qPrint(paramName)); children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Italic,tagName,TRUE); children().append<DocWord>(parser(),thisVariant(),paramName); children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Italic,tagName,FALSE); if (!retval.is(TokenRetval::TK_WORD)) children().append<DocWhiteSpace>(parser(),thisVariant()," "); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'name' attribute from <param%sref> tag.",tagId==HtmlTagType::XML_PARAMREF?"":"type"); } } break; case HtmlTagType::XML_EXCEPTION: { parser()->context.xmlComment=TRUE; QCString exceptName; if (findAttribute(tagHtmlAttribs,"cref",&exceptName)) { unescapeCRef(exceptName); retval = handleParamSection(exceptName,DocParamSect::Exception,TRUE); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'cref' attribute from <exception> tag."); } } break; case HtmlTagType::XML_ITEM: case HtmlTagType::XML_LISTHEADER: if (insideTable(thisVariant())) { retval = Token::make_RetVal_TableRow(); } else if (insideUL(thisVariant()) || insideOL(thisVariant())) { retval = Token::make_RetVal_ListItem(); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"lonely <item> tag found"); } break; case HtmlTagType::XML_RETURNS: parser()->context.xmlComment=TRUE; retval = handleSimpleSection(DocSimpleSect::Return,TRUE); parser()->context.hasReturnCommand=TRUE; break; case HtmlTagType::XML_TERM: if (insideTable(thisVariant())) { retval = Token::make_RetVal_TableCell(); } break; case HtmlTagType::XML_SEE: // I'm not sure if <see> is the same as <seealso> or if it // should you link a member without producing a section. The // C# specification is extremely vague about this (but what else // can we expect from Microsoft...) { QCString cref; //printf("HtmlTagType::XML_SEE: empty tag=%d\n",parser()->context.token->emptyTag); if (findAttribute(tagHtmlAttribs,"cref",&cref)) { unescapeCRef(cref); if (parser()->context.token->emptyTag) // <see cref="..."/> style { bool inSeeBlock = parser()->context.inSeeBlock; parser()->context.token->name = cref; parser()->context.inSeeBlock = TRUE; parser()->handleLinkedWord(thisVariant(),children(),TRUE); parser()->context.inSeeBlock = inSeeBlock; } else // <see cref="...">...</see> style { //DocRef *ref = new DocRef(this,cref); //children().append(ref); //ref->parse(); parser()->tokenizer.setStatePara(); children().append<DocLink>(parser(),thisVariant(),cref); DocLink *lnk = children().get_last<DocLink>(); QCString leftOver = lnk->parse(FALSE,TRUE); if (!leftOver.isEmpty()) { children().append<DocWord>(parser(),thisVariant(),leftOver); } } } else if (findAttribute(tagHtmlAttribs,"langword",&cref)) // <see langword="..."/> or <see langword="..."></see> { bool inSeeBlock = parser()->context.inSeeBlock; parser()->context.token->name = cref; parser()->context.inSeeBlock = TRUE; children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Code,tagName,TRUE); parser()->handleLinkedWord(thisVariant(),children(),TRUE); children().append<DocStyleChange>(parser(),thisVariant(),parser()->context.nodeStack.size(),DocStyleChange::Code,tagName,FALSE); parser()->context.inSeeBlock = inSeeBlock; } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'cref' or 'langword' attribute from <see> tag."); } } break; case HtmlTagType::XML_SEEALSO: { parser()->context.xmlComment=TRUE; QCString cref; if (findAttribute(tagHtmlAttribs,"cref",&cref)) { unescapeCRef(cref); // Look for an existing "see" section DocNodeVariant *vss=nullptr; for (auto &n : children()) { DocSimpleSect *candidate = std::get_if<DocSimpleSect>(&n); if (candidate && candidate->type()==DocSimpleSect::See) { vss = &n; } } if (!vss) // start new section { children().append<DocSimpleSect>(parser(),thisVariant(),DocSimpleSect::See); vss = &children().back(); } std::get<DocSimpleSect>(*vss).appendLinkWord(cref); retval = Token::make_RetVal_OK(); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing 'cref' attribute from <seealso> tag."); } } break; case HtmlTagType::XML_LIST: { QCString type; findAttribute(tagHtmlAttribs,"type",&type); DocHtmlList::Type listType = DocHtmlList::Unordered; HtmlAttribList emptyList; if (type=="number") { listType=DocHtmlList::Ordered; } if (type=="table") { children().append<DocHtmlTable>(parser(),thisVariant(),emptyList); retval=children().get_last<DocHtmlTable>()->parseXml(); } else { children().append<DocHtmlList>(parser(),thisVariant(),emptyList,listType); retval=children().get_last<DocHtmlList>()->parseXml(); } } break; case HtmlTagType::XML_INCLUDE: case HtmlTagType::XML_PERMISSION: // These tags are defined in .Net but are currently unsupported parser()->context.xmlComment=TRUE; break; case HtmlTagType::UNKNOWN: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported xml/html tag <%s> found", qPrint(tagName)); children().append<DocWord>(parser(),thisVariant(), "<"+tagName+parser()->context.token->attribsStr+">"); break; case HtmlTagType::XML_INHERITDOC: handleInheritDoc(); break; default: // we should not get here! warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected start tag %s",qPrint(tagName)); ASSERT(0); break; } AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } Token DocPara::handleHtmlEndTag(const QCString &tagName) { AUTO_TRACE("tagName={}",tagName); HtmlTagType tagId = Mappers::htmlTagMapper->map(tagName); Token retval = Token::make_RetVal_OK(); switch (tagId) { case HtmlTagType::HTML_UL: if (!insideUL(thisVariant())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </ul> tag without matching <ul>"); } else { retval = Token::make_RetVal_EndList(); } break; case HtmlTagType::HTML_OL: if (!insideOL(thisVariant())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </ol> tag without matching <ol>"); } else { retval = Token::make_RetVal_EndList(); } break; case HtmlTagType::HTML_LI: if (!insideLI(thisVariant())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </li> tag without matching <li>"); } else { // ignore </li> tags } break; case HtmlTagType::HTML_DETAILS: if (!insideDetails(thisVariant())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </details> tag without matching <details>"); } else { retval = Token::make_RetVal_EndHtmlDetails(); } break; case HtmlTagType::HTML_BLOCKQUOTE: if (!insideBlockQuote(thisVariant())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </blockquote> tag without matching <blockquote>"); } else { retval = Token::make_RetVal_EndBlockQuote(); } break; case HtmlTagType::HTML_BOLD: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Bold,tagName); break; case HtmlTagType::HTML_S: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::S,"s"); break; case HtmlTagType::HTML_STRIKE: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Strike,tagName); break; case HtmlTagType::HTML_DEL: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Del,tagName); break; case HtmlTagType::HTML_UNDERLINE: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Underline,tagName); break; case HtmlTagType::HTML_INS: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Ins,tagName); break; case HtmlTagType::HTML_CODE: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Code,tagName); break; case HtmlTagType::HTML_KBD: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Kbd,tagName); break; case HtmlTagType::HTML_EMPHASIS: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Italic,tagName); break; case HtmlTagType::HTML_DIV: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Div,tagName); break; case HtmlTagType::HTML_SPAN: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Span,tagName); break; case HtmlTagType::HTML_SUB: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Subscript,tagName); break; case HtmlTagType::HTML_SUP: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Superscript,tagName); break; case HtmlTagType::HTML_CENTER: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Center,tagName); break; case HtmlTagType::HTML_SMALL: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Small,tagName); break; case HtmlTagType::HTML_CITE: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Cite,tagName); break; case HtmlTagType::HTML_PRE: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Preformatted,tagName); setInsidePreformatted(FALSE); parser()->tokenizer.setInsidePre(FALSE); break; case HtmlTagType::HTML_P: retval = Token::make_TK_NEWPARA(); break; case HtmlTagType::HTML_DL: retval = Token::make_RetVal_EndDesc(); break; case HtmlTagType::HTML_DT: // ignore </dt> tag break; case HtmlTagType::HTML_DD: // ignore </dd> tag break; case HtmlTagType::HTML_TABLE: retval = Token::make_RetVal_EndTable(); break; case HtmlTagType::HTML_TR: // ignore </tr> tag break; case HtmlTagType::HTML_TD: // ignore </td> tag break; case HtmlTagType::HTML_TH: // ignore </th> tag break; case HtmlTagType::HTML_THEAD: case HtmlTagType::HTML_TBODY: case HtmlTagType::HTML_TFOOT: // for time being ignore </t....> tag break; case HtmlTagType::HTML_CAPTION: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </caption> found"); break; case HtmlTagType::HTML_BR: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal </br> tag found"); break; case HtmlTagType::HTML_H1: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h1> found"); break; case HtmlTagType::HTML_H2: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h2> found"); break; case HtmlTagType::HTML_H3: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h3> found"); break; case HtmlTagType::HTML_H4: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h4> found"); break; case HtmlTagType::HTML_H5: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h5> found"); break; case HtmlTagType::HTML_H6: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </h6> found"); break; case HtmlTagType::HTML_IMG: break; case HtmlTagType::HTML_HR: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal </hr> tag found"); break; case HtmlTagType::HTML_A: //warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected tag </a> found"); // ignore </a> tag (can be part of <a name=...></a> break; case HtmlTagType::XML_TERM: break; case HtmlTagType::XML_SUMMARY: retval = Token::make_TK_NEWPARA(); break; case HtmlTagType::XML_REMARKS: case HtmlTagType::XML_PARA: case HtmlTagType::XML_VALUE: case HtmlTagType::XML_EXAMPLE: case HtmlTagType::XML_PARAM: case HtmlTagType::XML_LIST: case HtmlTagType::XML_TYPEPARAM: case HtmlTagType::XML_RETURNS: case HtmlTagType::XML_SEE: case HtmlTagType::XML_SEEALSO: case HtmlTagType::XML_EXCEPTION: case HtmlTagType::XML_INHERITDOC: retval = Token::make_RetVal_CloseXml(); break; case HtmlTagType::XML_C: parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Code,tagName); break; case HtmlTagType::XML_ITEM: case HtmlTagType::XML_LISTHEADER: case HtmlTagType::XML_INCLUDE: case HtmlTagType::XML_PERMISSION: case HtmlTagType::XML_DESCRIPTION: case HtmlTagType::XML_PARAMREF: case HtmlTagType::XML_TYPEPARAMREF: // These tags are defined in .Net but are currently unsupported break; case HtmlTagType::UNKNOWN: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported xml/html tag </%s> found", qPrint(tagName)); children().append<DocWord>(parser(),thisVariant(),"</"+tagName+">"); break; default: // we should not get here! warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end tag %s",qPrint(tagName)); ASSERT(0); break; } AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } static bool checkIfHtmlEndTagEndsAutoList(DocParser *parser,const DocNodeVariant *n) { // expected hierarchy: // 1. DocAutoListItem <- n // 2. DocAutoList <- parent(n) // 3. DocPara <- parent(parent(n)) // step 1 if (!std::get_if<DocAutoListItem>(n)) // not inside a auto list item { return false; } // step 2 n = parent(n); int indent = 0; const auto docAutoList = std::get_if<DocAutoList>(n); if (docAutoList) // capture indent { indent = docAutoList->indent(); } else { return false; } // step 3 n = parent(n); const auto docPara = std::get_if<DocPara>(n); if (docPara) { QCString tagNameLower = QCString(parser->context.token->name).lower(); auto topStyleChange = [](const DocStyleChangeStack &stack) -> const DocStyleChange & { return std::get<DocStyleChange>(*stack.top()); }; if (parser->context.styleStack.empty() || // no style change (topStyleChange(parser->context.styleStack).tagName()==tagNameLower && // correct style change topStyleChange(parser->context.styleStack).position()!=parser->context.nodeStack.size()) // wrong position, so normal close ) { // insert an artificial 'end of autolist' marker and parse again QCString indentStr; indentStr.fill(' ',indent); parser->tokenizer.unputString("\\ilinebr "+indentStr+".\\ilinebr"+indentStr+"</"+parser->context.token->name+">"); return true; } } return false; } Token DocPara::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); // handle style commands "inherited" from the previous paragraph parser()->handleInitialStyleCommands(thisVariant(),children()); Token tok=parser()->tokenizer.lex(); Token retval = Token::make_TK_NONE(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) // get the next token { reparsetoken: AUTO_TRACE_ADD("token '{}' at {}",tok.to_string(),parser()->tokenizer.getLineNr()); if (tok.is_any_of(TokenRetval::TK_WORD,TokenRetval::TK_LNKWORD,TokenRetval::TK_SYMBOL,TokenRetval::TK_URL, TokenRetval::TK_COMMAND_AT,TokenRetval::TK_COMMAND_BS,TokenRetval::TK_HTMLTAG) ) { AUTO_TRACE_ADD("name={}",parser()->context.token->name); } switch(tok.value()) { case TokenRetval::TK_WORD: children().append<DocWord>(parser(),thisVariant(),parser()->context.token->name); break; case TokenRetval::TK_LNKWORD: parser()->handleLinkedWord(thisVariant(),children()); break; case TokenRetval::TK_URL: children().append<DocURL>(parser(),thisVariant(),parser()->context.token->name,parser()->context.token->isEMailAddr); break; case TokenRetval::TK_WHITESPACE: { // prevent leading whitespace and collapse multiple whitespace areas if (insidePRE(thisVariant()) || // all whitespace is relevant ( // remove leading whitespace !children().empty() && // and whitespace after certain constructs !holds_one_of_alternatives<DocHtmlDescList, DocHtmlTable, DocHtmlList, DocSimpleSect, DocAutoList, DocSimpleList, DocHtmlHeader, DocHtmlBlockQuote, DocParamSect, DocHtmlDetails, DocXRefItem>(children().back()) ) ) { children().append<DocWhiteSpace>(parser(),thisVariant(),parser()->context.token->chars); } } break; case TokenRetval::TK_LISTITEM: { AUTO_TRACE_ADD("found list item at {}",parser()->context.token->indent); const DocNodeVariant *n=parent(); while (n && !std::holds_alternative<DocAutoList>(*n)) n=::parent(n); const DocAutoList *al = std::get_if<DocAutoList>(n); if (al) // we found an auto list up in the hierarchy { AUTO_TRACE_ADD("previous list item at {}",al->indent()); if (al->indent()>=parser()->context.token->indent) // new item at the same or lower indent level { retval = Token::make_TK_LISTITEM(); goto endparagraph; } } // determine list depth int depth = 0; n=parent(); while (n) { al = std::get_if<DocAutoList>(n); if (al && al->isEnumList()) depth++; n=::parent(n); } // first item or sub list => create new list do { children().append<DocAutoList>(parser(),thisVariant(), parser()->context.token->indent, parser()->context.token->isEnumList,depth, parser()->context.token->isCheckedList); al = children().get_last<DocAutoList>(); retval = children().get_last<DocAutoList>()->parse(); } while (retval.is(TokenRetval::TK_LISTITEM) && // new list al->indent()==parser()->context.token->indent // at same indent level ); // check the return value if (retval.is(TokenRetval::RetVal_SimpleSec)) // auto list ended due to simple section command { // Reparse the token that ended the section at this level, // so a new simple section will be started at this level. // This is the same as unputting the last read token and continuing. parser()->context.token->name = parser()->context.token->simpleSectName; if (parser()->context.token->name.startsWith("rcs:")) // RCS section { parser()->context.token->name = parser()->context.token->name.mid(4); parser()->context.token->text = parser()->context.token->simpleSectText; tok = Token::make_TK_RCSTAG(); } else // other section { tok = Token::make_TK_COMMAND_BS(); } AUTO_TRACE_ADD("reparsing command {}",parser()->context.token->name); goto reparsetoken; } else if (retval.is(TokenRetval::TK_ENDLIST)) { if (al->indent()>parser()->context.token->indent) // end list { goto endparagraph; } else // continue with current paragraph { } } else // paragraph ended due to TokenRetval::TK_NEWPARA, TokenRetval::TK_LISTITEM, or EOF { goto endparagraph; } } break; case TokenRetval::TK_ENDLIST: AUTO_TRACE_ADD("Found end of list inside of paragraph at line {}",parser()->tokenizer.getLineNr()); if (std::get_if<DocAutoListItem>(parent())) { const DocAutoList *al = std::get_if<DocAutoList>(::parent(parent())); if (al && al->indent()>=parser()->context.token->indent) { // end of list marker ends this paragraph retval = Token::make_TK_ENDLIST(); goto endparagraph; } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"End of list marker found " "has invalid indent level"); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"End of list marker found without any preceding " "list items"); } break; case TokenRetval::TK_COMMAND_AT: // fall through case TokenRetval::TK_COMMAND_BS: { // see if we have to start a simple section CommandType cmd = Mappers::cmdMapper->map(parser()->context.token->name); const DocNodeVariant *n=parent(); while (n && !std::holds_alternative<DocSimpleSect>(*n) && !std::holds_alternative<DocParamSect>(*n)) { n=::parent(n); } if (cmd>CommandType::SIMPLESECT_BIT) { if (n) // already in a simple section { // simple section cannot start in this paragraph, need // to unwind the stack and remember the command. parser()->context.token->simpleSectName = parser()->context.token->name; retval = Token::make_RetVal_SimpleSec(); goto endparagraph; } } // see if we are in a simple list n=parent(); while (n && !std::holds_alternative<DocSimpleListItem>(*n)) n=::parent(n); if (n) { if (cmd==CommandType::CMD_LI) { retval = Token::make_RetVal_ListItem(); goto endparagraph; } } // handle the command retval=handleCommand(tok.command_to_char(),parser()->context.token->name); AUTO_TRACE_ADD("handleCommand returns {}",retval.to_string()); // check the return value if (retval.is(TokenRetval::RetVal_SimpleSec)) { // Reparse the token that ended the section at this level, // so a new simple section will be started at this level. // This is the same as unputting the last read token and continuing. parser()->context.token->name = parser()->context.token->simpleSectName; if (parser()->context.token->name.startsWith("rcs:")) // RCS section { parser()->context.token->name = parser()->context.token->name.mid(4); parser()->context.token->text = parser()->context.token->simpleSectText; tok = Token::make_TK_RCSTAG(); } else // other section { tok = Token::make_TK_COMMAND_BS(); } AUTO_TRACE_ADD("reparsing command {}",parser()->context.token->name); goto reparsetoken; } else if (retval.value()>TokenRetval::TK_NONE && retval.value()<TokenRetval::RetVal_OK) { // the command ended with a new command, reparse this token tok = retval; goto reparsetoken; } else if (retval.value()!=TokenRetval::RetVal_OK) // end of file, end of paragraph, start or end of section // or some auto list marker { goto endparagraph; } } break; case TokenRetval::TK_HTMLTAG: { if (!parser()->context.token->endTag) // found a start tag { retval = handleHtmlStartTag(parser()->context.token->name,parser()->context.token->attribs); } else // found an end tag { if (checkIfHtmlEndTagEndsAutoList(parser(),parent())) { break; // new code has been pushed back to the scanner, need to reparse } retval = handleHtmlEndTag(parser()->context.token->name); } if (!retval.is(TokenRetval::RetVal_OK)) { goto endparagraph; } } break; case TokenRetval::TK_SYMBOL: { HtmlEntityMapper::SymType s = DocSymbol::decodeSymbol(parser()->context.token->name); if (s!=HtmlEntityMapper::Sym_Unknown) { children().append<DocSymbol>(parser(),thisVariant(),s); } else { children().append<DocWord>(parser(),thisVariant(),parser()->context.token->name); warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '%s' found", qPrint(parser()->context.token->name)); } break; } case TokenRetval::TK_NEWPARA: retval = Token::make_TK_NEWPARA(); goto endparagraph; case TokenRetval::TK_RCSTAG: { const DocNodeVariant *n=parent(); while (n && !std::holds_alternative<DocSimpleSect>(*n) && !std::holds_alternative<DocParamSect>(*n)) { n=::parent(n); } if (n) // already in a simple section { // simple section cannot start in this paragraph, need // to unwind the stack and remember the command. parser()->context.token->simpleSectName = "rcs:"+parser()->context.token->name; parser()->context.token->simpleSectText = parser()->context.token->text; retval = Token::make_RetVal_SimpleSec(); goto endparagraph; } // see if we are in a simple list children().append<DocSimpleSect>(parser(),thisVariant(),DocSimpleSect::Rcs); children().get_last<DocSimpleSect>()->parseRcs(); } break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Found unexpected token (id=%s)",tok.to_string()); break; } tok=parser()->tokenizer.lex(); } retval=Token::make_TK_NONE(); endparagraph: parser()->handlePendingStyleCommands(thisVariant(),children()); DocPara *par = std::get_if<DocPara>(parser()->context.nodeStack.top()); if (!parser()->context.token->endTag && par && retval.is(TokenRetval::TK_NEWPARA) && parser()->context.token->name.lower() == "p") { par->setAttribs(parser()->context.token->attribs); } INTERNAL_ASSERT(retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::TK_NEWPARA,TokenRetval::TK_LISTITEM, TokenRetval::TK_ENDLIST,TokenRetval::RetVal_OK) ); AUTO_TRACE_EXIT("retval={}",retval.to_string()); return retval; } //-------------------------------------------------------------------------- Token DocSection::parse() { AUTO_TRACE("start {} level={}", parser()->context.token->sectionId, m_level); Token retval = Token::make_RetVal_OK(); auto ns = AutoNodeStack(parser(),thisVariant()); if (!m_id.isEmpty()) { const SectionInfo *sec = SectionManager::instance().find(m_id); if (sec) { m_file = sec->fileName(); m_anchor = sec->label(); QCString titleStr = sec->title(); if (titleStr.isEmpty()) titleStr = sec->label(); m_title = createDocNode<DocTitle>(parser(),thisVariant()); DocTitle *title = &std::get<DocTitle>(*m_title); title->parseFromString(thisVariant(),titleStr); } } // first parse any number of paragraphs bool isFirst=TRUE; DocPara *lastPar=nullptr; do { children().append<DocPara>(parser(),thisVariant()); DocPara *par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); if (!par->isEmpty()) { if (lastPar) lastPar->markLast(FALSE); lastPar = par; } else { children().pop_back(); } if (retval.is(TokenRetval::TK_LISTITEM)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid list item found"); } if (retval.is(TokenRetval::RetVal_Internal)) { children().append<DocInternal>(parser(),thisVariant()); retval = children().get_last<DocInternal>()->parse(m_level+1); if (retval.is(TokenRetval::RetVal_EndInternal)) { retval = Token::make_RetVal_OK(); } } } while (!retval.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF, TokenRetval::RetVal_Section, TokenRetval::RetVal_Subsection, TokenRetval::RetVal_Subsubsection, TokenRetval::RetVal_Paragraph, TokenRetval::RetVal_SubParagraph, TokenRetval::RetVal_SubSubParagraph, TokenRetval::RetVal_EndInternal) ); if (lastPar) lastPar->markLast(); while (true) { if (retval.is(TokenRetval::RetVal_Subsection) && m_level<=1) { // then parse any number of nested sections while (retval.is(TokenRetval::RetVal_Subsection)) // more sections follow { children().append<DocSection>(parser(),thisVariant(), 2, parser()->context.token->sectionId); retval = children().get_last<DocSection>()->parse(); } break; } else if (retval.is(TokenRetval::RetVal_Subsubsection) && m_level<=2) { if ((m_level <= 1) && !AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str())) { warn_doc_error(parser()->context.fileName, parser()->tokenizer.getLineNr(), "Unexpected subsubsection command found inside %s!", g_sectionLevelToName[m_level]); } // then parse any number of nested sections while (retval.is(TokenRetval::RetVal_Subsubsection)) // more sections follow { children().append<DocSection>(parser(),thisVariant(), 3, parser()->context.token->sectionId); retval = children().get_last<DocSection>()->parse(); } if (!(m_level < 2 && retval.is(TokenRetval::RetVal_Subsection))) break; } else if (retval.is(TokenRetval::RetVal_Paragraph) && m_level<=3) { if ((m_level <= 2) && !AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Unexpected paragraph command found inside %s!", g_sectionLevelToName[m_level]); } // then parse any number of nested sections while (retval.is(TokenRetval::RetVal_Paragraph)) // more sections follow { children().append<DocSection>(parser(),thisVariant(), 4, parser()->context.token->sectionId); retval = children().get_last<DocSection>()->parse(); } if (!(m_level<3 && (retval.is_any_of(TokenRetval::RetVal_Subsection,TokenRetval::RetVal_Subsubsection)))) break; } else if (retval.is(TokenRetval::RetVal_SubParagraph) && m_level<=4) { if ((m_level <= 3) && !AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Unexpected subparagraph command found inside %s!", g_sectionLevelToName[m_level]); } // then parse any number of nested sections while (retval.is(TokenRetval::RetVal_SubParagraph)) // more sections follow { children().append<DocSection>(parser(),thisVariant(), 5, parser()->context.token->sectionId); retval = children().get_last<DocSection>()->parse(); } if (!(m_level<4 && (retval.is_any_of(TokenRetval::RetVal_Subsection,TokenRetval::RetVal_Subsubsection,TokenRetval::RetVal_Paragraph)))) break; } else if (retval.is(TokenRetval::RetVal_SubSubParagraph) && m_level<=5) { if ((m_level <= 4) && !AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str())) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(), "Unexpected subsubparagraph command found inside %s!", g_sectionLevelToName[m_level]); } // then parse any number of nested sections while (retval.is(TokenRetval::RetVal_SubSubParagraph)) // more sections follow { children().append<DocSection>(parser(),thisVariant(), 6, parser()->context.token->sectionId); retval = children().get_last<DocSection>()->parse(); } if (!(m_level<5 && (retval.is_any_of( TokenRetval::RetVal_Subsection, TokenRetval::RetVal_Subsubsection, TokenRetval::RetVal_Paragraph, TokenRetval::RetVal_SubParagraph)))) break; } else { break; } } INTERNAL_ASSERT(retval.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF, TokenRetval::RetVal_Section, TokenRetval::RetVal_Subsection, TokenRetval::RetVal_Subsubsection, TokenRetval::RetVal_Paragraph, TokenRetval::RetVal_SubParagraph, TokenRetval::RetVal_SubSubParagraph, TokenRetval::RetVal_Internal, TokenRetval::RetVal_EndInternal) ); AUTO_TRACE_EXIT("retval={}", retval.to_string()); return retval; } //-------------------------------------------------------------------------- void DocText::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); parser()->tokenizer.setStateText(); Token tok = parser()->tokenizer.lex(); while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF)) // get the next token { switch(tok.value()) { case TokenRetval::TK_WORD: children().append<DocWord>(parser(),thisVariant(),parser()->context.token->name); break; case TokenRetval::TK_WHITESPACE: children().append<DocWhiteSpace>(parser(),thisVariant(),parser()->context.token->chars); break; case TokenRetval::TK_SYMBOL: { HtmlEntityMapper::SymType s = DocSymbol::decodeSymbol(parser()->context.token->name); if (s!=HtmlEntityMapper::Sym_Unknown) { children().append<DocSymbol>(parser(),thisVariant(),s); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '%s' found", qPrint(parser()->context.token->name)); } } break; case TokenRetval::TK_COMMAND_AT: // fall through case TokenRetval::TK_COMMAND_BS: switch (Mappers::cmdMapper->map(parser()->context.token->name)) { case CommandType::CMD_BSLASH: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_BSlash); break; case CommandType::CMD_AT: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_At); break; case CommandType::CMD_LESS: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Less); break; case CommandType::CMD_GREATER: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Greater); break; case CommandType::CMD_AMP: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Amp); break; case CommandType::CMD_DOLLAR: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Dollar); break; case CommandType::CMD_HASH: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Hash); break; case CommandType::CMD_DCOLON: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_DoubleColon); break; case CommandType::CMD_PERCENT: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Percent); break; case CommandType::CMD_NDASH: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); break; case CommandType::CMD_MDASH: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); break; case CommandType::CMD_QUOTE: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Quot); break; case CommandType::CMD_PUNT: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Dot); break; case CommandType::CMD_PLUS: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Plus); break; case CommandType::CMD_MINUS: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Minus); break; case CommandType::CMD_EQUAL: children().append<DocSymbol>(parser(),thisVariant(),HtmlEntityMapper::Sym_Equal); break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command '%s' found", qPrint(parser()->context.token->name)); break; } break; default: warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s", tok.to_string()); break; } tok = parser()->tokenizer.lex(); } parser()->handleUnclosedStyleCommands(); } //-------------------------------------------------------------------------- void DocRoot::parse() { AUTO_TRACE(); auto ns = AutoNodeStack(parser(),thisVariant()); parser()->tokenizer.setStatePara(); Token retval = Token::make_TK_NONE(); // first parse any number of paragraphs bool isFirst=TRUE; DocPara *lastPar = nullptr; do { { children().append<DocPara>(parser(),thisVariant()); DocPara *par = children().get_last<DocPara>(); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); if (par->isEmpty() && par->attribs().empty()) { children().pop_back(); } else { lastPar = par; } } auto checkParagraph = [this,&retval](Token t,int level,const char *sectionType,const char *parentSectionType) { if (retval == t) { if (!AnchorGenerator::instance().isGenerated(parser()->context.token->sectionId.str())) { warn_doc_error(parser()->context.fileName, parser()->tokenizer.getLineNr(), "found %s command (id: '%s') outside of %s context!", sectionType,qPrint(parser()->context.token->sectionId),parentSectionType); } while (retval==t) { if (!parser()->context.token->sectionId.isEmpty()) { const SectionInfo *sec=SectionManager::instance().find(parser()->context.token->sectionId); if (sec) { children().append<DocSection>(parser(),thisVariant(), level, parser()->context.token->sectionId); retval = children().get_last<DocSection>()->parse(); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid %s id '%s'; ignoring %s", sectionType,qPrint(parser()->context.token->sectionId),sectionType); retval = Token::make_TK_NONE(); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing id for %s; ignoring %s",sectionType,sectionType); retval = Token::make_TK_NONE(); } } } }; checkParagraph(Token::make_RetVal_SubSubParagraph(), 6, "subsubparagraph", "subparagraph" ); checkParagraph(Token::make_RetVal_SubParagraph(), 5, "subparagraph", "paragraph" ); checkParagraph(Token::make_RetVal_Paragraph(), 4, "paragraph", "subsubsection" ); checkParagraph(Token::make_RetVal_Subsubsection(), 3, "subsubsection", "subsection" ); checkParagraph(Token::make_RetVal_Subsection(), 2, "subsection", "section" ); if (retval.is(TokenRetval::TK_LISTITEM)) { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid list item found"); } if (retval.is(TokenRetval::RetVal_Internal)) { children().append<DocInternal>(parser(),thisVariant()); retval = children().get_last<DocInternal>()->parse(1); } } while (!retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF,TokenRetval::RetVal_Section)); if (lastPar) lastPar->markLast(); //printf("DocRoot::parse() retval=%d %d\n",retval,TokenRetval::RetVal_Section); // then parse any number of level1 sections while (retval.is(TokenRetval::RetVal_Section)) { if (!parser()->context.token->sectionId.isEmpty()) { const SectionInfo *sec=SectionManager::instance().find(parser()->context.token->sectionId); if (sec) { children().append<DocSection>(parser(),thisVariant(), 1, parser()->context.token->sectionId); retval = children().get_last<DocSection>()->parse(); } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Invalid section id '%s'; ignoring section",qPrint(parser()->context.token->sectionId)); retval = Token::make_TK_NONE(); } } else { warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Missing id for section; ignoring section"); retval = Token::make_TK_NONE(); } } parser()->handleUnclosedStyleCommands(); }
222,663
C++
.cpp
5,793
31.456068
240
0.615241
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,490
vhdldocgen.cpp
doxygen_doxygen/src/vhdldocgen.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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. * */ /****************************************************************************** * Parser for VHDL subset * written by M. Kreis * supports VHDL-87/93/2008 * does not support VHDL-AMS ******************************************************************************/ // global includes #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <map> #include <algorithm> #include <unordered_set> #include <mutex> /* --------------------------------------------------------------- */ // local includes #include "qcstring.h" #include "vhdldocgen.h" #include "message.h" #include "config.h" #include "doxygen.h" #include "util.h" #include "language.h" #include "commentscan.h" #include "definition.h" #include "searchindex.h" #include "outputlist.h" #include "parserintf.h" #include "layout.h" #include "arguments.h" #include "portable.h" #include "memberlist.h" #include "memberdef.h" #include "groupdef.h" #include "classlist.h" #include "namespacedef.h" #include "filename.h" #include "membergroup.h" #include "memberdef.h" #include "membername.h" #include "plantuml.h" #include "vhdljjparser.h" #include "VhdlParser.h" #include "regex.h" #include "plantuml.h" #include "textstream.h" #include "moduledef.h" //#define DEBUGFLOW #define theTranslator_vhdlType theTranslator->trVhdlType static void initUCF(Entry* root,const QCString &type,QCString &qcs,int line,const QCString & fileName,QCString & brief); static void writeUCFLink(const MemberDef* mdef,OutputList &ol); static void addInstance(ClassDefMutable* entity, ClassDefMutable* arch, ClassDefMutable *inst, const std::shared_ptr<Entry> &cur); static const MemberDef *flowMember=nullptr; void VhdlDocGen::setFlowMember( const MemberDef* mem) { flowMember=mem; } const MemberDef* VhdlDocGen::getFlowMember() { return flowMember; } //-------------------------------------------------------------------------------------------------- static void writeLink(const MemberDef* mdef,OutputList &ol) { ol.writeObjectLink(mdef->getReference(), mdef->getOutputFileBase(), mdef->anchor(), mdef->name()); } static void startFonts(const QCString& q, const char *keyword,OutputList& ol) { auto &codeOL = ol.codeGenerators(); codeOL.startFontClass(keyword); codeOL.codify(q); codeOL.endFontClass(); } static QCString splitString(QCString& str,char c) { QCString n=str; int i=str.find(c); if (i>0) { n=str.left(i); str=str.remove(0,i+1); } return n; } static int compareString(const QCString& s1,const QCString& s2) { return qstricmp(s1.stripWhiteSpace(),s2.stripWhiteSpace()); } //-------------------------------------------------------------------------------------------------- // vhdl keywords included VHDL 2008 static const std::unordered_set< std::string > g_vhdlKeyWordSet0 = { "abs","access","after","alias","all","and","architecture","array","assert","assume","assume_guarantee","attribute", "begin","block","body","buffer","bus", "case","component","configuration","constant","context","cover", "default","disconnect","downto", "else","elsif","end","entity","exit", "fairness","file","for","force","function", "generate","generic","group","guarded", "if","impure","in","inertial","inout","is", "label","library","linkage","literal","loop", "map","mod", "nand","new","next","nor","not","null", "of","on","open","or","others","out", "package","parameter","port","postponed","procedure","process","property","protected","pure", "range","record","register","reject","release","restrict","restrict_guarantee","rem","report","rol","ror","return", "select","sequence","severity","signal","shared","sla","sll","sra","srl","strong","subtype", "then","to","transport","type", "unaffected","units","until","use", "variable","vmode","vprop","vunit", "wait","when","while","with", "xor","xnor" }; // type static const std::unordered_set< std::string> g_vhdlKeyWordSet1 = { "natural","unsigned","signed","string","boolean", "bit","bit_vector","character", "std_ulogic","std_ulogic_vector","std_logic","std_logic_vector","integer", "real","float","ufixed","sfixed","time","positive" }; // logic static const std::unordered_set< std::string > g_vhdlKeyWordSet2 = { "abs","and","or","not","mod","xor","rem","xnor","ror","rol","sla","sll" }; // predefined attributes static const std::unordered_set< std::string > g_vhdlKeyWordSet3 = { "base","left","right","high","low","ascending", "image","value","pos","val","succ","pred","leftof","rightof","left","right","high","low", "range","reverse_range","length","ascending","delayed","stable","quiet","transaction","event", "active","last_event","last_active","last_value","driving","driving_value","simple_name","instance_name","path_name" }; void VhdlDocGen::init() { } /*! * returns the color of a keyword */ const char* VhdlDocGen::findKeyWord(const QCString& kw) { std::string word=kw.lower().str(); if (word.empty()) return nullptr; if (g_vhdlKeyWordSet0.find(word)!=g_vhdlKeyWordSet0.end()) return "keywordflow"; if (g_vhdlKeyWordSet1.find(word)!=g_vhdlKeyWordSet1.end()) return "keywordtype"; if (g_vhdlKeyWordSet2.find(word)!=g_vhdlKeyWordSet2.end()) return "vhdllogic"; if (g_vhdlKeyWordSet3.find(word)!=g_vhdlKeyWordSet3.end()) return "vhdlkeyword"; return nullptr; } ClassDef *VhdlDocGen::getClass(const QCString &name) { if (name.isEmpty()) return nullptr; return Doxygen::classLinkedMap->find(QCString(name).stripWhiteSpace()); } ClassDef* VhdlDocGen::getPackageName(const QCString & name) { return getClass(name); } static std::recursive_mutex g_vhdlMutex; static std::map<std::string,const MemberDef*> g_varMap; static std::vector<ClassDef*> g_classList; static std::map<ClassDef*,std::vector<ClassDef*> > g_packages; const MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName) { std::lock_guard lock(g_vhdlMutex); ClassDef *ecd=nullptr; const MemberDef *mdef=nullptr; ClassDef *cd=getClass(className); //printf("VhdlDocGen::findMember(%s,%s)=%p\n",qPrint(className),qPrint(memName),cd); if (cd==nullptr) return nullptr; mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType::VariableMembers()); if (mdef) return mdef; mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType::PubMethods()); if (mdef) return mdef; // nothing found so far // if we are an architecture or package body search in entity if (VhdlDocGen::convert(cd->protection())==VhdlDocGen::ARCHITECTURECLASS || VhdlDocGen::convert(cd->protection())==VhdlDocGen::PACKBODYCLASS) { Definition *d = cd->getOuterScope(); // searching upper/lower case names QCString tt=d->name(); ecd =getClass(tt); if (!ecd) { tt=tt.upper(); ecd =getClass(tt); } if (!ecd) { tt=tt.lower(); ecd =getClass(tt); } if (ecd) //d && d->definitionType()==Definition::TypeClass) { //ClassDef *ecd = (ClassDef*)d; mdef=VhdlDocGen::findMemberDef(ecd,memName,MemberListType::VariableMembers()); if (mdef) return mdef; mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType::PubMethods()); if (mdef) return mdef; } } if (VhdlDocGen::convert(cd->protection())==VhdlDocGen::ARCHITECTURECLASS || VhdlDocGen::convert(cd->protection())==VhdlDocGen::PACKBODYCLASS) { Definition *d = cd->getOuterScope(); QCString tt=d->name(); ClassDef *acd =getClass(tt); if (!acd) { tt=tt.upper(); acd =getClass(tt); } if (!acd) { tt=tt.lower(); acd =getClass(tt); } if (acd) //d && d->definitionType()==Definition::TypeClass) { if(g_packages.find(acd)==g_packages.end()) { VhdlDocGen::findAllPackages(acd); } } } else { ecd=cd; if (g_packages.find(ecd)==g_packages.end()) VhdlDocGen::findAllPackages(ecd); } if (ecd) { auto cList_it = g_packages.find(ecd); if (cList_it!=g_packages.end()) { for (const auto &cdp : cList_it->second) { mdef=VhdlDocGen::findMemberDef(cdp,memName,MemberListType::VariableMembers()); if (mdef) return mdef; mdef=VhdlDocGen::findMemberDef(cdp,memName,MemberListType::PubMethods()); if (mdef) return mdef; } } } return nullptr; }//findMember /** * This function returns the entity|package * in which the key (type) is found */ const MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberListType type) { std::lock_guard lock(g_vhdlMutex); QCString keyType=cd->symbolName()+"@"+key; //printf("\n %s | %s | %s",qPrint(cd->symbolName()),key.data(,),qPrint(keyType)); auto it = g_varMap.find(keyType.str()); if (it!=g_varMap.end()) { return it->second; } if (std::find(g_classList.begin(),g_classList.end(),cd)!=g_classList.end()) { return nullptr; } const MemberList *ml=cd->getMemberList(type); g_classList.push_back(cd); if (!ml) { return nullptr; } //int l=ml->count(); // fprintf(stderr,"\n loading entity %s %s: %d",qPrint(cd->symbolName()),qPrint(keyType),l); for (const auto &md : *ml) { QCString tkey=cd->symbolName()+"@"+md->name(); if (g_varMap.find(tkey.str())==g_varMap.end()) { g_varMap.emplace(tkey.str(),md); } } it=g_varMap.find(keyType.str()); if (it!=g_varMap.end()) { return it->second; } return nullptr; }//findMemberDef /*! * finds all included packages of an Entity or Package */ void VhdlDocGen::findAllPackages( ClassDef *cdef) { std::lock_guard lock(g_vhdlMutex); if (g_packages.find(cdef)!=g_packages.end()) return; std::vector<ClassDef*> cList; MemberList *mem=cdef->getMemberList(MemberListType::VariableMembers()); if (mem) { for (const auto &md : *mem) { if (VhdlDocGen::isPackage(md)) { ClassDef* cd=VhdlDocGen::getPackageName(md->name()); if (cd) { cList.push_back(cd); VhdlDocGen::findAllPackages(cd); g_packages.emplace(cdef,cList); } } }//for } }// findAllPackages /*! * returns the function with the matching argument list * is called in vhdlcode.l */ const MemberDef* VhdlDocGen::findFunction(const QCString& funcname, const QCString& package) { ClassDef *cdef=getClass(package); if (cdef==nullptr) return nullptr; MemberList *mem=cdef->getMemberList(MemberListType::PubMethods()); if (mem) { for (const auto &mdef : *mem) { QCString mname=mdef->name(); if ((VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isVhdlFunction(mdef)) && (compareString(funcname,mname)==0)) { return mdef; }//if }//for }//if return nullptr; } //findFunction static VhdlSpecifier getSpecifierTypeFromClass(const ClassDef *cd) { VhdlDocGen::VhdlClasses ii=VhdlDocGen::convert(cd->protection()); QCString type; if (ii==VhdlDocGen::ENTITYCLASS) return VhdlSpecifier::ENTITY; else if (ii==VhdlDocGen::ARCHITECTURECLASS) return VhdlSpecifier::ARCHITECTURE; else if (ii==VhdlDocGen::PACKBODYCLASS) return VhdlSpecifier::PACKAGE_BODY; else if (ii==VhdlDocGen::PACKAGECLASS) return VhdlSpecifier::PACKAGE; return VhdlSpecifier::UNKNOWN; } /*! * returns the class title+ref */ QCString VhdlDocGen::getClassTitle(const ClassDef *cd) { QCString pageTitle; if (cd==nullptr) return ""; pageTitle=VhdlDocGen::getClassName(cd); pageTitle+=" "; pageTitle+=theTranslator_vhdlType(getSpecifierTypeFromClass(cd),TRUE); return pageTitle; } // getClassTitle /* returns the class name without their prefixes */ QCString VhdlDocGen::getClassName(const ClassDef* cd) { QCString temp; if (cd==nullptr) return ""; if (VhdlDocGen::convert(cd->protection())==VhdlDocGen::PACKBODYCLASS) { temp=cd->name(); temp.stripPrefix("_"); return temp; } return substitute(cd->className(),"::","."); } /*! * writes an inline link form entity|package to architecture|package body and vice verca */ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) { std::vector<QCString> ql; QCString nn=cd->className(); VhdlClasses ii=convert(cd->protection()); QCString type = theTranslator_vhdlType(getSpecifierTypeFromClass(cd),TRUE); //type=type.lower(); type+=" >> "; ol.disable(OutputType::RTF); ol.disable(OutputType::Man); if (ii==VhdlDocGen::PACKBODYCLASS) { nn.stripPrefix("_"); cd=getClass(nn); } else if (ii==VhdlDocGen::PACKAGECLASS) { nn.prepend("_"); cd=getClass(nn); } else if (ii==VhdlDocGen::ARCHITECTURECLASS) { StringVector qlist=split(nn.str(),"-"); if (qlist.size()>1) { nn=qlist[1]; cd=VhdlDocGen::getClass(nn); } } QCString opp; if (ii==VhdlDocGen::ENTITYCLASS) { VhdlDocGen::findAllArchitectures(ql,cd); for (const auto &s : ql) { StringVector qlist=split(s.str(),"-"); if (qlist.size()>2) { QCString s1(qlist[0]); QCString s2(qlist[1]); s1.stripPrefix("_"); if (ql.size()==1) s1.clear(); ClassDef *cc = getClass(s); if (cc) { VhdlDocGen::writeVhdlLink(cc,ol,type,s2,s1); } } } } else { VhdlDocGen::writeVhdlLink(cd,ol,type,nn,opp); } ol.enable(OutputType::Man); ol.enable(OutputType::RTF); }// write /* * finds all architectures which belongs to an entity */ void VhdlDocGen::findAllArchitectures(std::vector<QCString>& qll,const ClassDef *cd) { for (const auto &citer : *Doxygen::classLinkedMap) { QCString className=citer->className(); int pos = -1; if (cd != citer.get() && (pos=className.find('-'))!=-1) { QCString postfix=className.mid(pos+1); if (qstricmp(cd->className(),postfix)==0) { qll.push_back(className); } } }// for }//findAllArchitectures const ClassDef* VhdlDocGen::findArchitecture(const ClassDef *cd) { QCString nn=cd->name(); for (const auto &citer : *Doxygen::classLinkedMap) { QCString jj=citer->name(); StringVector ql=split(jj.str(),":"); if (ql.size()>1) { if (QCString(ql[0])==nn) { return citer.get(); } } } return nullptr; } /* * writes the link entity >> .... or architecture >> ... */ void VhdlDocGen::writeVhdlLink(const ClassDef* ccd ,OutputList& ol,QCString& type,QCString& nn,QCString& behav) { if (ccd==nullptr) return; ol.startBold(); ol.docify(type); ol.endBold(); nn.stripPrefix("_"); ol.writeObjectLink(ccd->getReference(),ccd->getOutputFileBase(),QCString(),nn); if (!behav.isEmpty()) { behav.prepend(" "); ol.startBold(); ol.docify(behav); ol.endBold(); } ol.lineBreak(); } /*! * strips the "--!" prefixes of vhdl comments */ void VhdlDocGen::prepareComment(QCString& qcs) { qcs=qcs.stripWhiteSpace(); if (qcs.isEmpty()) return; const char* sc="--!"; if (qcs.startsWith(sc)) qcs = qcs.mid(qstrlen(sc)); static const reg::Ex re(R"(\n[ \t]*--!)"); std::string s = qcs.str(); reg::Iterator iter(s,re); reg::Iterator end; std::string result; size_t p=0; size_t sl=s.length(); for ( ; iter!=end ; ++iter) { const auto &match = *iter; size_t i = match.position(); result+="\n"; result+=s.substr(p,i-p); p = match.position()+match.length(); } if (p<sl) { result+="\n"; result+=s.substr(p); } qcs = result; qcs=qcs.stripWhiteSpace(); } /*! * parses a function proto * @param text function string * @param name points to the function name * @param ret Stores the return type * @param doc ??? */ void VhdlDocGen::parseFuncProto(const QCString &text,QCString& name,QCString& ret,bool doc) { QCString s1(text); QCString temp; int index=s1.find("("); if (index<0) index=0; int end=s1.findRev(")"); if ((end-index)>0) { temp=s1.mid(index+1,(end-index-1)); //getFuncParams(qlist,temp); } if (doc) { name=s1.left(index); name=name.stripWhiteSpace(); if ((end-index)>0) { ret="function"; } return; } else { s1=s1.stripWhiteSpace(); int i=s1.find('('); int s=s1.find(' '); if (s==-1) s=s1.find('\t'); if (i==-1 || i<s) s1=VhdlDocGen::getIndexWord(s1,1); else // s<i, s=start of name, i=end of name s1=s1.mid(s,(i-s)); name=s1.stripWhiteSpace(); } index=s1.findRev("return",-1,FALSE); if (index !=-1) { ret=s1.mid(index+6,s1.length()); ret=ret.stripWhiteSpace(); VhdlDocGen::deleteCharRev(ret,';'); } } /* * returns the n'th word of a string */ QCString VhdlDocGen::getIndexWord(const QCString &c,int index) { static const reg::Ex reg(R"([\s:|])"); auto ql=split(c.str(),reg); if (index < static_cast<int>(ql.size())) { return QCString(ql[index]); } return ""; } QCString VhdlDocGen::getProtectionName(int prot) { if (prot==VhdlDocGen::ENTITYCLASS) return "entity"; else if (prot==VhdlDocGen::ARCHITECTURECLASS) return "architecture"; else if (prot==VhdlDocGen::PACKAGECLASS) return "package"; else if (prot==VhdlDocGen::PACKBODYCLASS) return "package body"; return ""; } /*! * deletes a char backwards in a string */ bool VhdlDocGen::deleteCharRev(QCString &s,char c) { int index=s.findRev(c,-1,FALSE); if (index > -1) { s = s.remove(index,1); return TRUE; } return FALSE; } void VhdlDocGen::deleteAllChars(QCString &s,char c) { int index=s.findRev(c,-1,FALSE); while (index > -1) { s = s.remove(index,1); index=s.findRev(c,-1,FALSE); } } static int recordCounter=0; /*! * returns the next number of a record|unit member */ QCString VhdlDocGen::getRecordNumber() { char buf[12]; qsnprintf(buf,12,"%d",recordCounter++); QCString qcs(&buf[0]); return qcs; } /*! * returns the next number of an anonymous process */ QCString VhdlDocGen::getProcessNumber() { static int stringCounter; QCString qcs("PROCESS_"); char buf[8]; qsnprintf(buf,8,"%d",stringCounter++); qcs.append(&buf[0]); return qcs; } /*! * writes a colored and formatted string */ void VhdlDocGen::writeFormatString(const QCString& s,OutputList&ol,const MemberDef* mdef) { static const reg::Ex reg(R"([\[\]./<>:\s,;'+*|&=()\"-])"); QCString qcs = s; qcs+=QCString(" ");// parsing the last sign QCString find=qcs; QCString temp=qcs; char buf[2]; buf[1]='\0'; int j = findIndex(temp.str(),reg); ol.startBold(); if (j>=0) { while (j>=0) { find=find.left(j); buf[0]=temp[j]; const char *ss=VhdlDocGen::findKeyWord(find); bool k=isNumber(find.str()); // is this a number if (k) { ol.docify(" "); startFonts(find,"vhdldigit",ol); ol.docify(" "); } else if (j != 0 && ss) { startFonts(find,ss,ol); } else { if (j>0) { VhdlDocGen::writeStringLink(mdef,find,ol); } } startFonts(&buf[0],"vhdlchar",ol); QCString st=temp.remove(0,j+1); find=st; if (!find.isEmpty() && find.at(0)=='"') { int ii=find.find('"',2); if (ii>1) { QCString com=find.left(ii+1); startFonts(com,"keyword",ol); temp=find.remove(0,ii+1); } } else { temp=st; } j = findIndex(temp.str(),reg); }//while }//if else { startFonts(find,"vhdlchar",ol); } ol.endBold(); }// writeFormatString /*! * returns TRUE if this string is a number */ bool VhdlDocGen::isNumber(const std::string& s) { static const reg::Ex regg(R"([0-9][0-9eEfFbBcCdDaA_.#+?xXzZ-]*)"); return reg::match(s,regg); }// isNumber /*! * inserts white spaces for better readings * and writes a colored string to the output */ void VhdlDocGen::formatString(const QCString &s, OutputList& ol,const MemberDef* mdef) { QCString qcs = s; QCString temp; qcs.stripPrefix(":"); qcs.stripPrefix("is"); qcs.stripPrefix("IS"); qcs.stripPrefix("of"); qcs.stripPrefix("OF"); size_t len = qcs.length(); size_t index=1; for (size_t j=0;j<len;j++) { char c=qcs[j]; char b=c; if (j>0) b=qcs[j-1]; if (c=='"' || c==',' || c=='\''|| c=='(' || c==')' || c==':' || c=='[' || c==']' ) // || (c==':' && b!='=')) // || (c=='=' && b!='>')) { if (temp.length()>=index && temp.at(index-1) != ' ') { temp+=" "; } temp+=c; temp+=" "; } else if (c=='=') { if (b==':') // := operator { temp.replace(index-1,1,"="); temp+=" "; } else // = operator { temp+=" "; temp+=c; temp+=" "; } } else { temp+=c; } index=temp.length(); }// for temp=temp.stripWhiteSpace(); // printf("\n [%s]",qPrint(qcs)); VhdlDocGen::writeFormatString(temp,ol,mdef); } /*! * writes a procedure prototype to the output */ void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList &al,const MemberDef* mdef) { bool sem=FALSE; size_t len=al.size(); ol.docify("( "); if (len > 2) { ol.lineBreak(); } for (const Argument &arg : al) { ol.startBold(); if (sem && len <3) ol.writeChar(','); QCString nn=arg.name; nn+=": "; QCString defval = arg.defval; const char *str=VhdlDocGen::findKeyWord(defval); defval+=" "; if (str) { startFonts(defval,str,ol); } else { startFonts(defval,"vhdlchar",ol); // write type (variable,constant etc.) } startFonts(nn,"vhdlchar",ol); // write name if (qstricmp(arg.attrib,arg.type) != 0) { startFonts(arg.attrib.lower(),"stringliteral",ol); // write in|out } ol.docify(" "); VhdlDocGen::formatString(arg.type,ol,mdef); sem=TRUE; ol.endBold(); if (len > 2) { ol.lineBreak(); ol.docify(" "); } }//for ol.docify(" )"); } /*! * writes a function prototype to the output */ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList &al,const MemberDef* mdef) { if (!al.hasParameters()) return; bool sem=FALSE; size_t len=al.size(); ol.startBold(); ol.docify(" ( "); ol.endBold(); if (len>2) { ol.lineBreak(); } for (const Argument &arg : al) { ol.startBold(); QCString att=arg.defval; bool bGen=att.stripPrefix("generic"); if (sem && len < 3) { ol.docify(" , "); } if (bGen) { VhdlDocGen::formatString(QCString("generic "),ol,mdef); } if (!att.isEmpty()) { const char *str=VhdlDocGen::findKeyWord(att); att+=" "; if (str) VhdlDocGen::formatString(att,ol,mdef); else startFonts(att,"vhdlchar",ol); } QCString nn=arg.name; nn+=": "; QCString ss=arg.type.stripWhiteSpace(); //.lower(); QCString w=ss.stripWhiteSpace();//.upper(); startFonts(nn,"vhdlchar",ol); startFonts("in ","stringliteral",ol); const char *str=VhdlDocGen::findKeyWord(ss); if (str) VhdlDocGen::formatString(w,ol,mdef); else startFonts(w,"vhdlchar",ol); if (!arg.attrib.isEmpty()) startFonts(arg.attrib,"vhdlchar",ol); sem=TRUE; ol.endBold(); if (len > 2) { ol.lineBreak(); } } ol.startBold(); ol.docify(" )"); QCString exp=mdef->excpString(); if (!exp.isEmpty()) { ol.insertMemberAlign(); ol.startBold(); ol.docify("[ "); ol.docify(exp); ol.docify(" ]"); ol.endBold(); } ol.endBold(); } /*! * writes a process prototype to the output */ void VhdlDocGen::writeProcessProto(OutputList& ol,const ArgumentList &al,const MemberDef* mdef) { if (!al.hasParameters()) return; bool sem=FALSE; ol.startBold(); ol.docify(" ( "); for (const Argument &arg : al) { if (sem) { ol.docify(" , "); } QCString nn=arg.name; // startFonts(nn,"vhdlchar",ol); VhdlDocGen::writeFormatString(nn,ol,mdef); sem=TRUE; } ol.docify(" )"); ol.endBold(); } /*! * writes a function|procedure documentation to the output */ bool VhdlDocGen::writeFuncProcDocu( const MemberDef *md, OutputList& ol, const ArgumentList &al, bool /*type*/) { //bool sem=FALSE; ol.enableAll(); size_t index=al.size(); if (index==0) { ol.docify(" ( ) "); return FALSE; } ol.endMemberDocName(); ol.startParameterList(TRUE); //ol.startParameterName(FALSE); bool first=TRUE; for (const Argument &arg : al) { ol.startParameterType(first,""); // if (first) ol.writeChar('('); QCString attl=arg.defval; //bool bGen=attl.stripPrefix("generic"); //if (bGen) // VhdlDocGen::writeFormatString(QCString("generic "),ol,md); if (VhdlDocGen::isProcedure(md) || VhdlDocGen::isVhdlFunction(md) ) { startFonts(arg.defval,"keywordtype",ol); ol.docify(" "); } ol.endParameterType(); ol.startParameterName(TRUE); VhdlDocGen::writeFormatString(arg.name,ol,md); if (VhdlDocGen::isProcedure(md)) { startFonts(arg.attrib,"stringliteral",ol); } else if (VhdlDocGen::isVhdlFunction(md)) { startFonts(QCString("in"),"stringliteral",ol); } ol.docify(" "); ol.disable(OutputType::Man); ol.startEmphasis(); ol.enable(OutputType::Man); if (!VhdlDocGen::isProcess(md)) { // startFonts(arg.type,"vhdlkeyword",ol); VhdlDocGen::writeFormatString(arg.type,ol,md); } ol.disable(OutputType::Man); ol.endEmphasis(); ol.enable(OutputType::Man); if (--index) { ol.docify(" , "); } else { // ol.docify(" ) "); ol.endParameterName(); ol.startParameterExtra(); ol.endParameterExtra(true,false,true); break; } ol.endParameterName(); ol.startParameterExtra(); ol.endParameterExtra(false,false,false); //sem=TRUE; first=FALSE; } //ol.endParameterList(); return TRUE; } // writeDocFunProc QCString VhdlDocGen::convertArgumentListToString(const ArgumentList &al,bool func) { QCString argString; bool sem=FALSE; for (const Argument &arg : al) { if (sem) argString.append(", "); if (func) { argString+=arg.name; argString+=":"; argString+=arg.type; } else { argString+=arg.defval+" "; argString+=arg.name+" :"; argString+=arg.attrib+" "; argString+=arg.type; } sem=TRUE; } return argString; } void VhdlDocGen::writeVhdlDeclarations(const MemberList* ml, OutputList& ol,const GroupDef* gd,const ClassDef* cd,const FileDef *fd,const NamespaceDef* nd,const ModuleDef *mod) { VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::LIBRARY,FALSE),QCString(),FALSE,VhdlSpecifier::LIBRARY); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::USE,FALSE),QCString(),FALSE,VhdlSpecifier::USE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::FUNCTION,FALSE),QCString(),FALSE,VhdlSpecifier::FUNCTION); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::COMPONENT,FALSE),QCString(),FALSE,VhdlSpecifier::COMPONENT); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::CONSTANT,FALSE),QCString(),FALSE,VhdlSpecifier::CONSTANT); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::TYPE,FALSE),QCString(),FALSE,VhdlSpecifier::TYPE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::SUBTYPE,FALSE),QCString(),FALSE,VhdlSpecifier::SUBTYPE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::GENERIC,FALSE),QCString(),FALSE,VhdlSpecifier::GENERIC); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::PORT,FALSE),QCString(),FALSE,VhdlSpecifier::PORT); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::PROCESS,FALSE),QCString(),FALSE,VhdlSpecifier::PROCESS); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::SIGNAL,FALSE),QCString(),FALSE,VhdlSpecifier::SIGNAL); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::ATTRIBUTE,FALSE),QCString(),FALSE,VhdlSpecifier::ATTRIBUTE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::PROCEDURE,FALSE),QCString(),FALSE,VhdlSpecifier::PROCEDURE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::RECORD,FALSE),QCString(),FALSE,VhdlSpecifier::RECORD); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::UNITS,FALSE),QCString(),FALSE,VhdlSpecifier::UNITS); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::SHAREDVARIABLE,FALSE),QCString(),FALSE,VhdlSpecifier::SHAREDVARIABLE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::VFILE,FALSE),QCString(),FALSE,VhdlSpecifier::VFILE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::GROUP,FALSE),QCString(),FALSE,VhdlSpecifier::GROUP); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::INSTANTIATION,FALSE),QCString(),FALSE,VhdlSpecifier::INSTANTIATION); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::ALIAS,FALSE),QCString(),FALSE,VhdlSpecifier::ALIAS); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::MISCELLANEOUS,TRUE),QCString(),FALSE,VhdlSpecifier::MISCELLANEOUS); // configurations must be added to global file definitions. VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::CONFIG,FALSE),QCString(),FALSE,VhdlSpecifier::CONFIG); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,theTranslator_vhdlType(VhdlSpecifier::UCF_CONST,FALSE),QCString(),FALSE,VhdlSpecifier::UCF_CONST); } void VhdlDocGen::correctMemberProperties(MemberDefMutable *md) { if (md->argsString()=="package") { md->setVhdlSpecifiers(VhdlSpecifier::INSTANTIATION); } else if (md->argsString()=="configuration") { md->setVhdlSpecifiers(VhdlSpecifier::CONFIG); } else if (md->typeString()=="library") { md->setVhdlSpecifiers(VhdlSpecifier::LIBRARY); } else if (md->typeString()=="use") { md->setVhdlSpecifiers(VhdlSpecifier::USE); } else if (md->typeString().lower()=="misc") { md->setVhdlSpecifiers(VhdlSpecifier::MISCELLANEOUS); } else if (md->typeString().lower()=="ucf_const") { md->setVhdlSpecifiers(VhdlSpecifier::UCF_CONST); } if (md->getVhdlSpecifiers()==VhdlSpecifier::UCF_CONST) { int mm=md->name().findRev('_'); if (mm>0) { md->setName(md->name().left(mm)); } } else if (md->getVhdlSpecifiers()==VhdlSpecifier::TYPE) { QCString largs=md->argsString(); bool bRec=largs.stripPrefix("record") ; bool bUnit=largs.stripPrefix("units") ; if (bRec || bUnit) { md->setType(""); } } } /* writes a vhdl type documentation */ bool VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition *d, OutputList &ol) { const ClassDef *cd=toClassDef(d); bool hasParams = FALSE; if (cd==nullptr) return hasParams; QCString ttype=mdef->typeString(); QCString largs=mdef->argsString(); if ((VhdlDocGen::isVhdlFunction(mdef) || VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isProcess(mdef))) { QCString nn=mdef->typeString(); nn=nn.stripWhiteSpace(); QCString na=cd->name(); const MemberDef* memdef=VhdlDocGen::findMember(na,nn); if (memdef && memdef->isLinkable()) { ol.docify(" "); ol.startBold(); writeLink(memdef,ol); ol.endBold(); ol.docify(" "); } else { ol.docify(" "); VhdlDocGen::formatString(ttype,ol,mdef); ol.docify(" "); } ol.docify(mdef->name()); hasParams = VhdlDocGen::writeFuncProcDocu(mdef,ol, mdef->argumentList()); } if (mdef->isVariable()) { if (VhdlDocGen::isConstraint(mdef)) { writeLink(mdef,ol); ol.docify(" "); largs=substitute(largs,"#"," "); VhdlDocGen::formatString(largs,ol,mdef); return hasParams; } else { writeLink(mdef,ol); if (VhdlDocGen::isLibrary(mdef) || VhdlDocGen::isPackage(mdef)) { return hasParams; } ol.docify(" "); } // QCString largs=mdef->argsString(); bool c=largs=="context"; bool brec=largs.stripPrefix("record") ; if (!brec && !c) VhdlDocGen::formatString(ttype,ol,mdef); if (c || brec || largs.stripPrefix("units")) { if (c) largs=ttype; VhdlDocGen::writeRecUnitDocu(mdef,ol,largs); return hasParams; } ol.docify(" "); if (VhdlDocGen::isPort(mdef) || VhdlDocGen::isGeneric(mdef)) { // QCString largs=mdef->argsString(); VhdlDocGen::formatString(largs,ol,mdef); ol.docify(" "); } } return hasParams; } void VhdlDocGen::writeTagFile(MemberDefMutable *mdef,TextStream &tagFile) { tagFile << " <member kind=\""; if (VhdlDocGen::isGeneric(mdef)) tagFile << "generic"; if (VhdlDocGen::isPort(mdef)) tagFile << "port"; if (VhdlDocGen::isEntity(mdef)) tagFile << "entity"; if (VhdlDocGen::isComponent(mdef)) tagFile << "component"; if (VhdlDocGen::isVType(mdef)) tagFile << "type"; if (VhdlDocGen::isConstant(mdef)) tagFile << "constant"; if (VhdlDocGen::isSubType(mdef)) tagFile << "subtype"; if (VhdlDocGen::isVhdlFunction(mdef)) tagFile << "function"; if (VhdlDocGen::isProcedure(mdef)) tagFile << "procedure"; if (VhdlDocGen::isProcess(mdef)) tagFile << "process"; if (VhdlDocGen::isSignals(mdef)) tagFile << "signal"; if (VhdlDocGen::isAttribute(mdef)) tagFile << "attribute"; if (VhdlDocGen::isRecord(mdef)) tagFile << "record"; if (VhdlDocGen::isLibrary(mdef)) tagFile << "library"; if (VhdlDocGen::isPackage(mdef)) tagFile << "package"; if (VhdlDocGen::isVariable(mdef)) tagFile << "shared variable"; if (VhdlDocGen::isFile(mdef)) tagFile << "file"; if (VhdlDocGen::isGroup(mdef)) tagFile << "group"; if (VhdlDocGen::isCompInst(mdef)) tagFile << "instantiation"; if (VhdlDocGen::isAlias(mdef)) tagFile << "alias"; if (VhdlDocGen::isCompInst(mdef)) tagFile << "configuration"; QCString fn = mdef->getOutputFileBase(); addHtmlExtensionIfMissing(fn); tagFile << "\">\n"; tagFile << " <type>" << convertToXML(mdef->typeString()) << "</type>\n"; tagFile << " <name>" << convertToXML(mdef->name()) << "</name>\n"; tagFile << " <anchorfile>" << convertToXML(fn) << "</anchorfile>\n"; tagFile << " <anchor>" << convertToXML(mdef->anchor()) << "</anchor>\n"; if (VhdlDocGen::isVhdlFunction(mdef)) tagFile << " <arglist>" << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList(),TRUE)) << "</arglist>\n"; else if (VhdlDocGen::isProcedure(mdef)) tagFile << " <arglist>" << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList(),FALSE)) << "</arglist>\n"; else tagFile << " <arglist>" << convertToXML(mdef->argsString()) << "</arglist>\n"; mdef->writeDocAnchorsToTagFile(tagFile); tagFile << " </member>\n"; } /* writes a vhdl type declaration */ void VhdlDocGen::writeVHDLDeclaration(MemberDefMutable* mdef,OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, bool /*inGroup*/) { const Definition *d=nullptr; ASSERT(cd!=nullptr || nd!=nullptr || fd!=nullptr || gd!=nullptr || mod!=nullptr || mdef->getVhdlSpecifiers()==VhdlSpecifier::LIBRARY || mdef->getVhdlSpecifiers()==VhdlSpecifier::USE ); // member should belong to something if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else if (mod) d=mod; else if (gd) d=gd; else d=mdef; // write search index info if (Doxygen::searchIndex.enabled()) { Doxygen::searchIndex.setCurrentDoc(mdef,mdef->anchor(),FALSE); Doxygen::searchIndex.addWord(mdef->localName(),TRUE); Doxygen::searchIndex.addWord(mdef->qualifiedName(),FALSE); } QCString cname = d->name(); QCString cfname = d->getOutputFileBase(); //HtmlHelp *htmlHelp=nullptr; // bool hasHtmlHelp = Config_getBool(GENERATE_HTML) && Config_getBool(GENERATE_HTMLHELP); // if (hasHtmlHelp) htmlHelp = HtmlHelp::getInstance(); // search for the last anonymous scope in the member type ClassDef *annoClassDef=mdef->getClassDefOfAnonymousType(); // start a new member declaration OutputGenerator::MemberItemType memType = annoClassDef!=nullptr ? OutputGenerator::MemberItemType::AnonymousStart : OutputGenerator::MemberItemType::Normal; ///printf("startMemberItem for %s\n",qPrint(name())); VhdlSpecifier mm=mdef->getVhdlSpecifiers(); if (mm==VhdlSpecifier::MISCELLANEOUS) memType=OutputGenerator::MemberItemType::Templated; ol.startMemberItem( mdef->anchor(), memType ); // If there is no detailed description we need to write the anchor here. bool detailsVisible = mdef->hasDetailedDescription(); if (!detailsVisible) // && !m_impl->annMemb) { QCString doxyName=mdef->name(); if (!cname.isEmpty()) doxyName.prepend(cname+"::"); QCString doxyArgs=mdef->argsString(); ol.startDoxyAnchor(cfname,cname,mdef->anchor(),doxyName,doxyArgs); ol.addLabel(cfname,mdef->anchor()); ol.pushGeneratorState(); ol.disable(OutputType::Man); ol.disable(OutputType::Latex); ol.docify("\n"); ol.popGeneratorState(); } // *** write type /*VHDL CHANGE */ QCString ltype(mdef->typeString()); QCString largs(mdef->argsString()); ClassDef *kl=nullptr; const ArgumentList &al = mdef->argumentList(); QCString nn; //VhdlDocGen::adjustRecordMember(mdef); if (gd) gd=nullptr; switch (mm) { case VhdlSpecifier::MISCELLANEOUS: VhdlDocGen::writeSource(mdef,ol,nn); break; case VhdlSpecifier::PROCEDURE: case VhdlSpecifier::FUNCTION: ol.startBold(); VhdlDocGen::formatString(ltype,ol,mdef); ol.endBold(); ol.insertMemberAlign(); ol.docify(" "); writeLink(mdef,ol); if (al.hasParameters() && mm==VhdlSpecifier::FUNCTION) VhdlDocGen::writeFunctionProto(ol,al,mdef); if (al.hasParameters() && mm==VhdlSpecifier::PROCEDURE) VhdlDocGen::writeProcedureProto(ol,al,mdef); break; case VhdlSpecifier::USE: kl=VhdlDocGen::getClass(mdef->name()); if (kl && (VhdlDocGen::convert(kl->protection())==VhdlDocGen::ENTITYCLASS)) break; writeLink(mdef,ol); ol.insertMemberAlign(); ol.docify(" "); if (kl) { nn=kl->getOutputFileBase(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.docify(" "); QCString name=theTranslator_vhdlType(VhdlSpecifier::PACKAGE,TRUE); ol.startBold(); ol.docify(name); name.clear(); ol.endBold(); name+=" <"+mdef->name()+">"; ol.startEmphasis(); ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),QCString(),name); ol.popGeneratorState(); } break; case VhdlSpecifier::LIBRARY: writeLink(mdef,ol); ol.insertMemberAlign(); if (largs=="context") { VhdlDocGen::writeRecordUnit(ltype,largs,ol,mdef); } break; case VhdlSpecifier::GENERIC: case VhdlSpecifier::PORT: case VhdlSpecifier::ALIAS: writeLink(mdef,ol); ol.docify(" "); if (mm==VhdlSpecifier::GENERIC) { ol.insertMemberAlign(); ol.startBold(); VhdlDocGen::formatString(largs,ol,mdef); ol.endBold(); } else { ol.insertMemberAlignLeft(memType, false); ol.docify(" "); ol.startBold(); VhdlDocGen::formatString(ltype,ol,mdef); ol.endBold(); ol.insertMemberAlign(); ol.docify(" "); VhdlDocGen::formatString(largs,ol,mdef); } break; case VhdlSpecifier::PROCESS: writeLink(mdef,ol); ol.insertMemberAlign(); VhdlDocGen::writeProcessProto(ol,al,mdef); break; case VhdlSpecifier::PACKAGE: case VhdlSpecifier::ENTITY: case VhdlSpecifier::COMPONENT: case VhdlSpecifier::INSTANTIATION: case VhdlSpecifier::CONFIG: if (VhdlDocGen::isCompInst(mdef) ) { nn=largs; if(nn.stripPrefix("function") || nn.stripPrefix("package")) { VhdlDocGen::formatString(largs,ol,mdef); ol.insertMemberAlign(); writeLink(mdef,ol); ol.docify(" "); VhdlDocGen::formatString(ltype,ol,mdef); break; } largs.prepend("::"); largs.prepend(mdef->name()); ol.writeObjectLink(mdef->getReference(), cfname, mdef->anchor(), mdef->name()); } else writeLink(mdef,ol); ol.insertMemberAlign(); ol.docify(" "); ol.startBold(); ol.docify(ltype); ol.endBold(); ol.docify(" "); if (VhdlDocGen::isComponent(mdef) || VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef)) { if (VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef)) { nn=ltype; } else { nn=mdef->name(); } kl=getClass(nn); if (kl) { nn=kl->getOutputFileBase(); ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.startEmphasis(); QCString name("<Entity "); if (VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef)) { name+=ltype+">"; } else { name+=mdef->name()+"> "; } ol.writeObjectLink(kl->getReference(),kl->getOutputFileBase(),QCString(),name); ol.endEmphasis(); ol.popGeneratorState(); } } break; case VhdlSpecifier::UCF_CONST: writeUCFLink(mdef,ol); break; case VhdlSpecifier::SIGNAL: case VhdlSpecifier::ATTRIBUTE: case VhdlSpecifier::SUBTYPE: case VhdlSpecifier::CONSTANT: case VhdlSpecifier::SHAREDVARIABLE: case VhdlSpecifier::VFILE: case VhdlSpecifier::GROUP: case VhdlSpecifier::TYPE: writeLink(mdef,ol); ol.docify(" "); ol.insertMemberAlign(); VhdlDocGen::formatString(ltype,ol,mdef); break; case VhdlSpecifier::RECORD: case VhdlSpecifier::UNITS: writeRecordUnit(largs,ltype,ol,mdef); break; default: break; } bool htmlOn = ol.isEnabled(OutputType::Html); if (htmlOn && /*Config_getBool(HTML_ALIGN_MEMBERS) &&*/ !ltype.isEmpty()) { ol.disable(OutputType::Html); } if (!ltype.isEmpty()) ol.docify(" "); if (htmlOn) { ol.enable(OutputType::Html); } if (!detailsVisible)// && !m_impl->annMemb) { ol.endDoxyAnchor(cfname,mdef->anchor()); } ol.endMemberItem(memType); if (!mdef->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC) /* && !annMemb */) { QCString s=mdef->briefDescription(); ol.startMemberDescription(mdef->anchor(), QCString(), mm == VhdlSpecifier::PORT); ol.generateDoc(mdef->briefFile(),mdef->briefLine(), mdef->getOuterScope()?mdef->getOuterScope():d, mdef,s,TRUE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); if (detailsVisible) { ol.pushGeneratorState(); ol.disableAllBut(OutputType::Html); ol.docify(" "); if (mdef->getGroupDef()!=nullptr && gd==nullptr) // forward link to the group { ol.startTextLink(mdef->getOutputFileBase(),mdef->anchor()); } else // local link { ol.startTextLink(QCString(),mdef->anchor()); } ol.endTextLink(); ol.popGeneratorState(); } ol.endMemberDescription(); } mdef->warnIfUndocumented(); }// end writeVhdlDeclaration void VhdlDocGen::writePlainVHDLDeclarations( const MemberList* mlist,OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, VhdlSpecifier specifier) { StringSet pack; bool first=TRUE; for (const auto &imd : *mlist) { MemberDefMutable *md = toMemberDefMutable(imd); if (md) { VhdlSpecifier mems=md->getVhdlSpecifiers(); if (md->isBriefSectionVisible() && (mems==specifier) && (mems!=VhdlSpecifier::LIBRARY) ) { if (first) { ol.startMemberList();first=FALSE; } VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,mod,FALSE); } //if else if (md->isBriefSectionVisible() && (mems==specifier)) { if (pack.find(md->name().str())==pack.end()) { if (first) ol.startMemberList(),first=FALSE; VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,mod,FALSE); pack.insert(md->name().str()); } } //if } //if } //for if (!first) ol.endMemberList(); }//plainDeclaration static bool membersHaveSpecificType(const MemberList *ml,VhdlSpecifier type) { if (ml==nullptr) return FALSE; for (const auto &mdd : *ml) { if (mdd->getVhdlSpecifiers()==type) //is type in class { return TRUE; } } for (const auto &mg : ml->getMemberGroupList()) { if (!mg->members().empty()) { if (membersHaveSpecificType(&mg->members(),type)) return TRUE; } } return FALSE; } void VhdlDocGen::writeVHDLDeclarations(const MemberList* ml,OutputList &ol, const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod, const QCString &title,const QCString &subtitle,bool /*showEnumValues*/,VhdlSpecifier type) { if (!membersHaveSpecificType(ml,type)) return; if (!title.isEmpty()) { ol.startMemberHeader(convertToId(title),type == VhdlSpecifier::PORT ? 3 : 2); ol.parseText(title); ol.endMemberHeader(); ol.docify(" "); } if (!subtitle.isEmpty()) { ol.startMemberSubtitle(); ol.generateDoc("[generated]",-1,nullptr,nullptr,subtitle,FALSE,FALSE, QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberSubtitle(); } //printf("memberGroupList=%p\n",memberGroupList); VhdlDocGen::writePlainVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,type); for (const auto &mg : ml->getMemberGroupList()) { if (membersHaveSpecificType(&mg->members(),type)) { //printf("mg->header=%s\n",qPrint(mg->header())); bool hasHeader=!mg->header().isEmpty(); ol.startMemberGroupHeader(hasHeader); if (hasHeader) { ol.parseText(mg->header()); } ol.endMemberGroupHeader(); if (!mg->documentation().isEmpty()) { //printf("Member group has docs!\n"); ol.startMemberGroupDocs(); ol.generateDoc("[generated]",-1,nullptr,nullptr,mg->documentation()+"\n",FALSE,FALSE, QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT)); ol.endMemberGroupDocs(); } ol.startMemberGroup(); //printf("--- mg->writePlainDeclarations ---\n"); VhdlDocGen::writePlainVHDLDeclarations(&mg->members(),ol,cd,nd,fd,gd,mod,type); ol.endMemberGroup(hasHeader); } } }// writeVHDLDeclarations bool VhdlDocGen::writeClassType( const ClassDef * cd, OutputList &ol ,QCString & cname) { QCString qcs = theTranslator->trVhdlType(getSpecifierTypeFromClass(cd),TRUE); cname=VhdlDocGen::getClassName(cd); ol.startBold(); ol.writeString(qcs); ol.writeString(" "); ol.endBold(); //ol.insertMemberAlign(); return FALSE; }// writeClassLink /*! writes a link if the string is linkable else a formatted string */ void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList& ol) { if (mdef) { const ClassDef *cd=mdef->getClassDef(); if (cd) { QCString n=cd->name(); const MemberDef* memdef=VhdlDocGen::findMember(n,mem); if (memdef && memdef->isLinkable()) { ol.startBold(); writeLink(memdef,ol); ol.endBold(); ol.docify(" "); return; } } } startFonts(mem,"vhdlchar",ol); }// found component void VhdlDocGen::writeSource(const MemberDef* mdef,OutputList& ol,const QCString &cname) { auto intf = Doxygen::parserManager->getCodeParser(".vhd"); // pIntf->resetCodeParserState(); QCString codeFragment=mdef->documentation(); if (cname.isEmpty()) { writeLink(mdef,ol); int fi=0; int j=0; do { fi=codeFragment.find("\n",++fi); } while(fi>=0 && j++ <3); // show only the first four lines if (j==4) { codeFragment=codeFragment.left(fi); codeFragment.append("\n .... "); } } codeFragment.prepend("\n"); ol.pushGeneratorState(); auto &codeOL = ol.codeGenerators(); codeOL.startCodeFragment("DoxyCode"); intf->parseCode( codeOL, // codeOutIntf QCString(), // scope codeFragment, // input SrcLangExt::VHDL, // lang Config_getBool(STRIP_CODE_COMMENTS), FALSE, // isExample QCString(), // exampleName mdef->getFileDef(), // fileDef mdef->getStartBodyLine(), // startLine mdef->getEndBodyLine(), // endLine TRUE, // inlineFragment mdef, // memberDef TRUE // show line numbers ); codeOL.endCodeFragment("DoxyCode"); ol.popGeneratorState(); if (cname.isEmpty()) return; MemberDefMutable *mdm = toMemberDefMutable(const_cast<MemberDef*>(mdef)); if (mdm) { mdm->writeSourceDef(ol); if (mdef->hasReferencesRelation()) mdm->writeSourceRefs(ol,cname); if (mdef->hasReferencedByRelation()) mdm->writeSourceReffedBy(ol,cname); } } QCString VhdlDocGen::convertFileNameToClassName(const QCString &name) { QCString n=name; n=n.remove(0,6); int i=0; while((i=n.find("__"))>0) { n=n.remove(i,1); } while((i=n.find("_1"))>0) { n=n.replace(i,2,":"); } return n; } void VhdlDocGen::parseUCF(const QCString &input,Entry* entity,const QCString &fileName,bool altera) { QCString ucFile(input); int lineNo=0; QCString comment("#!"); QCString brief; while (!ucFile.isEmpty()) { int i=ucFile.find("\n"); if (i<0) break; lineNo++; QCString temp=ucFile.left(i); temp=temp.stripWhiteSpace(); bool bb=temp.stripPrefix("//"); if (!temp.isEmpty()) { if (temp.stripPrefix(comment) ) { brief+=temp; brief.append("\\n"); } else if (!temp.stripPrefix("#") && !bb) { if (altera) { int in=temp.find("-name"); if (in>0) { temp=temp.remove(0,in+5); } temp.stripPrefix("set_location_assignment"); initUCF(entity,QCString(),temp,lineNo,fileName,brief); } else { static const reg::Ex ee(R"([\s=])"); int in=findIndex(temp.str(),ee); if (in<0) in=0; QCString ff=temp.left(in); temp.stripPrefix(ff); ff.append("#"); if (!temp.isEmpty()) { initUCF(entity,ff,temp,lineNo,fileName,brief); } } } }//temp ucFile=ucFile.remove(0,i+1); }// while } static void initUCF(Entry* root,const QCString &type,QCString &qcs, int line,const QCString &fileName,QCString & brief) { if (qcs.isEmpty())return; QCString n; VhdlDocGen::deleteAllChars(qcs,';'); qcs=qcs.stripWhiteSpace(); static const reg::Ex reg(R"([\s=])"); int i = findIndex(qcs.str(),reg); if (i<0) return; if (i==0) { n=type; VhdlDocGen::deleteAllChars(n,'#'); } else { n=qcs.left(i); } qcs=qcs.remove(0,i+1); // qcs.prepend("|"); qcs.stripPrefix("="); std::shared_ptr<Entry> current = std::make_shared<Entry>(); current->vhdlSpec=VhdlSpecifier::UCF_CONST; current->section=EntryType::makeVariable(); current->bodyLine=line; current->fileName=fileName; current->type="ucf_const"; current->args+=qcs; current->lang= SrcLangExt::VHDL ; // adding dummy name for constraints like VOLTAGE=5,TEMPERATURE=20 C if (n.isEmpty()) { n="dummy"; n+=VhdlDocGen::getRecordNumber(); } current->name= n+"_"; current->name.append(VhdlDocGen::getRecordNumber()); if (!brief.isEmpty()) { current->brief=brief; current->briefLine=line; current->briefFile=fileName; brief.clear(); } root->moveToSubEntryAndKeep(current); } static void writeUCFLink(const MemberDef* mdef,OutputList &ol) { QCString largs(mdef->argsString()); QCString n= splitString(largs, '#'); // VhdlDocGen::adjustRecordMember(mdef); bool equ=(n.length()==largs.length()); if (!equ) { ol.writeString(n); ol.docify(" "); ol.insertMemberAlign(); } if (mdef->name().contains("dummy")==0) { writeLink(mdef,ol); } if (equ) { ol.insertMemberAlign(); } ol.docify(" "); VhdlDocGen::formatString(largs,ol,mdef); } // for cell_inst : [entity] work.proto [ (label|expr) ] QCString VhdlDocGen::parseForConfig(QCString & entity,QCString & arch) { if (!entity.contains(":")) return ""; static const reg::Ex exp(R"([:()\s])"); auto ql=split(entity.str(),exp); if (ql.size()<2) { return ""; } QCString label(ql[0]); entity = ql[1]; int index = entity.findRev("."); if (index!=-1) { entity.remove(0,index+1); } if (ql.size()==3) { arch = ql[2]; ql=split(arch.str(),exp); if (ql.size()>1) // expression { arch=""; } } return label; // label } // use (configuration|entity|open) work.test [(cellfor)]; QCString VhdlDocGen::parseForBinding(QCString & entity,QCString & arch) { static const reg::Ex exp(R"([()\s])"); auto ql = split(entity.str(),exp); if (findIndex(ql,"open")!=-1) { return "open"; } if (ql.size()<2) { return ""; } std::string label=ql[0]; entity = ql[1]; int index=entity.findRev("."); if (index!=-1) { entity.remove(0,index+1); } if (ql.size()==3) { arch=ql[2]; } return QCString(label); } // find class with upper/lower letters ClassDef* VhdlDocGen::findVhdlClass(const QCString &className ) { for (const auto &cd : *Doxygen::classLinkedMap) { if (qstricmp(className.data(),qPrint(cd->name()))==0) { return cd.get(); } } return nullptr; } /* // file foo.vhd // entity foo // ..... // end entity // file foo_arch.vhd // architecture xxx of foo is // ........ // end architecture */ void VhdlDocGen::computeVhdlComponentRelations() { QCString entity,arch,inst; for (const auto &cur : getVhdlInstList()) { if (cur->isStatic ) // was bind { continue; } if (cur->includeName=="entity" || cur->includeName=="component" ) { entity=cur->includeName+" "+cur->type; QCString rr=VhdlDocGen::parseForBinding(entity,arch); } else if (cur->includeName.isEmpty()) { entity=cur->type; } ClassDefMutable *classEntity= toClassDefMutable(VhdlDocGen::findVhdlClass(entity)); inst=VhdlDocGen::getIndexWord(cur->args,0); ClassDefMutable *cd=toClassDefMutable(Doxygen::classLinkedMap->find(inst)); ClassDefMutable *ar=toClassDefMutable(Doxygen::classLinkedMap->find(cur->args)); if (cd==nullptr) { continue; } // if (classEntity==nullptr) // err("%s:%d:Entity:%s%s",qPrint(cur->fileName),cur->startLine,qPrint(entity)," could not be found"); addInstance(classEntity,ar,cd,cur); } } static void addInstance(ClassDefMutable* classEntity, ClassDefMutable* ar, ClassDefMutable *cd , const std::shared_ptr<Entry> &cur) { QCString bName,n1; if (ar==nullptr) return; if (classEntity==nullptr) { //add component inst n1=cur->type; goto ferr; } if (classEntity==cd) return; bName=classEntity->name(); // fprintf(stderr,"\naddInstance %s to %s %s %s\n",qPrint( classEntity->name()),qPrint(cd->name()),qPrint(ar->name()),cur->name); n1=classEntity->name(); if (!cd->isBaseClass(classEntity, true)) { cd->insertBaseClass(classEntity,n1,Protection::Public,Specifier::Normal,QCString()); } else { VhdlDocGen::addBaseClass(cd,classEntity); } if (!VhdlDocGen::isSubClass(classEntity,cd,true,0)) { classEntity->insertSubClass(cd,Protection::Public,Specifier::Normal,QCString()); classEntity->setLanguage(SrcLangExt::VHDL); } ferr: QCString uu=cur->name; auto md = createMemberDef( ar->getDefFileName(), cur->startLine,cur->startColumn, n1,uu,uu, QCString(), Protection::Public, Specifier::Normal, cur->isStatic, Relationship::Member, MemberType::Variable, ArgumentList(), ArgumentList(), ""); auto mmd = toMemberDefMutable(md.get()); if (!ar->getOutputFileBase().isEmpty()) { TagInfo tg; tg.anchor = nullptr; tg.fileName = ar->getOutputFileBase(); tg.tagName = nullptr; mmd->setTagInfo(&tg); } //fprintf(stderr,"\n%s%s%s\n",qPrint(md->name()),qPrint(cur->brief),qPrint(cur->doc)); mmd->setLanguage(SrcLangExt::VHDL); mmd->setVhdlSpecifiers(VhdlSpecifier::INSTANTIATION); mmd->setBriefDescription(cur->brief,cur->briefFile,cur->briefLine); mmd->setBodySegment(cur->startLine,cur->startLine,-1) ; mmd->setDocumentation(cur->doc,cur->docFile,cur->docLine); FileDef *fd=ar->getFileDef(); mmd->setBodyDef(fd); ar->insertMember(md.get()); MemberName *mn = Doxygen::functionNameLinkedMap->add(uu); mn->push_back(std::move(md)); } void VhdlDocGen::writeRecordUnit(QCString &/* largs */,QCString & ltype,OutputList& ol ,MemberDefMutable *mdef) { int i=mdef->name().find('~'); if (i>0) { //sets the real record member name mdef->setName(mdef->name().left(i)); } writeLink(mdef,ol); ol.startBold(); ol.insertMemberAlign(); if (!ltype.isEmpty()) { VhdlDocGen::formatString(ltype,ol,mdef); } ol.endBold(); } void VhdlDocGen::writeRecUnitDocu( const MemberDef *md, OutputList& ol, QCString largs) { StringVector ql=split(largs.str(),"#"); size_t len=ql.size(); ol.startParameterList(TRUE); bool first=TRUE; for(size_t i=0;i<len;i++) { QCString n=QCString(ql[i]); ol.startParameterType(first,""); ol.endParameterType(); ol.startParameterName(TRUE); VhdlDocGen::formatString(n,ol,md); ol.endParameterName(); ol.startParameterExtra(); if ((len-i)>1) { ol.endParameterExtra(false,false,false); } else { ol.endParameterExtra(true,false,true); } first=FALSE; } }//# bool VhdlDocGen::isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level) { bool found=FALSE; //printf("isBaseClass(cd=%s) looking for %s\n",qPrint(name()),qPrint(bcd->name())); if (level>255) { err("Possible recursive class relation while inside %s and looking for %s\n",qPrint(cd->name()),qPrint(scd->name())); abort(); } for (const auto &bcd :cd->subClasses()) { const ClassDef *ccd=bcd.classDef; if (!followInstances && ccd->templateMaster()) ccd=ccd->templateMaster(); //printf("isSubClass() subclass %s\n",qPrint(ccd->name())); if (ccd==scd) { found=true; } else { if (level <256) { level = ccd->isBaseClass(scd,followInstances); if (level>0) { found=true; } } } } return found; } void VhdlDocGen::addBaseClass(ClassDef* cd,ClassDef *ent) { BaseClassList bcl = cd->baseClasses(); for (auto &bcd : bcl) { ClassDef *ccd = bcd.classDef; if (ccd==ent) { QCString n = bcd.usedName; int i = n.find('('); if(i<0) { bcd.usedName.append("(2)"); return; } static const reg::Ex reg(R"(\d+)"); QCString s=n.left(i); QCString r=n.right(n.length()-i); std::string t=r.str(); VhdlDocGen::deleteAllChars(r,')'); VhdlDocGen::deleteAllChars(r,'('); r.setNum(r.toInt()+1); reg::replace(t, reg, r.str()); s.append(t.c_str()); bcd.usedName=s; bcd.templSpecifiers=t; } } cd->updateBaseClasses(bcl); } static std::vector<const MemberDef*> mdList; static const MemberDef* findMemFlow(const MemberDef* mdef) { for (const auto &md : mdList) { if (md->name()==mdef->name() && md->getStartBodyLine()==mdef->getStartBodyLine()) { return md; } } return nullptr; } void VhdlDocGen::createFlowChart(const MemberDef *mdef) { if (mdef==nullptr) return; QCString codeFragment; const MemberDef* mm=nullptr; if ((mm=findMemFlow(mdef))!=nullptr) { // don't create the same flowchart twice VhdlDocGen::setFlowMember(mm); return; } else { mdList.push_back(mdef); } //fprintf(stderr,"\n create flow mem %s %p\n",qPrint(mdef->name()),mdef); int actualStart= mdef->getStartBodyLine(); int actualEnd=mdef->getEndBodyLine(); const FileDef* fd=mdef->getFileDef(); bool b=readCodeFragment( fd->absFilePath(), false, actualStart, actualEnd, codeFragment); if (!b) return; auto parser { Doxygen::parserManager->getOutlineParser(".vhd") }; VhdlDocGen::setFlowMember(mdef); std::shared_ptr<Entry> root = std::make_shared<Entry>(); StringVector filesInSameTu; parser->parseInput("",codeFragment.data(),root,nullptr); } void VhdlDocGen::resetCodeVhdlParserState() { std::lock_guard lock(g_vhdlMutex); g_varMap.clear(); g_classList.clear(); g_packages.clear(); } bool VhdlDocGen::isConstraint(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::UCF_CONST; } bool VhdlDocGen::isConfig(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::CONFIG; } bool VhdlDocGen::isAlias(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::ALIAS; } bool VhdlDocGen::isLibrary(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::LIBRARY; } bool VhdlDocGen::isGeneric(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::GENERIC; } bool VhdlDocGen::isPort(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::PORT; } bool VhdlDocGen::isComponent(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::COMPONENT; } bool VhdlDocGen::isPackage(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::USE; } bool VhdlDocGen::isEntity(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::ENTITY; } bool VhdlDocGen::isConstant(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::CONSTANT; } bool VhdlDocGen::isVType(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::TYPE; } bool VhdlDocGen::isSubType(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::SUBTYPE; } bool VhdlDocGen::isVhdlFunction(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::FUNCTION; } bool VhdlDocGen::isProcess(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::PROCESS; } bool VhdlDocGen::isSignal(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::SIGNAL; } bool VhdlDocGen::isAttribute(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::ATTRIBUTE; } bool VhdlDocGen::isSignals(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::SIGNAL; } bool VhdlDocGen::isProcedure(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::PROCEDURE; } bool VhdlDocGen::isRecord(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::RECORD; } bool VhdlDocGen::isArchitecture(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::ARCHITECTURE; } bool VhdlDocGen::isUnit(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::UNITS; } bool VhdlDocGen::isPackageBody(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::PACKAGE_BODY; } bool VhdlDocGen::isVariable(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::SHAREDVARIABLE; } bool VhdlDocGen::isFile(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::VFILE; } bool VhdlDocGen::isGroup(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::GROUP; } bool VhdlDocGen::isCompInst(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::INSTANTIATION; } bool VhdlDocGen::isMisc(const MemberDef *mdef) { return mdef->getVhdlSpecifiers()==VhdlSpecifier::MISCELLANEOUS; } //############################## Flowcharts ################################################# #define STARTL (FlowChart::WHILE_NO | FlowChart::IF_NO | \ FlowChart::FOR_NO | FlowChart::CASE_NO | \ FlowChart::LOOP_NO | WHEN_NO) #define DECLN (FlowChart::WHEN_NO | \ FlowChart::ELSIF_NO | FlowChart::IF_NO | \ FlowChart::FOR_NO | FlowChart::WHILE_NO | \ FlowChart::CASE_NO | FlowChart::LOOP_NO ) #define STARTFIN (FlowChart::START_NO | FlowChart::END_NO) #define LOOP (FlowChart::FOR_NO | FlowChart::WHILE_NO | \ FlowChart::LOOP_NO ) #define ENDCL (FlowChart::END_CASE | FlowChart::END_LOOP) #define EEND (FlowChart::ENDIF_NO | FlowChart::ELSE_NO ) #define IFF (FlowChart::ELSIF_NO | FlowChart::IF_NO) #define EXITNEXT (FlowChart::EXIT_NO | FlowChart::NEXT_NO ) #define EMPTY (EEND | FlowChart::ELSIF_NO) #define EE (FlowChart::ELSE_NO | FlowChart::ELSIF_NO) #define EMPTNODE (ENDCL | EEND | FlowChart::ELSIF_NO) #define FLOWLEN (flowList.size()-1) static int ifcounter=0; static int nodeCounter=0; static struct { // link colors const char *textNodeLink; const char *yesNodeLink; const char *noNodeLink; // node colors const char* comment; const char* decisionNode; const char* varNode; const char *startEndNode; const char* textNode; } flowCol = { "green", // textNodeLink "red", // yesNodeLink "black", // noNodeLink "khaki", // comment "0.7 0.3 1.0", // decisionNode "lightyellow", // varNode "white", // startEndNode "lightcyan" // textNode }; std::vector<FlowChart> flowList; #ifdef DEBUGFLOW static std::map<std::string,int> g_keyMap; #endif void alignText(QCString & q) { if (q.length()<=80) return; if (q.length()>200) { q.resize(200); } q.append(" ..."); QCString str(q); QCString temp; while (str.length()>80) { int j=std::max(str.findRev(' ',80),str.findRev('|',80)); if (j<=0) { temp+=str; q=temp; return; } else { QCString qcs=str.left(j); temp+=qcs+"\\"; temp+="n"; str.remove(0,j); } }//while q=temp+str; // #endif } void FlowChart::printNode(const FlowChart& flo) { QCString ui="-"; std::string q; std::string t; ui.fill('-',255); if (flo.type & STARTL) { if (flo.stamp>0) { q=ui.left(2*flo.stamp).str(); } else { q=" "; } QCString nn=flo.exp.stripWhiteSpace(); printf("\nYES: %s%s[%d,%d]",qPrint(q),qPrint(nn),flo.stamp,flo.id); } else { if (flo.type & COMMENT_NO) { t=flo.label.str(); } else { t=flo.text.str(); } static const reg::Ex ep(R"(\s)"); t = reg::replace(t,ep,std::string()); if (t.empty()) { t=" "; } if (flo.stamp>0) { q=ui.left(2*flo.stamp).str(); } else { q=" "; } if (flo.type & EMPTNODE) { printf("\n NO: %s%s[%d,%d]",q.c_str(),FlowChart::getNodeType(flo.type),flo.stamp,flo.id); } else if (flo.type & COMMENT_NO) { printf("\n NO: %s%s[%d,%d]",t.c_str(),FlowChart::getNodeType(flo.type),flo.stamp,flo.id); } else { printf("\n NO: %s[%d,%d]",t.c_str(),flo.stamp,flo.id); } } } void FlowChart::printFlowTree() { for (const auto &flowChart : flowList) { printNode(flowChart); } } void FlowChart::colTextNodes() { FlowChart *flno = nullptr; bool found=FALSE; for (size_t j=0;j<flowList.size();j++) { FlowChart &flo = flowList[j]; if (flo.type&TEXT_NO) { if (!found) { flno=&flo; } else { flno->text+=flo.text; flowList.erase(flowList.begin()+j); if (j>0) j=j-1; } found=TRUE; } else { found=FALSE; } } // find if..endif without text // if..elseif without text if (!flowList.empty()) { for (size_t j=0;j<flowList.size()-1;j++) { const FlowChart &flo = flowList[j]; int kind = flo.type; if ( (kind & IFF) || (flo.type & ELSE_NO)) { const FlowChart &ftemp = flowList[j+1]; if (ftemp.type & EMPTY) { FlowChart fc(TEXT_NO,"empty ",QCString()); fc.stamp = flo.stamp; flowList.insert(flowList.begin()+j+1,fc); } } } } }// colTextNode QCString FlowChart::getNodeName(int n) { QCString node; node.setNum(n); return node.prepend("node"); } void FlowChart::delFlowList() { ifcounter=0; nodeCounter=0; flowList.clear(); } void FlowChart::alignCommentNode(TextStream &t,QCString com) { size_t max=0; QCString s; StringVector ql=split(com.str(),"\n"); for (size_t j=0;j<ql.size();j++) { s=ql[j]; if (max<s.length()) max=s.length(); } s=ql.back(); int diff=static_cast<int>(max-s.length()); QCString n; if (diff>0) { n.fill(' ',2*diff); n.append("."); s+=n; ql.pop_back(); ql.push_back(s.str()); } for (size_t j=0;j<ql.size();j++) { s=ql[j]; if (j<ql.size()-1) { s+="\n"; } FlowChart::codify(t,s); } } void FlowChart::buildCommentNodes(TextStream & t) { size_t size=flowList.size(); bool begin=false; if (size>0) { for (uint32_t j=0;j < size-1 ;j++) { FlowChart &fll = flowList[j]; if (fll.type & COMMENT_NO) { FlowChart &to=flowList[j+1]; if (to.type & COMMENT_NO) { to.label = fll.label+"\n"+to.label; flowList.erase(flowList.begin()+j); if (size>0) size--; if (j>0) j--; } } }// for } for (size_t j=0;j <flowList.size() ;j++) { const FlowChart &fll=flowList[j]; if (fll.type & BEGIN_NO) { begin = true; continue; } if (fll.type & COMMENT_NO) { const FlowChart *to = nullptr; if (!begin) { // comment between function/process .. begin is linked to start node to = &flowList[0]; } else if (j>0 && flowList[j-1].line==fll.line) { to = &flowList[j-1]; } else { to = &flowList[j+1]; } t << getNodeName(fll.id); t << "[shape=none, label=<\n"; t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n "; t << "<TR><TD BGCOLOR=\""; t << flowCol.comment; t << "\" > "; FlowChart::alignCommentNode(t,fll.label); t << " </TD></TR></TABLE>>];"; writeEdge(t,fll.id,to->id,2); } }// for // delete comment nodes; size=flowList.size(); for (size_t j=0; j<size; j++) { FlowChart &fll=flowList[j]; if (fll.type & (COMMENT_NO | BEGIN_NO)) { size_t diff=FLOWLEN-(j+1); if ((fll.type & COMMENT_NO) && diff > 1) { flowList[j+1].label = fll.label; } flowList.erase(flowList.begin()+j); if (size>0) size--; if (j>0) j--; } }// for; } void FlowChart::codify(TextStream &t,const QCString &str) { if (!str.isEmpty()) { const char *p=str.data(); while (*p) { char c=*p++; switch(c) { case '<': t << "&lt;"; break; case '>': t << "&gt;"; break; case '&': t << "&amp;"; break; case '\'': t << "&#39;"; break; case '"': t << "&quot;"; break; case '\n': t <<"<BR ALIGN=\"LEFT\"/>"; break; default: t << c; break; } } } }//codify FlowChart::FlowChart(int typ,const QCString &t,const QCString &ex,const QCString &lab) { stamp=ifcounter; if (typ & STARTL) { ifcounter++; } text=t; exp=ex; type=typ; label=lab; if (typ & (ELSE_NO | ELSIF_NO)) { stamp--; } if (typ & (START_NO | END_NO | VARIABLE_NO)) { stamp=0; } id=nodeCounter++; } void FlowChart::addFlowChart(int type,const QCString &text,const QCString &exp, const QCString &label) { if (!VhdlDocGen::getFlowMember()) return; QCString typeString(text); QCString expression(exp); if (!text.isEmpty()) { typeString=substitute(typeString,";","\n"); } if (!exp.isEmpty()) { expression=substitute(expression,"\"","\\\""); } if (type & VARIABLE_NO) { // Ignore the empty section of the VHDL variable definition. // This is section between `process` and `begin` keywords, where any source text is missing, probably a bug in the VHDL source parser. if(text.isEmpty()) return; flowList.insert(flowList.begin(),FlowChart(type,typeString,expression,label)); flowList.front().line=1; // TODO: use getLine(); of the parser } else if (type & START_NO) { flowList.insert(flowList.begin(),FlowChart(type,typeString,expression,label)); flowList.front().line=1; // TODO: use getLine(); of the parser } else { flowList.emplace_back(type,typeString,expression,label); flowList.back().line=1; // TODO: use getLine(); of the parser } } void FlowChart::moveToPrevLevel() { if (!VhdlDocGen::getFlowMember()) return; ifcounter--; } QCString FlowChart::printPlantUmlNode(const FlowChart &flo,bool ca,bool endL) { QCString t; QCString exp=flo.exp.stripWhiteSpace(); QCString text=flo.text.stripWhiteSpace(); switch (flo.type) { case START_NO: t=":"+text+"|"; break; case IF_NO : t="\nif ("+exp+") then (yes)"; break; case ELSIF_NO: t="\nelseif ("+exp+") then (yes)"; break; case ELSE_NO: t="\nelse"; break; case CASE_NO: t="\n:"+exp+";"; break; case WHEN_NO: t="\n"; if (!ca) t+="else"; t+="if ("+exp+") then (yes)"; break; case EXIT_NO: break; case END_NO: if (text.contains(" function")==0) t="\n:"+text+";"; break; case TEXT_NO: t="\n:"+text+"]"; break; case ENDIF_NO: t="\nendif"; break; case FOR_NO: t="\nwhile ("+exp+") is (yes)"; break; case WHILE_NO: t="\nwhile ("+exp+") is (yes)"; break; case END_LOOP: t="\nendwhile"; break; case END_CASE: t="\nendif\n:end case;"; break; case VARIABLE_NO:t="\n:"+text+";"; break; case RETURN_NO: t="\n:"+text+";"; if (!endL) t+="\nstop"; break; case LOOP_NO: t="\nwhile (infinite loop)"; break; case NEXT_NO: break; case EMPTY_NO: break; case COMMENT_NO: t="\n note left \n "+flo.label+"\nend note \n"; break; case BEGIN_NO: t="\n:begin;"; break; default: assert(false); break; } return t; } void FlowChart::printUmlTree() { int caseCounter = 0; int whenCounter = 0; QCString qcs; size_t size=flowList.size(); for (size_t j=0;j<size;j++) { bool endList = j==FLOWLEN; const FlowChart &flo = flowList[j]; if (flo.type==CASE_NO) { caseCounter++; whenCounter=0; } if (flo.type==END_CASE) { caseCounter--; } bool ca = (caseCounter>0 && whenCounter==0); qcs+=printPlantUmlNode(flo,ca,endList); if (flo.type==WHEN_NO) { whenCounter++; } } qcs+="\n"; QCString htmlOutDir = Config_getString(HTML_OUTPUT); QCString n=convertNameToFileName(); n=PlantumlManager::instance().writePlantUMLSource(htmlOutDir,n,qcs,PlantumlManager::PUML_SVG,"uml",n,1,true); PlantumlManager::instance().generatePlantUMLOutput(n,htmlOutDir,PlantumlManager::PUML_SVG); } QCString FlowChart::convertNameToFileName() { return VhdlDocGen::getFlowMember()->name(); } const char* FlowChart::getNodeType(int c) { switch(c) { case IF_NO: return "if "; case ELSIF_NO: return "elsif "; case ELSE_NO: return "else "; case CASE_NO: return "case "; case WHEN_NO: return "when "; case EXIT_NO: return "exit "; case END_NO: return "end "; case TEXT_NO: return "text "; case START_NO: return "start "; case ENDIF_NO: return "endif "; case FOR_NO: return "for "; case WHILE_NO: return "while "; case END_LOOP: return "end_loop "; case END_CASE: return "end_case "; case VARIABLE_NO: return "variable_decl "; case RETURN_NO: return "return "; case LOOP_NO: return "infinite loop "; case NEXT_NO: return "next "; case COMMENT_NO: return "comment "; case EMPTY_NO: return "empty "; case BEGIN_NO: return "<begin> "; default: return "--failure--"; } } void FlowChart::createSVG() { QCString qcs("/"); QCString ov = Config_getString(HTML_OUTPUT); qcs+=FlowChart::convertNameToFileName()+".svg"; //const MemberDef *m=VhdlDocGen::getFlowMember(); //if (m) // fprintf(stderr,"\n creating flowchart : %s %s in file %s \n",theTranslator->trVhdlType(m->getMemberSpecifiers(),TRUE),qPrint(m->name()),qPrint(m->getFileDef()->name())); QCString dir=" -o \""+ov+qcs+"\""; ov+="/flow_design.dot"; QCString vlargs="-Tsvg \""+ov+"\" "+dir ; if (Portable::system(Doxygen::verifiedDotPath,vlargs)!=0) { err("could not create dot file\n"); } } void FlowChart::startDot(TextStream &t) { t << " digraph G { \n"; t << "rankdir=TB \n"; t << "concentrate=true\n"; t << "stylesheet=\"doxygen.css\"\n"; } void FlowChart::endDot(TextStream &t) { t << " } \n"; } void FlowChart::writeFlowChart() { // assert(VhdlDocGen::flowMember); QCString ov = Config_getString(HTML_OUTPUT); QCString fileName = ov+"/flow_design.dot"; std::ofstream f = Portable::openOutputStream(fileName); if (!f.is_open()) { err("Cannot open file %s for writing\n",qPrint(fileName)); return; } TextStream t(&f); colTextNodes(); // buildCommentNodes(t); #ifdef DEBUGFLOW printFlowTree(); #endif if (!Config_getString(PLANTUML_JAR_PATH).isEmpty()) { printUmlTree(); delFlowList(); t.flush(); f.close(); return; } startDot(t); buildCommentNodes(t); for (const auto &fll : flowList) { writeShape(t,fll); } writeFlowLinks(t); FlowChart::endDot(t); delFlowList(); t.flush(); f.close(); FlowChart::createSVG(); }// writeFlowChart void FlowChart::writeShape(TextStream &t,const FlowChart &fl) { if (fl.type & EEND) return; QCString var; if (fl.type & LOOP) { var=" loop"; } else if (fl.type & IFF) { var=" then"; } else { var=""; } t << getNodeName(fl.id); #ifdef DEBUGFLOW QCString qq(getNodeName(fl.id)); g_keyMap.emplace(qq.str(),fl.id); #endif bool dec=(fl.type & DECLN); bool exit=(fl.type & EXITNEXT); if (exit && !fl.exp.isEmpty()) { dec=TRUE; } if (dec) { QCString exp=fl.exp; alignText(exp); t << " [shape=diamond,style=filled,color=\""; t << flowCol.decisionNode; t << "\",label=\" "; QCString kl; if (exit) kl=fl.text+" "; if (!fl.label.isEmpty()) { kl+=fl.label+":"+exp+var; } else { kl+=exp+var; } FlowChart::alignCommentNode(t,kl); t << "\"]\n"; } else if (fl.type & ENDCL) { QCString val=fl.text; t << " [shape=ellipse ,label=\""+val+"\"]\n"; } else if (fl.type & STARTFIN) { QCString val=fl.text; t << "[shape=box , style=rounded label=<\n"; t << "<TABLE BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" >\n "; t << "<TR><TD BGCOLOR=\""; t<< flowCol.startEndNode; t<< "\"> "; FlowChart::alignCommentNode(t,val); t << " </TD></TR></TABLE>>];"; } else { if (fl.text.isEmpty()) return; bool isVar=(fl.type & FlowChart::VARIABLE_NO); QCString q=fl.text; if (exit) { q+=" "+fl.label; } int z=q.findRev("\n"); if (z==static_cast<int>(q.length())-1) { q=q.remove(z,2); } t << "[shape=none margin=0.1, label=<\n"; t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n "; if (isVar) { t << "<TR><TD BGCOLOR=\"" << flowCol.varNode << "\" > "; } else { t << "<TR><TD BGCOLOR=\"" << flowCol.textNode << "\" > "; } FlowChart::alignCommentNode(t,q); t << " </TD></TR></TABLE>>];"; } } void FlowChart::writeEdge(TextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i) { bool b=fl_from.type & STARTL; bool c=fl_to.type & STARTL; #ifdef DEBUGFLOW QCString s1(getNodeName(fl_from.id)); QCString s2(getNodeName(fl_to.id)); auto it = g_keyMap.find(s1.str()); auto it1 = g_keyMap.find(s2.str()); // checks if the link is connected to a valid node assert(it!=g_keyMap.end()); assert(it1!=g_keyMap.end()); #endif writeEdge(t,fl_from.id,fl_to.id,i,b,c); } void FlowChart::writeEdge(TextStream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo) { QCString label,col; if (i==0) { col=flowCol.yesNodeLink; label="yes"; } else if (i==1) { col=flowCol.noNodeLink; label="no"; } else { col=flowCol.textNodeLink; label=""; } t << "edge [color=\""+col+"\",label=\""+label+"\"]\n"; t << getNodeName(fl_from); if (bFrom) t << ":s"; t << "->"; t << getNodeName(fl_to); if (bTo) t << ":n"; t << "\n"; } void FlowChart::alignFuncProc( QCString & q,const ArgumentList &al,bool isFunc) { size_t index=al.size(); if (index==0) return; size_t len=q.length()+VhdlDocGen::getFlowMember()->name().length(); QCString prev,temp; prev.fill(' ',static_cast<int>(len)+1); q+="\n"; for (const Argument &arg : al) { QCString attl=arg.defval+" "; attl+=arg.name+" "; if (!isFunc) { attl+=arg.attrib+" "; } else { attl+=" in "; } attl+=arg.type; if (--index) attl+=",\n"; else attl+="\n"; attl.prepend(prev); temp+=attl; } q+=temp; } size_t FlowChart::findNextLoop(size_t index,int stamp) { for (size_t j=index+1; j<flowList.size(); j++) { const FlowChart &flo = flowList[j]; if (flo.stamp==stamp) { continue; } if (flo.type&END_LOOP) { return j; } } return flowList.size()-1; } size_t FlowChart::findPrevLoop(size_t index,int stamp,bool endif) { for (size_t j=index;j>0;j--) { const FlowChart &flo = flowList[j]; if (flo.type & LOOP) { if (flo.stamp==stamp && endif) { return j; } else { if (flo.stamp<stamp) { return j; } } } } return flowList.size()-1; } size_t FlowChart::findLabel(size_t index,const QCString &label) { for (size_t j=index;j>0;j--) { const FlowChart &flo = flowList[j]; if ((flo.type & LOOP) && !flo.label.isEmpty() && qstricmp(flo.label,label)==0) { return j; } } err("could not find label: '%s'\n",qPrint(label)); return 0; } size_t FlowChart::findNode(size_t index,int stamp,int type) { for (size_t j=index+1; j<flowList.size(); j++) { const FlowChart &flo = flowList[j]; if (flo.type==type && flo.stamp==stamp) { return j; } } return 0; }// findNode size_t FlowChart::getNextNode(size_t index,int stamp) { for (size_t j=index+1; j<flowList.size(); j++) { const FlowChart &flo = flowList[j]; int kind = flo.type; int s = flo.stamp; if (s>stamp) { continue; } if (kind & ENDIF_NO) { if (s<stamp && stamp>0) { stamp--; continue; } } if (kind & (ELSE_NO | ELSIF_NO)) { if (s<stamp && stamp>0) { stamp--; } j=findNode(j,stamp,ENDIF_NO); continue; } if (kind & WHEN_NO) { if (s<stamp && stamp>0) { stamp--; } return findNode(j,stamp-1,END_CASE); } return j; } return FLOWLEN; } size_t FlowChart::getNextIfLink(const FlowChart &fl,size_t index) { int stamp=fl.stamp; size_t start = index+1; size_t endifNode = findNode(start,stamp,ENDIF_NO); size_t elseifNode = findNode(start,stamp,ELSIF_NO); size_t elseNode = findNode(start,stamp,ELSE_NO); if (elseifNode>0 && elseifNode<endifNode) { return elseifNode; } if (elseNode>0 && elseNode<endifNode) { return elseNode+1; } stamp=flowList[endifNode].stamp; return getNextNode(endifNode,stamp); } void FlowChart::writeFlowLinks(TextStream &t) { size_t size=flowList.size(); if (size<2) return; // write start link writeEdge(t,flowList[0],flowList[1],2); for (size_t j=0;j<size;j++) { const FlowChart &fll = flowList[j]; int kind = fll.type; int stamp = fll.stamp; if (kind & EEND) { continue; } if (kind & IFF) { writeEdge(t,fll,flowList[j+1],0); size_t z=getNextIfLink(fll,j); // assert(z>-1); writeEdge(t,fll,flowList[z],1); } else if (kind & LOOP_NO) { writeEdge(t,fll,flowList[j+1],2); continue; } else if (kind & (CASE_NO | FOR_NO | WHILE_NO)) { if (kind & CASE_NO) { writeEdge(t,fll,flowList[j+1],2); continue; } else { writeEdge(t,fll,flowList[j+1],0); } kind=END_LOOP; size_t z=findNode(j+1,fll.stamp,kind); z=getNextNode(z,flowList[z].stamp); // assert(z>-1); writeEdge(t,fll,flowList[z],1); continue; } else if (kind & (TEXT_NO | VARIABLE_NO)) { size_t z=getNextNode(j,stamp); writeEdge(t,fll,flowList[z],2); } else if (kind & WHEN_NO) { // default value if (qstricmp(fll.text.simplifyWhiteSpace(),"others")==0) { writeEdge(t,fll,flowList[j+1],2); continue; } writeEdge(t,fll,flowList[j+1],0); size_t u=findNode(j,stamp,WHEN_NO); size_t v=findNode(j,stamp-1,END_CASE); if (u>0 && u<v) { writeEdge(t,fll,flowList[u],1); } else { writeEdge(t,fll,flowList[v],1); } } else if (kind & END_CASE) { size_t z=FlowChart::getNextNode(j,fll.stamp); writeEdge(t,fll,flowList[z],2); } else if (kind & END_LOOP) { size_t z=findPrevLoop(j,fll.stamp,true); writeEdge(t,fll,flowList[z],2); } else if (kind & RETURN_NO) { writeEdge(t,fll,flowList[size-1],2); } else if (kind & (EXIT_NO | NEXT_NO)) { size_t z = 0; bool b = kind==NEXT_NO; if (!fll.exp.isEmpty()) { writeEdge(t,fll,flowList[j+1],1); } if (!fll.label.isEmpty()) { z=findLabel(j,fll.label); if (b) { writeEdge(t,fll,flowList[z],0); } else { z=findNode(z,flowList[z].stamp,END_LOOP); z=getNextNode(z,flowList[z].stamp); writeEdge(t,fll,flowList[z],0); } continue; } else { if (b) { z=findPrevLoop(j,fll.stamp); writeEdge(t,fll,flowList[z],0); continue; } else { z =findNextLoop(j,fll.stamp-1); } z=getNextNode(z,flowList[z].stamp); } writeEdge(t,fll,flowList[z],0); } } //for } //writeFlowLinks
89,632
C++
.cpp
3,141
23.894301
177
0.628839
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,491
emoji.cpp
doxygen_doxygen/src/emoji.cpp
/****************************************************************************** * * Copyright (C) 1997-2018 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 "emoji.h" #include "message.h" #include "util.h" #include "textstream.h" static struct emojiEntityInfo { const char *name; const char *unicode; } g_emojiEntities[] = /* generated using the download_github_emojis.py script */ { { ":+1:", "&#x1f44d;" }, { ":-1:", "&#x1f44e;" }, { ":100:", "&#x1f4af;" }, { ":1234:", "&#x1f522;" }, { ":1st_place_medal:", "&#x1f947;" }, { ":2nd_place_medal:", "&#x1f948;" }, { ":3rd_place_medal:", "&#x1f949;" }, { ":8ball:", "&#x1f3b1;" }, { ":a:", "&#x1f170;" }, { ":ab:", "&#x1f18e;" }, { ":abacus:", "&#x1f9ee;" }, { ":abc:", "&#x1f524;" }, { ":abcd:", "&#x1f521;" }, { ":accept:", "&#x1f251;" }, { ":accordion:", "&#x1fa97;" }, { ":adhesive_bandage:", "&#x1fa79;" }, { ":adult:", "&#x1f9d1;" }, { ":aerial_tramway:", "&#x1f6a1;" }, { ":afghanistan:", "&#x1f1e6;&#x1f1eb;" }, { ":airplane:", "&#x2708;" }, { ":aland_islands:", "&#x1f1e6;&#x1f1fd;" }, { ":alarm_clock:", "&#x23f0;" }, { ":albania:", "&#x1f1e6;&#x1f1f1;" }, { ":alembic:", "&#x2697;" }, { ":algeria:", "&#x1f1e9;&#x1f1ff;" }, { ":alien:", "&#x1f47d;" }, { ":ambulance:", "&#x1f691;" }, { ":american_samoa:", "&#x1f1e6;&#x1f1f8;" }, { ":amphora:", "&#x1f3fa;" }, { ":anatomical_heart:", "&#x1fac0;" }, { ":anchor:", "&#x2693;" }, { ":andorra:", "&#x1f1e6;&#x1f1e9;" }, { ":angel:", "&#x1f47c;" }, { ":anger:", "&#x1f4a2;" }, { ":angola:", "&#x1f1e6;&#x1f1f4;" }, { ":angry:", "&#x1f620;" }, { ":anguilla:", "&#x1f1e6;&#x1f1ee;" }, { ":anguished:", "&#x1f627;" }, { ":ant:", "&#x1f41c;" }, { ":antarctica:", "&#x1f1e6;&#x1f1f6;" }, { ":antigua_barbuda:", "&#x1f1e6;&#x1f1ec;" }, { ":apple:", "&#x1f34e;" }, { ":aquarius:", "&#x2652;" }, { ":argentina:", "&#x1f1e6;&#x1f1f7;" }, { ":aries:", "&#x2648;" }, { ":armenia:", "&#x1f1e6;&#x1f1f2;" }, { ":arrow_backward:", "&#x25c0;" }, { ":arrow_double_down:", "&#x23ec;" }, { ":arrow_double_up:", "&#x23eb;" }, { ":arrow_down:", "&#x2b07;" }, { ":arrow_down_small:", "&#x1f53d;" }, { ":arrow_forward:", "&#x25b6;" }, { ":arrow_heading_down:", "&#x2935;" }, { ":arrow_heading_up:", "&#x2934;" }, { ":arrow_left:", "&#x2b05;" }, { ":arrow_lower_left:", "&#x2199;" }, { ":arrow_lower_right:", "&#x2198;" }, { ":arrow_right:", "&#x27a1;" }, { ":arrow_right_hook:", "&#x21aa;" }, { ":arrow_up:", "&#x2b06;" }, { ":arrow_up_down:", "&#x2195;" }, { ":arrow_up_small:", "&#x1f53c;" }, { ":arrow_upper_left:", "&#x2196;" }, { ":arrow_upper_right:", "&#x2197;" }, { ":arrows_clockwise:", "&#x1f503;" }, { ":arrows_counterclockwise:", "&#x1f504;" }, { ":art:", "&#x1f3a8;" }, { ":articulated_lorry:", "&#x1f69b;" }, { ":artificial_satellite:", "&#x1f6f0;" }, { ":artist:", "&#x1f9d1;&#x1f3a8;" }, { ":aruba:", "&#x1f1e6;&#x1f1fc;" }, { ":ascension_island:", "&#x1f1e6;&#x1f1e8;" }, { ":asterisk:", "&#x002a;&#x20e3;" }, { ":astonished:", "&#x1f632;" }, { ":astronaut:", "&#x1f9d1;&#x1f680;" }, { ":athletic_shoe:", "&#x1f45f;" }, { ":atm:", "&#x1f3e7;" }, { ":atom_symbol:", "&#x269b;" }, { ":australia:", "&#x1f1e6;&#x1f1fa;" }, { ":austria:", "&#x1f1e6;&#x1f1f9;" }, { ":auto_rickshaw:", "&#x1f6fa;" }, { ":avocado:", "&#x1f951;" }, { ":axe:", "&#x1fa93;" }, { ":azerbaijan:", "&#x1f1e6;&#x1f1ff;" }, { ":b:", "&#x1f171;" }, { ":baby:", "&#x1f476;" }, { ":baby_bottle:", "&#x1f37c;" }, { ":baby_chick:", "&#x1f424;" }, { ":baby_symbol:", "&#x1f6bc;" }, { ":back:", "&#x1f519;" }, { ":bacon:", "&#x1f953;" }, { ":badger:", "&#x1f9a1;" }, { ":badminton:", "&#x1f3f8;" }, { ":bagel:", "&#x1f96f;" }, { ":baggage_claim:", "&#x1f6c4;" }, { ":baguette_bread:", "&#x1f956;" }, { ":bahamas:", "&#x1f1e7;&#x1f1f8;" }, { ":bahrain:", "&#x1f1e7;&#x1f1ed;" }, { ":balance_scale:", "&#x2696;" }, { ":bald_man:", "&#x1f468;&#x1f9b2;" }, { ":bald_woman:", "&#x1f469;&#x1f9b2;" }, { ":ballet_shoes:", "&#x1fa70;" }, { ":balloon:", "&#x1f388;" }, { ":ballot_box:", "&#x1f5f3;" }, { ":ballot_box_with_check:", "&#x2611;" }, { ":bamboo:", "&#x1f38d;" }, { ":banana:", "&#x1f34c;" }, { ":bangbang:", "&#x203c;" }, { ":bangladesh:", "&#x1f1e7;&#x1f1e9;" }, { ":banjo:", "&#x1fa95;" }, { ":bank:", "&#x1f3e6;" }, { ":bar_chart:", "&#x1f4ca;" }, { ":barbados:", "&#x1f1e7;&#x1f1e7;" }, { ":barber:", "&#x1f488;" }, { ":baseball:", "&#x26be;" }, { ":basket:", "&#x1f9fa;" }, { ":basketball:", "&#x1f3c0;" }, { ":basketball_man:", "&#x26f9;&#x2642;" }, { ":basketball_woman:", "&#x26f9;&#x2640;" }, { ":bat:", "&#x1f987;" }, { ":bath:", "&#x1f6c0;" }, { ":bathtub:", "&#x1f6c1;" }, { ":battery:", "&#x1f50b;" }, { ":beach_umbrella:", "&#x1f3d6;" }, { ":beans:", "&#x1fad8;" }, { ":bear:", "&#x1f43b;" }, { ":bearded_person:", "&#x1f9d4;" }, { ":beaver:", "&#x1f9ab;" }, { ":bed:", "&#x1f6cf;" }, { ":bee:", "&#x1f41d;" }, { ":beer:", "&#x1f37a;" }, { ":beers:", "&#x1f37b;" }, { ":beetle:", "&#x1fab2;" }, { ":beginner:", "&#x1f530;" }, { ":belarus:", "&#x1f1e7;&#x1f1fe;" }, { ":belgium:", "&#x1f1e7;&#x1f1ea;" }, { ":belize:", "&#x1f1e7;&#x1f1ff;" }, { ":bell:", "&#x1f514;" }, { ":bell_pepper:", "&#x1fad1;" }, { ":bellhop_bell:", "&#x1f6ce;" }, { ":benin:", "&#x1f1e7;&#x1f1ef;" }, { ":bento:", "&#x1f371;" }, { ":bermuda:", "&#x1f1e7;&#x1f1f2;" }, { ":beverage_box:", "&#x1f9c3;" }, { ":bhutan:", "&#x1f1e7;&#x1f1f9;" }, { ":bicyclist:", "&#x1f6b4;" }, { ":bike:", "&#x1f6b2;" }, { ":biking_man:", "&#x1f6b4;&#x2642;" }, { ":biking_woman:", "&#x1f6b4;&#x2640;" }, { ":bikini:", "&#x1f459;" }, { ":billed_cap:", "&#x1f9e2;" }, { ":biohazard:", "&#x2623;" }, { ":bird:", "&#x1f426;" }, { ":birthday:", "&#x1f382;" }, { ":bison:", "&#x1f9ac;" }, { ":biting_lip:", "&#x1fae6;" }, { ":black_bird:", "&#x1f426;&#x2b1b;" }, { ":black_cat:", "&#x1f408;&#x2b1b;" }, { ":black_circle:", "&#x26ab;" }, { ":black_flag:", "&#x1f3f4;" }, { ":black_heart:", "&#x1f5a4;" }, { ":black_joker:", "&#x1f0cf;" }, { ":black_large_square:", "&#x2b1b;" }, { ":black_medium_small_square:", "&#x25fe;" }, { ":black_medium_square:", "&#x25fc;" }, { ":black_nib:", "&#x2712;" }, { ":black_small_square:", "&#x25aa;" }, { ":black_square_button:", "&#x1f532;" }, { ":blond_haired_man:", "&#x1f471;&#x2642;" }, { ":blond_haired_person:", "&#x1f471;" }, { ":blond_haired_woman:", "&#x1f471;&#x2640;" }, { ":blonde_woman:", "&#x1f471;&#x2640;" }, { ":blossom:", "&#x1f33c;" }, { ":blowfish:", "&#x1f421;" }, { ":blue_book:", "&#x1f4d8;" }, { ":blue_car:", "&#x1f699;" }, { ":blue_heart:", "&#x1f499;" }, { ":blue_square:", "&#x1f7e6;" }, { ":blueberries:", "&#x1fad0;" }, { ":blush:", "&#x1f60a;" }, { ":boar:", "&#x1f417;" }, { ":boat:", "&#x26f5;" }, { ":bolivia:", "&#x1f1e7;&#x1f1f4;" }, { ":bomb:", "&#x1f4a3;" }, { ":bone:", "&#x1f9b4;" }, { ":book:", "&#x1f4d6;" }, { ":bookmark:", "&#x1f516;" }, { ":bookmark_tabs:", "&#x1f4d1;" }, { ":books:", "&#x1f4da;" }, { ":boom:", "&#x1f4a5;" }, { ":boomerang:", "&#x1fa83;" }, { ":boot:", "&#x1f462;" }, { ":bosnia_herzegovina:", "&#x1f1e7;&#x1f1e6;" }, { ":botswana:", "&#x1f1e7;&#x1f1fc;" }, { ":bouncing_ball_man:", "&#x26f9;&#x2642;" }, { ":bouncing_ball_person:", "&#x26f9;" }, { ":bouncing_ball_woman:", "&#x26f9;&#x2640;" }, { ":bouquet:", "&#x1f490;" }, { ":bouvet_island:", "&#x1f1e7;&#x1f1fb;" }, { ":bow:", "&#x1f647;" }, { ":bow_and_arrow:", "&#x1f3f9;" }, { ":bowing_man:", "&#x1f647;&#x2642;" }, { ":bowing_woman:", "&#x1f647;&#x2640;" }, { ":bowl_with_spoon:", "&#x1f963;" }, { ":bowling:", "&#x1f3b3;" }, { ":boxing_glove:", "&#x1f94a;" }, { ":boy:", "&#x1f466;" }, { ":brain:", "&#x1f9e0;" }, { ":brazil:", "&#x1f1e7;&#x1f1f7;" }, { ":bread:", "&#x1f35e;" }, { ":breast_feeding:", "&#x1f931;" }, { ":bricks:", "&#x1f9f1;" }, { ":bride_with_veil:", "&#x1f470;&#x2640;" }, { ":bridge_at_night:", "&#x1f309;" }, { ":briefcase:", "&#x1f4bc;" }, { ":british_indian_ocean_territory:", "&#x1f1ee;&#x1f1f4;" }, { ":british_virgin_islands:", "&#x1f1fb;&#x1f1ec;" }, { ":broccoli:", "&#x1f966;" }, { ":broken_heart:", "&#x1f494;" }, { ":broom:", "&#x1f9f9;" }, { ":brown_circle:", "&#x1f7e4;" }, { ":brown_heart:", "&#x1f90e;" }, { ":brown_square:", "&#x1f7eb;" }, { ":brunei:", "&#x1f1e7;&#x1f1f3;" }, { ":bubble_tea:", "&#x1f9cb;" }, { ":bubbles:", "&#x1fae7;" }, { ":bucket:", "&#x1faa3;" }, { ":bug:", "&#x1f41b;" }, { ":building_construction:", "&#x1f3d7;" }, { ":bulb:", "&#x1f4a1;" }, { ":bulgaria:", "&#x1f1e7;&#x1f1ec;" }, { ":bullettrain_front:", "&#x1f685;" }, { ":bullettrain_side:", "&#x1f684;" }, { ":burkina_faso:", "&#x1f1e7;&#x1f1eb;" }, { ":burrito:", "&#x1f32f;" }, { ":burundi:", "&#x1f1e7;&#x1f1ee;" }, { ":bus:", "&#x1f68c;" }, { ":business_suit_levitating:", "&#x1f574;" }, { ":busstop:", "&#x1f68f;" }, { ":bust_in_silhouette:", "&#x1f464;" }, { ":busts_in_silhouette:", "&#x1f465;" }, { ":butter:", "&#x1f9c8;" }, { ":butterfly:", "&#x1f98b;" }, { ":cactus:", "&#x1f335;" }, { ":cake:", "&#x1f370;" }, { ":calendar:", "&#x1f4c6;" }, { ":call_me_hand:", "&#x1f919;" }, { ":calling:", "&#x1f4f2;" }, { ":cambodia:", "&#x1f1f0;&#x1f1ed;" }, { ":camel:", "&#x1f42b;" }, { ":camera:", "&#x1f4f7;" }, { ":camera_flash:", "&#x1f4f8;" }, { ":cameroon:", "&#x1f1e8;&#x1f1f2;" }, { ":camping:", "&#x1f3d5;" }, { ":canada:", "&#x1f1e8;&#x1f1e6;" }, { ":canary_islands:", "&#x1f1ee;&#x1f1e8;" }, { ":cancer:", "&#x264b;" }, { ":candle:", "&#x1f56f;" }, { ":candy:", "&#x1f36c;" }, { ":canned_food:", "&#x1f96b;" }, { ":canoe:", "&#x1f6f6;" }, { ":cape_verde:", "&#x1f1e8;&#x1f1fb;" }, { ":capital_abcd:", "&#x1f520;" }, { ":capricorn:", "&#x2651;" }, { ":car:", "&#x1f697;" }, { ":card_file_box:", "&#x1f5c3;" }, { ":card_index:", "&#x1f4c7;" }, { ":card_index_dividers:", "&#x1f5c2;" }, { ":caribbean_netherlands:", "&#x1f1e7;&#x1f1f6;" }, { ":carousel_horse:", "&#x1f3a0;" }, { ":carpentry_saw:", "&#x1fa9a;" }, { ":carrot:", "&#x1f955;" }, { ":cartwheeling:", "&#x1f938;" }, { ":cat:", "&#x1f431;" }, { ":cat2:", "&#x1f408;" }, { ":cayman_islands:", "&#x1f1f0;&#x1f1fe;" }, { ":cd:", "&#x1f4bf;" }, { ":central_african_republic:", "&#x1f1e8;&#x1f1eb;" }, { ":ceuta_melilla:", "&#x1f1ea;&#x1f1e6;" }, { ":chad:", "&#x1f1f9;&#x1f1e9;" }, { ":chains:", "&#x26d3;" }, { ":chair:", "&#x1fa91;" }, { ":champagne:", "&#x1f37e;" }, { ":chart:", "&#x1f4b9;" }, { ":chart_with_downwards_trend:", "&#x1f4c9;" }, { ":chart_with_upwards_trend:", "&#x1f4c8;" }, { ":checkered_flag:", "&#x1f3c1;" }, { ":cheese:", "&#x1f9c0;" }, { ":cherries:", "&#x1f352;" }, { ":cherry_blossom:", "&#x1f338;" }, { ":chess_pawn:", "&#x265f;" }, { ":chestnut:", "&#x1f330;" }, { ":chicken:", "&#x1f414;" }, { ":child:", "&#x1f9d2;" }, { ":children_crossing:", "&#x1f6b8;" }, { ":chile:", "&#x1f1e8;&#x1f1f1;" }, { ":chipmunk:", "&#x1f43f;" }, { ":chocolate_bar:", "&#x1f36b;" }, { ":chopsticks:", "&#x1f962;" }, { ":christmas_island:", "&#x1f1e8;&#x1f1fd;" }, { ":christmas_tree:", "&#x1f384;" }, { ":church:", "&#x26ea;" }, { ":cinema:", "&#x1f3a6;" }, { ":circus_tent:", "&#x1f3aa;" }, { ":city_sunrise:", "&#x1f307;" }, { ":city_sunset:", "&#x1f306;" }, { ":cityscape:", "&#x1f3d9;" }, { ":cl:", "&#x1f191;" }, { ":clamp:", "&#x1f5dc;" }, { ":clap:", "&#x1f44f;" }, { ":clapper:", "&#x1f3ac;" }, { ":classical_building:", "&#x1f3db;" }, { ":climbing:", "&#x1f9d7;" }, { ":climbing_man:", "&#x1f9d7;&#x2642;" }, { ":climbing_woman:", "&#x1f9d7;&#x2640;" }, { ":clinking_glasses:", "&#x1f942;" }, { ":clipboard:", "&#x1f4cb;" }, { ":clipperton_island:", "&#x1f1e8;&#x1f1f5;" }, { ":clock1:", "&#x1f550;" }, { ":clock10:", "&#x1f559;" }, { ":clock1030:", "&#x1f565;" }, { ":clock11:", "&#x1f55a;" }, { ":clock1130:", "&#x1f566;" }, { ":clock12:", "&#x1f55b;" }, { ":clock1230:", "&#x1f567;" }, { ":clock130:", "&#x1f55c;" }, { ":clock2:", "&#x1f551;" }, { ":clock230:", "&#x1f55d;" }, { ":clock3:", "&#x1f552;" }, { ":clock330:", "&#x1f55e;" }, { ":clock4:", "&#x1f553;" }, { ":clock430:", "&#x1f55f;" }, { ":clock5:", "&#x1f554;" }, { ":clock530:", "&#x1f560;" }, { ":clock6:", "&#x1f555;" }, { ":clock630:", "&#x1f561;" }, { ":clock7:", "&#x1f556;" }, { ":clock730:", "&#x1f562;" }, { ":clock8:", "&#x1f557;" }, { ":clock830:", "&#x1f563;" }, { ":clock9:", "&#x1f558;" }, { ":clock930:", "&#x1f564;" }, { ":closed_book:", "&#x1f4d5;" }, { ":closed_lock_with_key:", "&#x1f510;" }, { ":closed_umbrella:", "&#x1f302;" }, { ":cloud:", "&#x2601;" }, { ":cloud_with_lightning:", "&#x1f329;" }, { ":cloud_with_lightning_and_rain:", "&#x26c8;" }, { ":cloud_with_rain:", "&#x1f327;" }, { ":cloud_with_snow:", "&#x1f328;" }, { ":clown_face:", "&#x1f921;" }, { ":clubs:", "&#x2663;" }, { ":cn:", "&#x1f1e8;&#x1f1f3;" }, { ":coat:", "&#x1f9e5;" }, { ":cockroach:", "&#x1fab3;" }, { ":cocktail:", "&#x1f378;" }, { ":coconut:", "&#x1f965;" }, { ":cocos_islands:", "&#x1f1e8;&#x1f1e8;" }, { ":coffee:", "&#x2615;" }, { ":coffin:", "&#x26b0;" }, { ":coin:", "&#x1fa99;" }, { ":cold_face:", "&#x1f976;" }, { ":cold_sweat:", "&#x1f630;" }, { ":collision:", "&#x1f4a5;" }, { ":colombia:", "&#x1f1e8;&#x1f1f4;" }, { ":comet:", "&#x2604;" }, { ":comoros:", "&#x1f1f0;&#x1f1f2;" }, { ":compass:", "&#x1f9ed;" }, { ":computer:", "&#x1f4bb;" }, { ":computer_mouse:", "&#x1f5b1;" }, { ":confetti_ball:", "&#x1f38a;" }, { ":confounded:", "&#x1f616;" }, { ":confused:", "&#x1f615;" }, { ":congo_brazzaville:", "&#x1f1e8;&#x1f1ec;" }, { ":congo_kinshasa:", "&#x1f1e8;&#x1f1e9;" }, { ":congratulations:", "&#x3297;" }, { ":construction:", "&#x1f6a7;" }, { ":construction_worker:", "&#x1f477;" }, { ":construction_worker_man:", "&#x1f477;&#x2642;" }, { ":construction_worker_woman:", "&#x1f477;&#x2640;" }, { ":control_knobs:", "&#x1f39b;" }, { ":convenience_store:", "&#x1f3ea;" }, { ":cook:", "&#x1f9d1;&#x1f373;" }, { ":cook_islands:", "&#x1f1e8;&#x1f1f0;" }, { ":cookie:", "&#x1f36a;" }, { ":cool:", "&#x1f192;" }, { ":cop:", "&#x1f46e;" }, { ":copyright:", "&#x00a9;" }, { ":coral:", "&#x1fab8;" }, { ":corn:", "&#x1f33d;" }, { ":costa_rica:", "&#x1f1e8;&#x1f1f7;" }, { ":cote_divoire:", "&#x1f1e8;&#x1f1ee;" }, { ":couch_and_lamp:", "&#x1f6cb;" }, { ":couple:", "&#x1f46b;" }, { ":couple_with_heart:", "&#x1f491;" }, { ":couple_with_heart_man_man:", "&#x1f468;&#x2764;&#x1f468;" }, { ":couple_with_heart_woman_man:", "&#x1f469;&#x2764;&#x1f468;" }, { ":couple_with_heart_woman_woman:", "&#x1f469;&#x2764;&#x1f469;" }, { ":couplekiss:", "&#x1f48f;" }, { ":couplekiss_man_man:", "&#x1f468;&#x2764;&#x1f48b;&#x1f468;" }, { ":couplekiss_man_woman:", "&#x1f469;&#x2764;&#x1f48b;&#x1f468;" }, { ":couplekiss_woman_woman:", "&#x1f469;&#x2764;&#x1f48b;&#x1f469;" }, { ":cow:", "&#x1f42e;" }, { ":cow2:", "&#x1f404;" }, { ":cowboy_hat_face:", "&#x1f920;" }, { ":crab:", "&#x1f980;" }, { ":crayon:", "&#x1f58d;" }, { ":credit_card:", "&#x1f4b3;" }, { ":crescent_moon:", "&#x1f319;" }, { ":cricket:", "&#x1f997;" }, { ":cricket_game:", "&#x1f3cf;" }, { ":croatia:", "&#x1f1ed;&#x1f1f7;" }, { ":crocodile:", "&#x1f40a;" }, { ":croissant:", "&#x1f950;" }, { ":crossed_fingers:", "&#x1f91e;" }, { ":crossed_flags:", "&#x1f38c;" }, { ":crossed_swords:", "&#x2694;" }, { ":crown:", "&#x1f451;" }, { ":crutch:", "&#x1fa7c;" }, { ":cry:", "&#x1f622;" }, { ":crying_cat_face:", "&#x1f63f;" }, { ":crystal_ball:", "&#x1f52e;" }, { ":cuba:", "&#x1f1e8;&#x1f1fa;" }, { ":cucumber:", "&#x1f952;" }, { ":cup_with_straw:", "&#x1f964;" }, { ":cupcake:", "&#x1f9c1;" }, { ":cupid:", "&#x1f498;" }, { ":curacao:", "&#x1f1e8;&#x1f1fc;" }, { ":curling_stone:", "&#x1f94c;" }, { ":curly_haired_man:", "&#x1f468;&#x1f9b1;" }, { ":curly_haired_woman:", "&#x1f469;&#x1f9b1;" }, { ":curly_loop:", "&#x27b0;" }, { ":currency_exchange:", "&#x1f4b1;" }, { ":curry:", "&#x1f35b;" }, { ":cursing_face:", "&#x1f92c;" }, { ":custard:", "&#x1f36e;" }, { ":customs:", "&#x1f6c3;" }, { ":cut_of_meat:", "&#x1f969;" }, { ":cyclone:", "&#x1f300;" }, { ":cyprus:", "&#x1f1e8;&#x1f1fe;" }, { ":czech_republic:", "&#x1f1e8;&#x1f1ff;" }, { ":dagger:", "&#x1f5e1;" }, { ":dancer:", "&#x1f483;" }, { ":dancers:", "&#x1f46f;" }, { ":dancing_men:", "&#x1f46f;&#x2642;" }, { ":dancing_women:", "&#x1f46f;&#x2640;" }, { ":dango:", "&#x1f361;" }, { ":dark_sunglasses:", "&#x1f576;" }, { ":dart:", "&#x1f3af;" }, { ":dash:", "&#x1f4a8;" }, { ":date:", "&#x1f4c5;" }, { ":de:", "&#x1f1e9;&#x1f1ea;" }, { ":deaf_man:", "&#x1f9cf;&#x2642;" }, { ":deaf_person:", "&#x1f9cf;" }, { ":deaf_woman:", "&#x1f9cf;&#x2640;" }, { ":deciduous_tree:", "&#x1f333;" }, { ":deer:", "&#x1f98c;" }, { ":denmark:", "&#x1f1e9;&#x1f1f0;" }, { ":department_store:", "&#x1f3ec;" }, { ":derelict_house:", "&#x1f3da;" }, { ":desert:", "&#x1f3dc;" }, { ":desert_island:", "&#x1f3dd;" }, { ":desktop_computer:", "&#x1f5a5;" }, { ":detective:", "&#x1f575;" }, { ":diamond_shape_with_a_dot_inside:", "&#x1f4a0;" }, { ":diamonds:", "&#x2666;" }, { ":diego_garcia:", "&#x1f1e9;&#x1f1ec;" }, { ":disappointed:", "&#x1f61e;" }, { ":disappointed_relieved:", "&#x1f625;" }, { ":disguised_face:", "&#x1f978;" }, { ":diving_mask:", "&#x1f93f;" }, { ":diya_lamp:", "&#x1fa94;" }, { ":dizzy:", "&#x1f4ab;" }, { ":dizzy_face:", "&#x1f635;" }, { ":djibouti:", "&#x1f1e9;&#x1f1ef;" }, { ":dna:", "&#x1f9ec;" }, { ":do_not_litter:", "&#x1f6af;" }, { ":dodo:", "&#x1f9a4;" }, { ":dog:", "&#x1f436;" }, { ":dog2:", "&#x1f415;" }, { ":dollar:", "&#x1f4b5;" }, { ":dolls:", "&#x1f38e;" }, { ":dolphin:", "&#x1f42c;" }, { ":dominica:", "&#x1f1e9;&#x1f1f2;" }, { ":dominican_republic:", "&#x1f1e9;&#x1f1f4;" }, { ":donkey:", "&#x1facf;" }, { ":door:", "&#x1f6aa;" }, { ":dotted_line_face:", "&#x1fae5;" }, { ":doughnut:", "&#x1f369;" }, { ":dove:", "&#x1f54a;" }, { ":dragon:", "&#x1f409;" }, { ":dragon_face:", "&#x1f432;" }, { ":dress:", "&#x1f457;" }, { ":dromedary_camel:", "&#x1f42a;" }, { ":drooling_face:", "&#x1f924;" }, { ":drop_of_blood:", "&#x1fa78;" }, { ":droplet:", "&#x1f4a7;" }, { ":drum:", "&#x1f941;" }, { ":duck:", "&#x1f986;" }, { ":dumpling:", "&#x1f95f;" }, { ":dvd:", "&#x1f4c0;" }, { ":e-mail:", "&#x1f4e7;" }, { ":eagle:", "&#x1f985;" }, { ":ear:", "&#x1f442;" }, { ":ear_of_rice:", "&#x1f33e;" }, { ":ear_with_hearing_aid:", "&#x1f9bb;" }, { ":earth_africa:", "&#x1f30d;" }, { ":earth_americas:", "&#x1f30e;" }, { ":earth_asia:", "&#x1f30f;" }, { ":ecuador:", "&#x1f1ea;&#x1f1e8;" }, { ":egg:", "&#x1f95a;" }, { ":eggplant:", "&#x1f346;" }, { ":egypt:", "&#x1f1ea;&#x1f1ec;" }, { ":eight:", "&#x0038;&#x20e3;" }, { ":eight_pointed_black_star:", "&#x2734;" }, { ":eight_spoked_asterisk:", "&#x2733;" }, { ":eject_button:", "&#x23cf;" }, { ":el_salvador:", "&#x1f1f8;&#x1f1fb;" }, { ":electric_plug:", "&#x1f50c;" }, { ":elephant:", "&#x1f418;" }, { ":elevator:", "&#x1f6d7;" }, { ":elf:", "&#x1f9dd;" }, { ":elf_man:", "&#x1f9dd;&#x2642;" }, { ":elf_woman:", "&#x1f9dd;&#x2640;" }, { ":email:", "&#x1f4e7;" }, { ":empty_nest:", "&#x1fab9;" }, { ":end:", "&#x1f51a;" }, { ":england:", "&#x1f3f4;&#xe0067;&#xe0062;&#xe0065;&#xe006e;&#xe0067;&#xe007f;" }, { ":envelope:", "&#x2709;" }, { ":envelope_with_arrow:", "&#x1f4e9;" }, { ":equatorial_guinea:", "&#x1f1ec;&#x1f1f6;" }, { ":eritrea:", "&#x1f1ea;&#x1f1f7;" }, { ":es:", "&#x1f1ea;&#x1f1f8;" }, { ":estonia:", "&#x1f1ea;&#x1f1ea;" }, { ":ethiopia:", "&#x1f1ea;&#x1f1f9;" }, { ":eu:", "&#x1f1ea;&#x1f1fa;" }, { ":euro:", "&#x1f4b6;" }, { ":european_castle:", "&#x1f3f0;" }, { ":european_post_office:", "&#x1f3e4;" }, { ":european_union:", "&#x1f1ea;&#x1f1fa;" }, { ":evergreen_tree:", "&#x1f332;" }, { ":exclamation:", "&#x2757;" }, { ":exploding_head:", "&#x1f92f;" }, { ":expressionless:", "&#x1f611;" }, { ":eye:", "&#x1f441;" }, { ":eye_speech_bubble:", "&#x1f441;&#x1f5e8;" }, { ":eyeglasses:", "&#x1f453;" }, { ":eyes:", "&#x1f440;" }, { ":face_exhaling:", "&#x1f62e;&#x1f4a8;" }, { ":face_holding_back_tears:", "&#x1f979;" }, { ":face_in_clouds:", "&#x1f636;&#x1f32b;" }, { ":face_with_diagonal_mouth:", "&#x1fae4;" }, { ":face_with_head_bandage:", "&#x1f915;" }, { ":face_with_open_eyes_and_hand_over_mouth:", "&#x1fae2;" }, { ":face_with_peeking_eye:", "&#x1fae3;" }, { ":face_with_spiral_eyes:", "&#x1f635;&#x1f4ab;" }, { ":face_with_thermometer:", "&#x1f912;" }, { ":facepalm:", "&#x1f926;" }, { ":facepunch:", "&#x1f44a;" }, { ":factory:", "&#x1f3ed;" }, { ":factory_worker:", "&#x1f9d1;&#x1f3ed;" }, { ":fairy:", "&#x1f9da;" }, { ":fairy_man:", "&#x1f9da;&#x2642;" }, { ":fairy_woman:", "&#x1f9da;&#x2640;" }, { ":falafel:", "&#x1f9c6;" }, { ":falkland_islands:", "&#x1f1eb;&#x1f1f0;" }, { ":fallen_leaf:", "&#x1f342;" }, { ":family:", "&#x1f46a;" }, { ":family_man_boy:", "&#x1f468;&#x1f466;" }, { ":family_man_boy_boy:", "&#x1f468;&#x1f466;&#x1f466;" }, { ":family_man_girl:", "&#x1f468;&#x1f467;" }, { ":family_man_girl_boy:", "&#x1f468;&#x1f467;&#x1f466;" }, { ":family_man_girl_girl:", "&#x1f468;&#x1f467;&#x1f467;" }, { ":family_man_man_boy:", "&#x1f468;&#x1f468;&#x1f466;" }, { ":family_man_man_boy_boy:", "&#x1f468;&#x1f468;&#x1f466;&#x1f466;" }, { ":family_man_man_girl:", "&#x1f468;&#x1f468;&#x1f467;" }, { ":family_man_man_girl_boy:", "&#x1f468;&#x1f468;&#x1f467;&#x1f466;" }, { ":family_man_man_girl_girl:", "&#x1f468;&#x1f468;&#x1f467;&#x1f467;" }, { ":family_man_woman_boy:", "&#x1f468;&#x1f469;&#x1f466;" }, { ":family_man_woman_boy_boy:", "&#x1f468;&#x1f469;&#x1f466;&#x1f466;" }, { ":family_man_woman_girl:", "&#x1f468;&#x1f469;&#x1f467;" }, { ":family_man_woman_girl_boy:", "&#x1f468;&#x1f469;&#x1f467;&#x1f466;" }, { ":family_man_woman_girl_girl:", "&#x1f468;&#x1f469;&#x1f467;&#x1f467;" }, { ":family_woman_boy:", "&#x1f469;&#x1f466;" }, { ":family_woman_boy_boy:", "&#x1f469;&#x1f466;&#x1f466;" }, { ":family_woman_girl:", "&#x1f469;&#x1f467;" }, { ":family_woman_girl_boy:", "&#x1f469;&#x1f467;&#x1f466;" }, { ":family_woman_girl_girl:", "&#x1f469;&#x1f467;&#x1f467;" }, { ":family_woman_woman_boy:", "&#x1f469;&#x1f469;&#x1f466;" }, { ":family_woman_woman_boy_boy:", "&#x1f469;&#x1f469;&#x1f466;&#x1f466;" }, { ":family_woman_woman_girl:", "&#x1f469;&#x1f469;&#x1f467;" }, { ":family_woman_woman_girl_boy:", "&#x1f469;&#x1f469;&#x1f467;&#x1f466;" }, { ":family_woman_woman_girl_girl:", "&#x1f469;&#x1f469;&#x1f467;&#x1f467;" }, { ":farmer:", "&#x1f9d1;&#x1f33e;" }, { ":faroe_islands:", "&#x1f1eb;&#x1f1f4;" }, { ":fast_forward:", "&#x23e9;" }, { ":fax:", "&#x1f4e0;" }, { ":fearful:", "&#x1f628;" }, { ":feather:", "&#x1fab6;" }, { ":feet:", "&#x1f43e;" }, { ":female_detective:", "&#x1f575;&#x2640;" }, { ":female_sign:", "&#x2640;" }, { ":ferris_wheel:", "&#x1f3a1;" }, { ":ferry:", "&#x26f4;" }, { ":field_hockey:", "&#x1f3d1;" }, { ":fiji:", "&#x1f1eb;&#x1f1ef;" }, { ":file_cabinet:", "&#x1f5c4;" }, { ":file_folder:", "&#x1f4c1;" }, { ":film_projector:", "&#x1f4fd;" }, { ":film_strip:", "&#x1f39e;" }, { ":finland:", "&#x1f1eb;&#x1f1ee;" }, { ":fire:", "&#x1f525;" }, { ":fire_engine:", "&#x1f692;" }, { ":fire_extinguisher:", "&#x1f9ef;" }, { ":firecracker:", "&#x1f9e8;" }, { ":firefighter:", "&#x1f9d1;&#x1f692;" }, { ":fireworks:", "&#x1f386;" }, { ":first_quarter_moon:", "&#x1f313;" }, { ":first_quarter_moon_with_face:", "&#x1f31b;" }, { ":fish:", "&#x1f41f;" }, { ":fish_cake:", "&#x1f365;" }, { ":fishing_pole_and_fish:", "&#x1f3a3;" }, { ":fist:", "&#x270a;" }, { ":fist_left:", "&#x1f91b;" }, { ":fist_oncoming:", "&#x1f44a;" }, { ":fist_raised:", "&#x270a;" }, { ":fist_right:", "&#x1f91c;" }, { ":five:", "&#x0035;&#x20e3;" }, { ":flags:", "&#x1f38f;" }, { ":flamingo:", "&#x1f9a9;" }, { ":flashlight:", "&#x1f526;" }, { ":flat_shoe:", "&#x1f97f;" }, { ":flatbread:", "&#x1fad3;" }, { ":fleur_de_lis:", "&#x269c;" }, { ":flight_arrival:", "&#x1f6ec;" }, { ":flight_departure:", "&#x1f6eb;" }, { ":flipper:", "&#x1f42c;" }, { ":floppy_disk:", "&#x1f4be;" }, { ":flower_playing_cards:", "&#x1f3b4;" }, { ":flushed:", "&#x1f633;" }, { ":flute:", "&#x1fa88;" }, { ":fly:", "&#x1fab0;" }, { ":flying_disc:", "&#x1f94f;" }, { ":flying_saucer:", "&#x1f6f8;" }, { ":fog:", "&#x1f32b;" }, { ":foggy:", "&#x1f301;" }, { ":folding_hand_fan:", "&#x1faad;" }, { ":fondue:", "&#x1fad5;" }, { ":foot:", "&#x1f9b6;" }, { ":football:", "&#x1f3c8;" }, { ":footprints:", "&#x1f463;" }, { ":fork_and_knife:", "&#x1f374;" }, { ":fortune_cookie:", "&#x1f960;" }, { ":fountain:", "&#x26f2;" }, { ":fountain_pen:", "&#x1f58b;" }, { ":four:", "&#x0034;&#x20e3;" }, { ":four_leaf_clover:", "&#x1f340;" }, { ":fox_face:", "&#x1f98a;" }, { ":fr:", "&#x1f1eb;&#x1f1f7;" }, { ":framed_picture:", "&#x1f5bc;" }, { ":free:", "&#x1f193;" }, { ":french_guiana:", "&#x1f1ec;&#x1f1eb;" }, { ":french_polynesia:", "&#x1f1f5;&#x1f1eb;" }, { ":french_southern_territories:", "&#x1f1f9;&#x1f1eb;" }, { ":fried_egg:", "&#x1f373;" }, { ":fried_shrimp:", "&#x1f364;" }, { ":fries:", "&#x1f35f;" }, { ":frog:", "&#x1f438;" }, { ":frowning:", "&#x1f626;" }, { ":frowning_face:", "&#x2639;" }, { ":frowning_man:", "&#x1f64d;&#x2642;" }, { ":frowning_person:", "&#x1f64d;" }, { ":frowning_woman:", "&#x1f64d;&#x2640;" }, { ":fu:", "&#x1f595;" }, { ":fuelpump:", "&#x26fd;" }, { ":full_moon:", "&#x1f315;" }, { ":full_moon_with_face:", "&#x1f31d;" }, { ":funeral_urn:", "&#x26b1;" }, { ":gabon:", "&#x1f1ec;&#x1f1e6;" }, { ":gambia:", "&#x1f1ec;&#x1f1f2;" }, { ":game_die:", "&#x1f3b2;" }, { ":garlic:", "&#x1f9c4;" }, { ":gb:", "&#x1f1ec;&#x1f1e7;" }, { ":gear:", "&#x2699;" }, { ":gem:", "&#x1f48e;" }, { ":gemini:", "&#x264a;" }, { ":genie:", "&#x1f9de;" }, { ":genie_man:", "&#x1f9de;&#x2642;" }, { ":genie_woman:", "&#x1f9de;&#x2640;" }, { ":georgia:", "&#x1f1ec;&#x1f1ea;" }, { ":ghana:", "&#x1f1ec;&#x1f1ed;" }, { ":ghost:", "&#x1f47b;" }, { ":gibraltar:", "&#x1f1ec;&#x1f1ee;" }, { ":gift:", "&#x1f381;" }, { ":gift_heart:", "&#x1f49d;" }, { ":ginger_root:", "&#x1fada;" }, { ":giraffe:", "&#x1f992;" }, { ":girl:", "&#x1f467;" }, { ":globe_with_meridians:", "&#x1f310;" }, { ":gloves:", "&#x1f9e4;" }, { ":goal_net:", "&#x1f945;" }, { ":goat:", "&#x1f410;" }, { ":goggles:", "&#x1f97d;" }, { ":golf:", "&#x26f3;" }, { ":golfing:", "&#x1f3cc;" }, { ":golfing_man:", "&#x1f3cc;&#x2642;" }, { ":golfing_woman:", "&#x1f3cc;&#x2640;" }, { ":goose:", "&#x1fabf;" }, { ":gorilla:", "&#x1f98d;" }, { ":grapes:", "&#x1f347;" }, { ":greece:", "&#x1f1ec;&#x1f1f7;" }, { ":green_apple:", "&#x1f34f;" }, { ":green_book:", "&#x1f4d7;" }, { ":green_circle:", "&#x1f7e2;" }, { ":green_heart:", "&#x1f49a;" }, { ":green_salad:", "&#x1f957;" }, { ":green_square:", "&#x1f7e9;" }, { ":greenland:", "&#x1f1ec;&#x1f1f1;" }, { ":grenada:", "&#x1f1ec;&#x1f1e9;" }, { ":grey_exclamation:", "&#x2755;" }, { ":grey_heart:", "&#x1fa76;" }, { ":grey_question:", "&#x2754;" }, { ":grimacing:", "&#x1f62c;" }, { ":grin:", "&#x1f601;" }, { ":grinning:", "&#x1f600;" }, { ":guadeloupe:", "&#x1f1ec;&#x1f1f5;" }, { ":guam:", "&#x1f1ec;&#x1f1fa;" }, { ":guard:", "&#x1f482;" }, { ":guardsman:", "&#x1f482;&#x2642;" }, { ":guardswoman:", "&#x1f482;&#x2640;" }, { ":guatemala:", "&#x1f1ec;&#x1f1f9;" }, { ":guernsey:", "&#x1f1ec;&#x1f1ec;" }, { ":guide_dog:", "&#x1f9ae;" }, { ":guinea:", "&#x1f1ec;&#x1f1f3;" }, { ":guinea_bissau:", "&#x1f1ec;&#x1f1fc;" }, { ":guitar:", "&#x1f3b8;" }, { ":gun:", "&#x1f52b;" }, { ":guyana:", "&#x1f1ec;&#x1f1fe;" }, { ":hair_pick:", "&#x1faae;" }, { ":haircut:", "&#x1f487;" }, { ":haircut_man:", "&#x1f487;&#x2642;" }, { ":haircut_woman:", "&#x1f487;&#x2640;" }, { ":haiti:", "&#x1f1ed;&#x1f1f9;" }, { ":hamburger:", "&#x1f354;" }, { ":hammer:", "&#x1f528;" }, { ":hammer_and_pick:", "&#x2692;" }, { ":hammer_and_wrench:", "&#x1f6e0;" }, { ":hamsa:", "&#x1faac;" }, { ":hamster:", "&#x1f439;" }, { ":hand:", "&#x270b;" }, { ":hand_over_mouth:", "&#x1f92d;" }, { ":hand_with_index_finger_and_thumb_crossed:", "&#x1faf0;" }, { ":handbag:", "&#x1f45c;" }, { ":handball_person:", "&#x1f93e;" }, { ":handshake:", "&#x1f91d;" }, { ":hankey:", "&#x1f4a9;" }, { ":hash:", "&#x0023;&#x20e3;" }, { ":hatched_chick:", "&#x1f425;" }, { ":hatching_chick:", "&#x1f423;" }, { ":headphones:", "&#x1f3a7;" }, { ":headstone:", "&#x1faa6;" }, { ":health_worker:", "&#x1f9d1;&#x2695;" }, { ":hear_no_evil:", "&#x1f649;" }, { ":heard_mcdonald_islands:", "&#x1f1ed;&#x1f1f2;" }, { ":heart:", "&#x2764;" }, { ":heart_decoration:", "&#x1f49f;" }, { ":heart_eyes:", "&#x1f60d;" }, { ":heart_eyes_cat:", "&#x1f63b;" }, { ":heart_hands:", "&#x1faf6;" }, { ":heart_on_fire:", "&#x2764;&#x1f525;" }, { ":heartbeat:", "&#x1f493;" }, { ":heartpulse:", "&#x1f497;" }, { ":hearts:", "&#x2665;" }, { ":heavy_check_mark:", "&#x2714;" }, { ":heavy_division_sign:", "&#x2797;" }, { ":heavy_dollar_sign:", "&#x1f4b2;" }, { ":heavy_equals_sign:", "&#x1f7f0;" }, { ":heavy_exclamation_mark:", "&#x2757;" }, { ":heavy_heart_exclamation:", "&#x2763;" }, { ":heavy_minus_sign:", "&#x2796;" }, { ":heavy_multiplication_x:", "&#x2716;" }, { ":heavy_plus_sign:", "&#x2795;" }, { ":hedgehog:", "&#x1f994;" }, { ":helicopter:", "&#x1f681;" }, { ":herb:", "&#x1f33f;" }, { ":hibiscus:", "&#x1f33a;" }, { ":high_brightness:", "&#x1f506;" }, { ":high_heel:", "&#x1f460;" }, { ":hiking_boot:", "&#x1f97e;" }, { ":hindu_temple:", "&#x1f6d5;" }, { ":hippopotamus:", "&#x1f99b;" }, { ":hocho:", "&#x1f52a;" }, { ":hole:", "&#x1f573;" }, { ":honduras:", "&#x1f1ed;&#x1f1f3;" }, { ":honey_pot:", "&#x1f36f;" }, { ":honeybee:", "&#x1f41d;" }, { ":hong_kong:", "&#x1f1ed;&#x1f1f0;" }, { ":hook:", "&#x1fa9d;" }, { ":horse:", "&#x1f434;" }, { ":horse_racing:", "&#x1f3c7;" }, { ":hospital:", "&#x1f3e5;" }, { ":hot_face:", "&#x1f975;" }, { ":hot_pepper:", "&#x1f336;" }, { ":hotdog:", "&#x1f32d;" }, { ":hotel:", "&#x1f3e8;" }, { ":hotsprings:", "&#x2668;" }, { ":hourglass:", "&#x231b;" }, { ":hourglass_flowing_sand:", "&#x23f3;" }, { ":house:", "&#x1f3e0;" }, { ":house_with_garden:", "&#x1f3e1;" }, { ":houses:", "&#x1f3d8;" }, { ":hugs:", "&#x1f917;" }, { ":hungary:", "&#x1f1ed;&#x1f1fa;" }, { ":hushed:", "&#x1f62f;" }, { ":hut:", "&#x1f6d6;" }, { ":hyacinth:", "&#x1fabb;" }, { ":ice_cream:", "&#x1f368;" }, { ":ice_cube:", "&#x1f9ca;" }, { ":ice_hockey:", "&#x1f3d2;" }, { ":ice_skate:", "&#x26f8;" }, { ":icecream:", "&#x1f366;" }, { ":iceland:", "&#x1f1ee;&#x1f1f8;" }, { ":id:", "&#x1f194;" }, { ":identification_card:", "&#x1faaa;" }, { ":ideograph_advantage:", "&#x1f250;" }, { ":imp:", "&#x1f47f;" }, { ":inbox_tray:", "&#x1f4e5;" }, { ":incoming_envelope:", "&#x1f4e8;" }, { ":index_pointing_at_the_viewer:", "&#x1faf5;" }, { ":india:", "&#x1f1ee;&#x1f1f3;" }, { ":indonesia:", "&#x1f1ee;&#x1f1e9;" }, { ":infinity:", "&#x267e;" }, { ":information_desk_person:", "&#x1f481;" }, { ":information_source:", "&#x2139;" }, { ":innocent:", "&#x1f607;" }, { ":interrobang:", "&#x2049;" }, { ":iphone:", "&#x1f4f1;" }, { ":iran:", "&#x1f1ee;&#x1f1f7;" }, { ":iraq:", "&#x1f1ee;&#x1f1f6;" }, { ":ireland:", "&#x1f1ee;&#x1f1ea;" }, { ":isle_of_man:", "&#x1f1ee;&#x1f1f2;" }, { ":israel:", "&#x1f1ee;&#x1f1f1;" }, { ":it:", "&#x1f1ee;&#x1f1f9;" }, { ":izakaya_lantern:", "&#x1f3ee;" }, { ":jack_o_lantern:", "&#x1f383;" }, { ":jamaica:", "&#x1f1ef;&#x1f1f2;" }, { ":japan:", "&#x1f5fe;" }, { ":japanese_castle:", "&#x1f3ef;" }, { ":japanese_goblin:", "&#x1f47a;" }, { ":japanese_ogre:", "&#x1f479;" }, { ":jar:", "&#x1fad9;" }, { ":jeans:", "&#x1f456;" }, { ":jellyfish:", "&#x1fabc;" }, { ":jersey:", "&#x1f1ef;&#x1f1ea;" }, { ":jigsaw:", "&#x1f9e9;" }, { ":jordan:", "&#x1f1ef;&#x1f1f4;" }, { ":joy:", "&#x1f602;" }, { ":joy_cat:", "&#x1f639;" }, { ":joystick:", "&#x1f579;" }, { ":jp:", "&#x1f1ef;&#x1f1f5;" }, { ":judge:", "&#x1f9d1;&#x2696;" }, { ":juggling_person:", "&#x1f939;" }, { ":kaaba:", "&#x1f54b;" }, { ":kangaroo:", "&#x1f998;" }, { ":kazakhstan:", "&#x1f1f0;&#x1f1ff;" }, { ":kenya:", "&#x1f1f0;&#x1f1ea;" }, { ":key:", "&#x1f511;" }, { ":keyboard:", "&#x2328;" }, { ":keycap_ten:", "&#x1f51f;" }, { ":khanda:", "&#x1faaf;" }, { ":kick_scooter:", "&#x1f6f4;" }, { ":kimono:", "&#x1f458;" }, { ":kiribati:", "&#x1f1f0;&#x1f1ee;" }, { ":kiss:", "&#x1f48b;" }, { ":kissing:", "&#x1f617;" }, { ":kissing_cat:", "&#x1f63d;" }, { ":kissing_closed_eyes:", "&#x1f61a;" }, { ":kissing_heart:", "&#x1f618;" }, { ":kissing_smiling_eyes:", "&#x1f619;" }, { ":kite:", "&#x1fa81;" }, { ":kiwi_fruit:", "&#x1f95d;" }, { ":kneeling_man:", "&#x1f9ce;&#x2642;" }, { ":kneeling_person:", "&#x1f9ce;" }, { ":kneeling_woman:", "&#x1f9ce;&#x2640;" }, { ":knife:", "&#x1f52a;" }, { ":knot:", "&#x1faa2;" }, { ":koala:", "&#x1f428;" }, { ":koko:", "&#x1f201;" }, { ":kosovo:", "&#x1f1fd;&#x1f1f0;" }, { ":kr:", "&#x1f1f0;&#x1f1f7;" }, { ":kuwait:", "&#x1f1f0;&#x1f1fc;" }, { ":kyrgyzstan:", "&#x1f1f0;&#x1f1ec;" }, { ":lab_coat:", "&#x1f97c;" }, { ":label:", "&#x1f3f7;" }, { ":lacrosse:", "&#x1f94d;" }, { ":ladder:", "&#x1fa9c;" }, { ":lady_beetle:", "&#x1f41e;" }, { ":lantern:", "&#x1f3ee;" }, { ":laos:", "&#x1f1f1;&#x1f1e6;" }, { ":large_blue_circle:", "&#x1f535;" }, { ":large_blue_diamond:", "&#x1f537;" }, { ":large_orange_diamond:", "&#x1f536;" }, { ":last_quarter_moon:", "&#x1f317;" }, { ":last_quarter_moon_with_face:", "&#x1f31c;" }, { ":latin_cross:", "&#x271d;" }, { ":latvia:", "&#x1f1f1;&#x1f1fb;" }, { ":laughing:", "&#x1f606;" }, { ":leafy_green:", "&#x1f96c;" }, { ":leaves:", "&#x1f343;" }, { ":lebanon:", "&#x1f1f1;&#x1f1e7;" }, { ":ledger:", "&#x1f4d2;" }, { ":left_luggage:", "&#x1f6c5;" }, { ":left_right_arrow:", "&#x2194;" }, { ":left_speech_bubble:", "&#x1f5e8;" }, { ":leftwards_arrow_with_hook:", "&#x21a9;" }, { ":leftwards_hand:", "&#x1faf2;" }, { ":leftwards_pushing_hand:", "&#x1faf7;" }, { ":leg:", "&#x1f9b5;" }, { ":lemon:", "&#x1f34b;" }, { ":leo:", "&#x264c;" }, { ":leopard:", "&#x1f406;" }, { ":lesotho:", "&#x1f1f1;&#x1f1f8;" }, { ":level_slider:", "&#x1f39a;" }, { ":liberia:", "&#x1f1f1;&#x1f1f7;" }, { ":libra:", "&#x264e;" }, { ":libya:", "&#x1f1f1;&#x1f1fe;" }, { ":liechtenstein:", "&#x1f1f1;&#x1f1ee;" }, { ":light_blue_heart:", "&#x1fa75;" }, { ":light_rail:", "&#x1f688;" }, { ":link:", "&#x1f517;" }, { ":lion:", "&#x1f981;" }, { ":lips:", "&#x1f444;" }, { ":lipstick:", "&#x1f484;" }, { ":lithuania:", "&#x1f1f1;&#x1f1f9;" }, { ":lizard:", "&#x1f98e;" }, { ":llama:", "&#x1f999;" }, { ":lobster:", "&#x1f99e;" }, { ":lock:", "&#x1f512;" }, { ":lock_with_ink_pen:", "&#x1f50f;" }, { ":lollipop:", "&#x1f36d;" }, { ":long_drum:", "&#x1fa98;" }, { ":loop:", "&#x27bf;" }, { ":lotion_bottle:", "&#x1f9f4;" }, { ":lotus:", "&#x1fab7;" }, { ":lotus_position:", "&#x1f9d8;" }, { ":lotus_position_man:", "&#x1f9d8;&#x2642;" }, { ":lotus_position_woman:", "&#x1f9d8;&#x2640;" }, { ":loud_sound:", "&#x1f50a;" }, { ":loudspeaker:", "&#x1f4e2;" }, { ":love_hotel:", "&#x1f3e9;" }, { ":love_letter:", "&#x1f48c;" }, { ":love_you_gesture:", "&#x1f91f;" }, { ":low_battery:", "&#x1faab;" }, { ":low_brightness:", "&#x1f505;" }, { ":luggage:", "&#x1f9f3;" }, { ":lungs:", "&#x1fac1;" }, { ":luxembourg:", "&#x1f1f1;&#x1f1fa;" }, { ":lying_face:", "&#x1f925;" }, { ":m:", "&#x24c2;" }, { ":macau:", "&#x1f1f2;&#x1f1f4;" }, { ":macedonia:", "&#x1f1f2;&#x1f1f0;" }, { ":madagascar:", "&#x1f1f2;&#x1f1ec;" }, { ":mag:", "&#x1f50d;" }, { ":mag_right:", "&#x1f50e;" }, { ":mage:", "&#x1f9d9;" }, { ":mage_man:", "&#x1f9d9;&#x2642;" }, { ":mage_woman:", "&#x1f9d9;&#x2640;" }, { ":magic_wand:", "&#x1fa84;" }, { ":magnet:", "&#x1f9f2;" }, { ":mahjong:", "&#x1f004;" }, { ":mailbox:", "&#x1f4eb;" }, { ":mailbox_closed:", "&#x1f4ea;" }, { ":mailbox_with_mail:", "&#x1f4ec;" }, { ":mailbox_with_no_mail:", "&#x1f4ed;" }, { ":malawi:", "&#x1f1f2;&#x1f1fc;" }, { ":malaysia:", "&#x1f1f2;&#x1f1fe;" }, { ":maldives:", "&#x1f1f2;&#x1f1fb;" }, { ":male_detective:", "&#x1f575;&#x2642;" }, { ":male_sign:", "&#x2642;" }, { ":mali:", "&#x1f1f2;&#x1f1f1;" }, { ":malta:", "&#x1f1f2;&#x1f1f9;" }, { ":mammoth:", "&#x1f9a3;" }, { ":man:", "&#x1f468;" }, { ":man_artist:", "&#x1f468;&#x1f3a8;" }, { ":man_astronaut:", "&#x1f468;&#x1f680;" }, { ":man_beard:", "&#x1f9d4;&#x2642;" }, { ":man_cartwheeling:", "&#x1f938;&#x2642;" }, { ":man_cook:", "&#x1f468;&#x1f373;" }, { ":man_dancing:", "&#x1f57a;" }, { ":man_facepalming:", "&#x1f926;&#x2642;" }, { ":man_factory_worker:", "&#x1f468;&#x1f3ed;" }, { ":man_farmer:", "&#x1f468;&#x1f33e;" }, { ":man_feeding_baby:", "&#x1f468;&#x1f37c;" }, { ":man_firefighter:", "&#x1f468;&#x1f692;" }, { ":man_health_worker:", "&#x1f468;&#x2695;" }, { ":man_in_manual_wheelchair:", "&#x1f468;&#x1f9bd;" }, { ":man_in_motorized_wheelchair:", "&#x1f468;&#x1f9bc;" }, { ":man_in_tuxedo:", "&#x1f935;&#x2642;" }, { ":man_judge:", "&#x1f468;&#x2696;" }, { ":man_juggling:", "&#x1f939;&#x2642;" }, { ":man_mechanic:", "&#x1f468;&#x1f527;" }, { ":man_office_worker:", "&#x1f468;&#x1f4bc;" }, { ":man_pilot:", "&#x1f468;&#x2708;" }, { ":man_playing_handball:", "&#x1f93e;&#x2642;" }, { ":man_playing_water_polo:", "&#x1f93d;&#x2642;" }, { ":man_scientist:", "&#x1f468;&#x1f52c;" }, { ":man_shrugging:", "&#x1f937;&#x2642;" }, { ":man_singer:", "&#x1f468;&#x1f3a4;" }, { ":man_student:", "&#x1f468;&#x1f393;" }, { ":man_teacher:", "&#x1f468;&#x1f3eb;" }, { ":man_technologist:", "&#x1f468;&#x1f4bb;" }, { ":man_with_gua_pi_mao:", "&#x1f472;" }, { ":man_with_probing_cane:", "&#x1f468;&#x1f9af;" }, { ":man_with_turban:", "&#x1f473;&#x2642;" }, { ":man_with_veil:", "&#x1f470;&#x2642;" }, { ":mandarin:", "&#x1f34a;" }, { ":mango:", "&#x1f96d;" }, { ":mans_shoe:", "&#x1f45e;" }, { ":mantelpiece_clock:", "&#x1f570;" }, { ":manual_wheelchair:", "&#x1f9bd;" }, { ":maple_leaf:", "&#x1f341;" }, { ":maracas:", "&#x1fa87;" }, { ":marshall_islands:", "&#x1f1f2;&#x1f1ed;" }, { ":martial_arts_uniform:", "&#x1f94b;" }, { ":martinique:", "&#x1f1f2;&#x1f1f6;" }, { ":mask:", "&#x1f637;" }, { ":massage:", "&#x1f486;" }, { ":massage_man:", "&#x1f486;&#x2642;" }, { ":massage_woman:", "&#x1f486;&#x2640;" }, { ":mate:", "&#x1f9c9;" }, { ":mauritania:", "&#x1f1f2;&#x1f1f7;" }, { ":mauritius:", "&#x1f1f2;&#x1f1fa;" }, { ":mayotte:", "&#x1f1fe;&#x1f1f9;" }, { ":meat_on_bone:", "&#x1f356;" }, { ":mechanic:", "&#x1f9d1;&#x1f527;" }, { ":mechanical_arm:", "&#x1f9be;" }, { ":mechanical_leg:", "&#x1f9bf;" }, { ":medal_military:", "&#x1f396;" }, { ":medal_sports:", "&#x1f3c5;" }, { ":medical_symbol:", "&#x2695;" }, { ":mega:", "&#x1f4e3;" }, { ":melon:", "&#x1f348;" }, { ":melting_face:", "&#x1fae0;" }, { ":memo:", "&#x1f4dd;" }, { ":men_wrestling:", "&#x1f93c;&#x2642;" }, { ":mending_heart:", "&#x2764;&#x1fa79;" }, { ":menorah:", "&#x1f54e;" }, { ":mens:", "&#x1f6b9;" }, { ":mermaid:", "&#x1f9dc;&#x2640;" }, { ":merman:", "&#x1f9dc;&#x2642;" }, { ":merperson:", "&#x1f9dc;" }, { ":metal:", "&#x1f918;" }, { ":metro:", "&#x1f687;" }, { ":mexico:", "&#x1f1f2;&#x1f1fd;" }, { ":microbe:", "&#x1f9a0;" }, { ":micronesia:", "&#x1f1eb;&#x1f1f2;" }, { ":microphone:", "&#x1f3a4;" }, { ":microscope:", "&#x1f52c;" }, { ":middle_finger:", "&#x1f595;" }, { ":military_helmet:", "&#x1fa96;" }, { ":milk_glass:", "&#x1f95b;" }, { ":milky_way:", "&#x1f30c;" }, { ":minibus:", "&#x1f690;" }, { ":minidisc:", "&#x1f4bd;" }, { ":mirror:", "&#x1fa9e;" }, { ":mirror_ball:", "&#x1faa9;" }, { ":mobile_phone_off:", "&#x1f4f4;" }, { ":moldova:", "&#x1f1f2;&#x1f1e9;" }, { ":monaco:", "&#x1f1f2;&#x1f1e8;" }, { ":money_mouth_face:", "&#x1f911;" }, { ":money_with_wings:", "&#x1f4b8;" }, { ":moneybag:", "&#x1f4b0;" }, { ":mongolia:", "&#x1f1f2;&#x1f1f3;" }, { ":monkey:", "&#x1f412;" }, { ":monkey_face:", "&#x1f435;" }, { ":monocle_face:", "&#x1f9d0;" }, { ":monorail:", "&#x1f69d;" }, { ":montenegro:", "&#x1f1f2;&#x1f1ea;" }, { ":montserrat:", "&#x1f1f2;&#x1f1f8;" }, { ":moon:", "&#x1f314;" }, { ":moon_cake:", "&#x1f96e;" }, { ":moose:", "&#x1face;" }, { ":morocco:", "&#x1f1f2;&#x1f1e6;" }, { ":mortar_board:", "&#x1f393;" }, { ":mosque:", "&#x1f54c;" }, { ":mosquito:", "&#x1f99f;" }, { ":motor_boat:", "&#x1f6e5;" }, { ":motor_scooter:", "&#x1f6f5;" }, { ":motorcycle:", "&#x1f3cd;" }, { ":motorized_wheelchair:", "&#x1f9bc;" }, { ":motorway:", "&#x1f6e3;" }, { ":mount_fuji:", "&#x1f5fb;" }, { ":mountain:", "&#x26f0;" }, { ":mountain_bicyclist:", "&#x1f6b5;" }, { ":mountain_biking_man:", "&#x1f6b5;&#x2642;" }, { ":mountain_biking_woman:", "&#x1f6b5;&#x2640;" }, { ":mountain_cableway:", "&#x1f6a0;" }, { ":mountain_railway:", "&#x1f69e;" }, { ":mountain_snow:", "&#x1f3d4;" }, { ":mouse:", "&#x1f42d;" }, { ":mouse2:", "&#x1f401;" }, { ":mouse_trap:", "&#x1faa4;" }, { ":movie_camera:", "&#x1f3a5;" }, { ":moyai:", "&#x1f5ff;" }, { ":mozambique:", "&#x1f1f2;&#x1f1ff;" }, { ":mrs_claus:", "&#x1f936;" }, { ":muscle:", "&#x1f4aa;" }, { ":mushroom:", "&#x1f344;" }, { ":musical_keyboard:", "&#x1f3b9;" }, { ":musical_note:", "&#x1f3b5;" }, { ":musical_score:", "&#x1f3bc;" }, { ":mute:", "&#x1f507;" }, { ":mx_claus:", "&#x1f9d1;&#x1f384;" }, { ":myanmar:", "&#x1f1f2;&#x1f1f2;" }, { ":nail_care:", "&#x1f485;" }, { ":name_badge:", "&#x1f4db;" }, { ":namibia:", "&#x1f1f3;&#x1f1e6;" }, { ":national_park:", "&#x1f3de;" }, { ":nauru:", "&#x1f1f3;&#x1f1f7;" }, { ":nauseated_face:", "&#x1f922;" }, { ":nazar_amulet:", "&#x1f9ff;" }, { ":necktie:", "&#x1f454;" }, { ":negative_squared_cross_mark:", "&#x274e;" }, { ":nepal:", "&#x1f1f3;&#x1f1f5;" }, { ":nerd_face:", "&#x1f913;" }, { ":nest_with_eggs:", "&#x1faba;" }, { ":nesting_dolls:", "&#x1fa86;" }, { ":netherlands:", "&#x1f1f3;&#x1f1f1;" }, { ":neutral_face:", "&#x1f610;" }, { ":new:", "&#x1f195;" }, { ":new_caledonia:", "&#x1f1f3;&#x1f1e8;" }, { ":new_moon:", "&#x1f311;" }, { ":new_moon_with_face:", "&#x1f31a;" }, { ":new_zealand:", "&#x1f1f3;&#x1f1ff;" }, { ":newspaper:", "&#x1f4f0;" }, { ":newspaper_roll:", "&#x1f5de;" }, { ":next_track_button:", "&#x23ed;" }, { ":ng:", "&#x1f196;" }, { ":ng_man:", "&#x1f645;&#x2642;" }, { ":ng_woman:", "&#x1f645;&#x2640;" }, { ":nicaragua:", "&#x1f1f3;&#x1f1ee;" }, { ":niger:", "&#x1f1f3;&#x1f1ea;" }, { ":nigeria:", "&#x1f1f3;&#x1f1ec;" }, { ":night_with_stars:", "&#x1f303;" }, { ":nine:", "&#x0039;&#x20e3;" }, { ":ninja:", "&#x1f977;" }, { ":niue:", "&#x1f1f3;&#x1f1fa;" }, { ":no_bell:", "&#x1f515;" }, { ":no_bicycles:", "&#x1f6b3;" }, { ":no_entry:", "&#x26d4;" }, { ":no_entry_sign:", "&#x1f6ab;" }, { ":no_good:", "&#x1f645;" }, { ":no_good_man:", "&#x1f645;&#x2642;" }, { ":no_good_woman:", "&#x1f645;&#x2640;" }, { ":no_mobile_phones:", "&#x1f4f5;" }, { ":no_mouth:", "&#x1f636;" }, { ":no_pedestrians:", "&#x1f6b7;" }, { ":no_smoking:", "&#x1f6ad;" }, { ":non-potable_water:", "&#x1f6b1;" }, { ":norfolk_island:", "&#x1f1f3;&#x1f1eb;" }, { ":north_korea:", "&#x1f1f0;&#x1f1f5;" }, { ":northern_mariana_islands:", "&#x1f1f2;&#x1f1f5;" }, { ":norway:", "&#x1f1f3;&#x1f1f4;" }, { ":nose:", "&#x1f443;" }, { ":notebook:", "&#x1f4d3;" }, { ":notebook_with_decorative_cover:", "&#x1f4d4;" }, { ":notes:", "&#x1f3b6;" }, { ":nut_and_bolt:", "&#x1f529;" }, { ":o:", "&#x2b55;" }, { ":o2:", "&#x1f17e;" }, { ":ocean:", "&#x1f30a;" }, { ":octopus:", "&#x1f419;" }, { ":oden:", "&#x1f362;" }, { ":office:", "&#x1f3e2;" }, { ":office_worker:", "&#x1f9d1;&#x1f4bc;" }, { ":oil_drum:", "&#x1f6e2;" }, { ":ok:", "&#x1f197;" }, { ":ok_hand:", "&#x1f44c;" }, { ":ok_man:", "&#x1f646;&#x2642;" }, { ":ok_person:", "&#x1f646;" }, { ":ok_woman:", "&#x1f646;&#x2640;" }, { ":old_key:", "&#x1f5dd;" }, { ":older_adult:", "&#x1f9d3;" }, { ":older_man:", "&#x1f474;" }, { ":older_woman:", "&#x1f475;" }, { ":olive:", "&#x1fad2;" }, { ":om:", "&#x1f549;" }, { ":oman:", "&#x1f1f4;&#x1f1f2;" }, { ":on:", "&#x1f51b;" }, { ":oncoming_automobile:", "&#x1f698;" }, { ":oncoming_bus:", "&#x1f68d;" }, { ":oncoming_police_car:", "&#x1f694;" }, { ":oncoming_taxi:", "&#x1f696;" }, { ":one:", "&#x0031;&#x20e3;" }, { ":one_piece_swimsuit:", "&#x1fa71;" }, { ":onion:", "&#x1f9c5;" }, { ":open_book:", "&#x1f4d6;" }, { ":open_file_folder:", "&#x1f4c2;" }, { ":open_hands:", "&#x1f450;" }, { ":open_mouth:", "&#x1f62e;" }, { ":open_umbrella:", "&#x2602;" }, { ":ophiuchus:", "&#x26ce;" }, { ":orange:", "&#x1f34a;" }, { ":orange_book:", "&#x1f4d9;" }, { ":orange_circle:", "&#x1f7e0;" }, { ":orange_heart:", "&#x1f9e1;" }, { ":orange_square:", "&#x1f7e7;" }, { ":orangutan:", "&#x1f9a7;" }, { ":orthodox_cross:", "&#x2626;" }, { ":otter:", "&#x1f9a6;" }, { ":outbox_tray:", "&#x1f4e4;" }, { ":owl:", "&#x1f989;" }, { ":ox:", "&#x1f402;" }, { ":oyster:", "&#x1f9aa;" }, { ":package:", "&#x1f4e6;" }, { ":page_facing_up:", "&#x1f4c4;" }, { ":page_with_curl:", "&#x1f4c3;" }, { ":pager:", "&#x1f4df;" }, { ":paintbrush:", "&#x1f58c;" }, { ":pakistan:", "&#x1f1f5;&#x1f1f0;" }, { ":palau:", "&#x1f1f5;&#x1f1fc;" }, { ":palestinian_territories:", "&#x1f1f5;&#x1f1f8;" }, { ":palm_down_hand:", "&#x1faf3;" }, { ":palm_tree:", "&#x1f334;" }, { ":palm_up_hand:", "&#x1faf4;" }, { ":palms_up_together:", "&#x1f932;" }, { ":panama:", "&#x1f1f5;&#x1f1e6;" }, { ":pancakes:", "&#x1f95e;" }, { ":panda_face:", "&#x1f43c;" }, { ":paperclip:", "&#x1f4ce;" }, { ":paperclips:", "&#x1f587;" }, { ":papua_new_guinea:", "&#x1f1f5;&#x1f1ec;" }, { ":parachute:", "&#x1fa82;" }, { ":paraguay:", "&#x1f1f5;&#x1f1fe;" }, { ":parasol_on_ground:", "&#x26f1;" }, { ":parking:", "&#x1f17f;" }, { ":parrot:", "&#x1f99c;" }, { ":part_alternation_mark:", "&#x303d;" }, { ":partly_sunny:", "&#x26c5;" }, { ":partying_face:", "&#x1f973;" }, { ":passenger_ship:", "&#x1f6f3;" }, { ":passport_control:", "&#x1f6c2;" }, { ":pause_button:", "&#x23f8;" }, { ":paw_prints:", "&#x1f43e;" }, { ":pea_pod:", "&#x1fadb;" }, { ":peace_symbol:", "&#x262e;" }, { ":peach:", "&#x1f351;" }, { ":peacock:", "&#x1f99a;" }, { ":peanuts:", "&#x1f95c;" }, { ":pear:", "&#x1f350;" }, { ":pen:", "&#x1f58a;" }, { ":pencil:", "&#x1f4dd;" }, { ":pencil2:", "&#x270f;" }, { ":penguin:", "&#x1f427;" }, { ":pensive:", "&#x1f614;" }, { ":people_holding_hands:", "&#x1f9d1;&#x1f91d;&#x1f9d1;" }, { ":people_hugging:", "&#x1fac2;" }, { ":performing_arts:", "&#x1f3ad;" }, { ":persevere:", "&#x1f623;" }, { ":person_bald:", "&#x1f9d1;&#x1f9b2;" }, { ":person_curly_hair:", "&#x1f9d1;&#x1f9b1;" }, { ":person_feeding_baby:", "&#x1f9d1;&#x1f37c;" }, { ":person_fencing:", "&#x1f93a;" }, { ":person_in_manual_wheelchair:", "&#x1f9d1;&#x1f9bd;" }, { ":person_in_motorized_wheelchair:", "&#x1f9d1;&#x1f9bc;" }, { ":person_in_tuxedo:", "&#x1f935;" }, { ":person_red_hair:", "&#x1f9d1;&#x1f9b0;" }, { ":person_white_hair:", "&#x1f9d1;&#x1f9b3;" }, { ":person_with_crown:", "&#x1fac5;" }, { ":person_with_probing_cane:", "&#x1f9d1;&#x1f9af;" }, { ":person_with_turban:", "&#x1f473;" }, { ":person_with_veil:", "&#x1f470;" }, { ":peru:", "&#x1f1f5;&#x1f1ea;" }, { ":petri_dish:", "&#x1f9eb;" }, { ":philippines:", "&#x1f1f5;&#x1f1ed;" }, { ":phone:", "&#x260e;" }, { ":pick:", "&#x26cf;" }, { ":pickup_truck:", "&#x1f6fb;" }, { ":pie:", "&#x1f967;" }, { ":pig:", "&#x1f437;" }, { ":pig2:", "&#x1f416;" }, { ":pig_nose:", "&#x1f43d;" }, { ":pill:", "&#x1f48a;" }, { ":pilot:", "&#x1f9d1;&#x2708;" }, { ":pinata:", "&#x1fa85;" }, { ":pinched_fingers:", "&#x1f90c;" }, { ":pinching_hand:", "&#x1f90f;" }, { ":pineapple:", "&#x1f34d;" }, { ":ping_pong:", "&#x1f3d3;" }, { ":pink_heart:", "&#x1fa77;" }, { ":pirate_flag:", "&#x1f3f4;&#x2620;" }, { ":pisces:", "&#x2653;" }, { ":pitcairn_islands:", "&#x1f1f5;&#x1f1f3;" }, { ":pizza:", "&#x1f355;" }, { ":placard:", "&#x1faa7;" }, { ":place_of_worship:", "&#x1f6d0;" }, { ":plate_with_cutlery:", "&#x1f37d;" }, { ":play_or_pause_button:", "&#x23ef;" }, { ":playground_slide:", "&#x1f6dd;" }, { ":pleading_face:", "&#x1f97a;" }, { ":plunger:", "&#x1faa0;" }, { ":point_down:", "&#x1f447;" }, { ":point_left:", "&#x1f448;" }, { ":point_right:", "&#x1f449;" }, { ":point_up:", "&#x261d;" }, { ":point_up_2:", "&#x1f446;" }, { ":poland:", "&#x1f1f5;&#x1f1f1;" }, { ":polar_bear:", "&#x1f43b;&#x2744;" }, { ":police_car:", "&#x1f693;" }, { ":police_officer:", "&#x1f46e;" }, { ":policeman:", "&#x1f46e;&#x2642;" }, { ":policewoman:", "&#x1f46e;&#x2640;" }, { ":poodle:", "&#x1f429;" }, { ":poop:", "&#x1f4a9;" }, { ":popcorn:", "&#x1f37f;" }, { ":portugal:", "&#x1f1f5;&#x1f1f9;" }, { ":post_office:", "&#x1f3e3;" }, { ":postal_horn:", "&#x1f4ef;" }, { ":postbox:", "&#x1f4ee;" }, { ":potable_water:", "&#x1f6b0;" }, { ":potato:", "&#x1f954;" }, { ":potted_plant:", "&#x1fab4;" }, { ":pouch:", "&#x1f45d;" }, { ":poultry_leg:", "&#x1f357;" }, { ":pound:", "&#x1f4b7;" }, { ":pouring_liquid:", "&#x1fad7;" }, { ":pout:", "&#x1f621;" }, { ":pouting_cat:", "&#x1f63e;" }, { ":pouting_face:", "&#x1f64e;" }, { ":pouting_man:", "&#x1f64e;&#x2642;" }, { ":pouting_woman:", "&#x1f64e;&#x2640;" }, { ":pray:", "&#x1f64f;" }, { ":prayer_beads:", "&#x1f4ff;" }, { ":pregnant_man:", "&#x1fac3;" }, { ":pregnant_person:", "&#x1fac4;" }, { ":pregnant_woman:", "&#x1f930;" }, { ":pretzel:", "&#x1f968;" }, { ":previous_track_button:", "&#x23ee;" }, { ":prince:", "&#x1f934;" }, { ":princess:", "&#x1f478;" }, { ":printer:", "&#x1f5a8;" }, { ":probing_cane:", "&#x1f9af;" }, { ":puerto_rico:", "&#x1f1f5;&#x1f1f7;" }, { ":punch:", "&#x1f44a;" }, { ":purple_circle:", "&#x1f7e3;" }, { ":purple_heart:", "&#x1f49c;" }, { ":purple_square:", "&#x1f7ea;" }, { ":purse:", "&#x1f45b;" }, { ":pushpin:", "&#x1f4cc;" }, { ":put_litter_in_its_place:", "&#x1f6ae;" }, { ":qatar:", "&#x1f1f6;&#x1f1e6;" }, { ":question:", "&#x2753;" }, { ":rabbit:", "&#x1f430;" }, { ":rabbit2:", "&#x1f407;" }, { ":raccoon:", "&#x1f99d;" }, { ":racehorse:", "&#x1f40e;" }, { ":racing_car:", "&#x1f3ce;" }, { ":radio:", "&#x1f4fb;" }, { ":radio_button:", "&#x1f518;" }, { ":radioactive:", "&#x2622;" }, { ":rage:", "&#x1f621;" }, { ":railway_car:", "&#x1f683;" }, { ":railway_track:", "&#x1f6e4;" }, { ":rainbow:", "&#x1f308;" }, { ":rainbow_flag:", "&#x1f3f3;&#x1f308;" }, { ":raised_back_of_hand:", "&#x1f91a;" }, { ":raised_eyebrow:", "&#x1f928;" }, { ":raised_hand:", "&#x270b;" }, { ":raised_hand_with_fingers_splayed:", "&#x1f590;" }, { ":raised_hands:", "&#x1f64c;" }, { ":raising_hand:", "&#x1f64b;" }, { ":raising_hand_man:", "&#x1f64b;&#x2642;" }, { ":raising_hand_woman:", "&#x1f64b;&#x2640;" }, { ":ram:", "&#x1f40f;" }, { ":ramen:", "&#x1f35c;" }, { ":rat:", "&#x1f400;" }, { ":razor:", "&#x1fa92;" }, { ":receipt:", "&#x1f9fe;" }, { ":record_button:", "&#x23fa;" }, { ":recycle:", "&#x267b;" }, { ":red_car:", "&#x1f697;" }, { ":red_circle:", "&#x1f534;" }, { ":red_envelope:", "&#x1f9e7;" }, { ":red_haired_man:", "&#x1f468;&#x1f9b0;" }, { ":red_haired_woman:", "&#x1f469;&#x1f9b0;" }, { ":red_square:", "&#x1f7e5;" }, { ":registered:", "&#x00ae;" }, { ":relaxed:", "&#x263a;" }, { ":relieved:", "&#x1f60c;" }, { ":reminder_ribbon:", "&#x1f397;" }, { ":repeat:", "&#x1f501;" }, { ":repeat_one:", "&#x1f502;" }, { ":rescue_worker_helmet:", "&#x26d1;" }, { ":restroom:", "&#x1f6bb;" }, { ":reunion:", "&#x1f1f7;&#x1f1ea;" }, { ":revolving_hearts:", "&#x1f49e;" }, { ":rewind:", "&#x23ea;" }, { ":rhinoceros:", "&#x1f98f;" }, { ":ribbon:", "&#x1f380;" }, { ":rice:", "&#x1f35a;" }, { ":rice_ball:", "&#x1f359;" }, { ":rice_cracker:", "&#x1f358;" }, { ":rice_scene:", "&#x1f391;" }, { ":right_anger_bubble:", "&#x1f5ef;" }, { ":rightwards_hand:", "&#x1faf1;" }, { ":rightwards_pushing_hand:", "&#x1faf8;" }, { ":ring:", "&#x1f48d;" }, { ":ring_buoy:", "&#x1f6df;" }, { ":ringed_planet:", "&#x1fa90;" }, { ":robot:", "&#x1f916;" }, { ":rock:", "&#x1faa8;" }, { ":rocket:", "&#x1f680;" }, { ":rofl:", "&#x1f923;" }, { ":roll_eyes:", "&#x1f644;" }, { ":roll_of_paper:", "&#x1f9fb;" }, { ":roller_coaster:", "&#x1f3a2;" }, { ":roller_skate:", "&#x1f6fc;" }, { ":romania:", "&#x1f1f7;&#x1f1f4;" }, { ":rooster:", "&#x1f413;" }, { ":rose:", "&#x1f339;" }, { ":rosette:", "&#x1f3f5;" }, { ":rotating_light:", "&#x1f6a8;" }, { ":round_pushpin:", "&#x1f4cd;" }, { ":rowboat:", "&#x1f6a3;" }, { ":rowing_man:", "&#x1f6a3;&#x2642;" }, { ":rowing_woman:", "&#x1f6a3;&#x2640;" }, { ":ru:", "&#x1f1f7;&#x1f1fa;" }, { ":rugby_football:", "&#x1f3c9;" }, { ":runner:", "&#x1f3c3;" }, { ":running:", "&#x1f3c3;" }, { ":running_man:", "&#x1f3c3;&#x2642;" }, { ":running_shirt_with_sash:", "&#x1f3bd;" }, { ":running_woman:", "&#x1f3c3;&#x2640;" }, { ":rwanda:", "&#x1f1f7;&#x1f1fc;" }, { ":sa:", "&#x1f202;" }, { ":safety_pin:", "&#x1f9f7;" }, { ":safety_vest:", "&#x1f9ba;" }, { ":sagittarius:", "&#x2650;" }, { ":sailboat:", "&#x26f5;" }, { ":sake:", "&#x1f376;" }, { ":salt:", "&#x1f9c2;" }, { ":saluting_face:", "&#x1fae1;" }, { ":samoa:", "&#x1f1fc;&#x1f1f8;" }, { ":san_marino:", "&#x1f1f8;&#x1f1f2;" }, { ":sandal:", "&#x1f461;" }, { ":sandwich:", "&#x1f96a;" }, { ":santa:", "&#x1f385;" }, { ":sao_tome_principe:", "&#x1f1f8;&#x1f1f9;" }, { ":sari:", "&#x1f97b;" }, { ":sassy_man:", "&#x1f481;&#x2642;" }, { ":sassy_woman:", "&#x1f481;&#x2640;" }, { ":satellite:", "&#x1f4e1;" }, { ":satisfied:", "&#x1f606;" }, { ":saudi_arabia:", "&#x1f1f8;&#x1f1e6;" }, { ":sauna_man:", "&#x1f9d6;&#x2642;" }, { ":sauna_person:", "&#x1f9d6;" }, { ":sauna_woman:", "&#x1f9d6;&#x2640;" }, { ":sauropod:", "&#x1f995;" }, { ":saxophone:", "&#x1f3b7;" }, { ":scarf:", "&#x1f9e3;" }, { ":school:", "&#x1f3eb;" }, { ":school_satchel:", "&#x1f392;" }, { ":scientist:", "&#x1f9d1;&#x1f52c;" }, { ":scissors:", "&#x2702;" }, { ":scorpion:", "&#x1f982;" }, { ":scorpius:", "&#x264f;" }, { ":scotland:", "&#x1f3f4;&#xe0067;&#xe0062;&#xe0073;&#xe0063;&#xe0074;&#xe007f;" }, { ":scream:", "&#x1f631;" }, { ":scream_cat:", "&#x1f640;" }, { ":screwdriver:", "&#x1fa9b;" }, { ":scroll:", "&#x1f4dc;" }, { ":seal:", "&#x1f9ad;" }, { ":seat:", "&#x1f4ba;" }, { ":secret:", "&#x3299;" }, { ":see_no_evil:", "&#x1f648;" }, { ":seedling:", "&#x1f331;" }, { ":selfie:", "&#x1f933;" }, { ":senegal:", "&#x1f1f8;&#x1f1f3;" }, { ":serbia:", "&#x1f1f7;&#x1f1f8;" }, { ":service_dog:", "&#x1f415;&#x1f9ba;" }, { ":seven:", "&#x0037;&#x20e3;" }, { ":sewing_needle:", "&#x1faa1;" }, { ":seychelles:", "&#x1f1f8;&#x1f1e8;" }, { ":shaking_face:", "&#x1fae8;" }, { ":shallow_pan_of_food:", "&#x1f958;" }, { ":shamrock:", "&#x2618;" }, { ":shark:", "&#x1f988;" }, { ":shaved_ice:", "&#x1f367;" }, { ":sheep:", "&#x1f411;" }, { ":shell:", "&#x1f41a;" }, { ":shield:", "&#x1f6e1;" }, { ":shinto_shrine:", "&#x26e9;" }, { ":ship:", "&#x1f6a2;" }, { ":shirt:", "&#x1f455;" }, { ":shit:", "&#x1f4a9;" }, { ":shoe:", "&#x1f45e;" }, { ":shopping:", "&#x1f6cd;" }, { ":shopping_cart:", "&#x1f6d2;" }, { ":shorts:", "&#x1fa73;" }, { ":shower:", "&#x1f6bf;" }, { ":shrimp:", "&#x1f990;" }, { ":shrug:", "&#x1f937;" }, { ":shushing_face:", "&#x1f92b;" }, { ":sierra_leone:", "&#x1f1f8;&#x1f1f1;" }, { ":signal_strength:", "&#x1f4f6;" }, { ":singapore:", "&#x1f1f8;&#x1f1ec;" }, { ":singer:", "&#x1f9d1;&#x1f3a4;" }, { ":sint_maarten:", "&#x1f1f8;&#x1f1fd;" }, { ":six:", "&#x0036;&#x20e3;" }, { ":six_pointed_star:", "&#x1f52f;" }, { ":skateboard:", "&#x1f6f9;" }, { ":ski:", "&#x1f3bf;" }, { ":skier:", "&#x26f7;" }, { ":skull:", "&#x1f480;" }, { ":skull_and_crossbones:", "&#x2620;" }, { ":skunk:", "&#x1f9a8;" }, { ":sled:", "&#x1f6f7;" }, { ":sleeping:", "&#x1f634;" }, { ":sleeping_bed:", "&#x1f6cc;" }, { ":sleepy:", "&#x1f62a;" }, { ":slightly_frowning_face:", "&#x1f641;" }, { ":slightly_smiling_face:", "&#x1f642;" }, { ":slot_machine:", "&#x1f3b0;" }, { ":sloth:", "&#x1f9a5;" }, { ":slovakia:", "&#x1f1f8;&#x1f1f0;" }, { ":slovenia:", "&#x1f1f8;&#x1f1ee;" }, { ":small_airplane:", "&#x1f6e9;" }, { ":small_blue_diamond:", "&#x1f539;" }, { ":small_orange_diamond:", "&#x1f538;" }, { ":small_red_triangle:", "&#x1f53a;" }, { ":small_red_triangle_down:", "&#x1f53b;" }, { ":smile:", "&#x1f604;" }, { ":smile_cat:", "&#x1f638;" }, { ":smiley:", "&#x1f603;" }, { ":smiley_cat:", "&#x1f63a;" }, { ":smiling_face_with_tear:", "&#x1f972;" }, { ":smiling_face_with_three_hearts:", "&#x1f970;" }, { ":smiling_imp:", "&#x1f608;" }, { ":smirk:", "&#x1f60f;" }, { ":smirk_cat:", "&#x1f63c;" }, { ":smoking:", "&#x1f6ac;" }, { ":snail:", "&#x1f40c;" }, { ":snake:", "&#x1f40d;" }, { ":sneezing_face:", "&#x1f927;" }, { ":snowboarder:", "&#x1f3c2;" }, { ":snowflake:", "&#x2744;" }, { ":snowman:", "&#x26c4;" }, { ":snowman_with_snow:", "&#x2603;" }, { ":soap:", "&#x1f9fc;" }, { ":sob:", "&#x1f62d;" }, { ":soccer:", "&#x26bd;" }, { ":socks:", "&#x1f9e6;" }, { ":softball:", "&#x1f94e;" }, { ":solomon_islands:", "&#x1f1f8;&#x1f1e7;" }, { ":somalia:", "&#x1f1f8;&#x1f1f4;" }, { ":soon:", "&#x1f51c;" }, { ":sos:", "&#x1f198;" }, { ":sound:", "&#x1f509;" }, { ":south_africa:", "&#x1f1ff;&#x1f1e6;" }, { ":south_georgia_south_sandwich_islands:", "&#x1f1ec;&#x1f1f8;" }, { ":south_sudan:", "&#x1f1f8;&#x1f1f8;" }, { ":space_invader:", "&#x1f47e;" }, { ":spades:", "&#x2660;" }, { ":spaghetti:", "&#x1f35d;" }, { ":sparkle:", "&#x2747;" }, { ":sparkler:", "&#x1f387;" }, { ":sparkles:", "&#x2728;" }, { ":sparkling_heart:", "&#x1f496;" }, { ":speak_no_evil:", "&#x1f64a;" }, { ":speaker:", "&#x1f508;" }, { ":speaking_head:", "&#x1f5e3;" }, { ":speech_balloon:", "&#x1f4ac;" }, { ":speedboat:", "&#x1f6a4;" }, { ":spider:", "&#x1f577;" }, { ":spider_web:", "&#x1f578;" }, { ":spiral_calendar:", "&#x1f5d3;" }, { ":spiral_notepad:", "&#x1f5d2;" }, { ":sponge:", "&#x1f9fd;" }, { ":spoon:", "&#x1f944;" }, { ":squid:", "&#x1f991;" }, { ":sri_lanka:", "&#x1f1f1;&#x1f1f0;" }, { ":st_barthelemy:", "&#x1f1e7;&#x1f1f1;" }, { ":st_helena:", "&#x1f1f8;&#x1f1ed;" }, { ":st_kitts_nevis:", "&#x1f1f0;&#x1f1f3;" }, { ":st_lucia:", "&#x1f1f1;&#x1f1e8;" }, { ":st_martin:", "&#x1f1f2;&#x1f1eb;" }, { ":st_pierre_miquelon:", "&#x1f1f5;&#x1f1f2;" }, { ":st_vincent_grenadines:", "&#x1f1fb;&#x1f1e8;" }, { ":stadium:", "&#x1f3df;" }, { ":standing_man:", "&#x1f9cd;&#x2642;" }, { ":standing_person:", "&#x1f9cd;" }, { ":standing_woman:", "&#x1f9cd;&#x2640;" }, { ":star:", "&#x2b50;" }, { ":star2:", "&#x1f31f;" }, { ":star_and_crescent:", "&#x262a;" }, { ":star_of_david:", "&#x2721;" }, { ":star_struck:", "&#x1f929;" }, { ":stars:", "&#x1f320;" }, { ":station:", "&#x1f689;" }, { ":statue_of_liberty:", "&#x1f5fd;" }, { ":steam_locomotive:", "&#x1f682;" }, { ":stethoscope:", "&#x1fa7a;" }, { ":stew:", "&#x1f372;" }, { ":stop_button:", "&#x23f9;" }, { ":stop_sign:", "&#x1f6d1;" }, { ":stopwatch:", "&#x23f1;" }, { ":straight_ruler:", "&#x1f4cf;" }, { ":strawberry:", "&#x1f353;" }, { ":stuck_out_tongue:", "&#x1f61b;" }, { ":stuck_out_tongue_closed_eyes:", "&#x1f61d;" }, { ":stuck_out_tongue_winking_eye:", "&#x1f61c;" }, { ":student:", "&#x1f9d1;&#x1f393;" }, { ":studio_microphone:", "&#x1f399;" }, { ":stuffed_flatbread:", "&#x1f959;" }, { ":sudan:", "&#x1f1f8;&#x1f1e9;" }, { ":sun_behind_large_cloud:", "&#x1f325;" }, { ":sun_behind_rain_cloud:", "&#x1f326;" }, { ":sun_behind_small_cloud:", "&#x1f324;" }, { ":sun_with_face:", "&#x1f31e;" }, { ":sunflower:", "&#x1f33b;" }, { ":sunglasses:", "&#x1f60e;" }, { ":sunny:", "&#x2600;" }, { ":sunrise:", "&#x1f305;" }, { ":sunrise_over_mountains:", "&#x1f304;" }, { ":superhero:", "&#x1f9b8;" }, { ":superhero_man:", "&#x1f9b8;&#x2642;" }, { ":superhero_woman:", "&#x1f9b8;&#x2640;" }, { ":supervillain:", "&#x1f9b9;" }, { ":supervillain_man:", "&#x1f9b9;&#x2642;" }, { ":supervillain_woman:", "&#x1f9b9;&#x2640;" }, { ":surfer:", "&#x1f3c4;" }, { ":surfing_man:", "&#x1f3c4;&#x2642;" }, { ":surfing_woman:", "&#x1f3c4;&#x2640;" }, { ":suriname:", "&#x1f1f8;&#x1f1f7;" }, { ":sushi:", "&#x1f363;" }, { ":suspension_railway:", "&#x1f69f;" }, { ":svalbard_jan_mayen:", "&#x1f1f8;&#x1f1ef;" }, { ":swan:", "&#x1f9a2;" }, { ":swaziland:", "&#x1f1f8;&#x1f1ff;" }, { ":sweat:", "&#x1f613;" }, { ":sweat_drops:", "&#x1f4a6;" }, { ":sweat_smile:", "&#x1f605;" }, { ":sweden:", "&#x1f1f8;&#x1f1ea;" }, { ":sweet_potato:", "&#x1f360;" }, { ":swim_brief:", "&#x1fa72;" }, { ":swimmer:", "&#x1f3ca;" }, { ":swimming_man:", "&#x1f3ca;&#x2642;" }, { ":swimming_woman:", "&#x1f3ca;&#x2640;" }, { ":switzerland:", "&#x1f1e8;&#x1f1ed;" }, { ":symbols:", "&#x1f523;" }, { ":synagogue:", "&#x1f54d;" }, { ":syria:", "&#x1f1f8;&#x1f1fe;" }, { ":syringe:", "&#x1f489;" }, { ":t-rex:", "&#x1f996;" }, { ":taco:", "&#x1f32e;" }, { ":tada:", "&#x1f389;" }, { ":taiwan:", "&#x1f1f9;&#x1f1fc;" }, { ":tajikistan:", "&#x1f1f9;&#x1f1ef;" }, { ":takeout_box:", "&#x1f961;" }, { ":tamale:", "&#x1fad4;" }, { ":tanabata_tree:", "&#x1f38b;" }, { ":tangerine:", "&#x1f34a;" }, { ":tanzania:", "&#x1f1f9;&#x1f1ff;" }, { ":taurus:", "&#x2649;" }, { ":taxi:", "&#x1f695;" }, { ":tea:", "&#x1f375;" }, { ":teacher:", "&#x1f9d1;&#x1f3eb;" }, { ":teapot:", "&#x1fad6;" }, { ":technologist:", "&#x1f9d1;&#x1f4bb;" }, { ":teddy_bear:", "&#x1f9f8;" }, { ":telephone:", "&#x260e;" }, { ":telephone_receiver:", "&#x1f4de;" }, { ":telescope:", "&#x1f52d;" }, { ":tennis:", "&#x1f3be;" }, { ":tent:", "&#x26fa;" }, { ":test_tube:", "&#x1f9ea;" }, { ":thailand:", "&#x1f1f9;&#x1f1ed;" }, { ":thermometer:", "&#x1f321;" }, { ":thinking:", "&#x1f914;" }, { ":thong_sandal:", "&#x1fa74;" }, { ":thought_balloon:", "&#x1f4ad;" }, { ":thread:", "&#x1f9f5;" }, { ":three:", "&#x0033;&#x20e3;" }, { ":thumbsdown:", "&#x1f44e;" }, { ":thumbsup:", "&#x1f44d;" }, { ":ticket:", "&#x1f3ab;" }, { ":tickets:", "&#x1f39f;" }, { ":tiger:", "&#x1f42f;" }, { ":tiger2:", "&#x1f405;" }, { ":timer_clock:", "&#x23f2;" }, { ":timor_leste:", "&#x1f1f9;&#x1f1f1;" }, { ":tipping_hand_man:", "&#x1f481;&#x2642;" }, { ":tipping_hand_person:", "&#x1f481;" }, { ":tipping_hand_woman:", "&#x1f481;&#x2640;" }, { ":tired_face:", "&#x1f62b;" }, { ":tm:", "&#x2122;" }, { ":togo:", "&#x1f1f9;&#x1f1ec;" }, { ":toilet:", "&#x1f6bd;" }, { ":tokelau:", "&#x1f1f9;&#x1f1f0;" }, { ":tokyo_tower:", "&#x1f5fc;" }, { ":tomato:", "&#x1f345;" }, { ":tonga:", "&#x1f1f9;&#x1f1f4;" }, { ":tongue:", "&#x1f445;" }, { ":toolbox:", "&#x1f9f0;" }, { ":tooth:", "&#x1f9b7;" }, { ":toothbrush:", "&#x1faa5;" }, { ":top:", "&#x1f51d;" }, { ":tophat:", "&#x1f3a9;" }, { ":tornado:", "&#x1f32a;" }, { ":tr:", "&#x1f1f9;&#x1f1f7;" }, { ":trackball:", "&#x1f5b2;" }, { ":tractor:", "&#x1f69c;" }, { ":traffic_light:", "&#x1f6a5;" }, { ":train:", "&#x1f68b;" }, { ":train2:", "&#x1f686;" }, { ":tram:", "&#x1f68a;" }, { ":transgender_flag:", "&#x1f3f3;&#x26a7;" }, { ":transgender_symbol:", "&#x26a7;" }, { ":triangular_flag_on_post:", "&#x1f6a9;" }, { ":triangular_ruler:", "&#x1f4d0;" }, { ":trident:", "&#x1f531;" }, { ":trinidad_tobago:", "&#x1f1f9;&#x1f1f9;" }, { ":tristan_da_cunha:", "&#x1f1f9;&#x1f1e6;" }, { ":triumph:", "&#x1f624;" }, { ":troll:", "&#x1f9cc;" }, { ":trolleybus:", "&#x1f68e;" }, { ":trophy:", "&#x1f3c6;" }, { ":tropical_drink:", "&#x1f379;" }, { ":tropical_fish:", "&#x1f420;" }, { ":truck:", "&#x1f69a;" }, { ":trumpet:", "&#x1f3ba;" }, { ":tshirt:", "&#x1f455;" }, { ":tulip:", "&#x1f337;" }, { ":tumbler_glass:", "&#x1f943;" }, { ":tunisia:", "&#x1f1f9;&#x1f1f3;" }, { ":turkey:", "&#x1f983;" }, { ":turkmenistan:", "&#x1f1f9;&#x1f1f2;" }, { ":turks_caicos_islands:", "&#x1f1f9;&#x1f1e8;" }, { ":turtle:", "&#x1f422;" }, { ":tuvalu:", "&#x1f1f9;&#x1f1fb;" }, { ":tv:", "&#x1f4fa;" }, { ":twisted_rightwards_arrows:", "&#x1f500;" }, { ":two:", "&#x0032;&#x20e3;" }, { ":two_hearts:", "&#x1f495;" }, { ":two_men_holding_hands:", "&#x1f46c;" }, { ":two_women_holding_hands:", "&#x1f46d;" }, { ":u5272:", "&#x1f239;" }, { ":u5408:", "&#x1f234;" }, { ":u55b6:", "&#x1f23a;" }, { ":u6307:", "&#x1f22f;" }, { ":u6708:", "&#x1f237;" }, { ":u6709:", "&#x1f236;" }, { ":u6e80:", "&#x1f235;" }, { ":u7121:", "&#x1f21a;" }, { ":u7533:", "&#x1f238;" }, { ":u7981:", "&#x1f232;" }, { ":u7a7a:", "&#x1f233;" }, { ":uganda:", "&#x1f1fa;&#x1f1ec;" }, { ":uk:", "&#x1f1ec;&#x1f1e7;" }, { ":ukraine:", "&#x1f1fa;&#x1f1e6;" }, { ":umbrella:", "&#x2614;" }, { ":unamused:", "&#x1f612;" }, { ":underage:", "&#x1f51e;" }, { ":unicorn:", "&#x1f984;" }, { ":united_arab_emirates:", "&#x1f1e6;&#x1f1ea;" }, { ":united_nations:", "&#x1f1fa;&#x1f1f3;" }, { ":unlock:", "&#x1f513;" }, { ":up:", "&#x1f199;" }, { ":upside_down_face:", "&#x1f643;" }, { ":uruguay:", "&#x1f1fa;&#x1f1fe;" }, { ":us:", "&#x1f1fa;&#x1f1f8;" }, { ":us_outlying_islands:", "&#x1f1fa;&#x1f1f2;" }, { ":us_virgin_islands:", "&#x1f1fb;&#x1f1ee;" }, { ":uzbekistan:", "&#x1f1fa;&#x1f1ff;" }, { ":v:", "&#x270c;" }, { ":vampire:", "&#x1f9db;" }, { ":vampire_man:", "&#x1f9db;&#x2642;" }, { ":vampire_woman:", "&#x1f9db;&#x2640;" }, { ":vanuatu:", "&#x1f1fb;&#x1f1fa;" }, { ":vatican_city:", "&#x1f1fb;&#x1f1e6;" }, { ":venezuela:", "&#x1f1fb;&#x1f1ea;" }, { ":vertical_traffic_light:", "&#x1f6a6;" }, { ":vhs:", "&#x1f4fc;" }, { ":vibration_mode:", "&#x1f4f3;" }, { ":video_camera:", "&#x1f4f9;" }, { ":video_game:", "&#x1f3ae;" }, { ":vietnam:", "&#x1f1fb;&#x1f1f3;" }, { ":violin:", "&#x1f3bb;" }, { ":virgo:", "&#x264d;" }, { ":volcano:", "&#x1f30b;" }, { ":volleyball:", "&#x1f3d0;" }, { ":vomiting_face:", "&#x1f92e;" }, { ":vs:", "&#x1f19a;" }, { ":vulcan_salute:", "&#x1f596;" }, { ":waffle:", "&#x1f9c7;" }, { ":wales:", "&#x1f3f4;&#xe0067;&#xe0062;&#xe0077;&#xe006c;&#xe0073;&#xe007f;" }, { ":walking:", "&#x1f6b6;" }, { ":walking_man:", "&#x1f6b6;&#x2642;" }, { ":walking_woman:", "&#x1f6b6;&#x2640;" }, { ":wallis_futuna:", "&#x1f1fc;&#x1f1eb;" }, { ":waning_crescent_moon:", "&#x1f318;" }, { ":waning_gibbous_moon:", "&#x1f316;" }, { ":warning:", "&#x26a0;" }, { ":wastebasket:", "&#x1f5d1;" }, { ":watch:", "&#x231a;" }, { ":water_buffalo:", "&#x1f403;" }, { ":water_polo:", "&#x1f93d;" }, { ":watermelon:", "&#x1f349;" }, { ":wave:", "&#x1f44b;" }, { ":wavy_dash:", "&#x3030;" }, { ":waxing_crescent_moon:", "&#x1f312;" }, { ":waxing_gibbous_moon:", "&#x1f314;" }, { ":wc:", "&#x1f6be;" }, { ":weary:", "&#x1f629;" }, { ":wedding:", "&#x1f492;" }, { ":weight_lifting:", "&#x1f3cb;" }, { ":weight_lifting_man:", "&#x1f3cb;&#x2642;" }, { ":weight_lifting_woman:", "&#x1f3cb;&#x2640;" }, { ":western_sahara:", "&#x1f1ea;&#x1f1ed;" }, { ":whale:", "&#x1f433;" }, { ":whale2:", "&#x1f40b;" }, { ":wheel:", "&#x1f6de;" }, { ":wheel_of_dharma:", "&#x2638;" }, { ":wheelchair:", "&#x267f;" }, { ":white_check_mark:", "&#x2705;" }, { ":white_circle:", "&#x26aa;" }, { ":white_flag:", "&#x1f3f3;" }, { ":white_flower:", "&#x1f4ae;" }, { ":white_haired_man:", "&#x1f468;&#x1f9b3;" }, { ":white_haired_woman:", "&#x1f469;&#x1f9b3;" }, { ":white_heart:", "&#x1f90d;" }, { ":white_large_square:", "&#x2b1c;" }, { ":white_medium_small_square:", "&#x25fd;" }, { ":white_medium_square:", "&#x25fb;" }, { ":white_small_square:", "&#x25ab;" }, { ":white_square_button:", "&#x1f533;" }, { ":wilted_flower:", "&#x1f940;" }, { ":wind_chime:", "&#x1f390;" }, { ":wind_face:", "&#x1f32c;" }, { ":window:", "&#x1fa9f;" }, { ":wine_glass:", "&#x1f377;" }, { ":wing:", "&#x1fabd;" }, { ":wink:", "&#x1f609;" }, { ":wireless:", "&#x1f6dc;" }, { ":wolf:", "&#x1f43a;" }, { ":woman:", "&#x1f469;" }, { ":woman_artist:", "&#x1f469;&#x1f3a8;" }, { ":woman_astronaut:", "&#x1f469;&#x1f680;" }, { ":woman_beard:", "&#x1f9d4;&#x2640;" }, { ":woman_cartwheeling:", "&#x1f938;&#x2640;" }, { ":woman_cook:", "&#x1f469;&#x1f373;" }, { ":woman_dancing:", "&#x1f483;" }, { ":woman_facepalming:", "&#x1f926;&#x2640;" }, { ":woman_factory_worker:", "&#x1f469;&#x1f3ed;" }, { ":woman_farmer:", "&#x1f469;&#x1f33e;" }, { ":woman_feeding_baby:", "&#x1f469;&#x1f37c;" }, { ":woman_firefighter:", "&#x1f469;&#x1f692;" }, { ":woman_health_worker:", "&#x1f469;&#x2695;" }, { ":woman_in_manual_wheelchair:", "&#x1f469;&#x1f9bd;" }, { ":woman_in_motorized_wheelchair:", "&#x1f469;&#x1f9bc;" }, { ":woman_in_tuxedo:", "&#x1f935;&#x2640;" }, { ":woman_judge:", "&#x1f469;&#x2696;" }, { ":woman_juggling:", "&#x1f939;&#x2640;" }, { ":woman_mechanic:", "&#x1f469;&#x1f527;" }, { ":woman_office_worker:", "&#x1f469;&#x1f4bc;" }, { ":woman_pilot:", "&#x1f469;&#x2708;" }, { ":woman_playing_handball:", "&#x1f93e;&#x2640;" }, { ":woman_playing_water_polo:", "&#x1f93d;&#x2640;" }, { ":woman_scientist:", "&#x1f469;&#x1f52c;" }, { ":woman_shrugging:", "&#x1f937;&#x2640;" }, { ":woman_singer:", "&#x1f469;&#x1f3a4;" }, { ":woman_student:", "&#x1f469;&#x1f393;" }, { ":woman_teacher:", "&#x1f469;&#x1f3eb;" }, { ":woman_technologist:", "&#x1f469;&#x1f4bb;" }, { ":woman_with_headscarf:", "&#x1f9d5;" }, { ":woman_with_probing_cane:", "&#x1f469;&#x1f9af;" }, { ":woman_with_turban:", "&#x1f473;&#x2640;" }, { ":woman_with_veil:", "&#x1f470;&#x2640;" }, { ":womans_clothes:", "&#x1f45a;" }, { ":womans_hat:", "&#x1f452;" }, { ":women_wrestling:", "&#x1f93c;&#x2640;" }, { ":womens:", "&#x1f6ba;" }, { ":wood:", "&#x1fab5;" }, { ":woozy_face:", "&#x1f974;" }, { ":world_map:", "&#x1f5fa;" }, { ":worm:", "&#x1fab1;" }, { ":worried:", "&#x1f61f;" }, { ":wrench:", "&#x1f527;" }, { ":wrestling:", "&#x1f93c;" }, { ":writing_hand:", "&#x270d;" }, { ":x:", "&#x274c;" }, { ":x_ray:", "&#x1fa7b;" }, { ":yarn:", "&#x1f9f6;" }, { ":yawning_face:", "&#x1f971;" }, { ":yellow_circle:", "&#x1f7e1;" }, { ":yellow_heart:", "&#x1f49b;" }, { ":yellow_square:", "&#x1f7e8;" }, { ":yemen:", "&#x1f1fe;&#x1f1ea;" }, { ":yen:", "&#x1f4b4;" }, { ":yin_yang:", "&#x262f;" }, { ":yo_yo:", "&#x1fa80;" }, { ":yum:", "&#x1f60b;" }, { ":zambia:", "&#x1f1ff;&#x1f1f2;" }, { ":zany_face:", "&#x1f92a;" }, { ":zap:", "&#x26a1;" }, { ":zebra:", "&#x1f993;" }, { ":zero:", "&#x0030;&#x20e3;" }, { ":zimbabwe:", "&#x1f1ff;&#x1f1fc;" }, { ":zipper_mouth_face:", "&#x1f910;" }, { ":zombie:", "&#x1f9df;" }, { ":zombie_man:", "&#x1f9df;&#x2642;" }, { ":zombie_woman:", "&#x1f9df;&#x2640;" }, { ":zzz:", "&#x1f4a4;" } }; // compatibility with older versions static struct emojiEntityCompatibility { const char *oldName; const char *newName; } g_emojiCompatibilityEntities[] = { {":blonde_man:", ":blond_haired_man:"}, {":person_frowning:", ":frowning_person:"}, {":person_with_blond_hair:", ":blond_haired_person:"}, {":person_with_pouting_face:", ":pouting_face:"}, }; static const size_t g_numEmojiEntities = sizeof(g_emojiEntities)/sizeof(*g_emojiEntities); static const size_t g_numEmojiCompatibilityEntities = sizeof(g_emojiCompatibilityEntities)/sizeof(*g_emojiCompatibilityEntities); EmojiEntityMapper *EmojiEntityMapper::s_instance = nullptr; EmojiEntityMapper::EmojiEntityMapper() { for (size_t i = 0; i < g_numEmojiEntities; i++) { m_name2symGh.emplace(g_emojiEntities[i].name, static_cast<int>(i)); } for (size_t i = 0; i < g_numEmojiCompatibilityEntities; i++) { int ii = symbol2index(g_emojiCompatibilityEntities[i].newName); if (ii != -1) m_name2symGh.emplace(g_emojiCompatibilityEntities[i].oldName, ii); } } EmojiEntityMapper::~EmojiEntityMapper() { } /** Returns the one and only instance of the Emoji entity mapper */ EmojiEntityMapper &EmojiEntityMapper::instance() { static EmojiEntityMapper inst; return inst; } /*! * @brief Returns a code for the requested Emoji entity name * @param symName Emoji entity name * @return the code for the requested Emoji entity name, * in case the requested Emoji item does not exist `-1` is returned. */ int EmojiEntityMapper::symbol2index(const std::string &symName) const { auto it = m_name2symGh.find(symName); return it!=m_name2symGh.end() ? it->second : -1; } /*! * @brief Writes the list of supported emojis to the given file. */ void EmojiEntityMapper::writeEmojiFile(TextStream &t) { for (size_t i = 0; i < g_numEmojiEntities; i++) { t << g_emojiEntities[i].name << "\n"; } for (size_t i = 0; i < g_numEmojiCompatibilityEntities; i++) { t << g_emojiCompatibilityEntities[i].oldName << "\n"; } } /*! @brief Access routine to the unicode sequence for the Emoji entity * * @param index code of the requested Emoji entity returned by symbol2index() * @return the unicode sequence of the Emoji entity, */ const char *EmojiEntityMapper::unicode(int index) const { return index>=0 && static_cast<size_t>(index)<g_numEmojiEntities ? g_emojiEntities[index].unicode : nullptr; } /*! @brief Access routine to the name of the Emoji entity * * @param index code of the requested Emoji entity returned by symbol2index() * @return the name of the Emoji entity in GitHub format (i.e. :smile:) */ const char *EmojiEntityMapper::name(int index) const { return index>=0 && static_cast<size_t>(index)<g_numEmojiEntities ? g_emojiEntities[index].name : nullptr; }
174,105
C++
.cpp
2,018
83.325074
129
0.20484
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,492
doxyapp.cpp
doxygen_doxygen/addon/doxyapp/doxyapp.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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. * */ /** @file * @brief Example of how to use doxygen as part of another GPL applications * * This example shows how to configure and run doxygen programmatically from * within an application without generating the usual output. * * If you are running a non-UNIX-like system you should specify `--tempdir`. * * This example shows how to use to code parser to get cross-references information * and it also shows how to look up symbols in a program parsed by doxygen and * show some information about them. */ #include <stdlib.h> #include <map> #include <string> #include "dir.h" #include "doxygen.h" #include "outputgen.h" #include "outputlist.h" #include "parserintf.h" #include "classdef.h" #include "namespacedef.h" #include "filedef.h" #include "util.h" #include "classlist.h" #include "config.h" #include "filename.h" #include "version.h" class XRefDummyCodeGenerator : public OutputCodeIntf { public: XRefDummyCodeGenerator(FileDef *fd) : m_fd(fd) {} ~XRefDummyCodeGenerator() {} // these are just null functions, they can be used to produce a syntax highlighted // and cross-linked version of the source code, but who needs that anyway ;-) OutputType type() const override { return OutputType::Extension; } std::unique_ptr<OutputCodeIntf> clone() override { return std::make_unique<XRefDummyCodeGenerator>(m_fd); } void codify(const QCString &) override {} void stripCodeComments(bool) override {} void startSpecialComment() override {} void endSpecialComment() override {} void setStripIndentAmount(size_t) override {} void writeCodeLink(CodeSymbolType,const QCString &,const QCString &,const QCString &,const QCString &,const QCString &) override {} void writeLineNumber(const QCString &,const QCString &,const QCString &,int,bool) override {} virtual void writeTooltip(const QCString &,const DocLinkInfo &, const QCString &,const QCString &,const SourceLinkInfo &, const SourceLinkInfo &) override {} void startCodeLine(int) override {} void endCodeLine() override {} void startFontClass(const QCString &) override {} void endFontClass() override {} void writeCodeAnchor(const QCString &) override {} void startCodeFragment(const QCString &) override {} void endCodeFragment(const QCString &) override {} void startFold(int,const QCString &,const QCString &) override {} void endFold() override {} // here we are presented with the symbols found by the code parser void linkableSymbol(int l, const char *sym,Definition *symDef,Definition *context) { QCString ctx; if (context) // the context of the symbol is known { if (context->definitionType()==Definition::TypeMember) // it is inside a member { Definition *parentContext = context->getOuterScope(); if (parentContext && parentContext->definitionType()==Definition::TypeClass) // it is inside a member of a class { ctx.sprintf("inside %s %s of %s %s", (dynamic_cast<MemberDef*>(context))->memberTypeName().data(), context->name().data(), (dynamic_cast<ClassDef*>(parentContext))->compoundTypeString().data(), parentContext->name().data()); } else if (parentContext==Doxygen::globalScope) // it is inside a global member { ctx.sprintf("inside %s %s", (dynamic_cast<MemberDef*>(context))->memberTypeName().data(), context->name().data()); } } if (ctx.isEmpty()) // it is something else (class, or namespace member, ...) { ctx.sprintf("in %s",context->name().data()); } } printf("Found symbol %s at line %d of %s %s\n", sym,l,m_fd->getDefFileName().data(),ctx.data()); if (symDef && context) // in this case the definition of the symbol is // known to doxygen. { printf("-> defined at line %d of %s\n", symDef->getDefLine(),symDef->getDefFileName().data()); } } private: FileDef *m_fd; }; static void findXRefSymbols(FileDef *fd) { // get the interface to a parser that matches the file extension auto intf=Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); // get the programming language from the file name SrcLangExt lang = getLanguageFromFileName(fd->name()); // reset the parsers state intf->resetCodeParserState(); // create a new backend object std::unique_ptr<OutputCodeIntf> xrefGen = std::make_unique<XRefDummyCodeGenerator>(fd); OutputCodeList xrefList; xrefList.add(std::move(xrefGen)); // parse the source code intf->parseCode(xrefList, QCString(), fileToString(fd->absFilePath()), lang, FALSE, FALSE, QCString(), fd); } static void listSymbol(Definition *d) { if (d!=Doxygen::globalScope && // skip the global namespace symbol d->name().at(0)!='@' // skip anonymous stuff ) { printf("%s\n", d->name().data()); } } static void listSymbols() { for (const auto &kv : *Doxygen::symbolMap) { for (const auto &def : kv.second) { listSymbol(def); } } } static void lookupSymbol(const Definition *d) { if (d!=Doxygen::globalScope && // skip the global namespace symbol d->name().at(0)!='@' // skip anonymous stuff ) { printf("Symbol info\n"); printf("-----------\n"); printf("Name: %s\n",d->name().data()); printf("File: %s\n",d->getDefFileName().data()); printf("Line: %d\n",d->getDefLine()); // depending on the definition type we can case to the appropriate // derived to get additional information switch (d->definitionType()) { case Definition::TypeClass: { const ClassDef *cd = dynamic_cast<const ClassDef*>(d); printf("Kind: %s\n",cd->compoundTypeString().data()); } break; case Definition::TypeFile: { const FileDef *fd = dynamic_cast<const FileDef*>(d); printf("Kind: File: #includes %zu other files\n", fd->includeFileList().size()); } break; case Definition::TypeNamespace: { const NamespaceDef *nd = dynamic_cast<const NamespaceDef*>(d); printf("Kind: Namespace: contains %zu classes and %zu namespaces\n", nd->getClasses().size(), nd->getNamespaces().size()); } break; case Definition::TypeMember: { const MemberDef *md = dynamic_cast<const MemberDef*>(d); printf("Kind: %s\n",md->memberTypeName().data()); } break; default: // ignore groups/pages/packages/dirs for now break; } } } static void lookupSymbols(const QCString &sym) { if (!sym.isEmpty()) { auto range = Doxygen::symbolMap->find(sym); bool found=false; for (const Definition *def : range) { lookupSymbol(def); found=true; } if (!found) { printf("Unknown symbol\n"); } } } template <typename Iter> std::string join(Iter begin, Iter end, std::string const& separator) { std::ostringstream result; if (begin != end) result << *begin++; while (begin != end) result << separator << *begin++; return result.str(); } static auto symbolInfo(const Definition *def) { std::map<std::string, int> ret; if (def->hasDocumentation()) { if (def->hasBriefDescription()) ret["briefLine"] = def->briefLine(); ret["docLine"] = def->docLine(); } ret["defLine"] = def->getDefLine(); ret["defColumn"] = def->getDefColumn(); ret["startDefLine"] = def->getStartDefLine(); ret["startBodyLine"] = def->getStartBodyLine(); ret["endBodyLine"] = def->getEndBodyLine(); ret["inbodyLine"] = def->inbodyLine(); return ret; } static void locateSymbols() { std::map<std::string, std::map<std::string, std::map<std::string, std::map<std::string, int>>>> ret; for (const auto &kv : *Doxygen::symbolMap) { for (const auto &def : kv.second) { if (def == Doxygen::globalScope || def->name().at(0) == '@') continue; QCString args = ""; if (def->definitionType() == Definition::TypeMember) { const auto *md = dynamic_cast<MemberDef*>(def); args = md->argsString(); } ret[def->getDefFileName().data()][def->qualifiedName().data()][args.data()] = symbolInfo(def); } } // print as json std::vector<std::string> out; for (const auto &[fname, qmap] : ret) { out.push_back(std::string(4, ' ') + "\"" + fname + "\": {\n"); std::vector<std::string> file; for (const auto &[qname, arg_map] : qmap) { file.push_back(std::string(8, ' ') + "\"" + qname + "\": {\n"); std::vector<std::string> name; for (const auto &[args, imap] : arg_map) { name.push_back(std::string(12, ' ') + "\"" + args + "\": {\n"); std::vector<std::string> item; for (const auto &[key, value] : imap) { item.push_back(std::string(16, ' ') + "\"" + key + "\": " + std::to_string(value)); } name.back() += join(item.begin(), item.end(), ",\n"); name.back() += "\n" + std::string(12, ' ') + "}"; } file.back() += join(name.begin(), name.end(), ",\n"); file.back() += "\n" + std::string(8, ' ') + "}"; } out.back() += join(file.begin(), file.end(), ",\n"); out.back() += "\n" + std::string(4, ' ') + "}"; } std::cout << "{\n" << join(out.begin(), out.end(), ",\n") << "\n}\n"; } int main(int argc,char **argv) { std::string tempdir = "/tmp/doxygen"; std::string usage = "Usage: %s [--version] [--help] [--list] [--locate] [--tempdir ARG] path [path...]\n"; StringVector inputList; bool list = false; bool locate = false; for (size_t i = 1; i < argc; i++) { if (std::string(argv[i]) == "--version") { printf("%s version: %s\n",argv[0],getFullVersion().c_str()); exit(0); } if (std::string(argv[i]) == "--help") { printf(usage.c_str(), argv[0]); exit(0); } if (std::string(argv[i]) == "--list") { if (locate) { printf(usage.c_str(), argv[0]); exit(1); } list = true; continue; } if (std::string(argv[i]) == "--locate") { if (list) { printf(usage.c_str(), argv[0]); exit(1); } locate = true; continue; } if (std::string(argv[i]) == "--tempdir") { if (i+1 >= argc) { printf(usage.c_str(), argv[0]); exit(1); } tempdir = argv[i+1]; i++; continue; } inputList.push_back(argv[i]); } // initialize data structures initDoxygen(); // setup the non-default configuration options checkConfiguration(); adjustConfiguration(); // we need a place to put intermediate files Config_updateString(OUTPUT_DIRECTORY, tempdir.c_str()); // disable html output Config_updateBool(GENERATE_HTML,FALSE); // disable latex output Config_updateBool(GENERATE_LATEX,FALSE); // be quiet Config_updateBool(QUIET,TRUE); // turn off warnings Config_updateBool(WARNINGS,FALSE); Config_updateBool(WARN_IF_UNDOCUMENTED,FALSE); Config_updateBool(WARN_IF_DOC_ERROR,FALSE); Config_updateBool(WARN_IF_UNDOC_ENUM_VAL,FALSE); // Extract as much as possible Config_updateBool(EXTRACT_ALL,TRUE); Config_updateBool(EXTRACT_STATIC,TRUE); Config_updateBool(EXTRACT_PRIVATE,TRUE); Config_updateBool(EXTRACT_LOCAL_METHODS,TRUE); // Extract source browse information, needed // to make doxygen gather the cross reference info Config_updateBool(SOURCE_BROWSER,TRUE); // In case of a directory take all files on directory and its subdirectories Config_updateBool(RECURSIVE,TRUE); // set the input Config_updateList(INPUT,inputList); // parse the files parseInput(); // iterate over the input files for (const auto &fn : *Doxygen::inputNameLinkedMap) { for (const auto &fd : *fn) { // get the references (linked and unlinked) found in this file findXRefSymbols(fd.get()); } } // clean up after us Dir().rmdir(tempdir.c_str()); if (list) { listSymbols(); exit(0); } if (locate) { locateSymbols(); exit(0); } char cmd[256]; while (1) { printf("> Type a symbol name or\n> .list for a list of symbols or\n> .quit to exit\n> "); (void)fgets(cmd,256,stdin); QCString s(cmd); if (s.at(s.length()-1)=='\n') s=s.left(s.length()-1); // strip trailing \n if (s==".list") listSymbols(); else if (s==".locate") locateSymbols(); else if (s==".quit") exit(0); else lookupSymbols(s); } }
13,597
C++
.cpp
415
27.303614
136
0.616911
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,493
config_msg.cpp
doxygen_doxygen/addon/doxywizard/config_msg.cpp
#include <QString> #include "config_msg.h" #include "doxywizard.h" static QString warning_str = QString::fromLatin1("warning: "); static QString error_str = QString::fromLatin1("error: "); void config_err(const char *fmt, ...) { QString msg = error_str; msg.append(QString::fromLatin1(fmt)); va_list args; va_start(args, fmt); char debugOut[1000]; // this size should be sufficient vsnprintf(debugOut, 1000,qPrintable(msg), args); MainWindow::instance().outputLogText(QString::fromLatin1(debugOut)); va_end(args); } void config_term(const char *fmt, ...) { QString msg = error_str; msg.append(QString::fromLatin1(fmt)); va_list args; va_start(args, fmt); char debugOut[1000]; // this size should be sufficient vsnprintf(debugOut, 1000,qPrintable(msg), args); MainWindow::instance().outputLogText(QString::fromLatin1(debugOut)); va_end(args); exit(1); } void config_warn(const char *fmt, ...) { QString msg = warning_str; msg.append(QString::fromLatin1(fmt)); va_list args; va_start(args, fmt); char debugOut[1000]; vsnprintf(debugOut, 1000,qPrintable(msg), args); MainWindow::instance().outputLogText(QString::fromLatin1(debugOut)); va_end(args); } void config_open() { MainWindow::instance().outputLogStart(); } void config_finish() { MainWindow::instance().outputLogFinish(); }
1,343
C++
.cpp
47
26.234043
70
0.730381
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
true
false
false
true
false
false
28,494
inputint.cpp
doxygen_doxygen/addon/doxywizard/inputint.cpp
/****************************************************************************** * * Copyright (C) 1997-2019 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. * */ #include "inputint.h" #include "helplabel.h" #include "config_msg.h" #include <QSpinBox> #include <QGridLayout> #include <QWheelEvent> #include <QTextStream> class NoWheelSpinBox : public QSpinBox { protected: void wheelEvent(QWheelEvent *e) { e->ignore(); } }; InputInt::InputInt( QGridLayout *layout,int &row, const QString & id, int defVal, int minVal,int maxVal, const QString & docs ) : m_default(defVal), m_minVal(minVal), m_maxVal(maxVal), m_docs(docs), m_id(id) { m_lab = new HelpLabel(id); m_sp = new NoWheelSpinBox; m_sp->setMinimum(minVal); m_sp->setMaximum(maxVal); m_sp->setSingleStep(1); m_val=defVal-1; // force update setValue(defVal); layout->addWidget( m_lab, row, 0 ); layout->addWidget( m_sp, row, 1 ); connect(m_sp, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)) ); connect( m_lab, SIGNAL(enter()), SLOT(help()) ); connect( m_lab, SIGNAL(reset()), SLOT(reset()) ); row++; } void InputInt::help() { showHelp(this); } void InputInt::setValue(int val) { int newVal = val; newVal = qMax(m_minVal,newVal); newVal = qMin(m_maxVal,newVal); if (val != newVal) { config_warn("argument '%d' for option %s is not a valid number in the range [%d..%d]!" " Using the default: %d!\n",val,qPrintable(m_id),m_minVal,m_maxVal,m_default); newVal = m_default; } if (newVal!=m_val) { m_val = newVal; m_sp->setValue(newVal); m_value = m_val; updateDefault(); } } void InputInt::updateDefault() { { if (m_val==m_default || !m_lab->isEnabled()) { m_lab->setText(QString::fromLatin1("<qt>")+m_id+QString::fromLatin1("</qt>")); } else { m_lab->setText(QString::fromLatin1("<qt><font color='red'>")+m_id+QString::fromLatin1("</font></qt>")); } emit changed(); } } void InputInt::setEnabled(bool state) { m_lab->setEnabled(state); m_sp->setEnabled(state); updateDefault(); } QVariant &InputInt::value() { return m_value; } void InputInt::update() { bool ok; int newVal = m_value.toInt(&ok); if (!ok) { config_warn("argument '%s' for option %s is not a valid number in the range [%d..%d]!" " Using the default: %d!\n",qPrintable(m_value.toString()),qPrintable(m_id),m_minVal,m_maxVal,m_default); newVal = m_default; } setValue(newVal); } void InputInt::reset() { setValue(m_default); } void InputInt::writeValue(QTextStream &t,TextCodecAdapter *) { t << m_val; } bool InputInt::isDefault() { return m_val == m_default; }
3,117
C++
.cpp
118
22.881356
121
0.638833
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
true
false
false
true
false
false
28,495
inputstring.cpp
doxygen_doxygen/addon/doxywizard/inputstring.cpp
/****************************************************************************** * * Copyright (C) 1997-2019 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. * */ #include "inputstring.h" #include "helplabel.h" #include "doxywizard.h" #include "config_msg.h" #include "config.h" #include <QComboBox> #include <QLineEdit> #include <QGridLayout> #include <QWheelEvent> #include <QToolBar> #include <QFileInfo> #include <QFileDialog> class NoWheelComboBox : public QComboBox { protected: void wheelEvent(QWheelEvent *e) { e->ignore(); } }; InputString::InputString( QGridLayout *layout,int &row, const QString & id, const QString &s, StringMode m, const QString &docs, const QString &absPath ) : m_default(s), m_sm(m), m_index(0), m_docs(docs), m_id(id), m_absPath(absPath==QString::fromLatin1("1")) { m_lab = new HelpLabel(id); m_brFile = nullptr; m_brDir = nullptr; if (m==StringFixed) { layout->addWidget( m_lab, row, 0 ); m_com = new NoWheelComboBox; layout->addWidget( m_com, row, 1, 1, 3, Qt::AlignLeft ); m_le=nullptr; m_br=nullptr; m_im=nullptr; row++; } else { layout->addWidget( m_lab, row, 0 ); m_le = new QLineEdit; m_le->setText( s ); m_im = nullptr; //layout->setColumnMinimumWidth(2,150); if (m==StringFile || m==StringDir || m==StringImage || m==StringFileDir) { QHBoxLayout *rowLayout = new QHBoxLayout; rowLayout->addWidget( m_le); m_br = new QToolBar; m_br->setIconSize(QSize(24,24)); if (m==StringFile || m==StringImage || m==StringFileDir) { m_brFile = m_br->addAction(QIcon(QString::fromLatin1(":/images/file.png")),QString(),this,SLOT(browseFile())); m_brFile->setToolTip(tr("Browse to a file")); if (m==StringImage) { m_im = new QLabel; m_im->setMinimumSize(1,55); m_im->setAlignment(Qt::AlignLeft|Qt::AlignTop); row++; layout->addWidget( m_im,row,1 ); } } if (m==StringDir || m==StringFileDir) { m_brDir = m_br->addAction(QIcon(QString::fromLatin1(":/images/folder.png")),QString(),this,SLOT(browseDir())); m_brDir->setToolTip(tr("Browse to a folder")); } rowLayout->addWidget( m_br); layout->addLayout( rowLayout, m==StringImage?row-1:row, 1, 1, 2 ); } else { layout->addWidget( m_le, row, 1, 1, 2 ); m_br=nullptr; m_im=nullptr; } m_com=nullptr; row++; } if (m_le) connect( m_le, SIGNAL(textChanged(const QString&)), this, SLOT(setValue(const QString&)) ); if (m_com) connect( m_com, SIGNAL(textActivated(const QString &)), this, SLOT(setValue(const QString &)) ); m_str = s+QChar::fromLatin1('!'); // force update setValue(s); connect( m_lab, SIGNAL(enter()), SLOT(help()) ); connect( m_lab, SIGNAL(reset()), SLOT(reset()) ); } void InputString::help() { showHelp(this); } InputString::~InputString() { } void InputString::setValue(const QString &s) { if (m_str!=s) { m_str = s; m_value = m_str; updateDefault(); } } void InputString::updateDefault() { { if (m_str==m_default || !m_lab->isEnabled()) { m_lab->setText(QString::fromLatin1("<qt>")+m_id+QString::fromLatin1("</qt>")); } else { m_lab->setText(QString::fromLatin1("<qt><font color='red'>")+m_id+QString::fromLatin1("</font></qt>")); } if (m_im) { if (m_str.isEmpty()) { m_im->setText(tr("No Project logo selected.")); } else { QFile Fout(m_str); if(!Fout.exists()) { m_im->setText(tr("Sorry, cannot find file(")+m_str+QString::fromLatin1(");")); } else { QPixmap pm(m_str); if (!pm.isNull()) { m_im->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation)); } else { m_im->setText(tr("Sorry, no preview available (")+m_str+QString::fromLatin1(");")); } } } } if (m_le && m_le->text()!=m_str) m_le->setText( m_str ); emit changed(); } } void InputString::setEnabled(bool state) { m_lab->setEnabled(state); if (m_le) m_le->setEnabled(state); if (m_im) m_im->setEnabled(state); if (m_br) m_br->setEnabled(state); if (m_brFile) m_brFile->setEnabled(state); if (m_brDir) m_brDir->setEnabled(state); if (m_com) m_com->setEnabled(state); updateDefault(); } void InputString::browseFile() { QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QString fileName = QFileDialog::getOpenFileName(&MainWindow::instance(), tr("Select file"),path); if (!fileName.isNull()) { QDir dir(path); if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) { fileName = m_absPath ? fileName : dir.relativeFilePath(fileName); } setValue(fileName); } } void InputString::browseDir() { QString path = QFileInfo(MainWindow::instance().configFileName()).path(); { QString dirName = QFileDialog::getExistingDirectory(&MainWindow::instance(), tr("Select directory"),path); if (!dirName.isNull()) { QDir dir(path); if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) { dirName = m_absPath ? dirName : dir.relativeFilePath(dirName); } setValue(dirName); } } } void InputString::clear() { setValue(QString()); } void InputString::addValue(QString s) { if (m_sm==StringFixed) { m_values.append(s); m_com->addItem(s); } } void InputString::setDefault() { int index = m_values.indexOf(m_str); if (index!=-1 && m_com) m_com->setCurrentIndex(index); } QVariant &InputString::value() { return m_value; } void InputString::update() { setValue(m_value.toString().trimmed()); setDefault(); } void InputString::reset() { setValue(m_default); setDefault(); } void InputString::writeValue(QTextStream &t,TextCodecAdapter *codec) { writeStringValue(t,codec,m_str); } bool InputString::isDefault() { return m_str == m_default; } QString InputString::checkEnumVal(const QString &value) { QString val = value.trimmed().toLower(); QStringList::Iterator it; for ( it= m_values.begin(); it != m_values.end(); ++it ) { QString enumVal = *it; if (enumVal.toLower() == val) return enumVal; } config_warn("argument '%s' for option %s is not a valid enum value." " Using the default: %s!",qPrintable(value),qPrintable(m_id),qPrintable(m_default)); return m_default; }
7,067
C++
.cpp
256
22.828125
118
0.614025
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,496
inputstrlist.cpp
doxygen_doxygen/addon/doxywizard/inputstrlist.cpp
/****************************************************************************** * * Copyright (C) 1997-2019 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. * */ #include "inputstrlist.h" #include "helplabel.h" #include "doxywizard.h" #include "config.h" #include <QToolBar> #include <QGridLayout> #include <QLineEdit> #include <QListWidget> #include <QFileInfo> #include <QFileDialog> #include <QTextStream> InputStrList::InputStrList( QGridLayout *layout,int &row, const QString & id, const QStringList &sl, ListMode lm, const QString & docs) : m_default(sl), m_strList(sl), m_docs(docs), m_id(id) { m_lab = new HelpLabel( id ); m_le = new QLineEdit; m_le->clear(); QToolBar *toolBar = new QToolBar; toolBar->setIconSize(QSize(24,24)); m_add = toolBar->addAction(QIcon(QString::fromLatin1(":/images/add.png")),QString(), this,SLOT(addString())); m_add->setToolTip(tr("Add item")); m_del = toolBar->addAction(QIcon(QString::fromLatin1(":/images/del.png")),QString(), this,SLOT(delString())); m_del->setToolTip(tr("Delete selected item")); m_upd = toolBar->addAction(QIcon(QString::fromLatin1(":/images/refresh.png")),QString(), this,SLOT(updateString())); m_upd->setToolTip(tr("Update selected item")); m_lb = new QListWidget; //m_lb->setMinimumSize(400,100); foreach (QString s, m_strList) m_lb->addItem(s); m_brFile=nullptr; m_brDir=nullptr; if (lm!=ListString) { if (lm&ListFile) { m_brFile = toolBar->addAction(QIcon(QString::fromLatin1(":/images/file.png")),QString(), this,SLOT(browseFiles())); m_brFile->setToolTip(tr("Browse to a file")); } if (lm&ListDir) { m_brDir = toolBar->addAction(QIcon(QString::fromLatin1(":/images/folder.png")),QString(), this,SLOT(browseDir())); m_brDir->setToolTip(tr("Browse to a folder")); } } QHBoxLayout *rowLayout = new QHBoxLayout; rowLayout->addWidget( m_le ); rowLayout->addWidget( toolBar ); layout->addWidget( m_lab, row,0 ); layout->addLayout( rowLayout, row,1,1,2 ); layout->addWidget( m_lb, row+1,1,1,2 ); row+=2; m_value = m_strList; connect(m_le, SIGNAL(returnPressed()), this, SLOT(addString()) ); connect(m_lb, SIGNAL(currentTextChanged(const QString &)), this, SLOT(selectText(const QString &))); connect( m_lab, SIGNAL(enter()), SLOT(help()) ); connect( m_lab, SIGNAL(reset()), SLOT(reset()) ); } void InputStrList::help() { showHelp(this); } void InputStrList::addString() { if (!m_le->text().isEmpty()) { m_lb->addItem(m_le->text()); m_strList.append(m_le->text()); m_value = m_strList; updateDefault(); emit changed(); m_le->clear(); } } void InputStrList::delString() { if (m_lb->currentRow()!=-1) { int itemIndex = m_lb->currentRow(); delete m_lb->currentItem(); m_strList.removeAt(itemIndex); m_value = m_strList; updateDefault(); emit changed(); } } void InputStrList::updateString() { if (m_lb->currentRow()!=-1 && !m_le->text().isEmpty()) { m_lb->currentItem()->setText(m_le->text()); m_strList.insert(m_lb->currentRow(),m_le->text()); m_strList.removeAt(m_lb->currentRow()+1); m_value = m_strList; updateDefault(); emit changed(); } } void InputStrList::selectText(const QString &s) { m_le->setText(s); } void InputStrList::setEnabled(bool state) { m_lab->setEnabled(state); m_le->setEnabled(state); m_add->setEnabled(state); m_del->setEnabled(state); m_upd->setEnabled(state); m_lb->setEnabled(state); if (m_brFile) m_brFile->setEnabled(state); if (m_brDir) m_brDir->setEnabled(state); updateDefault(); } void InputStrList::browseFiles() { QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QStringList fileNames = QFileDialog::getOpenFileNames(); if (!fileNames.isEmpty()) { QStringList::Iterator it; for ( it= fileNames.begin(); it != fileNames.end(); ++it ) { QString fileName; QDir dir(path); if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) { fileName = dir.relativeFilePath(*it); } if (fileName.isEmpty()) { fileName = *it; } m_lb->addItem(fileName); m_strList.append(fileName); m_value = m_strList; updateDefault(); emit changed(); } m_le->setText(m_strList[0]); } } void InputStrList::browseDir() { QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QString dirName = QFileDialog::getExistingDirectory(); if (!dirName.isNull()) { QDir dir(path); if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) { dirName = dir.relativeFilePath(dirName); } if (dirName.isEmpty()) { dirName=QString::fromLatin1("."); } m_lb->addItem(dirName); m_strList.append(dirName); m_value = m_strList; updateDefault(); emit changed(); m_le->setText(dirName); } } void InputStrList::setValue(const QStringList &sl) { m_le->clear(); m_lb->clear(); m_strList = sl; for (int i=0;i<m_strList.size();i++) { m_lb->addItem(m_strList[i].trimmed()); } updateDefault(); } QVariant &InputStrList::value() { return m_value; } void InputStrList::update() { setValue(m_value.toStringList()); } void InputStrList::updateDefault() { if (isDefault() || !m_lab->isEnabled()) { m_lab->setText(QString::fromLatin1("<qt>")+m_id+QString::fromLatin1("</qt>")); } else { m_lab->setText(QString::fromLatin1("<qt><font color='red'>")+m_id+QString::fromLatin1("</font></qt>")); } } void InputStrList::reset() { setValue(m_default); } void InputStrList::writeValue(QTextStream &t,TextCodecAdapter *codec) { bool first=true; foreach (QString s, m_strList) { if (!first) { t << " \\\n"; t << " "; } first=false; writeStringValue(t,codec,s); } } bool InputStrList::isDefault() { if (m_strList==m_default) return true; auto it1 = m_strList.begin(); auto it2 = m_default.begin(); while (it1!=m_strList.end() && (*it1).isEmpty()) { ++it1; } while (it2!=m_default.end() && (*it2).isEmpty()) { ++it2; } // both lists are empty if (it1==m_strList.end() && it2==m_default.end()) return true; // one list is empty but the other is not if (it1==m_strList.end()) return false; if (it2==m_default.end()) return false; it1 = m_strList.begin(); it2 = m_default.begin(); while (it1!=m_strList.end() && it2!=m_default.end()) { // skip over empty values while (it1!=m_strList.end() && (*it1).isEmpty()) { ++it1; } while (it2!=m_default.end() && (*it2).isEmpty()) { ++it2; } if ((it1!=m_strList.end()) && (it2!=m_default.end())) { if ((*it1).trimmed()!= (*it2).trimmed()) // difference so not the default { return false; } ++it1; ++it2; } else if ((it1!=m_strList.end()) || (it2!=m_default.end())) { // one list empty so cannot be the default return false; } } return true; } bool InputStrList::isEmpty() { foreach (QString s, m_strList) { if (!s.isEmpty()) return false; } return true; }
7,842
C++
.cpp
288
22.8125
107
0.616591
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,497
wizard.cpp
doxygen_doxygen/addon/doxywizard/wizard.cpp
/****************************************************************************** * * Copyright (C) 1997-2019 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. * */ #include "wizard.h" #include "input.h" #include "doxywizard.h" #include <math.h> #include <QGridLayout> #include <QImage> #include <QLabel> #include <QHBoxLayout> #include <QPushButton> #include <QPixmap> #include <QPainter> #include <QMouseEvent> #include <QLineEdit> #include <QCheckBox> #include <QFileInfo> #include <QFileDialog> #include <QButtonGroup> #include <QGroupBox> #include <QRadioButton> #include <QTreeWidget> #include <QStackedWidget> #include <qdrawutil.h> // options configurable via the wizard #define STR_PROJECT_NAME QString::fromLatin1("PROJECT_NAME") #define STR_PROJECT_LOGO QString::fromLatin1("PROJECT_LOGO") #define STR_PROJECT_BRIEF QString::fromLatin1("PROJECT_BRIEF") #define STR_INPUT QString::fromLatin1("INPUT") #define STR_OUTPUT_DIRECTORY QString::fromLatin1("OUTPUT_DIRECTORY") #define STR_PROJECT_NUMBER QString::fromLatin1("PROJECT_NUMBER") #define STR_RECURSIVE QString::fromLatin1("RECURSIVE") #define STR_OPTIMIZE_OUTPUT_FOR_C QString::fromLatin1("OPTIMIZE_OUTPUT_FOR_C") #define STR_OPTIMIZE_OUTPUT_JAVA QString::fromLatin1("OPTIMIZE_OUTPUT_JAVA") #define STR_OPTIMIZE_FOR_FORTRAN QString::fromLatin1("OPTIMIZE_FOR_FORTRAN") #define STR_OPTIMIZE_OUTPUT_VHDL QString::fromLatin1("OPTIMIZE_OUTPUT_VHDL") #define STR_OPTIMIZE_OUTPUT_SLICE QString::fromLatin1("OPTIMIZE_OUTPUT_SLICE") #define STR_CPP_CLI_SUPPORT QString::fromLatin1("CPP_CLI_SUPPORT") #define STR_HIDE_SCOPE_NAMES QString::fromLatin1("HIDE_SCOPE_NAMES") #define STR_EXTRACT_ALL QString::fromLatin1("EXTRACT_ALL") #define STR_SOURCE_BROWSER QString::fromLatin1("SOURCE_BROWSER") #define STR_GENERATE_HTML QString::fromLatin1("GENERATE_HTML") #define STR_GENERATE_LATEX QString::fromLatin1("GENERATE_LATEX") #define STR_GENERATE_MAN QString::fromLatin1("GENERATE_MAN") #define STR_GENERATE_RTF QString::fromLatin1("GENERATE_RTF") #define STR_GENERATE_XML QString::fromLatin1("GENERATE_XML") #define STR_GENERATE_DOCBOOK QString::fromLatin1("GENERATE_DOCBOOK") #define STR_GENERATE_HTMLHELP QString::fromLatin1("GENERATE_HTMLHELP") #define STR_GENERATE_TREEVIEW QString::fromLatin1("GENERATE_TREEVIEW") #define STR_USE_PDFLATEX QString::fromLatin1("USE_PDFLATEX") #define STR_PDF_HYPERLINKS QString::fromLatin1("PDF_HYPERLINKS") #define STR_SEARCHENGINE QString::fromLatin1("SEARCHENGINE") #define STR_HAVE_DOT QString::fromLatin1("HAVE_DOT") #define STR_CLASS_GRAPH QString::fromLatin1("CLASS_GRAPH") #define STR_COLLABORATION_GRAPH QString::fromLatin1("COLLABORATION_GRAPH") #define STR_GRAPHICAL_HIERARCHY QString::fromLatin1("GRAPHICAL_HIERARCHY") #define STR_INCLUDE_GRAPH QString::fromLatin1("INCLUDE_GRAPH") #define STR_INCLUDED_BY_GRAPH QString::fromLatin1("INCLUDED_BY_GRAPH") #define STR_CALL_GRAPH QString::fromLatin1("CALL_GRAPH") #define STR_CALLER_GRAPH QString::fromLatin1("CALLER_GRAPH") #define STR_HTML_COLORSTYLE_HUE QString::fromLatin1("HTML_COLORSTYLE_HUE") #define STR_HTML_COLORSTYLE_SAT QString::fromLatin1("HTML_COLORSTYLE_SAT") #define STR_HTML_COLORSTYLE_GAMMA QString::fromLatin1("HTML_COLORSTYLE_GAMMA") static bool g_optimizeMapping[7][7] = { // A: OPTIMIZE_OUTPUT_FOR_C // B: OPTIMIZE_OUTPUT_JAVA // C: OPTIMIZE_FOR_FORTRAN // D: OPTIMIZE_OUTPUT_VHDL // E: CPP_CLI_SUPPORT // F: HIDE_SCOPE_NAMES // G: OPTIMIZE_OUTPUT_SLICE // A B C D E F G { false,false,false,false,false,false,false }, // 0: C++ { false,false,false,false,true, false,false }, // 1: C++/CLI { false,true, false,false,false,false,false }, // 2: C#/Java { true, false,false,false,false,true, false }, // 3: C/PHP { false,false,true, false,false,false,false }, // 4: Fortran { false,false,false,true, false,false,false }, // 5: VHDL { false,false,false,false,false,false,true }, // 6: SLICE }; static QString g_optimizeOptionNames[7] = { STR_OPTIMIZE_OUTPUT_FOR_C, STR_OPTIMIZE_OUTPUT_JAVA, STR_OPTIMIZE_FOR_FORTRAN, STR_OPTIMIZE_OUTPUT_VHDL, STR_CPP_CLI_SUPPORT, STR_HIDE_SCOPE_NAMES, STR_OPTIMIZE_OUTPUT_SLICE }; //========================================================================== static bool stringVariantToBool(const QVariant &v) { QString s = v.toString().toLower(); return s==QString::fromLatin1("yes") || s==QString::fromLatin1("true") || s==QString::fromLatin1("1"); } static bool getBoolOption( const QHash<QString,Input*>&model,const QString &name) { Input *option = model[name]; Q_ASSERT(option!=nullptr); return stringVariantToBool(option->value()); } static int getIntOption( const QHash<QString,Input*>&model,const QString &name) { Input *option = model[name]; Q_ASSERT(option!=nullptr); return option->value().toInt(); } static QString getStringOption( const QHash<QString,Input*>&model,const QString &name) { Input *option = model[name]; Q_ASSERT(option!=nullptr); return option->value().toString(); } static void updateBoolOption( const QHash<QString,Input*>&model,const QString &name,bool bNew) { Input *option = model[name]; Q_ASSERT(option!=nullptr); bool bOld = stringVariantToBool(option->value()); if (bOld!=bNew) { option->value()=QString::fromLatin1(bNew ? "true" : "false"); option->update(); } } static void updateIntOption( const QHash<QString,Input*>&model,const QString &name,int iNew) { Input *option = model[name]; Q_ASSERT(option!=nullptr); int iOld = option->value().toInt(); if (iOld!=iNew) { option->value()=QString::fromLatin1("%1").arg(iNew); option->update(); } } static void updateStringOption( const QHash<QString,Input*>&model,const QString &name,const QString &s) { Input *option = model[name]; Q_ASSERT(option!=nullptr); if (option->value().toString()!=s) { option->value() = s; option->update(); } } //========================================================================== TuneColorDialog::TuneColorDialog(int hue,int sat,int gamma,QWidget *parent) : QDialog(parent) { setWindowTitle(tr("Tune the color of the HTML output")); QGridLayout *layout = new QGridLayout(this); m_image = new QImage(QString::fromLatin1(":/images/tunecolor.png")); m_imageLab = new QLabel; updateImage(hue,sat,gamma); layout->addWidget(new QLabel(tr("Example output: use the sliders on the right to adjust the color")),0,0); layout->addWidget(m_imageLab,1,0); QHBoxLayout *buttonsLayout = new QHBoxLayout; QPushButton *okButton = new QPushButton(tr("Ok")); connect(okButton,SIGNAL(clicked()),SLOT(accept())); okButton->setDefault(true); QPushButton *cancelButton = new QPushButton(tr("Cancel")); connect(cancelButton,SIGNAL(clicked()),SLOT(reject())); ColorPicker *huePicker = new ColorPicker(ColorPicker::Hue); huePicker->setCol(hue,sat,gamma); huePicker->setFixedWidth(20); layout->addWidget(huePicker,1,1); ColorPicker *satPicker = new ColorPicker(ColorPicker::Saturation); satPicker->setCol(hue,sat,gamma); satPicker->setFixedWidth(20); layout->addWidget(satPicker,1,2); ColorPicker *gamPicker = new ColorPicker(ColorPicker::Gamma); gamPicker->setCol(hue,sat,gamma); gamPicker->setFixedWidth(20); layout->addWidget(gamPicker,1,3); connect(huePicker,SIGNAL(newHsv(int,int,int)),satPicker,SLOT(setCol(int,int,int))); connect(satPicker,SIGNAL(newHsv(int,int,int)),huePicker,SLOT(setCol(int,int,int))); connect(huePicker,SIGNAL(newHsv(int,int,int)),gamPicker,SLOT(setCol(int,int,int))); connect(satPicker,SIGNAL(newHsv(int,int,int)),gamPicker,SLOT(setCol(int,int,int))); connect(gamPicker,SIGNAL(newHsv(int,int,int)),satPicker,SLOT(setCol(int,int,int))); connect(gamPicker,SIGNAL(newHsv(int,int,int)),huePicker,SLOT(setCol(int,int,int))); connect(huePicker,SIGNAL(newHsv(int,int,int)),this,SLOT(updateImage(int,int,int))); connect(satPicker,SIGNAL(newHsv(int,int,int)),this,SLOT(updateImage(int,int,int))); connect(gamPicker,SIGNAL(newHsv(int,int,int)),this,SLOT(updateImage(int,int,int))); buttonsLayout->addStretch(); buttonsLayout->addWidget(okButton); buttonsLayout->addWidget(cancelButton); layout->addLayout(buttonsLayout,5,0,1,4); } void hsl2rgb(double h,double s,double l, double *pRed,double *pGreen,double *pBlue) { double v; double r,g,b; r = l; // default to gray g = l; b = l; v = (l <= 0.5) ? (l * (1.0 + s)) : (l + s - l * s); if (v > 0) { double m; double sv; int sextant; double fract, vsf, mid1, mid2; m = l + l - v; sv = (v - m ) / v; h *= 6.0; sextant = (int)h; fract = h - sextant; vsf = v * sv * fract; mid1 = m + vsf; mid2 = v - vsf; switch (sextant) { case 0: r = v; g = mid1; b = m; break; case 1: r = mid2; g = v; b = m; break; case 2: r = m; g = v; b = mid1; break; case 3: r = m; g = mid2; b = v; break; case 4: r = mid1; g = m; b = v; break; case 5: r = v; g = m; b = mid2; break; } } *pRed = r; *pGreen = g; *pBlue = b; } void TuneColorDialog::updateImage(int hue,int sat,int gam) { QImage coloredImg(m_image->width(),m_image->height(),QImage::Format_RGB32); uint *srcPixel = (uint *)m_image->scanLine(0); uint *dstPixel = (uint *)coloredImg.scanLine(0); uint nrPixels = coloredImg.width()*coloredImg.height(); for (uint i=0;i<nrPixels;i++,srcPixel++,dstPixel++) { QColor c = QColor::fromRgb(*srcPixel); double r,g,b; hsl2rgb(hue/359.0, sat/255.0, pow(c.green()/255.0,gam/100.0),&r,&g,&b); *dstPixel = qRgb((int)(r*255.0),(int)(g*255.0),(int)(b*255.0)); } m_imageLab->setPixmap(QPixmap::fromImage(coloredImg)); m_hue = hue; m_sat = sat; m_gam = gam; } int TuneColorDialog::getHue() const { return m_hue; } int TuneColorDialog::getSaturation() const { return m_sat; } int TuneColorDialog::getGamma() const { return m_gam; } //========================================================================== ColorPicker::ColorPicker(Mode m) { m_hue = 220; m_gam = 100; m_sat = 100; m_mode = m; m_pix = nullptr; } ColorPicker::~ColorPicker() { delete m_pix; } void ColorPicker::paintEvent(QPaintEvent*) { int w = width() - 5; QRect r(0, foff, w, height() - 2*foff); int wi = r.width() - 2; int hi = r.height() - 2; if (!m_pix || m_pix->height() != hi || m_pix->width() != wi) { delete m_pix; QImage img(wi, hi, QImage::Format_RGB32); int y; uint *pixel = (uint *) img.scanLine(0); for (y = 0; y < hi; y++) { const uint *end = pixel + wi; int yh = y2hue(y+coff); int ys = y2sat(y+coff); int yg = y2gam(y+coff); while (pixel < end) { QColor c; c.setHsv(yh, ys, (int)(255*pow(0.7,yg/100.0))); *pixel = c.rgb(); ++pixel; } } m_pix = new QPixmap(QPixmap::fromImage(img)); } QPainter p(this); p.drawPixmap(1, coff, *m_pix); const QPalette &g = palette(); qDrawShadePanel(&p, r, g, true); p.setPen(g.windowText().color()); p.setBrush(g.windowText()); QPolygon a; int y = m_mode==Hue ? hue2y(m_hue) : m_mode==Saturation ? sat2y(m_sat) : gam2y(m_gam); a.setPoints(3, w, y, w+5, y+5, w+5, y-5); p.eraseRect(w, 0, 5, height()); p.drawPolygon(a); } void ColorPicker::mouseMoveEvent(QMouseEvent *m) { if (m_mode==Hue) setHue(y2hue(getMouseYPositionFromEvent(m))); else if (m_mode==Saturation) setSat(y2sat(getMouseYPositionFromEvent(m))); else setGam(y2gam(getMouseYPositionFromEvent(m))); } void ColorPicker::mousePressEvent(QMouseEvent *m) { if (m_mode==Hue) setHue(y2hue(getMouseYPositionFromEvent(m))); else if (m_mode==Saturation) setSat(y2sat(getMouseYPositionFromEvent(m))); else setGam(y2gam(getMouseYPositionFromEvent(m))); } void ColorPicker::setHue(int h) { if (h==m_hue) return; m_hue = qMax(0,qMin(h,359)); delete m_pix; m_pix=nullptr; repaint(); emit newHsv(m_hue,m_sat,m_gam); } void ColorPicker::setSat(int s) { if (s==m_sat) return; m_sat = qMax(0,qMin(s,255)); delete m_pix; m_pix=nullptr; repaint(); emit newHsv(m_hue,m_sat,m_gam); } void ColorPicker::setGam(int g) { if (g==m_gam) return; m_gam = qMax(40,qMin(g,240)); delete m_pix; m_pix=nullptr; repaint(); emit newHsv(m_hue,m_sat,m_gam); } void ColorPicker::setCol(int h, int s, int g) { if (m_hue!=h || m_sat!=s || m_gam!=g) { m_hue = h; m_sat = s; m_gam = g; delete m_pix; m_pix=nullptr; repaint(); } } int ColorPicker::y2hue(int y) { int d = height() - 2*coff - 1; return m_mode==Hue ? (y - coff)*359/d : m_hue; } int ColorPicker::hue2y(int v) { int d = height() - 2*coff - 1; return coff + v*d/359; } int ColorPicker::y2sat(int y) { int d = height() - 2*coff - 1; return m_mode==Saturation ? 255 - (y - coff)*255/d : m_sat; } int ColorPicker::sat2y(int v) { int d = height() - 2*coff - 1; return coff + (255-v)*d/255; } int ColorPicker::y2gam(int y) { int d = height() - 2*coff - 1; return m_mode==Gamma ? 240 - (y - coff)*200/d : m_gam; } int ColorPicker::gam2y(int g) { int d = height() - 2*coff - 1; return coff + (240-g)*d/200; } //========================================================================== Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData) { QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(4,4,4,4); layout->setSpacing(8); QLabel *l = new QLabel(this); l->setText(tr("Provide some information " "about the project you are documenting")); layout->addWidget(l); QWidget *w = new QWidget( this ); QGridLayout *grid = new QGridLayout(w); grid->setSpacing(10); // project name QLabel *projName = new QLabel(this); projName->setText(tr("Project name:")); projName->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // project brief QLabel *projBrief = new QLabel(this); projBrief->setText(tr("Project synopsis:")); projBrief->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // project version QLabel *projVersion = new QLabel(this); projVersion->setText(tr("Project version or id:")); projVersion->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // project icon QLabel *projLogo = new QLabel(this); projLogo->setMinimumSize(1,55); projLogo->setText(tr("Project logo:")); projLogo->setAlignment(Qt::AlignRight|Qt::AlignVCenter); grid->addWidget(projName,0,0); grid->addWidget(projBrief,1,0); grid->addWidget(projVersion,2,0); grid->addWidget(projLogo,3,0); m_projName = new QLineEdit; m_projBrief = new QLineEdit; m_projNumber = new QLineEdit; QPushButton *projIconSel = new QPushButton(this); projIconSel->setText(tr("Select...")); m_projIconLab = new QLabel; grid->addWidget(m_projName,0,1,1,2); grid->addWidget(m_projBrief,1,1,1,2); grid->addWidget(m_projNumber,2,1,1,2); grid->addWidget(projIconSel,3,1); grid->addWidget(m_projIconLab,3,2); grid->setColumnStretch(2,1); w->setLayout(grid); layout->addWidget(w); //--------------------------------------------------- QFrame *f = new QFrame( this ); f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); layout->addWidget(f); l = new QLabel(this); l->setText(tr("Specify the directory to scan for source code")); layout->addWidget(l); QWidget *row = new QWidget; QHBoxLayout *rowLayout = new QHBoxLayout(row); rowLayout->setSpacing(10); l = new QLabel(this); l->setText(tr("Source code directory:")); rowLayout->addWidget(l); m_sourceDir = new QLineEdit; m_srcSelectDir = new QPushButton(this); m_srcSelectDir->setText(tr("Select...")); rowLayout->addWidget(m_sourceDir); rowLayout->addWidget(m_srcSelectDir); layout->addWidget(row); m_recursive = new QCheckBox(this); m_recursive->setText(tr("Scan recursively")); m_recursive->setChecked(true); layout->addWidget(m_recursive); //--------------------------------------------------- f = new QFrame( this ); f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); layout->addWidget(f); l = new QLabel(this); l->setText(tr("Specify the directory where doxygen should " "put the generated documentation")); layout->addWidget(l); row = new QWidget; rowLayout = new QHBoxLayout(row); rowLayout->setSpacing(10); l = new QLabel(this); l->setText(tr("Destination directory:")); rowLayout->addWidget(l); m_destDir = new QLineEdit; m_dstSelectDir = new QPushButton(this); m_dstSelectDir->setText(tr("Select...")); rowLayout->addWidget(m_destDir); rowLayout->addWidget(m_dstSelectDir); layout->addWidget(row); layout->addStretch(1); setLayout(layout); connect(projIconSel,SIGNAL(clicked()), this,SLOT(selectProjectIcon())); connect(m_srcSelectDir,SIGNAL(clicked()), this,SLOT(selectSourceDir())); connect(m_dstSelectDir,SIGNAL(clicked()), this,SLOT(selectDestinationDir())); connect(m_projName,SIGNAL(textChanged(const QString &)),SLOT(setProjectName(const QString &))); connect(m_projBrief,SIGNAL(textChanged(const QString &)),SLOT(setProjectBrief(const QString &))); connect(m_projNumber,SIGNAL(textChanged(const QString &)),SLOT(setProjectNumber(const QString &))); connect(m_sourceDir,SIGNAL(textChanged(const QString &)),SLOT(setSourceDir(const QString &))); connect(m_recursive,SIGNAL(stateChanged(int)),SLOT(setRecursiveScan(int))); connect(m_destDir,SIGNAL(textChanged(const QString &)),SLOT(setDestinationDir(const QString &))); } void Step1::selectProjectIcon() { QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QString iconName = QFileDialog::getOpenFileName(this, tr("Select project icon/image"),path); if (iconName.isEmpty()) { m_projIconLab->setText(tr("No Project logo selected.")); } else { QFile Fout(iconName); if(!Fout.exists()) { m_projIconLab->setText(tr("Sorry, cannot find file(")+iconName+QString::fromLatin1(");")); } else { QPixmap pm(iconName); if (!pm.isNull()) { m_projIconLab->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation)); } else { m_projIconLab->setText(tr("Sorry, no preview available (")+iconName+QString::fromLatin1(");")); } } } updateStringOption(m_modelData,STR_PROJECT_LOGO,iconName); } void Step1::selectSourceDir() { QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QString dirName = QFileDialog::getExistingDirectory(this, tr("Select source directory"),path); QDir dir(path); if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) { dirName = dir.relativeFilePath(dirName); } if (dirName.isEmpty()) { dirName=QString::fromLatin1("."); } m_sourceDir->setText(dirName); } void Step1::selectDestinationDir() { QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QString dirName = QFileDialog::getExistingDirectory(this, tr("Select destination directory"),path); QDir dir(path); if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) { dirName = dir.relativeFilePath(dirName); } if (dirName.isEmpty()) { dirName=QString::fromLatin1("."); } m_destDir->setText(dirName); } void Step1::setProjectName(const QString &name) { updateStringOption(m_modelData,STR_PROJECT_NAME,name); } void Step1::setProjectBrief(const QString &desc) { updateStringOption(m_modelData,STR_PROJECT_BRIEF,desc); } void Step1::setProjectNumber(const QString &num) { updateStringOption(m_modelData,STR_PROJECT_NUMBER,num); } void Step1::setSourceDir(const QString &dir) { Input *option = m_modelData[STR_INPUT]; if (option->value().toStringList().count()>0) { QStringList sl = option->value().toStringList(); if (sl[0]!=dir) { sl[0] = dir; option->value() = sl; option->update(); } } else { option->value() = QStringList() << dir; option->update(); } } void Step1::setDestinationDir(const QString &dir) { updateStringOption(m_modelData,STR_OUTPUT_DIRECTORY,dir); } void Step1::setRecursiveScan(int s) { updateBoolOption(m_modelData,STR_RECURSIVE,s==Qt::Checked); } void Step1::init() { Input *option; m_projName->setText(getStringOption(m_modelData,STR_PROJECT_NAME)); m_projBrief->setText(getStringOption(m_modelData,STR_PROJECT_BRIEF)); m_projNumber->setText(getStringOption(m_modelData,STR_PROJECT_NUMBER)); QString iconName = getStringOption(m_modelData,STR_PROJECT_LOGO); if (!iconName.isEmpty()) { QFile Fout(iconName); if(!Fout.exists()) { m_projIconLab->setText(tr("Sorry, cannot find file(")+iconName+QString::fromLatin1(");")); } else { QPixmap pm(iconName); if (!pm.isNull()) { m_projIconLab->setPixmap(pm.scaledToHeight(55,Qt::SmoothTransformation)); } else { m_projIconLab->setText(tr("Sorry, no preview available (")+iconName+QString::fromLatin1(");")); } } } else { m_projIconLab->setText(tr("No Project logo selected.")); } option = m_modelData[STR_INPUT]; if (option->value().toStringList().count()>0) { m_sourceDir->setText(option->value().toStringList().first()); } m_recursive->setChecked( getBoolOption(m_modelData,STR_RECURSIVE) ? Qt::Checked : Qt::Unchecked); m_destDir->setText(getStringOption(m_modelData,STR_OUTPUT_DIRECTORY)); } //========================================================================== Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData) { QRadioButton *r; QVBoxLayout *layout = new QVBoxLayout(this); //--------------------------------------------------- m_extractModeGroup = new QButtonGroup(this); m_extractMode = new QGroupBox(this); m_extractMode->setTitle(tr("Select the desired extraction mode:")); QGridLayout *gbox = new QGridLayout( m_extractMode ); r = new QRadioButton(tr("Documented entities only")); r->setChecked(true); m_extractModeGroup->addButton(r, 0); gbox->addWidget(r,1,0); // 1 -> EXTRACT_ALL = NO r = new QRadioButton(tr("All Entities")); m_extractModeGroup->addButton(r, 1); gbox->addWidget(r,2,0); // 2 -> EXTRACT_ALL = YES m_crossRef = new QCheckBox(m_extractMode); m_crossRef->setText(tr("Include cross-referenced source code in the output")); // m_crossRef -> SOURCE_BROWSER = YES/NO gbox->addWidget(m_crossRef,3,0); layout->addWidget(m_extractMode); //--------------------------------------------------- QFrame *f = new QFrame( this ); f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); layout->addWidget(f); m_optimizeLangGroup = new QButtonGroup(this); m_optimizeLang = new QGroupBox(this); m_optimizeLang->setTitle(tr("Select programming language to optimize the results for")); gbox = new QGridLayout( m_optimizeLang ); r = new QRadioButton(m_optimizeLang); r->setText(tr("Optimize for C++ output")); r->setChecked(true); m_optimizeLangGroup->addButton(r, 0); // 0 -> OPTIMIZE_OUTPUT_FOR_C = NO // OPTIMIZE_OUTPUT_JAVA = NO // OPTIMIZE_FOR_FORTRAN = NO // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,0,0); r = new QRadioButton(tr("Optimize for C++/CLI output")); gbox->addWidget(r,1,0); m_optimizeLangGroup->addButton(r, 1); // 1 -> OPTIMIZE_OUTPUT_FOR_C = NO // OPTIMIZE_OUTPUT_JAVA = NO // OPTIMIZE_FOR_FORTRAN = NO // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = YES // HIDE_SCOPE_NAMES = NO // OPTIMIZE_OUTPUT_SLICE = NO r = new QRadioButton(tr("Optimize for Java or C# output")); m_optimizeLangGroup->addButton(r, 2); // 2 -> OPTIMIZE_OUTPUT_FOR_C = NO // OPTIMIZE_OUTPUT_JAVA = YES // OPTIMIZE_FOR_FORTRAN = NO // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,2,0); r = new QRadioButton(tr("Optimize for C or PHP output")); m_optimizeLangGroup->addButton(r, 3); // 3 -> OPTIMIZE_OUTPUT_FOR_C = YES // OPTIMIZE_OUTPUT_JAVA = NO // OPTIMIZE_FOR_FORTRAN = NO // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = YES // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,3,0); r = new QRadioButton(tr("Optimize for Fortran output")); m_optimizeLangGroup->addButton(r, 4); // 4 -> OPTIMIZE_OUTPUT_FOR_C = NO // OPTIMIZE_OUTPUT_JAVA = NO // OPTIMIZE_FOR_FORTRAN = YES // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,4,0); r = new QRadioButton(tr("Optimize for VHDL output")); m_optimizeLangGroup->addButton(r, 5); // 5 -> OPTIMIZE_OUTPUT_FOR_C = NO // OPTIMIZE_OUTPUT_JAVA = NO // OPTIMIZE_FOR_FORTRAN = NO // OPTIMIZE_OUTPUT_VHDL = YES // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,5,0); r = new QRadioButton(tr("Optimize for SLICE output")); m_optimizeLangGroup->addButton(r, 6); // 5 -> OPTIMIZE_OUTPUT_FOR_C = NO // OPTIMIZE_OUTPUT_JAVA = NO // OPTIMIZE_FOR_FORTRAN = NO // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO // OPTIMIZE_OUTPUT_SLICE = YES gbox->addWidget(r,6,0); layout->addWidget(m_optimizeLang); layout->addStretch(1); connect(m_crossRef,SIGNAL(stateChanged(int)), SLOT(changeCrossRefState(int))); #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) connect(m_optimizeLangGroup,SIGNAL(buttonClicked(int)), SLOT(optimizeFor(int))); connect(m_extractModeGroup,SIGNAL(buttonClicked(int)), SLOT(extractMode(int))); #else connect(m_optimizeLangGroup,SIGNAL(idClicked(int)), SLOT(optimizeFor(int))); connect(m_extractModeGroup,SIGNAL(idClicked(int)), SLOT(extractMode(int))); #endif } void Step2::optimizeFor(int choice) { for (int i=0;i<7;i++) { updateBoolOption(m_modelData, g_optimizeOptionNames[i], g_optimizeMapping[choice][i]); } } void Step2::extractMode(int choice) { updateBoolOption(m_modelData,STR_EXTRACT_ALL,choice==1); } void Step2::changeCrossRefState(int choice) { updateBoolOption(m_modelData,STR_SOURCE_BROWSER,choice==Qt::Checked); } void Step2::init() { m_extractModeGroup->button( getBoolOption(m_modelData,STR_EXTRACT_ALL) ? 1 : 0)->setChecked(true); m_crossRef->setChecked(getBoolOption(m_modelData,STR_SOURCE_BROWSER)); int x=0; if (getBoolOption(m_modelData,STR_CPP_CLI_SUPPORT)) x=1; else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_JAVA)) x=2; else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_FOR_C)) x=3; else if (getBoolOption(m_modelData,STR_OPTIMIZE_FOR_FORTRAN)) x=4; else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_VHDL)) x=5; else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_SLICE)) x=6; m_optimizeLangGroup->button(x)->setChecked(true); } //========================================================================== Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData) { QVBoxLayout *vbox = nullptr; QRadioButton *r = nullptr; QGridLayout *gbox = new QGridLayout( this ); gbox->addWidget(new QLabel(tr("Select the output format(s) to generate")),0,0); { m_htmlOptions = new QGroupBox(tr("HTML")); m_htmlOptions->setCheckable(true); // GENERATE_HTML m_htmlOptionsGroup = new QButtonGroup(m_htmlOptions); QRadioButton *r = new QRadioButton(tr("plain HTML")); r->setChecked(true); m_htmlOptionsGroup->addButton(r, 0); vbox = new QVBoxLayout; vbox->addWidget(r); r = new QRadioButton(tr("with navigation panel")); m_htmlOptionsGroup->addButton(r, 1); // GENERATE_TREEVIEW vbox->addWidget(r); r = new QRadioButton(tr("prepare for compressed HTML (.chm)")); m_htmlOptionsGroup->addButton(r, 2); // GENERATE_HTMLHELP vbox->addWidget(r); m_searchEnabled=new QCheckBox(tr("With search function")); vbox->addWidget(m_searchEnabled); // SEARCH_ENGINE QHBoxLayout *hbox = new QHBoxLayout; m_tuneColor=new QPushButton(tr("Change color...")); hbox->addWidget(m_tuneColor); hbox->addStretch(1); vbox->addLayout(hbox); m_htmlOptions->setLayout(vbox); m_htmlOptions->setChecked(true); } gbox->addWidget(m_htmlOptions,1,0); { m_texOptions = new QGroupBox(tr("LaTeX")); m_texOptions->setCheckable(true); // GENERATE_LATEX m_texOptionsGroup = new QButtonGroup(m_texOptions); vbox = new QVBoxLayout; r = new QRadioButton(tr("as intermediate format for hyperlinked PDF")); m_texOptionsGroup->addButton(r, 0); // PDF_HYPERLINKS = YES r->setChecked(true); vbox->addWidget(r); r = new QRadioButton(tr("as intermediate format for PDF")); m_texOptionsGroup->addButton(r, 1); // PDF_HYPERLINKS = NO, USE_PDFLATEX = YES vbox->addWidget(r); r = new QRadioButton(tr("as intermediate format for PostScript")); m_texOptionsGroup->addButton(r, 2); // USE_PDFLATEX = NO vbox->addWidget(r); vbox->addStretch(1); m_texOptions->setLayout(vbox); m_texOptions->setChecked(true); } gbox->addWidget(m_texOptions,2,0); m_manEnabled=new QCheckBox(tr("Man pages")); // GENERATE_MAN m_rtfEnabled=new QCheckBox(tr("Rich Text Format (RTF)")); // GENERATE_RTF m_xmlEnabled=new QCheckBox(tr("XML")); // GENERATE_XML m_docbookEnabled=new QCheckBox(tr("Docbook")); // GENERATE_DOCBOOK gbox->addWidget(m_manEnabled,3,0); gbox->addWidget(m_rtfEnabled,4,0); gbox->addWidget(m_xmlEnabled,5,0); gbox->addWidget(m_docbookEnabled,6,0); gbox->setRowStretch(7,1); connect(m_htmlOptions,SIGNAL(toggled(bool)),SLOT(setHtmlEnabled(bool))); connect(m_texOptions,SIGNAL(toggled(bool)),SLOT(setLatexEnabled(bool))); connect(m_manEnabled,SIGNAL(stateChanged(int)),SLOT(setManEnabled(int))); connect(m_rtfEnabled,SIGNAL(stateChanged(int)),SLOT(setRtfEnabled(int))); connect(m_xmlEnabled,SIGNAL(stateChanged(int)),SLOT(setXmlEnabled(int))); connect(m_docbookEnabled,SIGNAL(stateChanged(int)),SLOT(setDocbookEnabled(int))); connect(m_searchEnabled,SIGNAL(stateChanged(int)),SLOT(setSearchEnabled(int))); #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) connect(m_htmlOptionsGroup,SIGNAL(buttonClicked(int)),SLOT(setHtmlOptions(int))); connect(m_texOptionsGroup,SIGNAL(buttonClicked(int)),SLOT(setLatexOptions(int))); #else connect(m_htmlOptionsGroup,SIGNAL(idClicked(int)),SLOT(setHtmlOptions(int))); connect(m_texOptionsGroup,SIGNAL(idClicked(int)),SLOT(setLatexOptions(int))); #endif connect(m_tuneColor,SIGNAL(clicked()),SLOT(tuneColorDialog())); } void Step3::tuneColorDialog() { int hue = getIntOption(m_modelData,STR_HTML_COLORSTYLE_HUE); int sat = getIntOption(m_modelData,STR_HTML_COLORSTYLE_SAT); int gam = getIntOption(m_modelData,STR_HTML_COLORSTYLE_GAMMA); TuneColorDialog tuneColor(hue,sat,gam,this); if (tuneColor.exec()==QDialog::Accepted) { updateIntOption(m_modelData,STR_HTML_COLORSTYLE_HUE,tuneColor.getHue()); updateIntOption(m_modelData,STR_HTML_COLORSTYLE_SAT,tuneColor.getSaturation()); updateIntOption(m_modelData,STR_HTML_COLORSTYLE_GAMMA,tuneColor.getGamma()); } } void Step3::setHtmlEnabled(bool b) { updateBoolOption(m_modelData,STR_GENERATE_HTML,b); } void Step3::setLatexEnabled(bool b) { updateBoolOption(m_modelData,STR_GENERATE_LATEX,b); } void Step3::setManEnabled(int state) { updateBoolOption(m_modelData,STR_GENERATE_MAN,state==Qt::Checked); } void Step3::setRtfEnabled(int state) { updateBoolOption(m_modelData,STR_GENERATE_RTF,state==Qt::Checked); } void Step3::setXmlEnabled(int state) { updateBoolOption(m_modelData,STR_GENERATE_XML,state==Qt::Checked); } void Step3::setDocbookEnabled(int state) { updateBoolOption(m_modelData,STR_GENERATE_DOCBOOK,state==Qt::Checked); } void Step3::setSearchEnabled(int state) { updateBoolOption(m_modelData,STR_SEARCHENGINE,state==Qt::Checked); } void Step3::setHtmlOptions(int id) { if (id==0) // plain HTML { updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,false); updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,false); } else if (id==1) // with navigation tree { updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,false); updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,true); } else if (id==2) // with compiled help { updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,true); updateBoolOption(m_modelData,STR_GENERATE_TREEVIEW,false); } } void Step3::setLatexOptions(int id) { if (id==0) // hyperlinked PDF { updateBoolOption(m_modelData,STR_USE_PDFLATEX,true); updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,true); } else if (id==1) // PDF { updateBoolOption(m_modelData,STR_USE_PDFLATEX,true); updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,false); } else if (id==2) // PostScript { updateBoolOption(m_modelData,STR_USE_PDFLATEX,false); updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,false); } } void Step3::init() { m_htmlOptions->setChecked(getBoolOption(m_modelData,STR_GENERATE_HTML)); m_texOptions->setChecked(getBoolOption(m_modelData,STR_GENERATE_LATEX)); m_manEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_MAN)); m_rtfEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_RTF)); m_xmlEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_XML)); m_docbookEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_DOCBOOK)); m_searchEnabled->setChecked(getBoolOption(m_modelData,STR_SEARCHENGINE)); if (getBoolOption(m_modelData,STR_GENERATE_HTMLHELP)) { m_htmlOptionsGroup->button(2)->setChecked(true); // compiled help } else if (getBoolOption(m_modelData,STR_GENERATE_TREEVIEW)) { m_htmlOptionsGroup->button(1)->setChecked(true); // navigation tree } else { m_htmlOptionsGroup->button(0)->setChecked(true); // plain HTML } if (!getBoolOption(m_modelData,STR_USE_PDFLATEX)) { m_texOptionsGroup->button(2)->setChecked(true); // PostScript } else if (!getBoolOption(m_modelData,STR_PDF_HYPERLINKS)) { m_texOptionsGroup->button(1)->setChecked(true); // Plain PDF } else { m_texOptionsGroup->button(0)->setChecked(true); // PDF with hyperlinks } } //========================================================================== Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData) { m_diagramModeGroup = new QButtonGroup(this); QGridLayout *gbox = new QGridLayout( this ); gbox->addWidget(new QLabel(tr("Diagrams to generate")),0,0); // CLASS_GRAPH = NO, HAVE_DOT = NO QRadioButton *rb = new QRadioButton(tr("No diagrams")); m_diagramModeGroup->addButton(rb, 0); gbox->addWidget(rb,1,0); rb->setChecked(true); // CLASS_GRAPH = TEXT, HAVE_DOT = NO rb = new QRadioButton(tr("Text only")); m_diagramModeGroup->addButton(rb, 1); gbox->addWidget(rb,2,0); // CLASS_GRAPH = YES/GRAPH, HAVE_DOT = NO rb = new QRadioButton(tr("Use built-in class diagram generator")); m_diagramModeGroup->addButton(rb, 2); gbox->addWidget(rb,3,0); // CLASS_GRAPH = YES/GRAPH, HAVE_DOT = YES rb = new QRadioButton(tr("Use dot tool from the GraphViz package")); m_diagramModeGroup->addButton(rb, 3); gbox->addWidget(rb,4,0); m_dotGroup = new QGroupBox(tr("Dot graphs to generate")); QVBoxLayout *vbox = new QVBoxLayout; m_dotClass=new QCheckBox(tr("Class graphs")); // CLASS_GRAPH m_dotCollaboration=new QCheckBox(tr("Collaboration diagrams")); // COLLABORATION_GRAPH m_dotInheritance=new QCheckBox(tr("Overall Class hierarchy")); // GRAPHICAL_HIERARCHY m_dotInclude=new QCheckBox(tr("Include dependency graphs")); // INCLUDE_GRAPH m_dotIncludedBy=new QCheckBox(tr("Included by dependency graphs")); // INCLUDED_BY_GRAPH m_dotCall=new QCheckBox(tr("Call graphs")); // CALL_GRAPH m_dotCaller=new QCheckBox(tr("Called by graphs")); // CALLER_GRAPH vbox->addWidget(m_dotClass); vbox->addWidget(m_dotCollaboration); vbox->addWidget(m_dotInheritance); vbox->addWidget(m_dotInclude); vbox->addWidget(m_dotIncludedBy); vbox->addWidget(m_dotCall); vbox->addWidget(m_dotCaller); vbox->addStretch(1); m_dotGroup->setLayout(vbox); m_dotClass->setChecked(true); m_dotGroup->setEnabled(false); gbox->addWidget(m_dotGroup,5,0); m_dotInclude->setChecked(true); m_dotCollaboration->setChecked(true); gbox->setRowStretch(6,1); #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) connect(m_diagramModeGroup,SIGNAL(buttonClicked(int)), this,SLOT(diagramModeChanged(int))); #else connect(m_diagramModeGroup,SIGNAL(idClicked(int)), this,SLOT(diagramModeChanged(int))); #endif connect(m_dotClass,SIGNAL(stateChanged(int)), this,SLOT(setClassGraphEnabled(int))); connect(m_dotCollaboration,SIGNAL(stateChanged(int)), this,SLOT(setCollaborationGraphEnabled(int))); connect(m_dotInheritance,SIGNAL(stateChanged(int)), this,SLOT(setGraphicalHierarchyEnabled(int))); connect(m_dotInclude,SIGNAL(stateChanged(int)), this,SLOT(setIncludeGraphEnabled(int))); connect(m_dotIncludedBy,SIGNAL(stateChanged(int)), this,SLOT(setIncludedByGraphEnabled(int))); connect(m_dotCall,SIGNAL(stateChanged(int)), this,SLOT(setCallGraphEnabled(int))); connect(m_dotCaller,SIGNAL(stateChanged(int)), this,SLOT(setCallerGraphEnabled(int))); } void Step4::diagramModeChanged(int id) { if (id==0) // no diagrams { updateBoolOption(m_modelData,STR_HAVE_DOT,false); updateStringOption(m_modelData,STR_CLASS_GRAPH, QString::fromLatin1("NO")); } else if (id==1) // text only { updateBoolOption(m_modelData,STR_HAVE_DOT,false); updateStringOption(m_modelData,STR_CLASS_GRAPH, QString::fromLatin1("TEXT")); } else if (id==2) // builtin diagrams { updateBoolOption(m_modelData,STR_HAVE_DOT,false); updateStringOption(m_modelData,STR_CLASS_GRAPH, QString::fromLatin1("YES")); } else if (id==3) // dot diagrams { updateBoolOption(m_modelData,STR_HAVE_DOT,true); updateStringOption(m_modelData,STR_CLASS_GRAPH, QString::fromLatin1("YES")); } m_dotGroup->setEnabled(id==3); } void Step4::setClassGraphEnabled(int state) { QString classGraph = getStringOption(m_modelData,STR_CLASS_GRAPH); if (state==Qt::Checked) { updateStringOption(m_modelData,STR_CLASS_GRAPH,QString::fromLatin1("YES")); } else if (classGraph==QString::fromLatin1("YES") || classGraph==QString::fromLatin1("GRAPH")) { updateStringOption(m_modelData,STR_CLASS_GRAPH,QString::fromLatin1("NO")); } } void Step4::setCollaborationGraphEnabled(int state) { updateBoolOption(m_modelData,STR_COLLABORATION_GRAPH,state==Qt::Checked); } void Step4::setGraphicalHierarchyEnabled(int state) { updateBoolOption(m_modelData,STR_GRAPHICAL_HIERARCHY,state==Qt::Checked); } void Step4::setIncludeGraphEnabled(int state) { updateBoolOption(m_modelData,STR_INCLUDE_GRAPH,state==Qt::Checked); } void Step4::setIncludedByGraphEnabled(int state) { updateBoolOption(m_modelData,STR_INCLUDED_BY_GRAPH,state==Qt::Checked); } void Step4::setCallGraphEnabled(int state) { updateBoolOption(m_modelData,STR_CALL_GRAPH,state==Qt::Checked); } void Step4::setCallerGraphEnabled(int state) { updateBoolOption(m_modelData,STR_CALLER_GRAPH,state==Qt::Checked); } void Step4::init() { int id = 0; QString classGraph = getStringOption(m_modelData,STR_CLASS_GRAPH).toLower(); if (classGraph==QString::fromLatin1("yes") || classGraph==QString::fromLatin1("graph")) { id = getBoolOption(m_modelData,STR_HAVE_DOT) ? 3 : 2; } else if (classGraph==QString::fromLatin1("text")) { id = 1; } else { id = 0; } m_diagramModeGroup->button(id)->setChecked(true); // no diagrams m_dotGroup->setEnabled(id==3); m_dotClass->setChecked(getBoolOption(m_modelData,STR_CLASS_GRAPH)); m_dotCollaboration->setChecked(getBoolOption(m_modelData,STR_COLLABORATION_GRAPH)); m_dotInheritance->setChecked(getBoolOption(m_modelData,STR_GRAPHICAL_HIERARCHY)); m_dotInclude->setChecked(getBoolOption(m_modelData,STR_INCLUDE_GRAPH)); m_dotIncludedBy->setChecked(getBoolOption(m_modelData,STR_INCLUDED_BY_GRAPH)); m_dotCall->setChecked(getBoolOption(m_modelData,STR_CALL_GRAPH)); m_dotCaller->setChecked(getBoolOption(m_modelData,STR_CALLER_GRAPH)); } //========================================================================== Wizard::Wizard(const QHash<QString,Input*> &modelData, QWidget *parent) : QSplitter(parent), m_modelData(modelData) { m_treeWidget = new QTreeWidget; m_treeWidget->setColumnCount(1); m_treeWidget->setHeaderLabels(QStringList() << QString::fromLatin1("Topics")); QList<QTreeWidgetItem*> items; items.append(new QTreeWidgetItem((QTreeWidget*)nullptr,QStringList(tr("Project")))); items.append(new QTreeWidgetItem((QTreeWidget*)nullptr,QStringList(tr("Mode")))); items.append(new QTreeWidgetItem((QTreeWidget*)nullptr,QStringList(tr("Output")))); items.append(new QTreeWidgetItem((QTreeWidget*)nullptr,QStringList(tr("Diagrams")))); m_treeWidget->insertTopLevelItems(0,items); m_topicStack = new QStackedWidget; m_step1 = new Step1(this,modelData); m_step2 = new Step2(this,modelData); m_step3 = new Step3(this,modelData); m_step4 = new Step4(this,modelData); m_topicStack->addWidget(m_step1); m_topicStack->addWidget(m_step2); m_topicStack->addWidget(m_step3); m_topicStack->addWidget(m_step4); QWidget *rightSide = new QWidget; QGridLayout *grid = new QGridLayout(rightSide); m_prev = new QPushButton(tr("Previous")); m_prev->setEnabled(false); m_next = new QPushButton(tr("Next")); grid->addWidget(m_topicStack,0,0,1,2); grid->addWidget(m_prev,1,0,Qt::AlignLeft); grid->addWidget(m_next,1,1,Qt::AlignRight); grid->setColumnStretch(0,1); grid->setRowStretch(0,1); addWidget(m_treeWidget); addWidget(rightSide); connect(m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)), SLOT(activateTopic(QTreeWidgetItem *,QTreeWidgetItem *))); connect(m_next,SIGNAL(clicked()),SLOT(nextTopic())); connect(m_prev,SIGNAL(clicked()),SLOT(prevTopic())); refresh(); } Wizard::~Wizard() { } void Wizard::activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *) { if (item) { QString label = item->text(0); if (label==tr("Project")) { m_topicStack->setCurrentWidget(m_step1); m_prev->setEnabled(false); m_next->setEnabled(true); } else if (label==tr("Mode")) { m_topicStack->setCurrentWidget(m_step2); m_prev->setEnabled(true); m_next->setEnabled(true); } else if (label==tr("Output")) { m_topicStack->setCurrentWidget(m_step3); m_prev->setEnabled(true); m_next->setEnabled(true); } else if (label==tr("Diagrams")) { m_topicStack->setCurrentWidget(m_step4); m_prev->setEnabled(true); m_next->setEnabled(true); } } } void Wizard::nextTopic() { if (m_topicStack->currentIndex()+1==m_topicStack->count()) // last topic { done(); } else { m_topicStack->setCurrentIndex(m_topicStack->currentIndex()+1); m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1); m_prev->setEnabled(m_topicStack->currentIndex()!=0); m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex())); } } void Wizard::prevTopic() { m_topicStack->setCurrentIndex(m_topicStack->currentIndex()-1); m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1); m_prev->setEnabled(m_topicStack->currentIndex()!=0); m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex())); } void Wizard::refresh() { m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(0)); m_step1->init(); m_step2->init(); m_step3->init(); m_step4->init(); }
45,521
C++
.cpp
1,296
31.62963
110
0.68156
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,499
doxywizard.cpp
doxygen_doxygen/addon/doxywizard/doxywizard.cpp
/****************************************************************************** * * Copyright (C) 1997-2021 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. * */ #include "doxywizard.h" #include "version.h" #include "expert.h" #include "wizard.h" #include <QMenu> #include <QMenuBar> #include <QPushButton> #include <QMessageBox> #include <QVBoxLayout> #include <QLineEdit> #include <QLabel> #include <QCheckBox> #include <QTextBrowser> #include <QStatusBar> #include <QProcess> #include <QTimer> #include <QCloseEvent> #include <QApplication> #include <QDir> #include <QFileDialog> #include <QDesktopServices> #include <QUrl> #include <QTextStream> #include <QRegularExpression> #include <QDebug> #include <QDate> #include <QScrollBar> #ifdef _WIN32 #include <windows.h> #endif #define MAX_RECENT_FILES 10 // globally accessible variables bool DoxygenWizard::debugFlag = false; const int messageTimeout = 5000; //!< status bar message timeout in milliseconds. #define APPQT(x) QString::fromLatin1("<qt><pre>") + x + QString::fromLatin1("</pre></qt>") MainWindow &MainWindow::instance() { static MainWindow *theInstance = new MainWindow; return *theInstance; } MainWindow::MainWindow() : m_settings(QString::fromLatin1("Doxygen.org"), QString::fromLatin1("Doxywizard")) { QMenu *file = menuBar()->addMenu(tr("File")); file->addAction(tr("Open..."), this, SLOT(openConfig()), Qt::CTRL|Qt::Key_O); m_recentMenu = file->addMenu(tr("Open recent")); file->addAction(tr("Save"), this, SLOT(saveConfig()), Qt::CTRL|Qt::Key_S); file->addAction(tr("Save as..."), this, SLOT(saveConfigAs()), Qt::SHIFT|Qt::CTRL|Qt::Key_S); file->addAction(tr("Quit"), this, SLOT(quit()), Qt::CTRL|Qt::Key_Q); QMenu *settings = menuBar()->addMenu(tr("Settings")); m_resetDefault = settings->addAction(tr("Reset to factory defaults"), this,SLOT(resetToDefaults())); settings->addAction(tr("Use current settings at startup"), this,SLOT(makeDefaults())); m_clearRecent = settings->addAction(tr("Clear recent list"), this,SLOT(clearRecent())); settings->addSeparator(); m_runMenu = settings->addAction(tr("Run doxygen"), this,SLOT(runDoxygenMenu()),Qt::CTRL|Qt::Key_R); m_runMenu->setEnabled(false); QMenu *help = menuBar()->addMenu(tr("Help")); help->addAction(tr("Online manual"), this, SLOT(manual()), Qt::Key_F1); help->addAction(tr("About"), this, SLOT(about()) ); m_expert = new Expert; m_wizard = new Wizard(m_expert->modelData()); // ----------- top part ------------------ QWidget *mainPart = new QWidget; QVBoxLayout *mainLayout = new QVBoxLayout(mainPart); QWidget *topPart = new QWidget; QVBoxLayout *rowLayout = new QVBoxLayout(topPart); mainLayout->addWidget(topPart); // select working directory QHBoxLayout *dirLayout = new QHBoxLayout; m_workingDir = new QLineEdit; m_selWorkingDir = new QPushButton(tr("Select...")); dirLayout->addWidget(m_workingDir); dirLayout->addWidget(m_selWorkingDir); //------------- bottom part -------------- m_runTab = new QWidget; QVBoxLayout *runTabLayout = new QVBoxLayout(m_runTab); // run doxygen QHBoxLayout *runLayout = new QHBoxLayout; m_run = new QPushButton(tr("Run doxygen")); m_run->setEnabled(false); m_runStatus = new QLabel(tr("Status: not running")); m_saveLog = new QPushButton(tr("Save log...")); m_saveLog->setEnabled(false); QPushButton *showSettings = new QPushButton(tr("Show configuration")); m_showCondensedSettings = new QCheckBox(this); m_showCondensedSettings->setText(tr("Condensed")); m_showCondensedSettings->setChecked(false); m_showCondensedSettings->setToolTip(tr("Show only configuration settings different from default settings")); // select extra run options m_runOptions = new QLineEdit; runTabLayout->addWidget(new QLabel(tr("Specify additional command line options for running doxygen"))); runTabLayout->addWidget(m_runOptions); QVBoxLayout *runVLayout = new QVBoxLayout; runLayout->addLayout(runVLayout); QHBoxLayout *runVHLayout = new QHBoxLayout; runVLayout->addLayout(runVHLayout); runVHLayout->addWidget(m_run); runVHLayout->addWidget(m_runStatus); QHBoxLayout *runVH2Layout = new QHBoxLayout; runVLayout->addLayout(runVH2Layout); m_launchHtml = new QPushButton(tr("Show HTML output")); runVH2Layout->addWidget(m_launchHtml); runVH2Layout->addStretch(1); // to have launch button not being stretched runLayout->addStretch(1); QVBoxLayout *settingsLayout = new QVBoxLayout; runLayout->addLayout(settingsLayout); settingsLayout->addWidget(m_showCondensedSettings); settingsLayout->addWidget(showSettings); QVBoxLayout *saveLayout = new QVBoxLayout; runLayout->addLayout(saveLayout); saveLayout->addWidget(m_saveLog); saveLayout->setAlignment(Qt::AlignTop); // saveLayout->addWidget(new QWidget); // to have the save button at the top // output produced by Doxygen runTabLayout->addLayout(runLayout); runTabLayout->addWidget(new QLabel(tr("Output produced by doxygen"))); QGridLayout *grid = new QGridLayout; //m_outputLog = new QTextEdit; m_outputLog = new QTextBrowser; //m_outputLog = new QPlainTextEdit; m_outputLog->setReadOnly(true); m_outputLog->setFontFamily(QString::fromLatin1("courier")); m_outputLog->setMinimumWidth(600); grid->addWidget(m_outputLog,0,0); grid->setColumnStretch(0,1); grid->setRowStretch(0,1); runTabLayout->addLayout(grid); m_tabs = new QTabWidget; m_tabs->addTab(m_wizard,tr("Wizard")); m_tabs->addTab(m_expert,tr("Expert")); m_tabs->addTab(m_runTab,tr("Run")); rowLayout->addWidget(new QLabel(tr("Specify the working directory from which doxygen will run"))); rowLayout->addLayout(dirLayout); rowLayout->addWidget(new QLabel(tr("Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation"))); mainLayout->addWidget(m_tabs); setCentralWidget(mainPart); statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout); m_runProcess = new QProcess; m_running = false; m_timer = new QTimer; // connect signals and slots connect(m_tabs,SIGNAL(currentChanged(int)),SLOT(selectTab(int))); connect(m_selWorkingDir,SIGNAL(clicked()),SLOT(selectWorkingDir())); connect(m_recentMenu,SIGNAL(triggered(QAction*)),SLOT(openRecent(QAction*))); connect(m_workingDir,SIGNAL(returnPressed()),SLOT(updateWorkingDir())); connect(m_runProcess,SIGNAL(readyReadStandardOutput()),SLOT(readStdout())); connect(m_runProcess,SIGNAL(finished(int, QProcess::ExitStatus)),SLOT(runComplete())); connect(m_timer,SIGNAL(timeout()),SLOT(readStdout())); connect(m_run,SIGNAL(clicked()),SLOT(runDoxygen())); connect(m_launchHtml,SIGNAL(clicked()),SLOT(showHtmlOutput())); connect(m_saveLog,SIGNAL(clicked()),SLOT(saveLog())); connect(showSettings,SIGNAL(clicked()),SLOT(showSettings())); connect(m_expert,SIGNAL(changed()),SLOT(configChanged())); connect(m_wizard,SIGNAL(done()),SLOT(selectRunTab())); connect(m_expert,SIGNAL(done()),SLOT(selectRunTab())); loadSettings(); updateLaunchButtonState(); m_modified = false; updateTitle(); m_wizard->refresh(); } void MainWindow::closeEvent(QCloseEvent *event) { if (discardUnsavedChanges()) { saveSettings(); event->accept(); } else { event->ignore(); } } void MainWindow::quit() { if (discardUnsavedChanges()) { saveSettings(); } else { return; } QApplication::exit(0); } void MainWindow::setWorkingDir(const QString &dirName) { QDir::setCurrent(dirName); m_workingDir->setText(dirName); m_run->setEnabled(!dirName.isEmpty()); m_runMenu->setEnabled(!dirName.isEmpty()); } void MainWindow::selectWorkingDir() { QString dirName = QFileDialog::getExistingDirectory(this, tr("Select working directory"),m_workingDir->text()); if (!dirName.isEmpty()) { setWorkingDir(dirName); } } void MainWindow::updateWorkingDir() { setWorkingDir(m_workingDir->text()); } void MainWindow::manual() { QDesktopServices::openUrl(QUrl(QString::fromLatin1("https://www.doxygen.org/manual/index.html"))); } void MainWindow::about() { QString msg; QTextStream t(&msg,QIODevice::WriteOnly); t << QString::fromLatin1("<qt><center>A tool to configure and run doxygen version ")+ QString::fromLatin1(getDoxygenVersion().c_str())+ QString::fromLatin1(" on your source files.</center>")+ QString::fromLatin1("<center>(Created with Qt version ")+ QString::fromLatin1(QT_VERSION_STR); if (qstrcmp(qVersion(),QT_VERSION_STR)) { t << QString::fromLatin1(", running with ")+ QString::fromLatin1(qVersion()); } t << QString::fromLatin1(")</center><p><br>" "<center>Written by<br> Dimitri van Heesch<br>&copy; 2000-"); t << QDate::currentDate().year(); t << QString::fromLatin1("</center><p></qt>"); QMessageBox::about(this,tr("Doxygen GUI"),msg); } void MainWindow::openConfig() { if (discardUnsavedChanges(false)) { QString fn = QFileDialog::getOpenFileName(this, tr("Open configuration file"), m_workingDir->text()); if (!fn.isEmpty()) { loadConfigFromFile(fn); } } } void MainWindow::updateConfigFileName(const QString &fileName) { if (m_fileName!=fileName) { m_fileName = fileName; QString curPath = QFileInfo(fileName).path(); setWorkingDir(curPath); addRecentFile(fileName); updateTitle(); } } void MainWindow::loadConfigFromFile(const QString & fileName) { // save full path info of original file QString absFileName = QFileInfo(fileName).absoluteFilePath(); // updates the current directory updateConfigFileName(fileName); // open the specified configuration file m_expert->loadConfig(absFileName); m_wizard->refresh(); updateLaunchButtonState(); m_modified = false; updateTitle(); } void MainWindow::saveConfig(const QString &fileName) { if (fileName.isEmpty()) return; QFile f(fileName); if (!f.open(QIODevice::WriteOnly | QIODevice::Text )) { QMessageBox::warning(this, tr("Error saving"), QString(tr("Error: cannot open the file "))+fileName+tr(" for writing!\n")+ tr("Reason given: ")+QString::number(f.error())); return; } QTextStream t(&f); t.device()->setTextModeEnabled(false); m_expert->writeConfig(t,false,false); updateConfigFileName(fileName); m_modified = false; updateTitle(); } bool MainWindow::saveConfig() { if (m_fileName.isEmpty()) { return saveConfigAs(); } else { saveConfig(m_fileName); return true; } } bool MainWindow::saveConfigAs() { QString fileName = QFileDialog::getSaveFileName(this, QString(), m_workingDir->text()+QString::fromLatin1("/Doxyfile")); if (fileName.isEmpty()) return false; saveConfig(fileName); return true; } void MainWindow::makeDefaults() { if (QMessageBox::question(this,tr("Use current setting at startup?"), tr("Do you want to save the current settings " "and use them next time Doxywizard starts?"), QMessageBox::Save| QMessageBox::Cancel)==QMessageBox::Save) { //printf("MainWindow:makeDefaults()\n"); m_expert->saveSettings(&m_settings); m_settings.setValue(QString::fromLatin1("wizard/loadsettings"), true); m_settings.sync(); } } void MainWindow::clearRecent() { if (QMessageBox::question(this,tr("Clear the list of recent files?"), tr("Do you want to clear the list of recently " "loaded configuration files?"), QMessageBox::Yes| QMessageBox::Cancel)==QMessageBox::Yes) { m_recentMenu->clear(); m_recentFiles.clear(); for (int i=0;i<MAX_RECENT_FILES;i++) { m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i),QString::fromLatin1("")); } m_clearRecent->setEnabled(false); m_recentMenu->setEnabled(false); m_settings.sync(); } } void MainWindow::resetToDefaults() { if (QMessageBox::question(this,tr("Reset settings to their default values?"), tr("Do you want to revert all settings back " "to their original values?"), QMessageBox::Reset| QMessageBox::Cancel)==QMessageBox::Reset) { //printf("MainWindow:resetToDefaults()\n"); m_expert->resetToDefaults(); m_settings.setValue(QString::fromLatin1("wizard/loadsettings"), false); m_settings.sync(); m_modified = false; updateTitle(); m_wizard->refresh(); } } void MainWindow::loadSettings() { QVariant geometry = m_settings.value(QString::fromLatin1("main/geometry")); QVariant state = m_settings.value(QString::fromLatin1("main/state")); QVariant wizState = m_settings.value(QString::fromLatin1("wizard/state")); QVariant loadSettings = m_settings.value(QString::fromLatin1("wizard/loadsettings")); QVariant workingDir = m_settings.value(QString::fromLatin1("wizard/workingdir")); if (!geometry.isNull()) restoreGeometry(geometry.toByteArray()); if (!state.isNull()) restoreState (state.toByteArray()); if (!wizState.isNull()) m_wizard->restoreState(wizState.toByteArray()); if (!loadSettings.isNull() && loadSettings.toBool()) { m_expert->loadSettings(&m_settings); if (!workingDir.isNull() && QDir(workingDir.toString()).exists()) { setWorkingDir(workingDir.toString()); } } /* due to prepend use list in reversed order */ for (int i=MAX_RECENT_FILES;i>=0;i--) { QString entry = m_settings.value(QString::fromLatin1("recent/config%1").arg(i)).toString(); if (!entry.isEmpty() && QFileInfo(entry).exists()) { addRecentFileList(entry); } } updateRecentFile(); } void MainWindow::saveSettings() { QSettings settings(QString::fromLatin1("Doxygen.org"), QString::fromLatin1("Doxywizard")); m_settings.setValue(QString::fromLatin1("main/geometry"), saveGeometry()); m_settings.setValue(QString::fromLatin1("main/state"), saveState()); m_settings.setValue(QString::fromLatin1("wizard/state"), m_wizard->saveState()); m_settings.setValue(QString::fromLatin1("wizard/workingdir"), m_workingDir->text()); } void MainWindow::selectTab(int id) { if (id==0) m_wizard->refresh(); else if (id==1) m_expert->refresh(); } void MainWindow::selectRunTab() { m_tabs->setCurrentIndex(2); } void MainWindow::addRecentFile(const QString &fileName) { addRecentFileList(fileName); updateRecentFile(); } void MainWindow::addRecentFileList(const QString &fileName) { int i=m_recentFiles.indexOf(fileName); if (i!=-1) m_recentFiles.removeAt(i); // not found if (m_recentFiles.count() < MAX_RECENT_FILES) // append { m_recentFiles.prepend(fileName); } else // add + drop last item { m_recentFiles.removeLast(); m_recentFiles.prepend(fileName); } m_clearRecent->setEnabled(m_recentFiles.count()>0); m_recentMenu->setEnabled(m_recentFiles.count()>0); m_settings.sync(); } void MainWindow::updateRecentFile(void) { m_recentMenu->clear(); int i=0; foreach( QString str, m_recentFiles ) { m_recentMenu->addAction(str); m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i++),str); } for (;i<MAX_RECENT_FILES;i++) { m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i),QString::fromLatin1("")); } m_clearRecent->setEnabled(m_recentFiles.count()>0); m_recentMenu->setEnabled(m_recentFiles.count()>0); m_settings.sync(); } void MainWindow::openRecent(QAction *action) { if (discardUnsavedChanges(false)) { loadConfigFromFile(action->text()); } } void MainWindow::runDoxygenMenu() { m_tabs->setCurrentWidget(m_runTab); runDoxygen(); } void MainWindow::runDoxygen() { if (!m_running) { QString doxygenPath; #if defined(Q_OS_MACX) doxygenPath = qApp->applicationDirPath()+QString::fromLatin1("/../Resources/"); qDebug() << tr("Doxygen path: ") << doxygenPath; if ( !QFile(doxygenPath + QString::fromLatin1("doxygen")).exists() ) { // No Doxygen binary in the resources, if there is a system Doxygen binary, use that instead if ( QFile(QString::fromLatin1("/usr/local/bin/doxygen")).exists() ) { doxygenPath = QString::fromLatin1("/usr/local/bin/"); } else { qDebug() << tr("Can't find the doxygen command, make sure it's in your $$PATH"); doxygenPath = QString::fromLatin1(""); } } qDebug() << tr("Getting doxygen from: ") << doxygenPath; #endif m_runProcess->setReadChannel(QProcess::StandardOutput); m_runProcess->setProcessChannelMode(QProcess::MergedChannels); m_runProcess->setWorkingDirectory(m_workingDir->text()); QStringList env=QProcess::systemEnvironment(); // set PWD environment variable to m_workingDir env.replaceInStrings(QRegularExpression(QString::fromLatin1("^PWD=(.*)"),QRegularExpression::CaseInsensitiveOption), QString::fromLatin1("PWD=")+m_workingDir->text()); m_runProcess->setEnvironment(env); QStringList args; #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) QStringList runOptions = m_runOptions->text().split(QLatin1Char(' '),QString::SkipEmptyParts); #else QStringList runOptions = m_runOptions->text().split(QLatin1Char(' '),Qt::SkipEmptyParts); #endif args << runOptions; args << QString::fromLatin1("-b"); // make stdout unbuffered args << QString::fromLatin1("-"); // read config from stdin m_outputLog->clear(); m_runProcess->start(doxygenPath + QString::fromLatin1("doxygen"), args); if (!m_runProcess->waitForStarted()) { m_outputLog->append(APPQT(QString::fromLatin1("*** Failed to run doxygen\n"))); return; } QTextStream t(m_runProcess); m_expert->writeConfig(t,false,false); t.flush(); m_runProcess->closeWriteChannel(); if (m_runProcess->state() == QProcess::NotRunning) { m_outputLog->append(APPQT(QString::fromLatin1("*** Failed to run doxygen\n"))); } else { m_saveLog->setEnabled(false); m_running=true; m_run->setText(tr("Stop doxygen")); m_runMenu->setEnabled(false); m_runStatus->setText(tr("Status: running")); m_timer->start(1000); } } else { m_running=false; m_run->setText(tr("Run doxygen")); m_runStatus->setText(tr("Status: not running")); m_runProcess->kill(); m_timer->stop(); //updateRunnable(m_workingDir->text()); } } void MainWindow::readStdout() { if (m_running) { QByteArray data = m_runProcess->readAllStandardOutput(); QString text = QString::fromUtf8(data); if (!text.isEmpty()) { QScrollBar *vbar = m_outputLog->verticalScrollBar(); const QTextCursor old_cursor = m_outputLog->textCursor(); const bool is_scrolled_up = vbar->value() == vbar->maximum(); const int distanceFromBottom = vbar->minimum() - vbar->value(); m_outputLog->moveCursor(QTextCursor::End); m_outputLog->insertPlainText(text); if (old_cursor.hasSelection() || !is_scrolled_up) { m_outputLog->setTextCursor(old_cursor); vbar->setValue(vbar->minimum() - distanceFromBottom); } else { m_outputLog->moveCursor(QTextCursor::End); vbar->setValue(m_outputLog->verticalScrollBar()->maximum()); } } } } void MainWindow::runComplete() { if (m_running) { m_outputLog->append(APPQT(tr("*** Doxygen has finished\n"))); } else { m_outputLog->append(APPQT(tr("*** Canceled by user\n"))); } m_outputLog->ensureCursorVisible(); m_run->setText(tr("Run doxygen")); m_runStatus->setText(tr("Status: not running")); m_running=false; m_runMenu->setEnabled(true); updateLaunchButtonState(); //updateRunnable(m_workingDir->text()); m_saveLog->setEnabled(true); } void MainWindow::updateLaunchButtonState() { m_launchHtml->setEnabled(m_expert->htmlOutputPresent(m_workingDir->text())); #if 0 m_launchPdf->setEnabled(m_expert->pdfOutputPresent(m_workingDir->text())); #endif } void MainWindow::showHtmlOutput() { QString indexFile = m_expert->getHtmlOutputIndex(m_workingDir->text()); QFileInfo fi(indexFile); // TODO: the following doesn't seem to work with IE #ifdef _WIN32 //QString indexUrl(QString::fromLatin1("file:///")); ShellExecute(nullptr, L"open", (LPCWSTR)fi.absoluteFilePath().utf16(), nullptr, nullptr, SW_SHOWNORMAL); #else QString indexUrl(QString::fromLatin1("file://")); indexUrl+=fi.absoluteFilePath(); QDesktopServices::openUrl(QUrl(indexUrl)); #endif } void MainWindow::saveLog() { QString fn = QFileDialog::getSaveFileName(this, tr("Save log file"), m_workingDir->text()+ QString::fromLatin1("/doxygen_log.txt")); if (!fn.isEmpty()) { QFile f(fn); if (f.open(QIODevice::WriteOnly)) { QTextStream t(&f); t << m_outputLog->toPlainText(); statusBar()->showMessage(tr("Output log saved"),messageTimeout); } else { QMessageBox::warning(nullptr,tr("Warning"), tr("Cannot open file ")+fn+tr(" for writing. Nothing saved!"),tr("ok")); } } } void MainWindow::showSettings() { QString text; QTextStream t(&text); if (m_showCondensedSettings->isChecked()) { m_expert->writeConfig(t,true,true); } else { m_expert->writeConfig(t,true,false); } m_outputLog->clear(); m_outputLog->append(APPQT(text)); m_outputLog->ensureCursorVisible(); m_saveLog->setEnabled(true); } void MainWindow::configChanged() { m_modified = true; updateTitle(); } void MainWindow::updateTitle() { QString title = tr("Doxygen GUI frontend"); m_resetDefault->setEnabled(m_modified); if (m_modified) { title+=QString::fromLatin1(" +"); } if (!m_fileName.isEmpty()) { title+=QString::fromLatin1(" (")+m_fileName+QString::fromLatin1(")"); } setWindowTitle(title); } bool MainWindow::discardUnsavedChanges(bool saveOption) { if (m_modified) { QMessageBox::StandardButton button; if (saveOption) { button = QMessageBox::question(this, tr("Unsaved changes"), tr("Unsaved changes will be lost! Do you want to save the configuration file?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); if (button==QMessageBox::Save) { return saveConfig(); } } else { button = QMessageBox::question(this, tr("Unsaved changes"), tr("Unsaved changes will be lost! Do you want to continue?"), QMessageBox::Discard | QMessageBox::Cancel ); } return button==QMessageBox::Discard; } return true; } void MainWindow::outputLogStart() { m_outputLogTextCount = 0; m_outputLog->clear(); } void MainWindow::outputLogText(QString text) { m_outputLogTextCount++; m_outputLog->append(APPQT(text)); } void MainWindow::outputLogFinish() { if (m_outputLogTextCount > 0) { selectRunTab(); } m_outputLog->ensureCursorVisible(); m_saveLog->setEnabled(true); } //----------------------------------------------------------------------- int main(int argc,char **argv) { static const char ENV_VAR_QT_DEVICE_PIXEL_RATIO[] = "QT_DEVICE_PIXEL_RATIO"; if (!qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO) && !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR") && !qEnvironmentVariableIsSet("QT_SCALE_FACTOR") && !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } QApplication a(argc,argv); int locArgc = argc; if (locArgc == 2) { if (!qstrcmp(argv[1],"--help")) { QMessageBox msgBox; msgBox.setText(QString::fromLatin1("Usage: %1 [config file]").arg(QString::fromLatin1(argv[0]))); msgBox.exec(); exit(0); } else if (!qstrcmp(argv[1],"--version")) { QMessageBox msgBox; if (!qstrcmp(qVersion(),QT_VERSION_STR)) { msgBox.setText(QString::fromLatin1("Doxywizard version: %1, Qt version: %2").arg(QString::fromLatin1(getFullVersion().c_str()),QString::fromLatin1(QT_VERSION_STR))); } else { msgBox.setText(QString::fromLatin1("Doxywizard version: %1, Qt version: created with %2, running with %3").arg(QString::fromLatin1(getFullVersion().c_str()),QString::fromLatin1(QT_VERSION_STR),QString::fromLatin1(qVersion()))); } msgBox.exec(); exit(0); } } if (!qstrcmp(argv[1],"--debug") && ((locArgc == 2) || (locArgc == 3))) { DoxygenWizard::debugFlag = true; locArgc--; } if (locArgc > 2) { QMessageBox msgBox; msgBox.setText(QString::fromLatin1("Too many arguments specified\n\nUsage: %1 [config file]").arg(QString::fromLatin1(argv[0]))); msgBox.exec(); exit(1); } else { MainWindow &main = MainWindow::instance(); if (locArgc==2 && argv[argc-1][0]!='-') // name of config file as an argument { main.loadConfigFromFile(QString::fromLocal8Bit(argv[argc-1])); } main.show(); return a.exec(); } }
25,774
C++
.cpp
783
28.659004
235
0.681282
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,500
inputbool.cpp
doxygen_doxygen/addon/doxywizard/inputbool.cpp
/****************************************************************************** * * Copyright (C) 1997-2019 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. * */ #include "inputbool.h" #include "helplabel.h" #include "config_msg.h" #include <QCheckBox> #include <QTextStream> #include <QGridLayout> InputBool::InputBool( QGridLayout *layout, int &row, const QString &id, bool checked, const QString &docs ) : m_default(checked), m_docs(docs), m_id(id) { m_lab = new HelpLabel(id); m_cb = new QCheckBox; layout->addWidget(m_lab,row, 0); layout->addWidget(m_cb,row, 1); m_enabled = true; m_state=!checked; // force update setValue(checked); connect( m_cb, SIGNAL(toggled(bool)), SLOT(setValue(bool)) ); connect( m_lab, SIGNAL(enter()), SLOT(help()) ); connect( m_lab, SIGNAL(reset()), SLOT(reset()) ); row++; } void InputBool::help() { showHelp(this); } void InputBool::setEnabled(bool b) { m_enabled = b; m_cb->setEnabled(b); m_lab->setEnabled(b); updateDefault(); updateDependencies(); } void InputBool::updateDependencies() { for (int i=0;i<m_dependencies.count();i++) { m_dependencies[i]->setEnabled(m_enabled && m_state); } } void InputBool::setValue( bool s ) { if (m_state!=s) { m_state=s; updateDefault(); updateDependencies(); m_cb->setChecked( s ); m_value = m_state; emit changed(); } } void InputBool::updateDefault() { if (m_state==m_default || !m_lab->isEnabled()) { m_lab->setText(QString::fromLatin1("<qt>")+m_id+QString::fromLatin1("</qt>")); } else { m_lab->setText(QString::fromLatin1("<qt><font color='red'>")+m_id+QString::fromLatin1("</font></qt>")); } } QVariant &InputBool::value() { return m_value; } bool InputBool::convertToBool(const QVariant &value,bool &isValid) { QString v = value.toString().toLower(); if (v==QString::fromLatin1("yes") || v==QString::fromLatin1("true") || v==QString::fromLatin1("1") || v==QString::fromLatin1("all")) { isValid = true; return true; } else if (v==QString::fromLatin1("no") || v==QString::fromLatin1("false") || v==QString::fromLatin1("0") || v==QString::fromLatin1("none")) { isValid = true; return false; } else { isValid = false; return false; } } void InputBool::update() { bool isValid=false; bool b = convertToBool(m_value,isValid); if (isValid) { m_state = b; } else { config_warn("argument '%s' for option %s is not a valid boolean value." " Using the default: %s!",qPrintable(m_value.toString()),qPrintable(m_id),m_default?"YES":"NO"); m_state = m_default; } m_cb->setChecked( m_state ); updateDefault(); updateDependencies(); } void InputBool::reset() { setValue(m_default); } void InputBool::writeValue(QTextStream &t,TextCodecAdapter *codec) { if (m_state) t << codec->encode(QString::fromLatin1("YES")); else t << codec->encode(QString::fromLatin1("NO")); } bool InputBool::isDefault() { return m_state == m_default; }
3,428
C++
.cpp
134
22.38806
112
0.646539
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
true
false
false
true
false
false
28,501
doxyindexer.cpp
doxygen_doxygen/addon/doxysearch/doxyindexer.cpp
/****************************************************************************** * * Copyright (C) 1997-2015 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. * */ // STL includes #include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <sstream> #include <fstream> #include <iterator> #include <regex> #include <sys/stat.h> // Xapian include #include <xapian.h> #include "version.h" #include "xml.h" #define MAX_TERM_LENGTH 245 #if defined(_WIN32) && !defined(__CYGWIN__) static char pathSep = '\\'; #else static char pathSep = '/'; #endif static void safeAddTerm(const std::string &term,Xapian::Document &doc,int wfd) { if (term.length()<=MAX_TERM_LENGTH) doc.add_term(term,wfd); } /** trims \a whitespace characters from the start and end of string \a str. */ static std::string trim(const std::string& str, const std::string& whitespace = " \t") { size_t strBegin = str.find_first_not_of(whitespace); if (strBegin == std::string::npos) return ""; // no content size_t strEnd = str.find_last_not_of(whitespace); size_t strRange = strEnd - strBegin + 1; return str.substr(strBegin, strRange); } /** trims \a whitespace from start and end and replace occurrences of * \a whitespace with \a fill. */ static std::string reduce(const std::string& str, const std::string& fill = " ", const std::string& whitespace = " \t") { // trim first std::string result = trim(str, whitespace); // replace sub ranges size_t beginSpace = result.find_first_of(whitespace); while (beginSpace != std::string::npos) { size_t endSpace = result.find_first_not_of(whitespace, beginSpace); size_t range = endSpace - beginSpace; result.replace(beginSpace, range, fill); size_t newStart = beginSpace + fill.length(); beginSpace = result.find_first_of(whitespace, newStart); } return result; } /** Adds all words in \a s to document \a doc with weight \a wfd */ static void addWords(const std::string &s,Xapian::Document &doc,int wfd) { std::istringstream iss(s); std::istream_iterator<std::string> begin(iss),end,it; for (it=begin;it!=end;++it) { const std::string word = *it; const std::string lword = Xapian::Unicode::tolower(word); safeAddTerm(word,doc,wfd); if (lword!=word) { safeAddTerm(lword,doc,wfd); } } } /** Adds all identifiers in \a s to document \a doc with weight \a wfd */ static void addIdentifiers(const std::string &s,Xapian::Document &doc,int wfd) { std::regex id_re("[A-Z_a-z][A-Z_a-z0-9]*"); auto id_begin = std::sregex_iterator(s.begin(), s.end(), id_re); auto id_end = std::sregex_iterator(); for (auto i = id_begin; i!=id_end; ++i) { std::smatch match = *i; safeAddTerm(match.str(),doc,wfd); } } /** Replaces all occurrences of \a old with \a repl in string \a str */ static void replace_all(std::string& str, const std::string& old, const std::string& repl) { size_t pos = 0; while ((pos = str.find(old, pos)) != std::string::npos) { str.replace(pos, old.length(), repl); pos += repl.length(); } } /** Replaces all XML entities in \a s with their unescaped representation */ static std::string unescapeXmlEntities(const std::string &s) { std::string result=s; replace_all(result,"&gt;",">"); replace_all(result,"&lt;","<"); replace_all(result,"&apos;","'"); replace_all(result,"&quot;","\""); replace_all(result,"&amp;","&"); return result; } /** This class is a wrapper around SAX style XML parser, which * parses the file without first building a DOM tree in memory. */ class XMLContentHandler { public: /** Handler for parsing XML data */ XMLContentHandler(const std::string &path) : m_db(path+"doxysearch.db",Xapian::DB_CREATE_OR_OVERWRITE), m_stemmer("english") { m_curFieldName = UnknownField; m_indexer.set_stemmer(m_stemmer); m_indexer.set_document(m_doc); } /** Free data handler */ ~XMLContentHandler() { m_db.commit(); } enum FieldNames { UnknownField = 0, TypeField = 1, NameField = 2, ArgsField = 3, TagField = 4, UrlField = 5, KeywordField = 6, TextField = 7 }; /** Handler for a start tag. Called for `<doc>` and `<field>` tags */ void startElement(const std::string &name, const XMLHandlers::Attributes &attrib) { m_data=""; if (name=="field") { std::string fieldName = XMLHandlers::value(attrib,"name"); if (fieldName=="type") m_curFieldName=TypeField; else if (fieldName=="name") m_curFieldName=NameField; else if (fieldName=="args") m_curFieldName=ArgsField; else if (fieldName=="tag") m_curFieldName=TagField; else if (fieldName=="url") m_curFieldName=UrlField; else if (fieldName=="keywords") m_curFieldName=KeywordField; else if (fieldName=="text") m_curFieldName=TextField; else m_curFieldName=UnknownField; } } /** Handler for an end tag. Called for `</doc>` and `</field>` tags */ void endElement(const std::string &name) { if (name=="doc") // </doc> { std::string term = m_doc.get_value(NameField); std::string partTerm; size_t pos = term.rfind("::"); if (pos!=std::string::npos) { partTerm = term.substr(pos+2); } if (m_doc.get_value(TypeField)=="class" || m_doc.get_value(TypeField)=="file" || m_doc.get_value(TypeField)=="namespace") // containers get highest prio { safeAddTerm(term,m_doc,1000); if (!partTerm.empty()) { safeAddTerm(partTerm,m_doc,500); } } else // members and others get lower prio { safeAddTerm(m_doc.get_value(NameField),m_doc,100); if (!partTerm.empty()) { safeAddTerm(partTerm,m_doc,50); } } m_db.add_document(m_doc); m_doc.clear_values(); m_doc.clear_terms(); } else if (name=="field" && m_curFieldName!=UnknownField) // </field> { // strip whitespace from m_data m_data = reduce(m_data); // replace XML entities m_data = unescapeXmlEntities(m_data); // add data to the document m_doc.add_value(m_curFieldName,m_data); switch (m_curFieldName) { case TypeField: case NameField: case TagField: case UrlField: // meta data that is not searchable break; case KeywordField: addWords(m_data,m_doc,50); break; case ArgsField: addIdentifiers(m_data,m_doc,10); break; case TextField: addWords(m_data,m_doc,2); break; default: break; } m_data=""; m_curFieldName=UnknownField; } // reset m_data } /** Handler for inline text */ void characters(const std::string& ch) { m_data += ch; } void error(const std::string &fileName,int lineNr,const std::string &msg) { std::cerr << "Fatal error at " << fileName << ":" << lineNr << ": " << msg << std::endl; } private: // internal state Xapian::WritableDatabase m_db; Xapian::Document m_doc; Xapian::TermGenerator m_indexer; Xapian::Stem m_stemmer; std::string m_data; FieldNames m_curFieldName; }; static void usage(const char *name, int exitVal = 1) { std::cerr << "Usage: " << name << " [-o output_dir] searchdata.xml [searchdata2.xml ...]" << std::endl; exit(exitVal); } // return the contents of a file as a string inline std::string fileToString(const std::string &fileName) { std::ifstream t(fileName); std::string result; t.seekg(0, std::ios::end); result.reserve(t.tellg()); t.seekg(0, std::ios::beg); result.assign(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>()); return result; } bool dirExists(const char *path) { struct stat info = {}; return stat(path,&info)==0 && (info.st_mode&S_IFDIR); } /** main function to index data */ int main(int argc,const char **argv) { if (argc<2) { usage(argv[0]); } std::string outputDir; for (int i=1;i<argc;i++) { if (std::string(argv[i])=="-o") { if (i>=argc-1) { std::cerr << "Error: missing parameter for -o option" << std::endl; usage(argv[0]); } else { i++; outputDir=argv[i]; if (!dirExists(outputDir.c_str())) { std::cerr << "Error: specified output directory does not exist!" << std::endl; usage(argv[0]); } } } else if (std::string(argv[i])=="-h" || std::string(argv[i])=="--help") { usage(argv[0],0); } else if (std::string(argv[i])=="-v" || std::string(argv[i])=="--version") { std::cerr << argv[0] << " version: " << getFullVersion() << std::endl; exit(0); } } try { if (!outputDir.empty() && outputDir.at(outputDir.length()-1)!=pathSep) { outputDir+=pathSep; } XMLContentHandler contentHandler(outputDir); XMLHandlers handlers; handlers.startElement = [&contentHandler](const std::string &name,const XMLHandlers::Attributes &attrs) { contentHandler.startElement(name,attrs); }; handlers.endElement = [&contentHandler](const std::string &name) { contentHandler.endElement(name); }; handlers.characters = [&contentHandler](const std::string &chars) { contentHandler.characters(chars); }; handlers.error = [&contentHandler](const std::string &fileName,int lineNr,const std::string &msg) { contentHandler.error(fileName,lineNr,msg); }; for (int i=1;i<argc;i++) { if (std::string(argv[i])=="-o") { i++; } else { std::cout << "Processing " << argv[i] << "..." << std::endl; std::string inputStr = fileToString(argv[i]); XMLParser parser(handlers); parser.parse(argv[i],inputStr.c_str(),false,[](){},[](){}); } } } catch(const Xapian::Error &e) { std::cerr << "Caught exception: " << e.get_description() << std::endl; } catch(...) { std::cerr << "Caught an unknown exception" << std::endl; } return 0; }
11,042
C++
.cpp
349
26.309456
156
0.604147
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,502
doxysearch.cpp
doxygen_doxygen/addon/doxysearch/doxysearch.cpp
/****************************************************************************** * * Copyright (C) 1997-2022 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. * */ // STL includes #include <cstdio> #include <cstdlib> #include <string> #include <vector> #include <sstream> #include <iostream> #include <fstream> #include <string> #include <algorithm> // Xapian includes #include <xapian.h> #include "version.h" #ifdef _WIN32 #include <windows.h> #else #include <sys/stat.h> #endif #define FIELD_TYPE 1 #define FIELD_NAME 2 #define FIELD_ARGS 3 #define FIELD_TAG 4 #define FIELD_URL 5 #define FIELD_KEYW 6 #define FIELD_DOC 7 #define HEX2DEC(x) (((x)>='0' && (x)<='9')?((x)-'0'):\ ((x)>='a' && (x)<='f')?((x)-'a'+10):\ ((x)>='A' && (x)<='F')?((x)-'A'+10):-1) bool dirExists(const std::string& dirName) { #ifdef _WIN32 DWORD ftyp = GetFileAttributesA(dirName.c_str()); if (ftyp == INVALID_FILE_ATTRIBUTES) return false; //something is wrong with your path! if (ftyp & FILE_ATTRIBUTE_DIRECTORY) return true; // this is a directory! #else struct stat sb; if (stat(dirName.c_str(), &sb)==0 && S_ISDIR(sb.st_mode)) { return true; } #endif return false; } /** decodes a URI encoded string into a normal string. */ static std::string uriDecode(const std::string & sSrc) { // Note from RFC1630: "Sequences which start with a percent // sign but are not followed by two hexadecimal characters // (0-9, A-F) are reserved for future extension" const unsigned char * pSrc = (const unsigned char *)sSrc.c_str(); const size_t SRC_LEN = sSrc.length(); const unsigned char * const SRC_END = pSrc + SRC_LEN; // last decodable '%' const unsigned char * const SRC_LAST_DEC = SRC_END - 2; char * const pStart = new char[SRC_LEN]; char * pEnd = pStart; while (pSrc < SRC_LAST_DEC) { if (*pSrc == '%') // replace %2A with corresponding ASCII character { char dec1, dec2; unsigned char c1=*(pSrc+1); unsigned char c2=*(pSrc+2); if (-1 != (dec1 = HEX2DEC(c1)) && -1 != (dec2 = HEX2DEC(c2))) { *pEnd++ = (dec1 << 4) + dec2; pSrc += 3; continue; } } else if (*pSrc == '+') // replace '+' with space { *pEnd++ = ' '; pSrc++; continue; } *pEnd++ = *pSrc++; } // the last 2- chars while (pSrc < SRC_END) *pEnd++ = *pSrc++; std::string sResult(pStart, pEnd); delete [] pStart; return sResult; } /** return list of strings that result when splitting \a s using * delimiter \a delim */ static std::vector<std::string> split(const std::string &s, char delim) { std::vector<std::string> elems; std::stringstream ss(s); std::string item; while (getline(ss, item, delim)) elems.push_back(item); return elems; } /** Read type T from string \a s */ template<class T> T fromString(const std::string& s) { std::istringstream stream (s); T t; stream >> t; return t; } /** Class that holds the starting position of a word */ struct WordPosition { WordPosition(size_t s,size_t i) : start(s), index(i) {} size_t start; size_t index; }; /** Class representing the '<' operator for WordPosition objects based on position. */ struct WordPosition_less { bool operator()(const WordPosition &p1,const WordPosition &p2) const { return p1.start<p2.start; } }; /** Class that holds a text fragment */ struct Fragment { Fragment(const std::string &t,int occ) : text(t), occurrences(occ) {} std::string text; int occurrences; }; /** Class representing the '>' operator for Fragment objects based on occurrence. */ struct Fragment_greater { bool operator()(const Fragment &p1,const Fragment &p2) const { return p1.occurrences>p2.occurrences; } }; /** Class representing a range within a string */ struct Range { Range(size_t s,size_t e) : start(s), end(e) {} size_t start; size_t end; }; /** Returns true if [start..start+len] is inside one of the \a ranges. */ static bool insideRange(const std::vector<Range> &ranges,size_t start,size_t len) { for (std::vector<Range>::const_iterator it = ranges.begin(); it!=ranges.end(); ++it ) { Range r = *it; if (start>=r.start && start+len<r.end) { return true; } } return false; } /** Returns a list of text \a fragments from \a s containing one or * more \a words. The list is sorted according to the * number of occurrences of words within the fragment. */ static void highlighter(const std::string &s, const std::vector<std::string> &words, std::vector<Fragment> &fragments) { const std::string spanStart="<span class=\"hl\">"; const std::string spanEnd="</span>"; const std::string dots="..."; const size_t fragLen = 60; size_t sl=s.length(); // find positions of words in s int j=0; std::vector<WordPosition> positions; for (std::vector<std::string>::const_iterator it=words.begin(); it!=words.end(); ++it,++j ) { size_t pos=0; size_t i; std::string word = *it; while ((i=s.find(word,pos))!=std::string::npos) { positions.push_back(WordPosition(i,j)); pos=i+word.length(); } } // sort on position std::sort(positions.begin(),positions.end(),WordPosition_less()); // get fragments around words std::vector<Range> ranges; for (std::vector<WordPosition>::const_iterator it=positions.begin(); it!=positions.end(); ++it) { WordPosition wp = *it; std::string w = words[wp.index]; size_t i=wp.start; size_t wl=w.length(); if (!insideRange(ranges,i,wl)) { if (wl>fragLen) { fragments.push_back(Fragment(spanStart+w+spanEnd,1)); ranges.push_back(Range(i,i+wl)); } else { std::string startFragment,endFragment; int bi=static_cast<int>(i)-static_cast<int>((fragLen-wl)/2); size_t ei=i+wl+(fragLen-wl)/2; int occ=0; if (bi<0) { ei-=bi; bi=0; } else startFragment=dots; if (ei>sl) { ei=sl; } else endFragment=dots; while (bi>0 && !isspace(s[bi])) bi--; // round to start of the word while (ei<sl && !isspace(s[ei])) ei++; // round to end of the word // highlight any word in s between indexes bi and ei std::string fragment=startFragment; size_t pos=bi; for (std::vector<WordPosition>::const_iterator it2=positions.begin(); it2!=positions.end(); ++it2) { WordPosition wp2 = *it2; std::string w2 = words[wp2.index]; size_t wl2 = w2.length(); if (wp2.start>=bi && wp2.start+wl2<=ei) // word is inside the range! { fragment+=s.substr(pos,wp2.start-pos)+ spanStart+ s.substr(wp2.start,wl2)+ spanEnd; pos=wp2.start+wl2; occ++; } } fragment+=s.substr(pos,ei-pos)+endFragment; fragments.push_back(Fragment(fragment,occ)); ranges.push_back(Range(bi,ei)); } } } std::sort(fragments.begin(),fragments.end(),Fragment_greater()); } /** Escapes a string such that is can be included in a JSON structure */ static std::string escapeString(const std::string &s) { std::stringstream dst; for (size_t i=0;i<s.length();i++) { char ch = s[i]; switch (ch) { case '\"': dst << "\\\""; break; default: dst << ch; break; } } return dst.str(); } static void showError(const std::string &callback,const std::string &error) { std::cout << callback << "({\"error\":\"" << error << "\"})"; exit(0); } static void usage(const char *name, int exitVal = 1) { std::cerr << "Usage: " << name << "[query_string]" << std::endl; std::cerr << " " << "alternatively the query string can be given by the environment variable QUERY_STRING" << std::endl; exit(exitVal); } /** Main routine */ int main(int argc,char **argv) { // process inputs that were passed to us via QUERY_STRING std::string callback; try { std::string queryString; if (argc == 1) { const char *queryEnv = getenv("QUERY_STRING"); if (queryEnv) { queryString = queryEnv; } else { usage(argv[0]); } } else if (argc == 2) { if (std::string(argv[1])=="-h" || std::string(argv[1])=="--help") { usage(argv[0],0); } else if (std::string(argv[1])=="-v" || std::string(argv[1])=="--version") { std::cerr << argv[0] << " version: " << getFullVersion() << std::endl; exit(0); } else { queryString = argv[1]; } } else { usage(argv[0]); } std::cout << "Content-Type:application/javascript;charset=utf-8\r\n\n"; // parse query string std::vector<std::string> parts = split(queryString,'&'); std::string searchFor,callback; int num=1,page=0; for (std::vector<std::string>::const_iterator it=parts.begin();it!=parts.end();++it) { std::vector<std::string> kv = split(*it,'='); if (kv.size()==2) { std::string val = uriDecode(kv[1]); if (kv[0]=="q") searchFor = val; else if (kv[0]=="n") num = fromString<int>(val); else if (kv[0]=="p") page = fromString<int>(val); else if (kv[0]=="cb") callback = val; } } std::string indexDir = "doxysearch.db"; if (queryString=="test") // user test { bool dbOk = dirExists(indexDir); if (dbOk) { std::cout << "Test successful."; } else { std::cout << "Test failed: cannot find search index " << indexDir; } exit(0); } // create query Xapian::Database db(indexDir); Xapian::Enquire enquire(db); std::vector<std::string> words = split(searchFor,' '); Xapian::QueryParser parser; parser.set_database(db); parser.set_default_op(Xapian::Query::OP_AND); parser.set_stemming_strategy(Xapian::QueryParser::STEM_ALL); Xapian::termcount max_expansion=100; #if (XAPIAN_MAJOR_VERSION==1) && (XAPIAN_MINOR_VERSION==2) parser.set_max_wildcard_expansion(max_expansion); #else parser.set_max_expansion(max_expansion,Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT); #endif Xapian::Query query=parser.parse_query(searchFor, Xapian::QueryParser::FLAG_DEFAULT | Xapian::QueryParser::FLAG_WILDCARD | Xapian::QueryParser::FLAG_PHRASE | Xapian::QueryParser::FLAG_PARTIAL ); enquire.set_query(query); // get results Xapian::MSet matches = enquire.get_mset(page*num,num); unsigned int hits = matches.get_matches_estimated(); unsigned int offset = page*num; unsigned int pages = num>0 ? (hits+num-1)/num : 0; if (offset>hits) offset=hits; if (offset+num>hits) num=hits-offset; // write results as JSONP std::cout << callback.c_str() << "("; std::cout << "{" << std::endl << " \"hits\":" << hits << "," << std::endl << " \"first\":" << offset << "," << std::endl << " \"count\":" << num << "," << std::endl << " \"page\":" << page << "," << std::endl << " \"pages\":" << pages << "," << std::endl << " \"query\": \"" << escapeString(searchFor) << "\"," << std::endl << " \"items\":[" << std::endl; // foreach search result unsigned int o = offset; for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i,++o) { std::vector<Fragment> hl; Xapian::Document doc = i.get_document(); highlighter(doc.get_value(FIELD_DOC),words,hl); std::cout << " {\"type\": \"" << doc.get_value(FIELD_TYPE) << "\"," << std::endl << " \"name\": \"" << doc.get_value(FIELD_NAME) << escapeString(doc.get_value(FIELD_ARGS)) << "\"," << std::endl << " \"tag\": \"" << doc.get_value(FIELD_TAG) << "\"," << std::endl << " \"url\": \"" << doc.get_value(FIELD_URL) << "\"," << std::endl; std::cout << " \"fragments\":[" << std::endl; int c=0; bool first=true; for (std::vector<Fragment>::const_iterator it = hl.begin();it!=hl.end() && c<3;++it,++c) { if (!first) std::cout << "," << std::endl; std::cout << " \"" << escapeString((*it).text) << "\""; first=false; } if (!first) std::cout << std::endl; std::cout << " ]" << std::endl; std::cout << " }"; if (o<offset+num-1) std::cout << ","; std::cout << std::endl; } std::cout << " ]" << std::endl << "})" << std::endl; } catch (const Xapian::Error &e) // Xapian exception { showError(callback,e.get_description()); } catch (...) // Any other exception { showError(callback,"Unknown Exception!"); exit(1); } return 0; }
13,652
C++
.cpp
433
26.078522
130
0.579666
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
true
false
false
true
false
false
28,503
doxyparse.cpp
doxygen_doxygen/addon/doxyparse/doxyparse.cpp
/****************************************************************************** * * Copyright (C) 2009-2015 by Joenio Costa. * * 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. * */ /** @file * @brief Code parse based on doxyapp by Dimitri van Heesch * */ #include <stdlib.h> #if !defined(_WIN32) || defined(__CYGWIN__) #include <unistd.h> #else #include <windows.h> #endif #include "version.h" #include "doxygen.h" #include "outputgen.h" #include "outputlist.h" #include "parserintf.h" #include "classlist.h" #include "config.h" #include "filedef.h" #include "util.h" #include "filename.h" #include "arguments.h" #include "memberlist.h" #include "types.h" #include <string> #include <cstdlib> #include <sstream> #include <map> #include "qcstring.h" #include "namespacedef.h" #include "portable.h" #include "dir.h" class Doxyparse : public OutputCodeIntf { public: Doxyparse(const FileDef *fd) : m_fd(fd) {} ~Doxyparse() {} // these are just null functions, they can be used to produce a syntax highlighted // and cross-linked version of the source code, but who needs that anyway ;-) OutputType type() const override { return OutputType::Extension; } std::unique_ptr<OutputCodeIntf> clone() override { return std::make_unique<Doxyparse>(m_fd); } void codify(const QCString &) override {} void stripCodeComments(bool) override {} void startSpecialComment() override {} void endSpecialComment() override {} void setStripIndentAmount(size_t) override {} void writeCodeLink(CodeSymbolType,const QCString &,const QCString &,const QCString &,const QCString &,const QCString &) override {} void startCodeLine(int) override {} void endCodeLine() override {} void writeCodeAnchor(const QCString &) override {} void startFontClass(const QCString &) override {} void endFontClass() override {} void writeLineNumber(const QCString &,const QCString &,const QCString &,int,bool) override {} virtual void writeTooltip(const QCString &,const DocLinkInfo &, const QCString &,const QCString &,const SourceLinkInfo &, const SourceLinkInfo &) override {} void startCodeFragment(const QCString &) override {} void endCodeFragment(const QCString &) override {} void startFold(int,const QCString &,const QCString &) override {} void endFold() override {} void linkableSymbol(int l, const char *sym, Definition *symDef, Definition *context) { if (!symDef) { // in this case we have a local or external symbol // TODO record use of external symbols // TODO must have a way to differentiate external symbols from local variables } } private: const FileDef *m_fd; }; static bool is_c_code = true; static void findXRefSymbols(FileDef *fd) { // get the interface to a parser that matches the file extension auto intf=Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); // get the programming language from the file name SrcLangExt lang = getLanguageFromFileName(fd->name()); // reset the parsers state intf->resetCodeParserState(); // create a new backend object std::unique_ptr<OutputCodeIntf> parse = std::make_unique<Doxyparse>(fd); OutputCodeList parseList; parseList.add(std::move(parse)); // parse the source code intf->parseCode(parseList, QCString(), fileToString(fd->absFilePath()), lang, FALSE, FALSE, QCString(), fd); } static bool ignoreStaticExternalCall(const MemberDef *context, const MemberDef *md) { if (md->isStatic()) { if(md->getFileDef() && context->getFileDef()) { if(md->getFileDef()->getOutputFileBase() == context->getFileDef()->getOutputFileBase()) // TODO ignore prefix of file return false; else return true; } else { return false; } } else { return false; } } static void startYamlDocument() { printf("---\n"); } static void printFile(std::string file) { printf("%s:\n", file.c_str()); } static void printModule(std::string module) { printf(" \"%s\":\n", unescapeCharsInString(module.c_str()).data()); } static void printClassInformation(std::string information) { printf(" information: %s\n", information.c_str()); } static void printInherits() { printf(" inherits:\n"); } static void printInheritance(std::string base_class) { printf(" - \"%s\"\n", base_class.c_str()); } static void printDefines() { printf(" defines:\n"); } static void printDefinition(std::string type, std::string signature, int line) { printf(" - \"%s\":\n", signature.substr(0, 1022).c_str()); printf(" type: %s\n", type.c_str()); printf(" line: %d\n", line); } static void printProtection(std::string protection) { printf(" protection: %s\n", protection.c_str()); } static void printPrototypeYes() { printf(" prototype: yes\n"); } static void printNumberOfLines(int lines) { printf(" lines_of_code: %d\n", lines); } static void printNumberOfArguments(size_t arguments) { printf(" parameters: %zu\n", arguments); } static void printUses() { printf(" uses:\n"); } static void printReferenceTo(std::string type, std::string signature, std::string defined_in) { printf(" - \"%s\":\n", signature.substr(0, 1022).c_str()); printf(" type: %s\n", type.c_str()); printf(" defined_in: \"%s\"\n", unescapeCharsInString(defined_in.c_str()).data()); } static void printNumberOfConditionalPaths(const MemberDef* md) { printf(" conditional_paths: %d\n", md->numberOfFlowKeyWords()); } static int isPartOfCStruct(const MemberDef * md) { return is_c_code && md->getClassDef() != nullptr; } std::string sanitizeString(std::string data) { QCString new_data = QCString(data.c_str()); new_data = substitute(new_data,"\"", ""); new_data = substitute(new_data,"\'", ""); // https://github.com/analizo/analizo/issues/138 return !new_data.isEmpty() ? new_data.data() : ""; } std::string argumentData(const Argument &argument) { std::string data = ""; if (argument.type.size() > 1) data = sanitizeString(argument.type.data()); else if (!argument.name.isEmpty()) data = sanitizeString(argument.name.data()); return data; } std::string functionSignature(const MemberDef* md) { std::string signature = sanitizeString(md->name().data()); if(md->isFunction()){ const ArgumentList &argList = md->argumentList(); signature += "("; auto it = argList.begin(); if(it!=argList.end()) { signature += argumentData(*it); for(++it; it!=argList.end(); ++it) { signature += std::string(",") + argumentData(*it); } } signature += ")"; } return signature; } static void referenceTo(const MemberDef* md) { std::string type = md->memberTypeName().data(); std::string defined_in = ""; std::string signature = ""; if (isPartOfCStruct(md)) { signature = md->getClassDef()->name().data() + std::string("::") + functionSignature(md); defined_in = md->getClassDef()->getFileDef()->getOutputFileBase().data(); } else { signature = functionSignature(md); if (md->getClassDef()) { defined_in = md->getClassDef()->name().data(); } else if (md->getFileDef()) { defined_in = md->getFileDef()->getOutputFileBase().data(); } else if (md->getNamespaceDef()) { defined_in = md->getNamespaceDef()->name().data(); } } printReferenceTo(type, signature, defined_in); } void protectionInformation(Protection protection) { if (protection == Protection::Public) { printProtection("public"); } else if (protection == Protection::Protected) { printProtection("protected"); } else if (protection == Protection::Private) { printProtection("private"); } else if (protection == Protection::Package) { printProtection("package"); } } void cModule(const ClassDef* cd) { const MemberList* ml = cd->getMemberList(MemberListType::VariableMembers()); if (ml) { const FileDef *fd = cd->getFileDef(); const MemberList *fd_ml = fd->getMemberList(MemberListType::AllMembersList()); if (!fd_ml || fd_ml->size() == 0) { printModule(fd->getOutputFileBase().data()); printDefines(); } for (const auto &md : *ml) { printDefinition("variable", cd->name().data() + std::string("::") + md->name().data(), md->getDefLine()); protectionInformation(md->protection()); } } } static bool checkOverrideArg(const ArgumentList &argList, const MemberDef *md) { if(!md->isFunction() || argList.empty()){ return false; } for (const Argument &argument : argList) { if(md->name() == argument.name) { return true; } } return false; } void functionInformation(const MemberDef* md) { std::string temp = ""; int size = md->getEndBodyLine() - md->getStartBodyLine() + 1; printNumberOfLines(size); const ArgumentList &argList = md->argumentList(); if (!argList.empty()) { temp = argumentData(argList.front()); // TODO: This is a workaround; better not include "void" in argList, in the first place. if (temp!="void") { printNumberOfArguments(argList.size()); } } printNumberOfConditionalPaths(md); auto refList = md->getReferencesMembers(); if (!refList.empty()) { printUses(); for (const auto &rmd : refList) { if (rmd->definitionType() == Definition::TypeMember && !ignoreStaticExternalCall(md, rmd) && !checkOverrideArg(argList, rmd)) { referenceTo(rmd); } } } } void prototypeInformation(const MemberDef* md) { printPrototypeYes(); const ArgumentList &argList = md->argumentList(); printNumberOfArguments(argList.size()); } static void lookupSymbol(const Definition *d) { if (d->definitionType() == Definition::TypeMember) { const MemberDef *md = dynamic_cast<const MemberDef*>(d); std::string type = md->memberTypeName().data(); std::string signature = functionSignature(md); printDefinition(type, signature, md->getDefLine()); protectionInformation(md->protection()); if (md->isFunction() && md->isPrototype()) { prototypeInformation(md); } else if (md->isFunction()) { functionInformation(md); } } } void listMembers(const MemberList *ml) { if (ml) { for (const auto &md : *ml) { lookupSymbol((Definition*) md); } } } void listAllMembers(const ClassDef* cd) { // methods listMembers(cd->getMemberList(MemberListType::FunctionMembers())); // constructors listMembers(cd->getMemberList(MemberListType::Constructors())); // attributes listMembers(cd->getMemberList(MemberListType::VariableMembers())); } static void classInformation(const ClassDef* cd) { if (is_c_code) { cModule(cd); } else { printModule(cd->name().data()); if (!cd->baseClasses().empty()) { printInherits(); for (const auto &bcd : cd->baseClasses()) { printInheritance(sanitizeString(bcd.classDef->name().data())); } } if(cd->isAbstract()) { printClassInformation("abstract class"); } printDefines(); listAllMembers(cd); } } static bool checkLanguage(std::string& filename, std::string extension) { if (filename.find(extension, filename.size() - extension.size()) != std::string::npos) { return true; } else { return false; } } /* Detects the programming language of the project. Actually, we only care * about whether it is a C project or not. */ static void detectProgrammingLanguage(FileNameLinkedMap &fnli) { for (const auto &fn : fnli) { std::string filename = fn->fileName().str(); if ( checkLanguage(filename, ".cc") || checkLanguage(filename, ".cxx") || checkLanguage(filename, ".cpp") || checkLanguage(filename, ".java") || checkLanguage(filename, ".py") || checkLanguage(filename, ".pyw") || checkLanguage(filename, ".cs") ) { is_c_code = false; } } } static void listSymbols() { detectProgrammingLanguage(*Doxygen::inputNameLinkedMap); // iterate over the input files for (const auto &fn : *Doxygen::inputNameLinkedMap) { for (const auto &fd : *fn) { printFile(fd->absFilePath().data()); MemberList *ml = fd->getMemberList(MemberListType::AllMembersList()); if (ml && ml->size() > 0) { printModule(fd->getOutputFileBase().data()); printDefines(); listMembers(ml); } ClassDefSet visitedClasses; for (const auto &cd : fd->getClasses()) { if (visitedClasses.find(cd)==visitedClasses.end()) { classInformation(cd); visitedClasses.insert(cd); } } } } // TODO print external symbols referenced } int main(int argc,char **argv) { int locArgc = argc; if (locArgc == 2) { if (!strcmp(argv[1],"--help")) { printf("Usage: %s [source_file | source_dir]\n",argv[0]); exit(0); } else if (!strcmp(argv[1],"--version")) { printf("%s version: %s\n",argv[0],getFullVersion().c_str()); exit(0); } } if (locArgc!=2) { printf("Usage: %s [source_file | source_dir]\n",argv[0]); exit(1); } // initialize data structures initDoxygen(); // check and finalize the configuration checkConfiguration(); adjustConfiguration(); // setup the non-default configuration options // we need a place to put intermediate files std::ostringstream tmpdir; unsigned int pid = Portable::pid(); if (!Portable::getenv("TMP").isEmpty()) tmpdir << Portable::getenv("TMP") << "/doxyparse-" << pid; else if (!Portable::getenv("TEMP").isEmpty()) tmpdir << Portable::getenv("TEMP") << "/doxyparse-" << pid; else tmpdir << "doxyparse-" << pid; Config_updateString(OUTPUT_DIRECTORY,tmpdir.str().c_str()); // enable HTML (fake) output to omit warning about missing output format Config_updateBool(GENERATE_HTML,TRUE); // disable latex output Config_updateBool(GENERATE_LATEX,FALSE); // be quiet Config_updateBool(QUIET,TRUE); // turn off warnings Config_updateBool(WARNINGS,FALSE); Config_updateBool(WARN_IF_UNDOCUMENTED,FALSE); Config_updateBool(WARN_IF_DOC_ERROR,FALSE); Config_updateBool(WARN_IF_UNDOC_ENUM_VAL,FALSE); // Extract as much as possible Config_updateBool(EXTRACT_ALL,TRUE); Config_updateBool(EXTRACT_STATIC,TRUE); Config_updateBool(EXTRACT_PRIVATE,TRUE); Config_updateBool(EXTRACT_LOCAL_METHODS,TRUE); Config_updateBool(EXTRACT_PACKAGE,TRUE); // Extract source browse information, needed // to make doxygen gather the cross reference info Config_updateBool(SOURCE_BROWSER,TRUE); // find functions call between modules Config_updateBool(CALL_GRAPH,TRUE); // loop recursive over input files Config_updateBool(RECURSIVE,TRUE); // add file extensions Config_updateList(FILE_PATTERNS, { "*.cc", "*.cxx", "*.cpp", "*.java", "*.py", "*.pyw", "*.cs", "*.c", "*.h", "*.hh", "*.hpp"}); // set the input StringVector inputList; for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-") == 0) { char filename[1024]; while (1) { (void)scanf("%s[^\n]", filename); if (feof(stdin)) { break; } inputList.push_back(filename); } } else { inputList.push_back(argv[i]); } } Config_updateList(INPUT,inputList); if (inputList.empty()) { exit(0); } // parse the files parseInput(); // iterate over the input files for (const auto &fn : *Doxygen::inputNameLinkedMap) { for (const auto &fd : *fn) { // get the references (linked and unlinked) found in this file findXRefSymbols(fd.get()); } } Dir thisDir; // remove temporary files if (!Doxygen::filterDBFileName.isEmpty()) thisDir.remove(Doxygen::filterDBFileName.str()); // clean up after us thisDir.rmdir(Config_getString(OUTPUT_DIRECTORY).str()); startYamlDocument(); listSymbols(); std::string cleanup_command = "rm -rf "; cleanup_command += tmpdir.str(); (void)system(cleanup_command.c_str()); exit(0); }
16,646
C++
.cpp
492
29.792683
136
0.664079
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,511
lodepng.cpp
doxygen_doxygen/deps/liblodepng/lodepng.cpp
/* LodePNG version 20080927 Copyright (c) 2005-2008 Lode Vandevenne This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* The manual and changelog can be found in the header file "lodepng.h" You are free to name this file lodepng.cpp or lodepng.c depending on your usage. */ #include "lodepng.h" #define USE_BRUTE_FORCE_ENCODING 1 #define VERSION_STRING "20080927" /* ////////////////////////////////////////////////////////////////////////// */ /* / Tools For C / */ /* ////////////////////////////////////////////////////////////////////////// */ /* About these tools (vector, uivector, ucvector and string): -LodePNG was originally written in C++. The vectors replace the std::vectors that were used in the C++ version. -The string tools are made to avoid problems with compilers that declare things like strncat as deprecated. -They're not used in the interface, only internally in this file, so all their functions are made static. */ //-------------------------------------------------------------------------------------------- /*LodePNG_chunk functions: These functions need as input a large enough amount of allocated memory.*/ static unsigned LodePNG_chunk_length(const unsigned char* chunk); /*get the length of the data of the chunk. Total chunk length has 12 bytes more.*/ static void LodePNG_chunk_generate_crc(unsigned char* chunk); /*generates the correct CRC from the data and puts it in the last 4 bytes of the chunk*/ /*add chunks to out buffer. It reallocs the buffer to append the data. returns error code*/ static unsigned LodePNG_create_chunk(unsigned char** out, size_t* outlength, unsigned length, const char* type, const unsigned char* data); /*appends new chunk to out. Returns pointer to start of appended chunk, or NULL if error happened; may change memory address of out buffer*/ static void LodePNG_InfoColor_init(LodePNG_InfoColor* info); static void LodePNG_InfoColor_cleanup(LodePNG_InfoColor* info); static unsigned LodePNG_InfoColor_copy(LodePNG_InfoColor* dest, const LodePNG_InfoColor* source); /*Use these functions instead of allocating palette manually*/ static void LodePNG_InfoColor_clearPalette(LodePNG_InfoColor* info); /*additional color info*/ static unsigned LodePNG_InfoColor_getBpp(const LodePNG_InfoColor* info); /*bits per pixel*/ static unsigned LodePNG_InfoColor_isGreyscaleType(const LodePNG_InfoColor* info); /*is it a greyscale type? (colorType 0 or 4)*/ static unsigned LodePNG_InfoColor_isAlphaType(const LodePNG_InfoColor* info); /*has it an alpha channel? (colorType 2 or 6)*/ static void LodePNG_InfoPng_init(LodePNG_InfoPng* info); static void LodePNG_InfoPng_cleanup(LodePNG_InfoPng* info); static unsigned LodePNG_InfoPng_copy(LodePNG_InfoPng* dest, const LodePNG_InfoPng* source); static void LodePNG_InfoRaw_init(LodePNG_InfoRaw* info); static void LodePNG_InfoRaw_cleanup(LodePNG_InfoRaw* info); static unsigned LodePNG_InfoRaw_copy(LodePNG_InfoRaw* dest, const LodePNG_InfoRaw* source); /* LodePNG_convert: Converts from any color type to 24-bit or 32-bit (later maybe more supported). return value = LodePNG error code The out buffer must have (w * h * bpp + 7) / 8, where bpp is the bits per pixel of the output color type (LodePNG_InfoColor_getBpp) */ static unsigned LodePNG_convert(unsigned char* out, const unsigned char* in, LodePNG_InfoColor* infoOut, LodePNG_InfoColor* infoIn, unsigned w, unsigned h); static void LodeZlib_DeflateSettings_init(LodeZlib_DeflateSettings* settings); /* ////////////////////////////////////////////////////////////////////////// */ /* LodeFlate & LodeZlib */ /* ////////////////////////////////////////////////////////////////////////// */ /*This function reallocates the out buffer and appends the data. Either, *out must be NULL and *outsize must be 0, or, *out must be a valid buffer and *outsize its size in bytes.*/ //unsigned LodeZlib_compress(unsigned char** out, size_t* outsize, const unsigned char* in, size_t insize, const LodeZlib_DeflateSettings* settings); //-------------------------------------------------------------------------------------------- typedef struct vector /*this one is used only by the deflate compressor*/ { void* data; size_t size; /*in groups of bytes depending on type*/ size_t allocsize; /*in bytes*/ unsigned typesize; /*sizeof the type you store in data*/ } vector; static unsigned vector_resize(vector* p, size_t size) /*returns 1 if success, 0 if failure ==> nothing done*/ { if(size * p->typesize > p->allocsize) { size_t newsize = size * p->typesize * 2; void* data = realloc(p->data, newsize); if(data) { p->allocsize = newsize; p->data = data; p->size = size; } else return 0; } else p->size = size; return 1; } static unsigned vector_resized(vector* p, size_t size, void dtor(void*)) /*resize and use destructor on elements if it gets smaller*/ { size_t i; if(size < p->size) for(i = size; i < p->size; i++) dtor(&((char*)(p->data))[i * p->typesize]); return vector_resize(p, size); } static void vector_cleanup(void* p) { ((vector*)p)->size = ((vector*)p)->allocsize = 0; free(((vector*)p)->data); ((vector*)p)->data = NULL; } static void vector_cleanupd(vector* p, void dtor(void*)) /*clear and use destructor on elements*/ { vector_resized(p, 0, dtor); vector_cleanup(p); } static void vector_init(vector* p, unsigned typesize) { p->data = NULL; p->size = p->allocsize = 0; p->typesize = typesize; } static void vector_swap(vector* p, vector* q) /*they're supposed to have the same typesize*/ { size_t tmp; void* tmpp; tmp = p->size; p->size = q->size; q->size = tmp; tmp = p->allocsize; p->allocsize = q->allocsize; q->allocsize = tmp; tmpp = p->data; p->data = q->data; q->data = tmpp; } static void* vector_get(vector* p, size_t index) { return &((char*)p->data)[index * p->typesize]; } /* /////////////////////////////////////////////////////////////////////////// */ typedef struct uivector { unsigned* data; size_t size; /*size in number of unsigned longs*/ size_t allocsize; /*allocated size in bytes*/ } uivector; static void uivector_cleanup(void* p) { ((uivector*)p)->size = ((uivector*)p)->allocsize = 0; free(((uivector*)p)->data); ((uivector*)p)->data = NULL; } static unsigned uivector_resize(uivector* p, size_t size) /*returns 1 if success, 0 if failure ==> nothing done*/ { if(size * sizeof(unsigned) > p->allocsize) { size_t newsize = size * sizeof(unsigned) * 2; void* data = realloc(p->data, newsize); if(data) { p->allocsize = newsize; p->data = (unsigned*)data; p->size = size; } else return 0; } else p->size = size; return 1; } static unsigned uivector_resizev(uivector* p, size_t size, unsigned value) /*resize and give all new elements the value*/ { size_t oldsize = p->size, i; if(!uivector_resize(p, size)) return 0; for(i = oldsize; i < size; i++) p->data[i] = value; return 1; } static void uivector_init(uivector* p) { p->data = NULL; p->size = p->allocsize = 0; } static unsigned uivector_push_back(uivector* p, unsigned c) /*returns 1 if success, 0 if failure ==> nothing done*/ { if(!uivector_resize(p, p->size + 1)) return 0; p->data[p->size - 1] = c; return 1; } static unsigned uivector_copy(uivector* p, const uivector* q) /*copy q to p, returns 1 if success, 0 if failure ==> nothing done*/ { size_t i; if(!uivector_resize(p, q->size)) return 0; for(i = 0; i < q->size; i++) p->data[i] = q->data[i]; return 1; } static void uivector_swap(uivector* p, uivector* q) { size_t tmp; unsigned* tmpp; tmp = p->size; p->size = q->size; q->size = tmp; tmp = p->allocsize; p->allocsize = q->allocsize; q->allocsize = tmp; tmpp = p->data; p->data = q->data; q->data = tmpp; } /* /////////////////////////////////////////////////////////////////////////// */ typedef struct ucvector { unsigned char* data; size_t size; /*used size*/ size_t allocsize; /*allocated size*/ } ucvector; static void ucvector_cleanup(void* p) { ((ucvector*)p)->size = ((ucvector*)p)->allocsize = 0; free(((ucvector*)p)->data); ((ucvector*)p)->data = NULL; } static unsigned ucvector_resize(ucvector* p, size_t size) /*returns 1 if success, 0 if failure ==> nothing done*/ { if(size * sizeof(unsigned) > p->allocsize) { size_t newsize = size * sizeof(unsigned) * 2; void* data = realloc(p->data, newsize); if(data) { p->allocsize = newsize; p->data = (unsigned char*)data; p->size = size; } else return 0; /*error: not enough memory*/ } else p->size = size; return 1; } static void ucvector_init(ucvector* p) { p->data = NULL; p->size = p->allocsize = 0; } /*you can both convert from vector to buffer&size and vica versa*/ static void ucvector_init_buffer(ucvector* p, unsigned char* buffer, size_t size) { p->data = buffer; p->allocsize = p->size = size; } static unsigned ucvector_push_back(ucvector* p, unsigned char c) /*returns 1 if success, 0 if failure ==> nothing done*/ { if(!ucvector_resize(p, p->size + 1)) return 0; p->data[p->size - 1] = c; return 1; } /* ////////////////////////////////////////////////////////////////////////// */ /* / Reading and writing single bits and bytes from/to stream for Deflate / */ /* ////////////////////////////////////////////////////////////////////////// */ static void addBitToStream(size_t* bitpointer, ucvector* bitstream, unsigned char bit) { if((*bitpointer) % 8 == 0) ucvector_push_back(bitstream, 0); /*add a new byte at the end*/ (bitstream->data[bitstream->size - 1]) |= (bit << ((*bitpointer) & 0x7)); /*earlier bit of huffman code is in a lesser significant bit of an earlier byte*/ (*bitpointer)++; } static void addBitsToStream(size_t* bitpointer, ucvector* bitstream, unsigned value, size_t nbits) { size_t i; for(i = 0; i < nbits; i++) addBitToStream(bitpointer, bitstream, (unsigned char)((value >> i) & 1)); } static void addBitsToStreamReversed(size_t* bitpointer, ucvector* bitstream, unsigned value, size_t nbits) { size_t i; for(i = 0; i < nbits; i++) addBitToStream(bitpointer, bitstream, (unsigned char)((value >> (nbits - 1 - i)) & 1)); } /* ////////////////////////////////////////////////////////////////////////// */ /* / Deflate - Huffman / */ /* ////////////////////////////////////////////////////////////////////////// */ #define FIRST_LENGTH_CODE_INDEX 257 #define LAST_LENGTH_CODE_INDEX 285 #define NUM_DEFLATE_CODE_SYMBOLS 288 /*256 literals, the end code, some length codes, and 2 unused codes*/ #define NUM_DISTANCE_SYMBOLS 32 /*the distance codes have their own symbols, 30 used, 2 unused*/ #define NUM_CODE_LENGTH_CODES 19 /*the code length codes. 0-15: code lengths, 16: copy previous 3-6 times, 17: 3-10 zeros, 18: 11-138 zeros*/ static const unsigned LENGTHBASE[29] /*the base lengths represented by codes 257-285*/ = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; static const unsigned LENGTHEXTRA[29] /*the extra bits used by codes 257-285 (added to base length)*/ = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; static const unsigned DISTANCEBASE[30] /*the base backwards distances (the bits of distance codes appear after length codes and use their own huffman tree)*/ = {1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; static const unsigned DISTANCEEXTRA[30] /*the extra bits of backwards distances (added to base)*/ = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; static const unsigned CLCL[NUM_CODE_LENGTH_CODES] /*the order in which "code length alphabet code lengths" are stored, out of this the huffman tree of the dynamic huffman tree lengths is generated*/ = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; /* /////////////////////////////////////////////////////////////////////////// */ /*terminology used for the package-merge algorithm and the coin collector's problem*/ typedef struct Coin /*a coin can be multiple coins (when they're merged)*/ { uivector symbols; float weight; /*the sum of all weights in this coin*/ } Coin; static void Coin_init(Coin* c) { uivector_init(&c->symbols); } static void Coin_cleanup(void* c) /*void* so that this dtor can be given as function pointer to the vector resize function*/ { uivector_cleanup(&((Coin*)c)->symbols); } static void Coin_copy(Coin* c1, const Coin* c2) { c1->weight = c2->weight; uivector_copy(&c1->symbols, &c2->symbols); } static void addCoins(Coin* c1, const Coin* c2) { unsigned i; for(i = 0; i < c2->symbols.size; i++) uivector_push_back(&c1->symbols, c2->symbols.data[i]); c1->weight += c2->weight; } static void Coin_sort(Coin* data, size_t amount) /*combsort*/ { size_t gap = amount; unsigned char swapped = 0; while(gap > 1 || swapped) { size_t i; gap = (gap * 10) / 13; /*shrink factor 1.3*/ if(gap == 9 || gap == 10) gap = 11; /*combsort11*/ if(gap < 1) gap = 1; swapped = 0; for(i = 0; i < amount - gap; i++) { size_t j = i + gap; if(data[j].weight < data[i].weight) { float temp = data[j].weight; data[j].weight = data[i].weight; data[i].weight = temp; uivector_swap(&data[i].symbols, &data[j].symbols); swapped = 1; } } } } typedef struct HuffmanTree { uivector tree2d; uivector tree1d; uivector lengths; /*the lengths of the codes of the 1d-tree*/ unsigned maxbitlen; /*maximum number of bits a single code can get*/ unsigned numcodes; /*number of symbols in the alphabet = number of codes*/ } HuffmanTree; /*function used for debug purposes*/ /*#include <iostream> static void HuffmanTree_draw(HuffmanTree* tree) { std::cout << "tree. length: " << tree->numcodes << " maxbitlen: " << tree->maxbitlen << std::endl; for(size_t i = 0; i < tree->tree1d.size; i++) { if(tree->lengths.data[i]) std::cout << i << " " << tree->tree1d.data[i] << " " << tree->lengths.data[i] << std::endl; } std::cout << std::endl; }*/ static void HuffmanTree_init(HuffmanTree* tree) { uivector_init(&tree->tree2d); uivector_init(&tree->tree1d); uivector_init(&tree->lengths); } static void HuffmanTree_cleanup(HuffmanTree* tree) { uivector_cleanup(&tree->tree2d); uivector_cleanup(&tree->tree1d); uivector_cleanup(&tree->lengths); } /*the tree representation used by the decoder. return value is error*/ static unsigned HuffmanTree_make2DTree(HuffmanTree* tree) { unsigned nodefilled = 0; /*up to which node it is filled*/ unsigned treepos = 0; /*position in the tree (1 of the numcodes columns)*/ unsigned n, i; if(!uivector_resize(&tree->tree2d, tree->numcodes * 2)) return 9901; /*if failed return not enough memory error*/ /*convert tree1d[] to tree2d[][]. In the 2D array, a value of 32767 means uninited, a value >= numcodes is an address to another bit, a value < numcodes is a code. The 2 rows are the 2 possible bit values (0 or 1), there are as many columns as codes - 1 a good huffman tree has N * 2 - 1 nodes, of which N - 1 are internal nodes. Here, the internal nodes are stored (what their 0 and 1 option point to). There is only memory for such good tree currently, if there are more nodes (due to too long length codes), error 55 will happen*/ for(n = 0; n < tree->numcodes * 2; n++) tree->tree2d.data[n] = 32767; /*32767 here means the tree2d isn't filled there yet*/ for(n = 0; n < tree->numcodes; n++) /*the codes*/ for(i = 0; i < tree->lengths.data[n]; i++) /*the bits for this code*/ { unsigned char bit = (unsigned char)((tree->tree1d.data[n] >> (tree->lengths.data[n] - i - 1)) & 1); if(treepos > tree->numcodes - 2) return 55; /*error 55: oversubscribed; see description in header*/ if(tree->tree2d.data[2 * treepos + bit] == 32767) /*not yet filled in*/ { if(i + 1 == tree->lengths.data[n]) /*last bit*/ { tree->tree2d.data[2 * treepos + bit] = n; /*put the current code in it*/ treepos = 0; } else /*put address of the next step in here, first that address has to be found of course (it's just nodefilled + 1)...*/ { nodefilled++; tree->tree2d.data[2 * treepos + bit] = nodefilled + tree->numcodes; /*addresses encoded with numcodes added to it*/ treepos = nodefilled; } } else treepos = tree->tree2d.data[2 * treepos + bit] - tree->numcodes; } for(n = 0; n < tree->numcodes * 2; n++) if(tree->tree2d.data[n] == 32767) tree->tree2d.data[n] = 0; /*remove possible remaining 32767's*/ return 0; } static unsigned HuffmanTree_makeFromLengths2(HuffmanTree* tree) /*given that numcodes, lengths and maxbitlen are already filled in correctly. return value is error.*/ { uivector blcount; uivector nextcode; unsigned bits, n, error = 0; uivector_init(&blcount); uivector_init(&nextcode); if(!uivector_resize(&tree->tree1d, tree->numcodes) || !uivector_resizev(&blcount, tree->maxbitlen + 1, 0) || !uivector_resizev(&nextcode, tree->maxbitlen + 1, 0)) error = 9902; if(!error) { /*step 1: count number of instances of each code length*/ for(bits = 0; bits < tree->numcodes; bits++) blcount.data[tree->lengths.data[bits]]++; /*step 2: generate the nextcode values*/ for(bits = 1; bits <= tree->maxbitlen; bits++) nextcode.data[bits] = (nextcode.data[bits - 1] + blcount.data[bits - 1]) << 1; /*step 3: generate all the codes*/ for(n = 0; n < tree->numcodes; n++) if(tree->lengths.data[n] != 0) tree->tree1d.data[n] = nextcode.data[tree->lengths.data[n]]++; } uivector_cleanup(&blcount); uivector_cleanup(&nextcode); if(!error) return HuffmanTree_make2DTree(tree); else return error; } /*given the code lengths (as stored in the PNG file), generate the tree as defined by Deflate. maxbitlen is the maximum bits that a code in the tree can have. return value is error.*/ static unsigned HuffmanTree_makeFromLengths(HuffmanTree* tree, const unsigned* bitlen, size_t numcodes, unsigned maxbitlen) { unsigned i; if(!uivector_resize(&tree->lengths, numcodes)) return 9903; for(i = 0; i < numcodes; i++) tree->lengths.data[i] = bitlen[i]; tree->numcodes = (unsigned)numcodes; /*number of symbols*/ tree->maxbitlen = maxbitlen; return HuffmanTree_makeFromLengths2(tree); } static unsigned HuffmanTree_fillInCoins(vector* coins, const unsigned* frequencies, unsigned numcodes, size_t sum) { unsigned i; for(i = 0; i < numcodes; i++) { Coin* coin; if(frequencies[i] == 0) continue; /*it's important to exclude symbols that aren't present*/ if(!vector_resize(coins, coins->size + 1)) { vector_cleanup(coins); return 9904; } coin = (Coin*)(vector_get(coins, coins->size - 1)); Coin_init(coin); coin->weight = frequencies[i] / (float)sum; uivector_push_back(&coin->symbols, i); } if(coins->size) Coin_sort((Coin*)coins->data, coins->size); return 0; } static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigned* frequencies, size_t numcodes, unsigned maxbitlen) { unsigned i, j; size_t sum = 0, numpresent = 0; unsigned error = 0; vector prev_row; /*type Coin, the previous row of coins*/ vector coins; /*type Coin, the coins of the currently calculated row*/ tree->maxbitlen = maxbitlen; for(i = 0; i < numcodes; i++) { if(frequencies[i] > 0) { numpresent++; sum += frequencies[i]; } } if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/ tree->numcodes = (unsigned)numcodes; /*number of symbols*/ if (!uivector_resize(&tree->lengths, 0)) return 9955; if(!uivector_resizev(&tree->lengths, tree->numcodes, 0)) return 9905; if(numpresent == 0) /*there are no symbols at all, in that case add one symbol of value 0 to the tree (see RFC 1951 section 3.2.7) */ { tree->lengths.data[0] = 1; return HuffmanTree_makeFromLengths2(tree); } else if(numpresent == 1) /*the package merge algorithm gives wrong results if there's only one symbol (theoretically 0 bits would then suffice, but we need a proper symbol for zlib)*/ { for(i = 0; i < numcodes; i++) if(frequencies[i]) tree->lengths.data[i] = 1; return HuffmanTree_makeFromLengths2(tree); } vector_init(&coins, sizeof(Coin)); vector_init(&prev_row, sizeof(Coin)); /*Package-Merge algorithm represented by coin collector's problem For every symbol, maxbitlen coins will be created*/ /*first row, lowest denominator*/ error = HuffmanTree_fillInCoins(&coins, frequencies, tree->numcodes, sum); if(!error) { for(j = 1; j <= maxbitlen && !error; j++) /*each of the remaining rows*/ { vector_swap(&coins, &prev_row); /*swap instead of copying*/ if(!vector_resized(&coins, 0, Coin_cleanup)) { error = 9906; break; } for(i = 0; i + 1 < prev_row.size; i += 2) { if(!vector_resize(&coins, coins.size + 1)) { error = 9907; break; } Coin_init((Coin*)vector_get(&coins, coins.size - 1)); Coin_copy((Coin*)vector_get(&coins, coins.size - 1), (Coin*)vector_get(&prev_row, i)); addCoins((Coin*)vector_get(&coins, coins.size - 1), (Coin*)vector_get(&prev_row, i + 1)); /*merge the coins into packages*/ } if(j < maxbitlen) { error = HuffmanTree_fillInCoins(&coins, frequencies, tree->numcodes, sum); } } } if(!error) { /*keep the coins with lowest weight, so that they add up to the amount of symbols - 1*/ vector_resized(&coins, numpresent - 1, Coin_cleanup); /*calculate the lengths of each symbol, as the amount of times a coin of each symbol is used*/ for(i = 0; i < coins.size; i++) { Coin* coin = (Coin*)vector_get(&coins, i); for(j = 0; j < coin->symbols.size; j++) tree->lengths.data[coin->symbols.data[j]]++; } error = HuffmanTree_makeFromLengths2(tree); } vector_cleanupd(&coins, Coin_cleanup); vector_cleanupd(&prev_row, Coin_cleanup); return error; } static unsigned HuffmanTree_getCode(const HuffmanTree* tree, unsigned index) { return tree->tree1d.data[index]; } static unsigned HuffmanTree_getLength(const HuffmanTree* tree, unsigned index) { return tree->lengths.data[index]; } /*get the tree of a deflated block with fixed tree, as specified in the deflate specification*/ static unsigned generateFixedTree(HuffmanTree* tree) { unsigned i, error = 0; uivector bitlen; uivector_init(&bitlen); if(!uivector_resize(&bitlen, NUM_DEFLATE_CODE_SYMBOLS)) error = 9909; if(!error) { /*288 possible codes: 0-255=literals, 256=endcode, 257-285=lengthcodes, 286-287=unused*/ for(i = 0; i <= 143; i++) bitlen.data[i] = 8; for(i = 144; i <= 255; i++) bitlen.data[i] = 9; for(i = 256; i <= 279; i++) bitlen.data[i] = 7; for(i = 280; i <= 287; i++) bitlen.data[i] = 8; error = HuffmanTree_makeFromLengths(tree, bitlen.data, NUM_DEFLATE_CODE_SYMBOLS, 15); } uivector_cleanup(&bitlen); return error; } static unsigned generateDistanceTree(HuffmanTree* tree) { unsigned i, error = 0; uivector bitlen; uivector_init(&bitlen); if(!uivector_resize(&bitlen, NUM_DISTANCE_SYMBOLS)) error = 9910; /*there are 32 distance codes, but 30-31 are unused*/ if(!error) { for(i = 0; i < NUM_DISTANCE_SYMBOLS; i++) bitlen.data[i] = 5; error = HuffmanTree_makeFromLengths(tree, bitlen.data, NUM_DISTANCE_SYMBOLS, 15); } uivector_cleanup(&bitlen); return error; } /* ////////////////////////////////////////////////////////////////////////// */ /* / Deflator / */ /* ////////////////////////////////////////////////////////////////////////// */ static const size_t MAX_SUPPORTED_DEFLATE_LENGTH = 258; /*bitlen is the size in bits of the code*/ static void addHuffmanSymbol(size_t* bp, ucvector* compressed, unsigned code, unsigned bitlen) { addBitsToStreamReversed(bp, compressed, code, bitlen); } /*search the index in the array, that has the largest value smaller than or equal to the given value, given array must be sorted (if no value is smaller, it returns the size of the given array)*/ static size_t searchCodeIndex(const unsigned* array, size_t array_size, size_t value) { /*linear search implementation*/ /*for(size_t i = 1; i < array_size; i++) if(array[i] > value) return i - 1; return array_size - 1;*/ /*binary search implementation (not that much faster) (precondition: array_size > 0)*/ size_t left = 1; size_t right = array_size - 1; while(left <= right) { size_t mid = (left + right) / 2; if(array[mid] <= value) left = mid + 1; /*the value to find is more to the right*/ else if(array[mid - 1] > value) right = mid - 1; /*the value to find is more to the left*/ else return mid - 1; } return array_size - 1; } static void addLengthDistance(uivector* values, size_t length, size_t distance) { /*values in encoded vector are those used by deflate: 0-255: literal bytes 256: end 257-285: length/distance pair (length code, followed by extra length bits, distance code, extra distance bits) 286-287: invalid*/ unsigned length_code = (unsigned)searchCodeIndex(LENGTHBASE, 29, length); unsigned extra_length = (unsigned)(length - LENGTHBASE[length_code]); unsigned dist_code = (unsigned)searchCodeIndex(DISTANCEBASE, 30, distance); unsigned extra_distance = (unsigned)(distance - DISTANCEBASE[dist_code]); uivector_push_back(values, length_code + FIRST_LENGTH_CODE_INDEX); uivector_push_back(values, extra_length); uivector_push_back(values, dist_code); uivector_push_back(values, extra_distance); } #if USE_BRUTE_FORCE_ENCODING #define encodeLZ77 encodeLZ77_brute /*the "brute force" version of the encodeLZ7 algorithm, not used anymore, kept here for reference*/ static unsigned encodeLZ77_brute(uivector* out, const unsigned char* in, size_t size, unsigned windowSize) { size_t pos; /*using pointer instead of vector for input makes it faster when NOT using optimization when compiling; no influence if optimization is used*/ for(pos = 0; pos < size; pos++) { /*Phase 1: doxygen images often have long runs of the same color, try to find them*/ const int minLength = 4; // Minimum length for a run to make sense if(pos < size - minLength * 4) { size_t p, fp; size_t current_length; /*RGBA pixel run?*/ p = pos; fp = pos + 4; current_length = 0; while(fp < size && in[p] == in[fp] && current_length < MAX_SUPPORTED_DEFLATE_LENGTH) { ++p; ++fp; ++current_length; } if (current_length > (minLength - 1 ) * 4) /*worth using?*/ { uivector_push_back(out, in[pos ]); uivector_push_back(out, in[pos + 1]); uivector_push_back(out, in[pos + 2]); uivector_push_back(out, in[pos + 3]); addLengthDistance(out, current_length, 4); pos += current_length + 4 - 1; /*-1 for loop's pos++*/ continue; } /*RGB pixel run?*/ p = pos; fp = pos + 3; current_length = 0; while(fp < size && in[p] == in[fp] && current_length < MAX_SUPPORTED_DEFLATE_LENGTH) { ++p; ++fp; ++current_length; } if (current_length > (minLength - 1 ) * 3) /*worth using?*/ { uivector_push_back(out, in[pos ]); uivector_push_back(out, in[pos + 1]); uivector_push_back(out, in[pos + 2]); addLengthDistance(out, current_length, 3); pos += current_length + 3 - 1; /*-1 for loop's pos++*/ continue; } } size_t length = 0, offset = 0; /*the length and offset found for the current position*/ size_t max_offset = pos < windowSize ? pos : windowSize; /*how far back to test*/ size_t current_offset; /**search for the longest string**/ for(current_offset = 1; current_offset < max_offset; current_offset++) /*search backwards through all possible distances (=offsets)*/ { size_t backpos = pos - current_offset; if(in[backpos] == in[pos]) { /*test the next characters*/ size_t current_length = 1; size_t backtest = backpos + 1; size_t foretest = pos + 1; while(foretest < size && in[backtest] == in[foretest] && current_length < MAX_SUPPORTED_DEFLATE_LENGTH) /*maximum support length by deflate is max length*/ { if(backpos >= pos) backpos -= current_offset; /*continue as if we work on the decoded bytes after pos by jumping back before pos*/ current_length++; backtest++; foretest++; } if(current_length > length) { length = current_length; /*the longest length*/ offset = current_offset; /*the offset that is related to this longest length*/ if(current_length == MAX_SUPPORTED_DEFLATE_LENGTH) break; /*you can jump out of this for loop once a length of max length is found (gives significant speed gain)*/ } } } /**encode it as length/distance pair or literal value**/ if(length < 3) /*only lengths of 3 or higher are supported as length/distance pair*/ { uivector_push_back(out, in[pos]); } else { addLengthDistance(out, length, offset); pos += (length - 1); } } /*end of the loop through each character of input*/ return 0; } #endif /* static const unsigned HASH_NUM_VALUES = 65536; static const unsigned HASH_NUM_CHARACTERS = 6; static const unsigned HASH_SHIFT = 2; Good and fast values: HASH_NUM_VALUES=65536, HASH_NUM_CHARACTERS=6, HASH_SHIFT=2 making HASH_NUM_CHARACTERS larger (like 8), makes the file size larger but is a bit faster making HASH_NUM_CHARACTERS smaller (like 3), makes the file size smaller but is slower */ #if !defined(USE_BRUTE_FORCE_ENCODING) static unsigned getHash(const unsigned char* data, size_t size, size_t pos) { unsigned result = 0; size_t amount, i; if(pos >= size) return 0; amount = HASH_NUM_CHARACTERS; if(pos + amount >= size) amount = size - pos; for(i = 0; i < amount; i++) result ^= (data[pos + i] << (i * HASH_SHIFT)); return result % HASH_NUM_VALUES; } /*LZ77-encode the data using a hash table technique to let it encode faster. Return value is error code*/ static unsigned encodeLZ77(uivector* out, const unsigned char* in, size_t size, unsigned windowSize) { /**generate hash table**/ vector table; /*HASH_NUM_VALUES uivectors; this represents what would be an std::vector<std::vector<unsigned> > in C++*/ uivector tablepos1, tablepos2; unsigned pos, i, error = 0; vector_init(&table, sizeof(uivector)); if(!vector_resize(&table, HASH_NUM_VALUES)) return 9917; for(i = 0; i < HASH_NUM_VALUES; i++) { uivector* v = (uivector*)vector_get(&table, i); uivector_init(v); } /*remember start and end positions in the tables to searching in*/ uivector_init(&tablepos1); uivector_init(&tablepos2); if(!uivector_resizev(&tablepos1, HASH_NUM_VALUES, 0)) error = 9918; if(!uivector_resizev(&tablepos2, HASH_NUM_VALUES, 0)) error = 9919; if(!error) { for(pos = 0; pos < size; pos++) { unsigned length = 0, offset = 0; /*the length and offset found for the current position*/ unsigned max_offset = pos < windowSize ? pos : windowSize; /*how far back to test*/ unsigned tablepos; /*/search for the longest string*/ /*first find out where in the table to start (the first value that is in the range from "pos - max_offset" to "pos")*/ unsigned hash = getHash(in, size, pos); if(!uivector_push_back((uivector*)vector_get(&table, hash), pos)) { error = 9920; break; } while(((uivector*)vector_get(&table, hash))->data[tablepos1.data[hash]] < pos - max_offset) tablepos1.data[hash]++; /*it now points to the first value in the table for which the index is larger than or equal to pos - max_offset*/ while(((uivector*)vector_get(&table, hash))->data[tablepos2.data[hash]] < pos) tablepos2.data[hash]++; /*it now points to the first value in the table for which the index is larger than or equal to pos*/ for(tablepos = tablepos2.data[hash] - 1; tablepos >= tablepos1.data[hash] && tablepos < tablepos2.data[hash]; tablepos--) { unsigned backpos = ((uivector*)vector_get(&table, hash))->data[tablepos]; unsigned current_offset = pos - backpos; /*test the next characters*/ unsigned current_length = 0; unsigned backtest = backpos; unsigned foretest = pos; while(foretest < size && in[backtest] == in[foretest] && current_length < MAX_SUPPORTED_DEFLATE_LENGTH) /*maximum support length by deflate is max length*/ { if(backpos >= pos) backpos -= current_offset; /*continue as if we work on the decoded bytes after pos by jumping back before pos*/ current_length++; backtest++; foretest++; } if(current_length > length) { length = current_length; /*the longest length*/ offset = current_offset; /*the offset that is related to this longest length*/ if(current_length == MAX_SUPPORTED_DEFLATE_LENGTH) break; /*you can jump out of this for loop once a length of max length is found (gives significant speed gain)*/ } } /**encode it as length/distance pair or literal value**/ if(length < 3) /*only lengths of 3 or higher are supported as length/distance pair*/ { if(!uivector_push_back(out, in[pos])) { error = 9921; break; } } else { unsigned j; addLengthDistance(out, length, offset); for(j = 0; j < length - 1; j++) { pos++; if(!uivector_push_back((uivector*)vector_get(&table, getHash(in, size, pos)), pos)) { error = 9922; break; } } } } /*end of the loop through each character of input*/ } /*end of "if(!error)"*/ /*cleanup*/ for(i = 0; i < table.size; i++) { uivector* v = (uivector*)vector_get(&table, i); uivector_cleanup(v); } vector_cleanup(&table); uivector_cleanup(&tablepos1); uivector_cleanup(&tablepos2); return error; } #endif /* /////////////////////////////////////////////////////////////////////////// */ static unsigned deflateNoCompression(ucvector* out, const unsigned char* data, size_t datasize) { /*non compressed deflate block data: 1 bit BFINAL,2 bits BTYPE,(5 bits): it jumps to start of next byte, 2 bytes LEN, 2 bytes NLEN, LEN bytes literal DATA*/ size_t i, j, numdeflateblocks = datasize / 65536 + 1; unsigned datapos = 0; for(i = 0; i < numdeflateblocks; i++) { unsigned BFINAL, BTYPE, LEN, NLEN; unsigned char firstbyte; BFINAL = (i == numdeflateblocks - 1); BTYPE = 0; firstbyte = (unsigned char)(BFINAL + ((BTYPE & 1) << 1) + ((BTYPE & 2) << 1)); ucvector_push_back(out, firstbyte); LEN = 65535; if(datasize - datapos < 65535) LEN = (unsigned)datasize - datapos; NLEN = 65535 - LEN; ucvector_push_back(out, (unsigned char)(LEN % 256)); ucvector_push_back(out, (unsigned char)(LEN / 256)); ucvector_push_back(out, (unsigned char)(NLEN % 256)); ucvector_push_back(out, (unsigned char)(NLEN / 256)); /*Decompressed data*/ for(j = 0; j < 65535 && datapos < datasize; j++) { ucvector_push_back(out, data[datapos++]); } } return 0; } /*write the encoded data, using lit/len as well as distance codes*/ static void writeLZ77data(size_t* bp, ucvector* out, const uivector* lz77_encoded, const HuffmanTree* codes, const HuffmanTree* codesD) { size_t i = 0; for(i = 0; i < lz77_encoded->size; i++) { unsigned val = lz77_encoded->data[i]; addHuffmanSymbol(bp, out, HuffmanTree_getCode(codes, val), HuffmanTree_getLength(codes, val)); if(val > 256) /*for a length code, 3 more things have to be added*/ { unsigned length_index = val - FIRST_LENGTH_CODE_INDEX; unsigned n_length_extra_bits = LENGTHEXTRA[length_index]; unsigned length_extra_bits = lz77_encoded->data[++i]; unsigned distance_code = lz77_encoded->data[++i]; unsigned distance_index = distance_code; unsigned n_distance_extra_bits = DISTANCEEXTRA[distance_index]; unsigned distance_extra_bits = lz77_encoded->data[++i]; addBitsToStream(bp, out, length_extra_bits, n_length_extra_bits); addHuffmanSymbol(bp, out, HuffmanTree_getCode(codesD, distance_code), HuffmanTree_getLength(codesD, distance_code)); addBitsToStream(bp, out, distance_extra_bits, n_distance_extra_bits); } } } static unsigned deflateDynamic(ucvector* out, const unsigned char* data, size_t datasize, const LodeZlib_DeflateSettings* settings) { /* after the BFINAL and BTYPE, the dynamic block consists out of the following: - 5 bits HLIT, 5 bits HDIST, 4 bits HCLEN - (HCLEN+4)*3 bits code lengths of code length alphabet - HLIT + 257 code lengths of lit/length alphabet (encoded using the code length alphabet, + possible repetition codes 16, 17, 18) - HDIST + 1 code lengths of distance alphabet (encoded using the code length alphabet, + possible repetition codes 16, 17, 18) - compressed data - 256 (end code) */ unsigned error = 0; uivector lz77_encoded; HuffmanTree codes; /*tree for literal values and length codes*/ HuffmanTree codesD; /*tree for distance codes*/ HuffmanTree codelengthcodes; uivector frequencies; uivector frequenciesD; uivector amounts; /*the amounts in the "normal" order*/ uivector lldl; uivector lldll; /*lit/len & dist code lengths*/ uivector clcls; unsigned BFINAL = 1; /*make only one block... the first and final one*/ size_t numcodes, numcodesD, i, bp = 0; /*the bit pointer*/ unsigned HLIT, HDIST, HCLEN; uivector_init(&lz77_encoded); HuffmanTree_init(&codes); HuffmanTree_init(&codesD); HuffmanTree_init(&codelengthcodes); uivector_init(&frequencies); uivector_init(&frequenciesD); uivector_init(&amounts); uivector_init(&lldl); uivector_init(&lldll); uivector_init(&clcls); while(!error) /*the goto-avoiding while construct: break out to go to the cleanup phase, a break at the end makes sure the while is never repeated*/ { if(settings->useLZ77) { error = encodeLZ77(&lz77_encoded, data, datasize, settings->windowSize); /*LZ77 encoded*/ if(error) break; } else { if(!uivector_resize(&lz77_encoded, datasize)) { error = 9923; break; } for(i = 0; i < datasize; i++) lz77_encoded.data[i] = data[i]; /*no LZ77, but still will be Huffman compressed*/ } if(!uivector_resizev(&frequencies, 286, 0)) { error = 9924; break; } if(!uivector_resizev(&frequenciesD, 30, 0)) { error = 9925; break; } for(i = 0; i < lz77_encoded.size; i++) { unsigned symbol = lz77_encoded.data[i]; frequencies.data[symbol]++; if(symbol > 256) { unsigned dist = lz77_encoded.data[i + 2]; frequenciesD.data[dist]++; i += 3; } } frequencies.data[256] = 1; /*there will be exactly 1 end code, at the end of the block*/ error = HuffmanTree_makeFromFrequencies(&codes, frequencies.data, frequencies.size, 15); if(error) break; error = HuffmanTree_makeFromFrequencies(&codesD, frequenciesD.data, frequenciesD.size, 15); if(error) break; addBitToStream(&bp, out, BFINAL); addBitToStream(&bp, out, 0); /*first bit of BTYPE "dynamic"*/ addBitToStream(&bp, out, 1); /*second bit of BTYPE "dynamic"*/ numcodes = codes.numcodes; if(numcodes > 286) numcodes = 286; numcodesD = codesD.numcodes; if(numcodesD > 30) numcodesD = 30; for(i = 0; i < numcodes; i++) uivector_push_back(&lldll, HuffmanTree_getLength(&codes, (unsigned)i)); for(i = 0; i < numcodesD; i++) uivector_push_back(&lldll, HuffmanTree_getLength(&codesD, (unsigned)i)); /*make lldl smaller by using repeat codes 16 (copy length 3-6 times), 17 (3-10 zeros), 18 (11-138 zeros)*/ for(i = 0; i < (unsigned)lldll.size; i++) { unsigned j = 0; while(i + j + 1 < (unsigned)lldll.size && lldll.data[i + j + 1] == lldll.data[i]) j++; if(lldll.data[i] == 0 && j >= 2) { j++; /*include the first zero*/ if(j <= 10) { uivector_push_back(&lldl, 17); uivector_push_back(&lldl, j - 3); } else { if(j > 138) j = 138; uivector_push_back(&lldl, 18); uivector_push_back(&lldl, j - 11); } i += (j - 1); } else if(j >= 3) { size_t k; unsigned num = j / 6, rest = j % 6; uivector_push_back(&lldl, lldll.data[i]); for(k = 0; k < num; k++) { uivector_push_back(&lldl, 16); uivector_push_back(&lldl, 6 - 3); } if(rest >= 3) { uivector_push_back(&lldl, 16); uivector_push_back(&lldl, rest - 3); } else j -= rest; i += j; } else uivector_push_back(&lldl, lldll.data[i]); } /*generate huffmantree for the length codes of lit/len and dist codes*/ if(!uivector_resizev(&amounts, 19, 0)) { error = 9926; break; } /*16 possible lengths (0-15) and 3 repeat codes (16, 17 and 18)*/ for(i = 0; i < lldl.size; i++) { amounts.data[lldl.data[i]]++; if(lldl.data[i] >= 16) i++; /*after a repeat code come the bits that specify the amount, those don't need to be in the amounts calculation*/ } error = HuffmanTree_makeFromFrequencies(&codelengthcodes, amounts.data, amounts.size, 7); if(error) break; if(!uivector_resize(&clcls, 19)) { error = 9927; break; } for(i = 0; i < 19; i++) clcls.data[i] = HuffmanTree_getLength(&codelengthcodes, CLCL[i]); /*lengths of code length tree is in the order as specified by deflate*/ while(clcls.data[clcls.size - 1] == 0 && clcls.size > 4) { if(!uivector_resize(&clcls, clcls.size - 1)) { error = 9928; break; } /*remove zeros at the end, but minimum size must be 4*/ } if(error) break; /*write the HLIT, HDIST and HCLEN values*/ HLIT = (unsigned)(numcodes - 257); HDIST = (unsigned)(numcodesD - 1); HCLEN = (unsigned)clcls.size - 4; addBitsToStream(&bp, out, HLIT, 5); addBitsToStream(&bp, out, HDIST, 5); addBitsToStream(&bp, out, HCLEN, 4); /*write the code lengths of the code length alphabet*/ for(i = 0; i < HCLEN + 4; i++) addBitsToStream(&bp, out, clcls.data[i], 3); /*write the lengths of the lit/len AND the dist alphabet*/ for(i = 0; i < lldl.size; i++) { addHuffmanSymbol(&bp, out, HuffmanTree_getCode(&codelengthcodes, lldl.data[i]), HuffmanTree_getLength(&codelengthcodes, lldl.data[i])); /*extra bits of repeat codes*/ if(lldl.data[i] == 16) addBitsToStream(&bp, out, lldl.data[++i], 2); else if(lldl.data[i] == 17) addBitsToStream(&bp, out, lldl.data[++i], 3); else if(lldl.data[i] == 18) addBitsToStream(&bp, out, lldl.data[++i], 7); } /*write the compressed data symbols*/ writeLZ77data(&bp, out, &lz77_encoded, &codes, &codesD); if(HuffmanTree_getLength(&codes, 256) == 0) { error = 64; break; } /*the length of the end code 256 must be larger than 0*/ addHuffmanSymbol(&bp, out, HuffmanTree_getCode(&codes, 256), HuffmanTree_getLength(&codes, 256)); /*end code*/ break; /*end of error-while*/ } /*cleanup*/ uivector_cleanup(&lz77_encoded); HuffmanTree_cleanup(&codes); HuffmanTree_cleanup(&codesD); HuffmanTree_cleanup(&codelengthcodes); uivector_cleanup(&frequencies); uivector_cleanup(&frequenciesD); uivector_cleanup(&amounts); uivector_cleanup(&lldl); uivector_cleanup(&lldll); uivector_cleanup(&clcls); return error; } static unsigned deflateFixed(ucvector* out, const unsigned char* data, size_t datasize, const LodeZlib_DeflateSettings* settings) { HuffmanTree codes; /*tree for literal values and length codes*/ HuffmanTree codesD; /*tree for distance codes*/ unsigned BFINAL = 1; /*make only one block... the first and final one*/ unsigned error = 0; size_t i, bp = 0; /*the bit pointer*/ HuffmanTree_init(&codes); HuffmanTree_init(&codesD); generateFixedTree(&codes); generateDistanceTree(&codesD); addBitToStream(&bp, out, BFINAL); addBitToStream(&bp, out, 1); /*first bit of BTYPE*/ addBitToStream(&bp, out, 0); /*second bit of BTYPE*/ if(settings->useLZ77) /*LZ77 encoded*/ { uivector lz77_encoded; uivector_init(&lz77_encoded); error = encodeLZ77(&lz77_encoded, data, datasize, settings->windowSize); if(!error) writeLZ77data(&bp, out, &lz77_encoded, &codes, &codesD); uivector_cleanup(&lz77_encoded); } else /*no LZ77, but still will be Huffman compressed*/ { for(i = 0; i < datasize; i++) addHuffmanSymbol(&bp, out, HuffmanTree_getCode(&codes, data[i]), HuffmanTree_getLength(&codes, data[i])); } if(!error) addHuffmanSymbol(&bp, out, HuffmanTree_getCode(&codes, 256), HuffmanTree_getLength(&codes, 256)); /*"end" code*/ /*cleanup*/ HuffmanTree_cleanup(&codes); HuffmanTree_cleanup(&codesD); return error; } unsigned LodeFlate_deflate(ucvector* out, const unsigned char* data, size_t datasize, const LodeZlib_DeflateSettings* settings) { unsigned error = 0; if(settings->btype == 0) error = deflateNoCompression(out, data, datasize); else if(settings->btype == 1) error = deflateFixed(out, data, datasize, settings); else if(settings->btype == 2) error = deflateDynamic(out, data, datasize, settings); else error = 61; return error; } /* ////////////////////////////////////////////////////////////////////////// */ /* / Adler32 */ /* ////////////////////////////////////////////////////////////////////////// */ static unsigned update_adler32(unsigned adler, const unsigned char* data, unsigned len) { unsigned s1 = adler & 0xffff; unsigned s2 = (adler >> 16) & 0xffff; while(len > 0) { /*at least 5550 sums can be done before the sums overflow, saving us from a lot of module divisions*/ unsigned amount = len > 5550 ? 5550 : len; len -= amount; while(amount > 0) { s1 = (s1 + *data++); s2 = (s2 + s1); amount--; } s1 %= 65521; s2 %= 65521; } return (s2 << 16) | s1; } /*Return the adler32 of the bytes data[0..len-1]*/ static unsigned adler32(const unsigned char* data, unsigned len) { return update_adler32(1L, data, len); } /* ////////////////////////////////////////////////////////////////////////// */ /* / Reading and writing single bits and bytes from/to stream for Zlib / */ /* ////////////////////////////////////////////////////////////////////////// */ static void LodeZlib_add32bitInt(ucvector* buffer, unsigned value) { ucvector_push_back(buffer, (unsigned char)((value >> 24) & 0xff)); ucvector_push_back(buffer, (unsigned char)((value >> 16) & 0xff)); ucvector_push_back(buffer, (unsigned char)((value >> 8) & 0xff)); ucvector_push_back(buffer, (unsigned char)((value ) & 0xff)); } /* ////////////////////////////////////////////////////////////////////////// */ /* / Zlib / */ /* ////////////////////////////////////////////////////////////////////////// */ static unsigned LodeZlib_compress(unsigned char** out, size_t* outsize, const unsigned char* in, size_t insize, const LodeZlib_DeflateSettings* settings) { /*initially, *out must be NULL and outsize 0, if you just give some random *out that's pointing to a non allocated buffer, this'll crash*/ ucvector deflatedata, outv; size_t i; unsigned error; unsigned ADLER32; /*zlib data: 1 byte CMF (CM+CINFO), 1 byte FLG, deflate data, 4 byte ADLER32 checksum of the Decompressed data*/ unsigned CMF = 120; /*0b01111000: CM 8, CINFO 7. With CINFO 7, any window size up to 32768 can be used.*/ unsigned FLEVEL = 0; unsigned FDICT = 0; unsigned CMFFLG = 256 * CMF + FDICT * 32 + FLEVEL * 64; unsigned FCHECK = 31 - CMFFLG % 31; CMFFLG += FCHECK; ucvector_init_buffer(&outv, *out, *outsize); /*ucvector-controlled version of the output buffer, for dynamic array*/ ucvector_push_back(&outv, (unsigned char)(CMFFLG / 256)); ucvector_push_back(&outv, (unsigned char)(CMFFLG % 256)); ucvector_init(&deflatedata); error = LodeFlate_deflate(&deflatedata, in, insize, settings); if(!error) { ADLER32 = adler32(in, (unsigned)insize); for(i = 0; i < deflatedata.size; i++) ucvector_push_back(&outv, deflatedata.data[i]); ucvector_cleanup(&deflatedata); LodeZlib_add32bitInt(&outv, ADLER32); } *out = outv.data; *outsize = outv.size; return error; } /* ////////////////////////////////////////////////////////////////////////// */ void LodeZlib_DeflateSettings_init(LodeZlib_DeflateSettings* settings) { settings->btype = 2; /*compress with dynamic huffman tree (not in the mathematical sense, just not the predefined one)*/ settings->useLZ77 = 1; settings->windowSize = 2048; /*this is a good tradeoff between speed and compression ratio*/ } /* ////////////////////////////////////////////////////////////////////////// */ /* ////////////////////////////////////////////////////////////////////////// */ /* ////////////////////////////////////////////////////////////////////////// */ /* ////////////////////////////////////////////////////////////////////////// */ /* ////////////////////////////////////////////////////////////////////////// */ /* // End of Zlib related code, now comes the PNG related code that uses it// */ /* ////////////////////////////////////////////////////////////////////////// */ /* ////////////////////////////////////////////////////////////////////////// */ /* ////////////////////////////////////////////////////////////////////////// */ /* ////////////////////////////////////////////////////////////////////////// */ /* ////////////////////////////////////////////////////////////////////////// */ /* The two functions below (LodePNG_decompress and LodePNG_compress) directly call the LodeZlib_decompress and LodeZlib_compress functions. The only purpose of the functions below, is to provide the ability to let LodePNG use a different Zlib encoder by only changing the two functions below, instead of changing it inside the various places in the other LodePNG functions. *out must be NULL and *outsize must be 0 initially, and after the function is done, *out must point to the decompressed data, *outsize must be the size of it, and must be the size of the useful data in bytes, not the alloc size. */ static unsigned LodePNG_compress(unsigned char** out, size_t* outsize, const unsigned char* in, size_t insize, const LodeZlib_DeflateSettings* settings) { return LodeZlib_compress(out, outsize, in, insize, settings); } /* ////////////////////////////////////////////////////////////////////////// */ /* / CRC32 / */ /* ////////////////////////////////////////////////////////////////////////// */ static unsigned Crc32_crc_table_computed = 0; static unsigned Crc32_crc_table[256]; /*Make the table for a fast CRC.*/ static void Crc32_make_crc_table(void) { unsigned int c, k, n; for(n = 0; n < 256; n++) { c = n; for(k = 0; k < 8; k++) { if(c & 1) c = (unsigned int)(0xedb88320L ^ (c >> 1)); else c = c >> 1; } Crc32_crc_table[n] = c; } Crc32_crc_table_computed = 1; } /*Update a running CRC with the bytes buf[0..len-1]--the CRC should be initialized to all 1's, and the transmitted value is the 1's complement of the final running CRC (see the crc() routine below).*/ static unsigned Crc32_update_crc(const unsigned char* buf, unsigned int crc, size_t len) { unsigned int c = crc; size_t n; if(!Crc32_crc_table_computed) Crc32_make_crc_table(); for(n = 0; n < len; n++) { c = Crc32_crc_table[(c ^ buf[n]) & 0xff] ^ (c >> 8); } return c; } /*Return the CRC of the bytes buf[0..len-1].*/ static unsigned Crc32_crc(const unsigned char* buf, size_t len) { return Crc32_update_crc(buf, 0xffffffffu, len) ^ 0xffffffffu; } /* ////////////////////////////////////////////////////////////////////////// */ /* / Reading and writing single bits and bytes from/to stream for LodePNG / */ /* ////////////////////////////////////////////////////////////////////////// */ static unsigned char readBitFromReversedStream(size_t* bitpointer, const unsigned char* bitstream) { unsigned char result = (unsigned char)((bitstream[(*bitpointer) >> 3] >> (7 - ((*bitpointer) & 0x7))) & 1); (*bitpointer)++; return result; } static unsigned readBitsFromReversedStream(size_t* bitpointer, const unsigned char* bitstream, size_t nbits) { unsigned result = 0; size_t i; for(i = nbits - 1; i < nbits; i--) result += (unsigned)readBitFromReversedStream(bitpointer, bitstream) << i; return result; } static void setBitOfReversedStream(size_t* bitpointer, unsigned char* bitstream, unsigned char bit) { /*the current bit in bitstream may be 0 or 1 for this to work*/ if(bit == 0) bitstream[(*bitpointer) >> 3] &= (unsigned char)(~(1 << (7 - ((*bitpointer) & 0x7)))); else bitstream[(*bitpointer) >> 3] |= (1 << (7 - ((*bitpointer) & 0x7))); (*bitpointer)++; } static unsigned LodePNG_read32bitInt(const unsigned char* buffer) { return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]; } static void LodePNG_set32bitInt(unsigned char* buffer, unsigned value) /*buffer must have at least 4 allocated bytes available*/ { buffer[0] = (unsigned char)((value >> 24) & 0xff); buffer[1] = (unsigned char)((value >> 16) & 0xff); buffer[2] = (unsigned char)((value >> 8) & 0xff); buffer[3] = (unsigned char)((value ) & 0xff); } static void LodePNG_add32bitInt(ucvector* buffer, unsigned value) { ucvector_resize(buffer, buffer->size + 4); LodePNG_set32bitInt(&buffer->data[buffer->size - 4], value); } /* ////////////////////////////////////////////////////////////////////////// */ /* / PNG chunks / */ /* ////////////////////////////////////////////////////////////////////////// */ static unsigned LodePNG_chunk_length(const unsigned char* chunk) /*get the length of the data of the chunk. Total chunk length has 12 bytes more.*/ { return LodePNG_read32bitInt(&chunk[0]); } static void LodePNG_chunk_generate_crc(unsigned char* chunk) /*generates the correct CRC from the data and puts it in the last 4 bytes of the chunk*/ { unsigned length = LodePNG_chunk_length(chunk); unsigned CRC = Crc32_crc(&chunk[4], length + 4); LodePNG_set32bitInt(chunk + 8 + length, CRC); } static unsigned LodePNG_create_chunk(unsigned char** out, size_t* outlength, unsigned length, const char* type, const unsigned char* data) /*appends new chunk to out. Returns error code; may change memory address of out buffer*/ { unsigned i; unsigned char *chunk, *new_buffer; size_t new_length = (*outlength) + length + 12; if(new_length < length + 12 || new_length < (*outlength)) return 77; /*integer overflow happened*/ new_buffer = (unsigned char*)realloc(*out, new_length); if(!new_buffer) return 9930; (*out) = new_buffer; (*outlength) = new_length; chunk = &(*out)[(*outlength) - length - 12]; /*1: length*/ LodePNG_set32bitInt(chunk, (unsigned)length); /*2: chunk name (4 letters)*/ chunk[4] = type[0]; chunk[5] = type[1]; chunk[6] = type[2]; chunk[7] = type[3]; /*3: the data*/ for(i = 0; i < length; i++) chunk[8 + i] = data[i]; /*4: CRC (of the chunkname characters and the data)*/ LodePNG_chunk_generate_crc(chunk); return 0; } /* ////////////////////////////////////////////////////////////////////////// */ /* / Color types and such / */ /* ////////////////////////////////////////////////////////////////////////// */ /*return type is a LodePNG error code*/ static unsigned checkColorValidity(unsigned colorType, unsigned bd) /*bd = bitDepth*/ { switch(colorType) { case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/ case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/ case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/ case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/ case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/ default: return 31; } return 0; /*allowed color type / bits combination*/ } static unsigned getNumColorChannels(unsigned colorType) { switch(colorType) { case 0: return 1; /*grey*/ case 2: return 3; /*RGB*/ case 3: return 1; /*palette*/ case 4: return 2; /*grey + alpha*/ case 6: return 4; /*RGBA*/ } return 0; /*nonexistent color type*/ } static unsigned getBpp(unsigned colorType, unsigned bitDepth) { return getNumColorChannels(colorType) * bitDepth; /*bits per pixel is amount of channels * bits per channel*/ } /* ////////////////////////////////////////////////////////////////////////// */ static void LodePNG_InfoColor_init(LodePNG_InfoColor* info) { info->key_defined = 0; info->key_r = info->key_g = info->key_b = 0; info->colorType = 6; info->bitDepth = 8; info->palette = 0; info->palettesize = 0; } static void LodePNG_InfoColor_cleanup(LodePNG_InfoColor* info) { LodePNG_InfoColor_clearPalette(info); } static void LodePNG_InfoColor_clearPalette(LodePNG_InfoColor* info) { if(info->palette) free(info->palette); info->palettesize = 0; } unsigned LodePNG_InfoColor_addPalette(LodePNG_InfoColor* info, unsigned char r, unsigned char g, unsigned char b, unsigned char a) { unsigned char* data; /*the same resize technique as C++ std::vectors is used, and here it's made so that for a palette with the max of 256 colors, it'll have the exact alloc size*/ if(!(info->palettesize & (info->palettesize - 1))) /*if palettesize is 0 or a power of two*/ { /*allocated data must be at least 4* palettesize (for 4 color bytes)*/ size_t alloc_size = info->palettesize == 0 ? 4 : info->palettesize * 4 * 2; data = (unsigned char*)realloc(info->palette, alloc_size); if(!data) return 9931; else info->palette = data; } info->palette[4 * info->palettesize + 0] = r; info->palette[4 * info->palettesize + 1] = g; info->palette[4 * info->palettesize + 2] = b; info->palette[4 * info->palettesize + 3] = a; info->palettesize++; return 0; } static unsigned LodePNG_InfoColor_getBpp(const LodePNG_InfoColor* info) { return getBpp(info->colorType, info->bitDepth); } /*calculate bits per pixel out of colorType and bitDepth*/ static unsigned LodePNG_InfoColor_isGreyscaleType(const LodePNG_InfoColor* info) { return info->colorType == 0 || info->colorType == 4; } static unsigned LodePNG_InfoColor_isAlphaType(const LodePNG_InfoColor* info) { return (info->colorType & 4) != 0; } static unsigned LodePNG_InfoColor_equal(const LodePNG_InfoColor* info1, const LodePNG_InfoColor* info2) { return info1->colorType == info2->colorType && info1->bitDepth == info2->bitDepth; /*palette and color key not compared*/ } static void LodePNG_InfoPng_init(LodePNG_InfoPng* info) { info->width = info->height = 0; LodePNG_InfoColor_init(&info->color); info->interlaceMethod = 0; info->compressionMethod = 0; info->filterMethod = 0; } static void LodePNG_InfoPng_cleanup(LodePNG_InfoPng* info) { LodePNG_InfoColor_cleanup(&info->color); } static unsigned LodePNG_InfoPng_copy(LodePNG_InfoPng* dest, const LodePNG_InfoPng* source) { unsigned error = 0; LodePNG_InfoPng_cleanup(dest); *dest = *source; LodePNG_InfoColor_init(&dest->color); error = LodePNG_InfoColor_copy(&dest->color, &source->color); if(error) return error; return error; } static unsigned LodePNG_InfoColor_copy(LodePNG_InfoColor* dest, const LodePNG_InfoColor* source) { size_t i; LodePNG_InfoColor_cleanup(dest); *dest = *source; dest->palette = (unsigned char*)malloc(source->palettesize * 4); if(!dest->palette && source->palettesize) return 9935; for(i = 0; i < source->palettesize * 4; i++) dest->palette[i] = source->palette[i]; return 0; } static void LodePNG_InfoRaw_init(LodePNG_InfoRaw* info) { LodePNG_InfoColor_init(&info->color); } static void LodePNG_InfoRaw_cleanup(LodePNG_InfoRaw* info) { LodePNG_InfoColor_cleanup(&info->color); } static unsigned LodePNG_InfoRaw_copy(LodePNG_InfoRaw* dest, const LodePNG_InfoRaw* source) { unsigned error = 0; LodePNG_InfoRaw_cleanup(dest); *dest = *source; LodePNG_InfoColor_init(&dest->color); error = LodePNG_InfoColor_copy(&dest->color, &source->color); return error; } /* ////////////////////////////////////////////////////////////////////////// */ /* converts from any color type to 24-bit or 32-bit (later maybe more supported). return value = LodePNG error code the out buffer must have (w * h * bpp + 7) / 8 bytes, where bpp is the bits per pixel of the output color type (LodePNG_InfoColor_getBpp) for < 8 bpp images, there may _not_ be padding bits at the end of scanlines. */ static unsigned LodePNG_convert(unsigned char* out, const unsigned char* in, LodePNG_InfoColor* infoOut, LodePNG_InfoColor* infoIn, unsigned w, unsigned h) { const size_t numpixels = w * h; /*amount of pixels*/ const unsigned OUT_BYTES = LodePNG_InfoColor_getBpp(infoOut) / 8; /*bytes per pixel in the output image*/ const unsigned OUT_ALPHA = LodePNG_InfoColor_isAlphaType(infoOut); /*use 8-bit alpha channel*/ size_t i, c, bp = 0; /*bitpointer, used by less-than-8-bit color types*/ /*cases where in and out already have the same format*/ if(LodePNG_InfoColor_equal(infoIn, infoOut)) { size_t i, size = (w * h * LodePNG_InfoColor_getBpp(infoIn) + 7) / 8; for(i = 0; i < size; i++) out[i] = in[i]; return 0; } if((infoOut->colorType == 2 || infoOut->colorType == 6) && infoOut->bitDepth == 8) { if(infoIn->bitDepth == 8) { switch(infoIn->colorType) { case 0: /*greyscale color*/ for(i = 0; i < numpixels; i++) { if(OUT_ALPHA) out[OUT_BYTES * i + 3] = 255; out[OUT_BYTES * i + 0] = out[OUT_BYTES * i + 1] = out[OUT_BYTES * i + 2] = in[i]; if(OUT_ALPHA && infoIn->key_defined && in[i] == infoIn->key_r) out[OUT_BYTES * i + 3] = 0; } break; case 2: /*RGB color*/ for(i = 0; i < numpixels; i++) { if(OUT_ALPHA) out[OUT_BYTES * i + 3] = 255; for(c = 0; c < 3; c++) out[OUT_BYTES * i + c] = in[3 * i + c]; if(OUT_ALPHA && infoIn->key_defined == 1 && in[3 * i + 0] == infoIn->key_r && in[3 * i + 1] == infoIn->key_g && in[3 * i + 2] == infoIn->key_b) out[OUT_BYTES * i + 3] = 0; } break; case 3: /*indexed color (palette)*/ for(i = 0; i < numpixels; i++) { if(OUT_ALPHA) out[OUT_BYTES * i + 3] = 255; if(in[i] >= infoIn->palettesize) return 46; for(c = 0; c < OUT_BYTES; c++) out[OUT_BYTES * i + c] = infoIn->palette[4 * in[i] + c]; /*get rgb colors from the palette*/ } break; case 4: /*greyscale with alpha*/ for(i = 0; i < numpixels; i++) { out[OUT_BYTES * i + 0] = out[OUT_BYTES * i + 1] = out[OUT_BYTES * i + 2] = in[2 * i + 0]; if(OUT_ALPHA) out[OUT_BYTES * i + 3] = in[2 * i + 1]; } break; case 6: /*RGB with alpha*/ for(i = 0; i < numpixels; i++) { for(c = 0; c < OUT_BYTES; c++) out[OUT_BYTES * i + c] = in[4 * i + c]; } break; default: break; } } else if(infoIn->bitDepth == 16) { switch(infoIn->colorType) { case 0: /*greyscale color*/ for(i = 0; i < numpixels; i++) { if(OUT_ALPHA) out[OUT_BYTES * i + 3] = 255; out[OUT_BYTES * i + 0] = out[OUT_BYTES * i + 1] = out[OUT_BYTES * i + 2] = in[2 * i]; if(OUT_ALPHA && infoIn->key_defined && 256U * in[i] + in[i + 1] == infoIn->key_r) out[OUT_BYTES * i + 3] = 0; } break; case 2: /*RGB color*/ for(i = 0; i < numpixels; i++) { if(OUT_ALPHA) out[OUT_BYTES * i + 3] = 255; for(c = 0; c < 3; c++) out[OUT_BYTES * i + c] = in[6 * i + 2 * c]; if(OUT_ALPHA && infoIn->key_defined && 256U * in[6 * i + 0] + in[6 * i + 1] == infoIn->key_r && 256U * in[6 * i + 2] + in[6 * i + 3] == infoIn->key_g && 256U * in[6 * i + 4] + in[6 * i + 5] == infoIn->key_b) out[OUT_BYTES * i + 3] = 0; } break; case 4: /*greyscale with alpha*/ for(i = 0; i < numpixels; i++) { out[OUT_BYTES * i + 0] = out[OUT_BYTES * i + 1] = out[OUT_BYTES * i + 2] = in[4 * i]; /*most significant byte*/ if(OUT_ALPHA) out[OUT_BYTES * i + 3] = in[4 * i + 2]; } break; case 6: /*RGB with alpha*/ for(i = 0; i < numpixels; i++) { for(c = 0; c < OUT_BYTES; c++) out[OUT_BYTES * i + c] = in[8 * i + 2 * c]; } break; default: break; } } else /*infoIn->bitDepth is less than 8 bit per channel*/ { switch(infoIn->colorType) { case 0: /*greyscale color*/ for(i = 0; i < numpixels; i++) { unsigned value = readBitsFromReversedStream(&bp, in, infoIn->bitDepth); if(OUT_ALPHA) out[OUT_BYTES * i + 3] = 255; if(OUT_ALPHA && infoIn->key_defined && value && ((1U << infoIn->bitDepth) - 1U) == infoIn->key_r && ((1U << infoIn->bitDepth) - 1U)) out[OUT_BYTES * i + 3] = 0; value = (value * 255) / ((1 << infoIn->bitDepth) - 1); /*scale value from 0 to 255*/ out[OUT_BYTES * i + 0] = out[OUT_BYTES * i + 1] = out[OUT_BYTES * i + 2] = (unsigned char)(value); } break; case 3: /*indexed color (palette)*/ for(i = 0; i < numpixels; i++) { unsigned value = readBitsFromReversedStream(&bp, in, infoIn->bitDepth); if(OUT_ALPHA) out[OUT_BYTES * i + 3] = 255; if(value >= infoIn->palettesize) return 47; for(c = 0; c < OUT_BYTES; c++) out[OUT_BYTES * i + c] = infoIn->palette[4 * value + c]; /*get rgb colors from the palette*/ } break; default: break; } } } else if(LodePNG_InfoColor_isGreyscaleType(infoOut) && infoOut->bitDepth == 8) /*conversion from greyscale to greyscale*/ { if(!LodePNG_InfoColor_isGreyscaleType(infoIn)) return 62; if(infoIn->bitDepth == 8) { switch(infoIn->colorType) { case 0: /*greyscale color*/ for(i = 0; i < numpixels; i++) { if(OUT_ALPHA) out[OUT_BYTES * i + 1] = 255; out[OUT_BYTES * i] = in[i]; if(OUT_ALPHA && infoIn->key_defined && in[i] == infoIn->key_r) out[OUT_BYTES * i + 1] = 0; } break; case 4: /*greyscale with alpha*/ for(i = 0; i < numpixels; i++) { out[OUT_BYTES * i + 0] = in[2 * i + 0]; if(OUT_ALPHA) out[OUT_BYTES * i + 1] = in[2 * i + 1]; } break; default: return 31; } } else if(infoIn->bitDepth == 16) { switch(infoIn->colorType) { case 0: /*greyscale color*/ for(i = 0; i < numpixels; i++) { if(OUT_ALPHA) out[OUT_BYTES * i + 1] = 255; out[OUT_BYTES * i] = in[2 * i]; if(OUT_ALPHA && infoIn->key_defined && 256U * in[i] + in[i + 1] == infoIn->key_r) out[OUT_BYTES * i + 1] = 0; } break; case 4: /*greyscale with alpha*/ for(i = 0; i < numpixels; i++) { out[OUT_BYTES * i] = in[4 * i]; /*most significant byte*/ if(OUT_ALPHA) out[OUT_BYTES * i + 1] = in[4 * i + 2]; /*most significant byte*/ } break; default: return 31; } } else /*infoIn->bitDepth is less than 8 bit per channel*/ { if(infoIn->colorType != 0) return 31; /*colorType 0 is the only greyscale type with < 8 bits per channel*/ for(i = 0; i < numpixels; i++) { unsigned value = readBitsFromReversedStream(&bp, in, infoIn->bitDepth); if(OUT_ALPHA) out[OUT_BYTES * i + 1] = 255; if(OUT_ALPHA && infoIn->key_defined && value && ((1U << infoIn->bitDepth) - 1U) == infoIn->key_r && ((1U << infoIn->bitDepth) - 1U)) out[OUT_BYTES * i + 1] = 0; value = (value * 255) / ((1 << infoIn->bitDepth) - 1); /*scale value from 0 to 255*/ out[OUT_BYTES * i] = (unsigned char)(value); } } } else return 59; return 0; } /*Path predictor, used by PNG filter type 4*/ static int paethPredictor(int a, int b, int c) { int p = a + b - c; int pa = p > a ? p - a : a - p; int pb = p > b ? p - b : b - p; int pc = p > c ? p - c : c - p; if(pa <= pb && pa <= pc) return a; else if(pb <= pc) return b; else return c; } /*shared values used by multiple Adam7 related functions*/ static const unsigned ADAM7_IX[7] = { 0, 4, 0, 2, 0, 1, 0 }; /*x start values*/ static const unsigned ADAM7_IY[7] = { 0, 0, 4, 0, 2, 0, 1 }; /*y start values*/ static const unsigned ADAM7_DX[7] = { 8, 8, 4, 4, 2, 2, 1 }; /*x delta values*/ static const unsigned ADAM7_DY[7] = { 8, 8, 8, 4, 4, 2, 2 }; /*y delta values*/ static void Adam7_getpassvalues(unsigned passw[7], unsigned passh[7], size_t filter_passstart[8], size_t padded_passstart[8], size_t passstart[8], unsigned w, unsigned h, unsigned bpp) { /*the passstart values have 8 values: the 8th one actually indicates the byte after the end of the 7th (= last) pass*/ unsigned i; /*calculate width and height in pixels of each pass*/ for(i = 0; i < 7; i++) { passw[i] = (w + ADAM7_DX[i] - ADAM7_IX[i] - 1) / ADAM7_DX[i]; passh[i] = (h + ADAM7_DY[i] - ADAM7_IY[i] - 1) / ADAM7_DY[i]; if(passw[i] == 0) passh[i] = 0; if(passh[i] == 0) passw[i] = 0; } filter_passstart[0] = padded_passstart[0] = passstart[0] = 0; for(i = 0; i < 7; i++) { filter_passstart[i + 1] = filter_passstart[i] + ((passw[i] && passh[i]) ? passh[i] * (1 + (passw[i] * bpp + 7) / 8) : 0); /*if passw[i] is 0, it's 0 bytes, not 1 (no filtertype-byte)*/ padded_passstart[i + 1] = padded_passstart[i] + passh[i] * ((passw[i] * bpp + 7) / 8); /*bits padded if needed to fill full byte at end of each scanline*/ passstart[i + 1] = passstart[i] + (passh[i] * passw[i] * bpp + 7) / 8; /*only padded at end of reduced image*/ } } /* ////////////////////////////////////////////////////////////////////////// */ /* / PNG Encoder / */ /* ////////////////////////////////////////////////////////////////////////// */ /*chunkName must be string of 4 characters*/ static unsigned addChunk(ucvector* out, const char* chunkName, const unsigned char* data, size_t length) { unsigned error = LodePNG_create_chunk(&out->data, &out->size, (unsigned)length, chunkName, data); if(error) return error; out->allocsize = out->size; /*fix the allocsize again*/ return 0; } static void writeSignature(ucvector* out) { /*8 bytes PNG signature*/ ucvector_push_back(out, 137); ucvector_push_back(out, 80); ucvector_push_back(out, 78); ucvector_push_back(out, 71); ucvector_push_back(out, 13); ucvector_push_back(out, 10); ucvector_push_back(out, 26); ucvector_push_back(out, 10); } static unsigned addChunk_IHDR(ucvector* out, unsigned w, unsigned h, unsigned bitDepth, unsigned colorType, unsigned interlaceMethod) { unsigned error = 0; ucvector header; ucvector_init(&header); LodePNG_add32bitInt(&header, w); /*width*/ LodePNG_add32bitInt(&header, h); /*height*/ ucvector_push_back(&header, (unsigned char)bitDepth); /*bit depth*/ ucvector_push_back(&header, (unsigned char)colorType); /*color type*/ ucvector_push_back(&header, 0); /*compression method*/ ucvector_push_back(&header, 0); /*filter method*/ ucvector_push_back(&header, interlaceMethod); /*interlace method*/ error = addChunk(out, "IHDR", header.data, header.size); ucvector_cleanup(&header); return error; } static unsigned addChunk_PLTE(ucvector* out, const LodePNG_InfoColor* info) { unsigned error = 0; size_t i; ucvector PLTE; ucvector_init(&PLTE); for(i = 0; i < info->palettesize * 4; i++) if(i % 4 != 3) ucvector_push_back(&PLTE, info->palette[i]); /*add all channels except alpha channel*/ error = addChunk(out, "PLTE", PLTE.data, PLTE.size); ucvector_cleanup(&PLTE); return error; } static unsigned addChunk_tRNS(ucvector* out, const LodePNG_InfoColor* info) { unsigned error = 0; size_t i; ucvector tRNS; ucvector_init(&tRNS); if(info->colorType == 3) { for(i = 0; i < info->palettesize; i++) ucvector_push_back(&tRNS, info->palette[4 * i + 3]); /*add only alpha channel*/ } else if(info->colorType == 0) { if(info->key_defined) { ucvector_push_back(&tRNS, (unsigned char)(info->key_r / 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_r % 256)); } } else if(info->colorType == 2) { if(info->key_defined) { ucvector_push_back(&tRNS, (unsigned char)(info->key_r / 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_r % 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_g / 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_g % 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_b / 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_b % 256)); } } error = addChunk(out, "tRNS", tRNS.data, tRNS.size); ucvector_cleanup(&tRNS); return error; } static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t datasize, LodeZlib_DeflateSettings* zlibsettings) { ucvector zlibdata; unsigned error = 0; /*compress with the Zlib compressor*/ ucvector_init(&zlibdata); error = LodePNG_compress(&zlibdata.data, &zlibdata.size, data, datasize, zlibsettings); if(!error) error = addChunk(out, "IDAT", zlibdata.data, zlibdata.size); ucvector_cleanup(&zlibdata); return error; } static unsigned addChunk_IEND(ucvector* out) { unsigned error = 0; error = addChunk(out, "IEND", 0, 0); return error; } static void filterScanline(unsigned char* out, const unsigned char* scanline, const unsigned char* prevline, size_t length, size_t bytewidth, unsigned char filterType) { size_t i; switch(filterType) { case 0: for(i = 0; i < length; i++) out[i] = scanline[i]; break; case 1: for(i = 0; i < bytewidth; i++) out[i] = scanline[i]; for(i = bytewidth; i < length; i++) out[i] = scanline[i] - scanline[i - bytewidth]; break; case 2: if(prevline) for(i = 0; i < length; i++) out[i] = scanline[i] - prevline[i]; else for(i = 0; i < length; i++) out[i] = scanline[i]; break; case 3: if(prevline) { for(i = 0; i < bytewidth; i++) out[i] = scanline[i] - prevline[i] / 2; for(i = bytewidth; i < length; i++) out[i] = scanline[i] - ((scanline[i - bytewidth] + prevline[i]) / 2); } else { for(i = 0; i < length; i++) out[i] = scanline[i]; for(i = bytewidth; i < length; i++) out[i] = scanline[i] - scanline[i - bytewidth] / 2; } break; case 4: if(prevline) { for(i = 0; i < bytewidth; i++) out[i] = (unsigned char)(scanline[i] - paethPredictor(0, prevline[i], 0)); for(i = bytewidth; i < length; i++) out[i] = (unsigned char)(scanline[i] - paethPredictor(scanline[i - bytewidth], prevline[i], prevline[i - bytewidth])); } else { for(i = 0; i < bytewidth; i++) out[i] = scanline[i]; for(i = bytewidth; i < length; i++) out[i] = (unsigned char)(scanline[i] - paethPredictor(scanline[i - bytewidth], 0, 0)); } break; default: return; /*nonexistent filter type given*/ } } static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h, const LodePNG_InfoColor* info) { /* For PNG filter method 0 out must be a buffer with as size: h + (w * h * bpp + 7) / 8, because there are the scanlines with 1 extra byte per scanline There is a nice heuristic described here: http://www.cs.toronto.edu/~cosmin/pngtech/optipng.html. It says: * If the image type is Palette, or the bit depth is smaller than 8, then do not filter the image (i.e. use fixed filtering, with the filter None). * (The other case) If the image type is Grayscale or RGB (with or without Alpha), and the bit depth is not smaller than 8, then use adaptive filtering heuristic as follows: independently for each row, apply all five filters and select the filter that produces the smallest sum of absolute values per row. Here the above method is used mostly. Note though that it appears to be better to use the adaptive filtering on the plasma 8-bit palette example, but that image isn't the best reference for palette images in general. */ unsigned bpp = LodePNG_InfoColor_getBpp(info); size_t linebytes = (w * bpp + 7) / 8; /*the width of a scanline in bytes, not including the filter type*/ size_t bytewidth = (bpp + 7) / 8; /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ const unsigned char* prevline = 0; unsigned x, y; unsigned heuristic; unsigned error = 0; if(bpp == 0) return 31; /*invalid color type*/ /*choose heuristic as described above*/ if(info->colorType == 3 || info->bitDepth < 8) heuristic = 0; else heuristic = 1; if(heuristic == 0) /*None filtertype for everything*/ { for(y = 0; y < h; y++) { size_t outindex = (1 + linebytes) * y; /*the extra filterbyte added to each row*/ size_t inindex = linebytes * y; const unsigned TYPE = 0; out[outindex] = TYPE; /*filter type byte*/ filterScanline(&out[outindex + 1], &in[inindex], prevline, linebytes, bytewidth, TYPE); prevline = &in[inindex]; } } else if(heuristic == 1) /*adaptive filtering*/ { size_t sum[5]; ucvector attempt[5]; /*five filtering attempts, one for each filter type*/ size_t smallest = 0; unsigned type, bestType = 0; for(type = 0; type < 5; type++) ucvector_init(&attempt[type]); for(type = 0; type < 5; type++) { if(!ucvector_resize(&attempt[type], linebytes)) { error = 9949; break; } } if(!error) { for(y = 0; y < h; y++) { /*try the 5 filter types*/ for(type = 0; type < 5; type++) { filterScanline(attempt[type].data, &in[y * linebytes], prevline, linebytes, bytewidth, type); /*calculate the sum of the result*/ sum[type] = 0; for(x = 0; x < attempt[type].size; x+=3) sum[type] += attempt[type].data[x]; /*note that not all pixels are checked to speed this up while still having probably the best choice*/ /*check if this is smallest sum (or if type == 0 it's the first case so always store the values)*/ if(type == 0 || sum[type] < smallest) { bestType = type; smallest = sum[type]; } } prevline = &in[y * linebytes]; /*now fill the out values*/ out[y * (linebytes + 1)] = bestType; /*the first byte of a scanline will be the filter type*/ for(x = 0; x < linebytes; x++) out[y * (linebytes + 1) + 1 + x] = attempt[bestType].data[x]; } } for(type = 0; type < 5; type++) ucvector_cleanup(&attempt[type]); } return error; } static void addPaddingBits(unsigned char* out, const unsigned char* in, size_t olinebits, size_t ilinebits, unsigned h) { /*The opposite of the removePaddingBits function olinebits must be >= ilinebits*/ unsigned y; size_t diff = olinebits - ilinebits; size_t obp = 0, ibp = 0; /*bit pointers*/ for(y = 0; y < h; y++) { size_t x; for(x = 0; x < ilinebits; x++) { unsigned char bit = readBitFromReversedStream(&ibp, in); setBitOfReversedStream(&obp, out, bit); } /*obp += diff; --> no, fill in some value in the padding bits too, to avoid "Use of uninitialised value of size ###" warning from valgrind*/ for(x = 0; x < diff; x++) setBitOfReversedStream(&obp, out, 0); } } static void Adam7_interlace(unsigned char* out, const unsigned char* in, unsigned w, unsigned h, unsigned bpp) { /*Note: this function works on image buffers WITHOUT padding bits at end of scanlines with non-multiple-of-8 bit amounts, only between reduced images is padding*/ unsigned passw[7], passh[7]; size_t filter_passstart[8], padded_passstart[8], passstart[8]; unsigned i; Adam7_getpassvalues(passw, passh, filter_passstart, padded_passstart, passstart, w, h, bpp); if(bpp >= 8) { for(i = 0; i < 7; i++) { unsigned x, y, b; size_t bytewidth = bpp / 8; for(y = 0; y < passh[i]; y++) for(x = 0; x < passw[i]; x++) { size_t pixelinstart = ((ADAM7_IY[i] + y * ADAM7_DY[i]) * w + ADAM7_IX[i] + x * ADAM7_DX[i]) * bytewidth; size_t pixeloutstart = passstart[i] + (y * passw[i] + x) * bytewidth; for(b = 0; b < bytewidth; b++) { out[pixeloutstart + b] = in[pixelinstart + b]; } } } } else /*bpp < 8: Adam7 with pixels < 8 bit is a bit trickier: with bit pointers*/ { for(i = 0; i < 7; i++) { unsigned x, y, b; unsigned ilinebits = bpp * passw[i]; unsigned olinebits = bpp * w; size_t obp, ibp; /*bit pointers (for out and in buffer)*/ for(y = 0; y < passh[i]; y++) for(x = 0; x < passw[i]; x++) { ibp = (ADAM7_IY[i] + y * ADAM7_DY[i]) * olinebits + (ADAM7_IX[i] + x * ADAM7_DX[i]) * bpp; obp = (8 * passstart[i]) + (y * ilinebits + x * bpp); for(b = 0; b < bpp; b++) { unsigned char bit = readBitFromReversedStream(&ibp, in); setBitOfReversedStream(&obp, out, bit); } } } } } /*out must be buffer big enough to contain uncompressed IDAT chunk data, and in must contain the full image*/ static unsigned preProcessScanlines(unsigned char** out, size_t* outsize, const unsigned char* in, const LodePNG_InfoPng* infoPng) /*return value is error*/ { /* This function converts the pure 2D image with the PNG's colortype, into filtered-padded-interlaced data. Steps: *) if no Adam7: 1) add padding bits (= possible extra bits per scanline if bpp < 8) 2) filter *) if adam7: 1) Adam7_interlace 2) 7x add padding bits 3) 7x filter */ unsigned bpp = LodePNG_InfoColor_getBpp(&infoPng->color); unsigned w = infoPng->width; unsigned h = infoPng->height; unsigned error = 0; if(infoPng->interlaceMethod == 0) { *outsize = h + (h * ((w * bpp + 7) / 8)); /*image size plus an extra byte per scanline + possible padding bits*/ *out = (unsigned char*)malloc(*outsize); if(!(*out) && (*outsize)) error = 9950; if(!error) { if(bpp < 8 && w * bpp != ((w * bpp + 7) / 8) * 8) /*non multiple of 8 bits per scanline, padding bits needed per scanline*/ { ucvector padded; ucvector_init(&padded); if(!ucvector_resize(&padded, h * ((w * bpp + 7) / 8))) error = 9951; if(!error) { addPaddingBits(padded.data, in, ((w * bpp + 7) / 8) * 8, w * bpp, h); error = filter(*out, padded.data, w, h, &infoPng->color); } ucvector_cleanup(&padded); } else error = filter(*out, in, w, h, &infoPng->color); /*we can immediately filter into the out buffer, no other steps needed*/ } } else /*interlaceMethod is 1 (Adam7)*/ { unsigned char* adam7 = (unsigned char*)malloc((h * w * bpp + 7) / 8); if(!adam7 && ((h * w * bpp + 7) / 8)) error = 9952; /*malloc failed*/ while(!error) /*not a real while loop, used to break out to cleanup to avoid a goto*/ { unsigned passw[7], passh[7]; size_t filter_passstart[8], padded_passstart[8], passstart[8]; unsigned i; Adam7_getpassvalues(passw, passh, filter_passstart, padded_passstart, passstart, w, h, bpp); *outsize = filter_passstart[7]; /*image size plus an extra byte per scanline + possible padding bits*/ *out = (unsigned char*)malloc(*outsize); if(!(*out) && (*outsize)) { error = 9953; break; } Adam7_interlace(adam7, in, w, h, bpp); for(i = 0; i < 7; i++) { if(bpp < 8) { ucvector padded; ucvector_init(&padded); if(!ucvector_resize(&padded, h * ((w * bpp + 7) / 8))) error = 9954; if(!error) { addPaddingBits(&padded.data[padded_passstart[i]], &adam7[passstart[i]], ((passw[i] * bpp + 7) / 8) * 8, passw[i] * bpp, passh[i]); error = filter(&(*out)[filter_passstart[i]], &padded.data[padded_passstart[i]], passw[i], passh[i], &infoPng->color); } ucvector_cleanup(&padded); } else { error = filter(&(*out)[filter_passstart[i]], &adam7[padded_passstart[i]], passw[i], passh[i], &infoPng->color); } } break; } free(adam7); } return error; } /*palette must have 4 * palettesize bytes allocated*/ static unsigned isPaletteFullyOpaque(const unsigned char* palette, size_t palettesize) /*palette given in format RGBARGBARGBARGBA...*/ { size_t i; for(i = 0; i < palettesize; i++) { if(palette[4 * i + 3] != 255) return 0; } return 1; } /*this function checks if the input image given by the user has no transparent pixels*/ static unsigned isFullyOpaque(const unsigned char* image, unsigned w, unsigned h, const LodePNG_InfoColor* info) { /*TODO: When the user specified a color key for the input image, then this function must also check for pixels that are the same as the color key and treat those as transparent.*/ unsigned i, numpixels = w * h; if(info->colorType == 6) { if(info->bitDepth == 8) { for(i = 0; i < numpixels; i++) if(image[i * 4 + 3] != 255) return 0; } else { for(i = 0; i < numpixels; i++) if(image[i * 8 + 6] != 255 || image[i * 8 + 7] != 255) return 0; } return 1; /*no single pixel with alpha channel other than 255 found*/ } else if(info->colorType == 4) { if(info->bitDepth == 8) { for(i = 0; i < numpixels; i++) if(image[i * 2 + 1] != 255) return 0; } else { for(i = 0; i < numpixels; i++) if(image[i * 4 + 2] != 255 || image[i * 4 + 3] != 255) return 0; } return 1; /*no single pixel with alpha channel other than 255 found*/ } else if(info->colorType == 3) { /*when there's a palette, we could check every pixel for translucency, but much quicker is to just check the palette*/ return(isPaletteFullyOpaque(info->palette, info->palettesize)); } return 0; /*color type that isn't supported by this function yet, so assume there is transparency to be safe*/ } void LodePNG_encode(LodePNG_Encoder* encoder, unsigned char** out, size_t* outsize, const unsigned char* image, unsigned w, unsigned h) { LodePNG_InfoPng info; ucvector outv; unsigned char* data = 0; /*uncompressed version of the IDAT chunk data*/ size_t datasize = 0; /*provide some proper output values if error will happen*/ *out = 0; *outsize = 0; encoder->error = 0; info = encoder->infoPng; /*UNSAFE copy to avoid having to cleanup! but we will only change primitive parameters, and not invoke the cleanup function nor touch the palette's buffer so we use it safely*/ info.width = w; info.height = h; if(encoder->settings.autoLeaveOutAlphaChannel && isFullyOpaque(image, w, h, &encoder->infoRaw.color)) { /*go to a color type without alpha channel*/ if(info.color.colorType == 6) info.color.colorType = 2; else if(info.color.colorType == 4) info.color.colorType = 0; } if(encoder->settings.zlibsettings.windowSize > 32768) { encoder->error = 60; return; } /*error: windowsize larger than allowed*/ if(encoder->settings.zlibsettings.btype > 2) { encoder->error = 61; return; } /*error: nonexistent btype*/ if(encoder->infoPng.interlaceMethod > 1) { encoder->error = 71; return; } /*error: nonexistent interlace mode*/ if((encoder->error = checkColorValidity(info.color.colorType, info.color.bitDepth))) return; /*error: nonexistent color type given*/ if((encoder->error = checkColorValidity(encoder->infoRaw.color.colorType, encoder->infoRaw.color.bitDepth))) return; /*error: nonexistent color type given*/ if(!LodePNG_InfoColor_equal(&encoder->infoRaw.color, &info.color)) { unsigned char* converted; size_t size = (w * h * LodePNG_InfoColor_getBpp(&info.color) + 7) / 8; if((info.color.colorType != 6 && info.color.colorType != 2) || (info.color.bitDepth != 8)) { encoder->error = 59; return; } /*for the output image, only these types are supported*/ converted = (unsigned char*)malloc(size); if(!converted && size) encoder->error = 9955; /*error: malloc failed*/ if(!encoder->error) encoder->error = LodePNG_convert(converted, image, &info.color, &encoder->infoRaw.color, w, h); if(!encoder->error) preProcessScanlines(&data, &datasize, converted, &info);/*filter(data.data, converted.data, w, h, LodePNG_InfoColor_getBpp(&info.color));*/ free(converted); } else preProcessScanlines(&data, &datasize, image, &info);/*filter(data.data, image, w, h, LodePNG_InfoColor_getBpp(&info.color));*/ ucvector_init(&outv); while(!encoder->error) /*not really a while loop, this is only used to break out if an error happens to avoid goto's to do the ucvector cleanup*/ { /*write signature and chunks*/ writeSignature(&outv); /*IHDR*/ addChunk_IHDR(&outv, w, h, info.color.bitDepth, info.color.colorType, info.interlaceMethod); /*PLTE*/ if(info.color.colorType == 3) { if(info.color.palettesize == 0 || info.color.palettesize > 256) { encoder->error = 68; break; } addChunk_PLTE(&outv, &info.color); } if(encoder->settings.force_palette && (info.color.colorType == 2 || info.color.colorType == 6)) { if(info.color.palettesize == 0 || info.color.palettesize > 256) { encoder->error = 68; break; } addChunk_PLTE(&outv, &info.color); } /*tRNS*/ if(info.color.colorType == 3 && !isPaletteFullyOpaque(info.color.palette, info.color.palettesize)) addChunk_tRNS(&outv, &info.color); if((info.color.colorType == 0 || info.color.colorType == 2) && info.color.key_defined) addChunk_tRNS(&outv, &info.color); /*IDAT (multiple IDAT chunks must be consecutive)*/ encoder->error = addChunk_IDAT(&outv, data, datasize, &encoder->settings.zlibsettings); if(encoder->error) break; /*IEND*/ addChunk_IEND(&outv); break; /*this isn't really a while loop; no error happened so break out now!*/ } free(data); /*instead of cleaning the vector up, give it to the output*/ *out = outv.data; *outsize = outv.size; } void LodePNG_EncodeSettings_init(LodePNG_EncodeSettings* settings) { LodeZlib_DeflateSettings_init(&settings->zlibsettings); settings->autoLeaveOutAlphaChannel = 1; settings->force_palette = 0; } void LodePNG_Encoder_init(LodePNG_Encoder* encoder) { LodePNG_EncodeSettings_init(&encoder->settings); LodePNG_InfoPng_init(&encoder->infoPng); LodePNG_InfoRaw_init(&encoder->infoRaw); encoder->error = 1; } void LodePNG_Encoder_cleanup(LodePNG_Encoder* encoder) { LodePNG_InfoPng_cleanup(&encoder->infoPng); LodePNG_InfoRaw_cleanup(&encoder->infoRaw); } void LodePNG_Encoder_copy(LodePNG_Encoder* dest, const LodePNG_Encoder* source) { LodePNG_Encoder_cleanup(dest); *dest = *source; LodePNG_InfoPng_init(&dest->infoPng); LodePNG_InfoRaw_init(&dest->infoRaw); dest->error = LodePNG_InfoPng_copy(&dest->infoPng, &source->infoPng); if(dest->error) return; dest->error = LodePNG_InfoRaw_copy(&dest->infoRaw, &source->infoRaw); if(dest->error) return; } /* ////////////////////////////////////////////////////////////////////////// */ /* / File IO / */ /* ////////////////////////////////////////////////////////////////////////// */ /*write given buffer to the file, overwriting the file, it doesn't append to it.*/ unsigned LodePNG_saveFile(const unsigned char* buffer, size_t buffersize, const char* filename) { FILE* file = fopen(filename,"wb"); if(!file) return 79; fwrite((char*)buffer , 1 , buffersize, file); fclose(file); return 0; }
94,076
C++
.cpp
2,114
40.109272
307
0.622472
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
true
false
false
true
false
false
28,512
fullversion.cpp
doxygen_doxygen/libversion/fullversion.cpp
#include <string.h> #include <version.h> std::string getFullVersion() { static std::string fullVersion; static bool init = false; if (!init) { fullVersion = getDoxygenVersion(); std::string gitVersion = getGitVersion(); if (!gitVersion.empty()) fullVersion+=" ("+gitVersion+")"; init = true; } return fullVersion; }
346
C++
.cpp
15
20.133333
62
0.684848
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,515
VhdlParser.cc
doxygen_doxygen/vhdlparser/VhdlParser.cc
/* VhdlParser.cc */ #include "VhdlParser.h" #include "TokenMgrError.h" namespace vhdl { namespace parser { unsigned int jj_la1_0[] = { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x90404000,0x80000,0x0,0x0,0x0,0x0,0x0,0x40000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80004000,0x10000000,0x400000,0x0,0x90404000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x40000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10800,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x400000,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40020000,0x40020001,0x0,0x0,0x0,0x0,0x4000000,0x0,0x0,0x40000000,0xd0020000,0x0,0x0,0x800000,0x0,0x0,0x80000000,0x4000,0x400000,0x0,0x0,0x80404000,0x0,0x0,0x0,0x0,0x8000,0x0,0x80000,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x10800,0x0,0x80000000,0x10000,0x0,0x10800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x90c04000,0x80000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x41000,0x0,0x0,0x10800,0x10000000,0x0,0x50000000,0x8000,0x80000000,0x0,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x4000000,0x8000000,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x800,0x4000000,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x80000000,0x4000,0x0,0x80004000,0x0,0x0,0x0,0x0,0x0,0x90004000,0x400000,0x0,0x0,0x90404000,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80004000,0x400000,0x0,0x80404000,0x0,0x0,0x0,0x0,0x0,0x0,0x21080000,0x0,0x0,0x80004000,0x400000,0x0,0x80404000,0x0,0x0,0x0,0x400000,0x404000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x1000000,0x0,0x1000000,0x21080000,0x80c04000,0x80404000,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x8000000,0x0,0x8000,0x4000000,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80004000,0x400000,0x0,0x80404000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x21080000,0x0,0x0,0x0,0x8000,0x0,0x0,0x41000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10800,0x2000,0x0,}; unsigned int jj_la1_1[] = { 0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x125808,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x1000,0x104800,0x0,0x1008,0x20000,0x125808,0x10000,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x1000,0x1000000,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000,0x400000,0x40000,0x400000,0x0,0x40000,0x400000,0x0,0x0,0x400000,0x20,0x0,0x200000,0x200000,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x1000,0x0,0x4000001,0x0,0x1,0x0,0x0,0x400000,0x4000101,0x4000101,0x0,0x10,0x0,0x0,0x8a00000,0x0,0x0,0x100,0x12024900,0x0,0x0,0x0,0x100,0x0,0x104000,0x800,0x8,0x20000,0x0,0x124808,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x200000,0x200000,0x0,0x0,0x10000,0x10000,0x125808,0x0,0x20,0x40,0x0,0x81000,0x0,0x0,0x0,0x0,0x0,0x40,0x20,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x800,0x800,0x0,0x200000,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x104000,0x100000,0x100000,0x0,0x1000000,0x0,0x0,0x0,0x104000,0x100000,0x100000,0x10000,0x0,0x0,0x0,0x0,0x0,0x8a00000,0x0,0x0,0x1000,0x0,0x0,0x0,0x1000,0x0,0x0,0x8a00000,0x8a00000,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800,0x40000,0x400000,0x0,0x0,0x104000,0x800,0x20000,0x124800,0x10000,0x10000,0x0,0x0,0x104000,0x800,0x8,0x20000,0x0,0x124808,0x10000,0x0,0x0,0x0,0x100,0x1,0x0,0x0,0x0,0x10000,0x0,0x0,0x1104000,0x800,0x0,0x20000,0x1124800,0x0,0x0,0x0,0x1000000,0x0,0x0,0x20081200,0x0,0x1104000,0x800,0x0,0x20000,0x1124800,0x0,0x10000,0x10000,0x4000,0x104000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x200000,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x20081200,0x1124800,0x1124800,0x0,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x8a00000,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x104000,0x1000000,0x1104800,0x0,0x20000,0x1124800,0x4000,0x0,0x100000,0x100000,0x10000,0x0,0x0,0x104000,0x20081200,0x0,0x10000,0x0,0x0,0x0,0x0,0x800,0x0,0x10000,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x0,0x104000,}; unsigned int jj_la1_2[] = { 0x0,0x0,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x221000,0x48000,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x400000,0x400000,0x0,0x0,0x0,0x4000,0x0,0x0,0x220000,0x1000,0x0,0x0,0x221000,0x0,0x4000,0x4000,0x0,0x0,0x0,0x0,0x48000,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x4000,0x0,0x0,0x0,0x4000,0x0,0x0,0x4000,0x800000,0x8000,0x8000,0x8000,0x0,0x0,0x2000000,0x0,0x2000000,0x0,0x0,0x2000000,0x0,0x0,0x2000000,0x0,0x0,0x800,0x800,0x23b,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x2000000,0x1000,0x1000,0x0,0x0,0x0,0x0,0x800,0x0,0x0,0x100,0x21000,0x0,0x0,0x0,0x0,0x0,0x220000,0x0,0x0,0x0,0x1000,0x221000,0x0,0x0,0x4000,0x0,0x400,0x8000,0x48000,0x0,0x0,0x0,0x0,0x0,0x0,0x209,0x23b,0x0,0x0,0x209,0x0,0x23b,0x100,0x100,0x800,0x800,0x0,0x0,0x0,0x0,0x221000,0x48000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x400000,0x0,0x0,0x23b,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x2000,0x2000,0x0,0x0,0x0,0x220000,0x200000,0x200000,0x0,0x0,0x2000,0x0,0x0,0x220000,0x200000,0x200000,0x0,0x2000,0x2000,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x1000,0x20,0x0,0x0,0x0,0x10,0x800,0x800,0x0,0x0,0x0,0x20000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x1000,0x0,0x220000,0x1000,0x0,0x221000,0x0,0x0,0x1000,0x0,0x220000,0x0,0x0,0x0,0x1000,0x221000,0x0,0x0,0x0,0x0,0x0,0x1000,0x2000,0x2000,0x0,0x0,0x2000,0x2000,0x220000,0x1000,0x0,0x0,0x221000,0x0,0x8000,0x0,0x0,0x8000,0x0,0x40000024,0x0,0x220000,0x1000,0x0,0x0,0x221000,0x0,0x0,0x0,0x10000,0x230000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x1000,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x800,0x800,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000024,0x221000,0x221000,0x80000000,0x80000000,0x0,0x2000000,0x0,0x1000000,0x0,0x1000000,0x0,0x400,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x0,0x220000,0x0,0x220000,0x0,0x0,0x220000,0x20000,0x0,0x200000,0x200000,0x0,0x2000,0x2000,0x220000,0x40000024,0x0,0x0,0x0,0x0,0x0,0x0,0xc00002,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x23b,0x0,0x268000,}; unsigned int jj_la1_3[] = { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x711060,0x20000000,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x100000,0x0,0x0,0x100000,0x0,0x611060,0x0,0x100000,0x0,0x711060,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000000,0x0,0x8000000,0x0,0x0,0x0,0x8000000,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000,0x0,0x8000,0x0,0x0,0x8000,0x0,0x0,0x8000,0x0,0x8000000,0x0,0x0,0xc0000000,0x8000000,0x0,0x8000000,0x8000000,0x8000000,0x0,0x0,0x100000,0x100000,0x0,0x0,0x100000,0x0,0x0,0x0,0x0,0x8000,0x100000,0x100000,0x0,0x4000,0x0,0x0,0x400000,0x400000,0x0,0x0,0x251020,0x0,0x0,0x0,0x0,0x0,0x11020,0x600040,0x100000,0x0,0x0,0x711060,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0xc0000000,0xc0020000,0x0,0x200020,0xc0000000,0x0,0xc0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x711060,0x20000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10000,0x40000,0x0,0x10000,0x0,0xc0000000,0x0,0x0,0x0,0x0,0x210060,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x410000,0x200060,0x200060,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x10000000,0x0,0x0,0x0,0x400000,0x0,0x0,0x400000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x210060,0x0,0x8000,0x0,0x0,0x211040,0x500000,0x0,0x711040,0x0,0x0,0x0,0x0,0x11000,0x600060,0x100000,0x0,0x0,0x711060,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x211040,0x100000,0x0,0x311040,0x0,0x0,0x0,0x0,0x0,0x0,0x34000002,0x0,0x0,0x211040,0x100000,0x0,0x311040,0x0,0x0,0x0,0x100000,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x2,0x0,0x8000000,0x0,0x40000,0x0,0x0,0x0,0x20000000,0x0,0x0,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x34000002,0x311040,0x311040,0x781,0x781,0x0,0x8000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x211040,0x100000,0x0,0x311040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x34000002,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x20000000,0x40,0x0,0x0,0x0,0x0,0x80000,0x0,0x0,0xc0020000,0x0,0x0,}; unsigned int jj_la1_4[] = { 0x0,0x0,0x0,0x0,0x0,0x100000,0xc1,0x100,0x400,0x0,0x0,0x0,0x0,0x200000,0x0,0x200004,0x4,0x4,0x4,0x200004,0x100,0x0,0x0,0x0,0x0,0x100,0x0,0x200000,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,0x0,0x0,0x200004,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x0,0x80000000,0x800,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200004,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x200004,0x0,0x0,0x0,0x0,0x0,0xa000c4,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x4,0x0,0x0,0x100000,0x100,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x200000,0x200000,0x200000,0x200000,0x0,0x100,0x0,0x0,0x0,0x0,0xa000c4,0x0,0x0,0x0,0x10,0xa00004,0x0,0x0,0x0,0x0,0x200000,0x4,0x0,0x0,0x0,0x200004,0x0,0x0,0x0,0x0,0x200000,0x100,0x0,0x100,0x0,0x0,0x0,0x0,0x200004,0x100004,0x0,0x200000,0x100,0xa000c4,0x0,0x4,0x200000,0x200000,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x4,0x0,0x0,0x200,0x0,0x0,0x0,0x100000,0x0,0x0,0x4,0x300000,0x0,0x0,0x0,0x0,0x0,0x4,0x200004,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x200004,0x0,0x0,0x0,0x20,0x200000,0x100,0x4,0x2,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x200000,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x200004,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x200000,0x200000,0x100,0x100,0x100,0x0,0x3f07e000,0x0,0x3f07e000,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x100,0x0,0x40000000,0x200000,0x40000000,0x0,0x40000000,0x0,0x0,0x900,0x900,0x100,0x100,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200004,0x0,0x0,0x0,0x0,0xc0,0x0,0x200004,0x0,0x200,0x0,0x100,0x200000,0x0,0x0,0x200,0x100,0x200000,0x0,0xc0,0x0,0x0,0x0,0x800,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x4,0x0,0x200004,0x0,0x0,0x4,0x0,0x200004,0x0,0x4,0x0,0x0,0x100,0x100,0x200004,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x100,0xa000c4,0x0,0x0,}; unsigned int jj_la1_5[] = { 0x1,0xa100,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x10,0x1e00,0x0,0x0,0xe00,0x0,0xe00,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0xc00,0x0,0xc00,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0xe00,0x0,0x0,0x0,0xc00,0xc00,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x80bf00,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0xc00,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x1e00,0xe00,0xe00,0x1e00,0x1c00,0x0,0xc00,0xc00,0x0,0x0,0x80bf00,0xd,0x0,0x0,0x0,0x80bf00,0x0,0x0,0x0,0x0,0xf00,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0xc00,0x0,0x1e00,0x0,0xc00,0x0,0xc00,0x0,0x0,0xc00,0xe00,0x0,0x0,0xe00,0x0,0x80bf00,0x0,0x0,0xe00,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0xc00,0x0,0xc00,0x0,0x0,0xe00,0xc00,0xc00,0x0,0x2,0xe00,0x0,0x0,0x10,0x0,0xc00,0xc00,0x0,0xc00,0xa100,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0xc00,0xe00,0xc00,0x0,0x0,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0xc00,0xe00,0xe00,0x0,0x0,0x0,0x0,0x0,0x8,0x0,0xc00,0x0,0xc00,0xc00,0xc00,0x0,0xc00,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0xc00,0xc00,0x0,0x0,0xc00,0xc00,0x0,0x0,0xc00,0xc00,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x10,0x0,0x0,0x1200,0xe00,0x0,0x0,0x0,0x0,0x0,0x0,0xe00,0x0,0x0,0x0,0xc00,0x0,0x0,0x0,0x0,0x80bf00,0x0,0xc00,}; unsigned int jj_la1_6[] = { 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; /** Constructor with user supplied TokenManager. */ QCString VhdlParser::absolute_pathname() {QCString s,s1; if (jj_2_1(2147483647)) { if (!hasError) { jj_consume_token(DOT_T); } if (!hasError) { s = pathname_element_list(); } if (!hasError) { s1 = identifier(); } if (!hasError) { return "."+s+s1; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case DOT_T:{ if (!hasError) { jj_consume_token(DOT_T); } if (!hasError) { s = identifier(); } if (!hasError) { return "."+s; } break; } default: jj_la1[0] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::abstract_literal() {Token *tok; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case DECIMAL_LITERAL:{ if (!hasError) { tok = jj_consume_token(DECIMAL_LITERAL); } if (!hasError) { return QCString(tok->image); } break; } case INTEGER:{ if (!hasError) { tok = jj_consume_token(INTEGER); } if (!hasError) { return QCString(tok->image); } break; } case BASED_LITERAL:{ if (!hasError) { tok = jj_consume_token(BASED_LITERAL); } if (!hasError) { return QCString(tok->image); } break; } default: jj_la1[1] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::access_type_definition() {Token *tok=nullptr;QCString str,str1; if (!hasError) { tok = jj_consume_token(ACCESS_T); } if (!hasError) { str1 = subtype_indication(); } str=tok->image; return str+str1; assert(false); } QCString VhdlParser::access_incomplete_type_definition() {Token *tok=nullptr;QCString str,str1; if (!hasError) { tok = jj_consume_token(ACCESS_T); } if (!hasError) { str1 = incomplete_subtype_indication(); } str=tok->image; return str+" "+str1; assert(false); } QCString VhdlParser::actual_designator() {QCString str,s;Token *t=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case OPEN_T:{ if (!hasError) { t = jj_consume_token(OPEN_T); } if (!hasError) { return QCString(t->image); } break; } default: jj_la1[3] = jj_gen; if (jj_2_2(2147483647)) { if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INERTIAL_T:{ if (!hasError) { t = jj_consume_token(INERTIAL_T); } if (!hasError) { s=QCString(t->image)+" "; } break; } default: jj_la1[2] = jj_gen; ; } } if (!hasError) { str = expression(); } if (!hasError) { return s+str; } } else if (jj_2_3(5)) { if (!hasError) { str = subtype_indication(); } if (!hasError) { return str; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { str = identifier(); } if (!hasError) { return str; } break; } default: jj_la1[4] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } assert(false); } QCString VhdlParser::actual_parameter_part() {QCString s; if (!hasError) { s = association_list(); } return s; assert(false); } QCString VhdlParser::actual_part() {QCString s,s1; if (jj_2_4(2147483647)) { if (!hasError) { s = actual_designator(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BOX_T:{ if (!hasError) { jj_consume_token(BOX_T); } if (!hasError) { return "<>"; } break; } default: jj_la1[5] = jj_gen; if (jj_2_5(2147483647)) { if (!hasError) { s = name(); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = actual_designator(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+="(";s+=s1+")";return s; } } else { jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } assert(false); } QCString VhdlParser::adding_operator() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PLUS_T:{ if (!hasError) { jj_consume_token(PLUS_T); } if (!hasError) { return "+"; } break; } case MINUS_T:{ if (!hasError) { jj_consume_token(MINUS_T); } if (!hasError) { return "-"; } break; } case AMPERSAND_T:{ if (!hasError) { jj_consume_token(AMPERSAND_T); } if (!hasError) { return "&"; } break; } default: jj_la1[6] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::aggregate() {QCString s,s1,s2; if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s = element_association(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[7] = jj_gen; goto end_label_1; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = element_association(); } if (!hasError) { s+=","+s1; } } end_label_1: ; } if (!hasError) { jj_consume_token(RPAREN_T); } return QCString("("+s+")"); assert(false); } QCString VhdlParser::alias_declaration() {QCString s,s1,s2; if (!hasError) { jj_consume_token(ALIAS_T); } if (!hasError) { s2 = alias_designator(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COLON_T:{ if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s+=":"; } if (!hasError) { s1 = subtype_indication(); } if (!hasError) { s+=s1; } break; } default: jj_la1[8] = jj_gen; ; } } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { s+=" is "; } if (!hasError) { s1 = name(); } if (!hasError) { s+=s1; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LBRACKET_T:{ if (!hasError) { s1 = signature(); } if (!hasError) { s+=s1; } break; } default: jj_la1[9] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } outlineParser()->addVhdlType(s2,outlineParser()->getLine(ALIAS_T), EntryType::makeVariable(),VhdlSpecifier::ALIAS,QCString(),s,Protection::Public); return s2+" "+s+";"; assert(false); } QCString VhdlParser::alias_designator() {Token *tok=nullptr;QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { return s; } break; } case CHARACTER_LITERAL:{ if (!hasError) { tok = jj_consume_token(CHARACTER_LITERAL); } if (!hasError) { return QCString(tok->image); } break; } case STRINGLITERAL:{ if (!hasError) { s = operator_symbol(); } if (!hasError) { return s; } break; } default: jj_la1[10] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } void VhdlParser::allocator() { if (jj_2_6(3)) { if (!hasError) { jj_consume_token(NEW_T); } if (!hasError) { qualified_expression(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NEW_T:{ if (!hasError) { jj_consume_token(NEW_T); } if (!hasError) { subtype_indication(); } break; } default: jj_la1[11] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::architecture_body() {QCString s,s1; if (!hasError) { jj_consume_token(ARCHITECTURE_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { s1 = name(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { QCString t=s1+"::"+s; m_sharedState->genLabels.clear(); outlineParser()->pushLabel(m_sharedState->genLabels,s1); m_sharedState->lastCompound=m_sharedState->current; outlineParser()->addVhdlType(t,outlineParser()->getLine(ARCHITECTURE_T), EntryType::makeClass(),VhdlSpecifier::ARCHITECTURE,QCString(),QCString(),Protection::Private); } if (!hasError) { try { if (!hasError) { architecture_declarative_part(); } } catch ( ...) { outlineParser()->error_skipto(BEGIN_T); } } if (!hasError) { jj_consume_token(BEGIN_T); } if (!hasError) { architecture_statement_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ARCHITECTURE_T:{ if (!hasError) { jj_consume_token(ARCHITECTURE_T); } break; } default: jj_la1[12] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } default: jj_la1[13] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->lastEntity=nullptr;m_sharedState->lastCompound=nullptr; m_sharedState->genLabels.clear(); } void VhdlParser::anonymous_type_indication() { if (!hasError) { jj_consume_token(TYPE_T); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { incomplete_type_definition(); } } void VhdlParser::architecture_declarative_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case COMPONENT_T: case CONSTANT_T: case DISCONNECT_T: case FILE_T: case FOR_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SIGNAL_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T: case VIEW_T:{ ; break; } default: jj_la1[14] = jj_gen; goto end_label_2; } if (!hasError) { block_declarative_item(); } } end_label_2: ; } } void VhdlParser::architecture_statement_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ASSERT_T: case POSTPONED_T: case PROCESS_T: case WITH_T: case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case VHDL2008TOOLDIR:{ ; break; } default: jj_la1[15] = jj_gen; goto end_label_3; } if (!hasError) { concurrent_statement(); } } end_label_3: ; } } void VhdlParser::array_constraint() { if (jj_2_7(2)) { if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { jj_consume_token(OPEN_T); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { array_element_constraint(); } break; } default: jj_la1[16] = jj_gen; ; } } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { index_constraint(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { array_element_constraint(); } break; } default: jj_la1[17] = jj_gen; ; } } break; } default: jj_la1[18] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::array_element_constraint() { if (!hasError) { element_constraint(); } } void VhdlParser::array_element_resolution() { if (!hasError) { resolution_indication(); } } void VhdlParser::array_incomplete_type_definition() { if (!hasError) { jj_consume_token(ARRAY_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { array_index_incomplete_type_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { incomplete_subtype_indication(); } } void VhdlParser::array_index_incomplete_type() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { index_constraint(); } break; } case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { index_subtype_definition(); } break; } case TYPE_T:{ if (!hasError) { anonymous_type_indication(); } break; } default: jj_la1[19] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } void VhdlParser::array_index_incomplete_type_list() { if (!hasError) { array_index_incomplete_type(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[20] = jj_gen; goto end_label_4; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { array_index_incomplete_type(); } } end_label_4: ; } } QCString VhdlParser::array_mode_view_indication() {QCString s; if (!hasError) { jj_consume_token(VIEW_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { subtype_indication(); } return ""; assert(false); } QCString VhdlParser::array_type_definition() {QCString s; if (jj_2_8(2147483647)) { if (!hasError) { s = constraint_array_definition(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ARRAY_T:{ if (!hasError) { s = unconstraint_array_definition(); } if (!hasError) { return s; } break; } default: jj_la1[21] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::assertion() {QCString s,s1,s2;Token *t=nullptr;Token *t1=nullptr; if (!hasError) { jj_consume_token(ASSERT_T); } if (!hasError) { s = condition(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case REPORT_T:{ if (!hasError) { t = jj_consume_token(REPORT_T); } if (!hasError) { s1 = expression(); } break; } default: jj_la1[22] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SEVERITY_T:{ if (!hasError) { t1 = jj_consume_token(SEVERITY_T); } if (!hasError) { s2 = expression(); } break; } default: jj_la1[23] = jj_gen; ; } } s.prepend("assert "); if(t!=nullptr) s1.prepend(" report "); if(t1!=nullptr) s2.prepend(" report "); return s+s1+s2; assert(false); } QCString VhdlParser::assertion_statement() {QCString s,s1,s2;Token *t=nullptr; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = label(); } if (!hasError) { t = jj_consume_token(COLON_T); } break; } default: jj_la1[24] = jj_gen; ; } } if (!hasError) { s1 = assertion(); } if (!hasError) { jj_consume_token(SEMI_T); } if(t!=nullptr) s+=":"; return s+s1+";"; assert(false); } QCString VhdlParser::association_element() {QCString s,s1; if (!hasError) { if (jj_2_9(2147483647)) { if (!hasError) { s = formal_part(); } if (!hasError) { jj_consume_token(ARROW_T); } } else { ; } } if (!hasError) { s1 = actual_part(); } return s+" => "+s1; assert(false); } QCString VhdlParser::association_list() {QCString s,s1; if (!hasError) { s = association_element(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[25] = jj_gen; goto end_label_5; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = association_element(); } if (!hasError) { s+=","+s1; } } end_label_5: ; } return s; assert(false); } QCString VhdlParser::attribute_declaration() {QCString s,s1; if (!hasError) { jj_consume_token(ATTRIBUTE_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = type_mark(); } if (!hasError) { jj_consume_token(SEMI_T); } outlineParser()->addVhdlType(s,outlineParser()->getLine(ATTRIBUTE_T), EntryType::makeVariable(),VhdlSpecifier::ATTRIBUTE,QCString(),s1,Protection::Public); return " attribute "+s+":"+s1+";"; assert(false); } QCString VhdlParser::attribute_designator() {QCString s;Token *tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { return s; } break; } case RANGE_T:{ if (!hasError) { tok = jj_consume_token(RANGE_T); } if (!hasError) { return QCString(tok->image); } break; } default: jj_la1[26] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::attribute_name() {QCString s,s1; if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(APOSTROPHE_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case RANGE_T:{ if (!hasError) { jj_consume_token(RANGE_T); } break; } case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s1 = name(); } break; } default: jj_la1[27] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } if (!hasError) { s+=s1; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+=s1; } break; } default: jj_la1[28] = jj_gen; ; } } return s; assert(false); } QCString VhdlParser::attribute_specification() {QCString s,s1,s2; if (!hasError) { jj_consume_token(ATTRIBUTE_T); } if (!hasError) { s = attribute_designator(); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { s1 = entity_specification(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { s2 = conditional_expression(); } if (!hasError) { jj_consume_token(SEMI_T); } QCString t= s1+" is "+s2; outlineParser()->addVhdlType(s,outlineParser()->getLine(ATTRIBUTE_T), EntryType::makeVariable(),VhdlSpecifier::ATTRIBUTE,QCString(),t,Protection::Public); return " attribute "+s+" of "+s1+ " is "+s2+";"; assert(false); } QCString VhdlParser::base() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(INTEGER); } return QCString(tok->image); assert(false); } QCString VhdlParser::base_specifier() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(BASIC_IDENTIFIER); } return QCString(tok->image); assert(false); } QCString VhdlParser::base_unit_declaration() {QCString s; if (!hasError) { s = identifier(); } return s; assert(false); } QCString VhdlParser::based_integer() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(BASIC_IDENTIFIER); } return QCString(tok->image); assert(false); } QCString VhdlParser::based_literal() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(BASED_LITERAL); } return QCString(tok->image); assert(false); } QCString VhdlParser::basic_identifier() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(BASIC_IDENTIFIER); } return QCString(tok->image); assert(false); } void VhdlParser::binding_indication() { if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case USE_T:{ if (!hasError) { jj_consume_token(USE_T); } if (!hasError) { entity_aspect(); } break; } default: jj_la1[29] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_map_aspect(); } break; } default: jj_la1[30] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PORT_T:{ if (!hasError) { port_map_aspect(); } break; } default: jj_la1[31] = jj_gen; ; } } } QCString VhdlParser::bit_string_literal() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(BIT_STRING_LITERAL); } return QCString(tok->image); assert(false); } QCString VhdlParser::bit_value() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(BASIC_IDENTIFIER); } return QCString(tok->image); assert(false); } void VhdlParser::block_configuration() { if (!hasError) { jj_consume_token(FOR_T); } if (!hasError) { block_specification(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case USE_T:{ ; break; } default: jj_la1[32] = jj_gen; goto end_label_6; } if (!hasError) { use_clause(); } } end_label_6: ; } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FOR_T:{ ; break; } default: jj_la1[33] = jj_gen; goto end_label_7; } if (!hasError) { configuration_item(); } } end_label_7: ; } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(FOR_T); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::block_declarative_item() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_declaration(); } break; } case TYPE_T:{ if (!hasError) { type_declaration(); } break; } case SUBTYPE_T:{ if (!hasError) { subtype_declaration(); } break; } case VIEW_T:{ if (!hasError) { mode_view_declaration(); } break; } case CONSTANT_T:{ if (!hasError) { constant_declaration(); } break; } case SIGNAL_T:{ if (!hasError) { signal_declaration(); } break; } case SHARED_T: case VARIABLE_T:{ if (!hasError) { variable_declaration(); } break; } case FILE_T:{ if (!hasError) { file_declaration(); } break; } case ALIAS_T:{ if (!hasError) { alias_declaration(); } break; } default: jj_la1[34] = jj_gen; if (jj_2_10(2)) { if (!hasError) { package_body(); } } else if (jj_2_11(2147483647)) { if (!hasError) { package_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { package_instantiation_declaration(); } break; } case COMPONENT_T:{ if (!hasError) { component_declaration(); } break; } default: jj_la1[35] = jj_gen; if (jj_2_12(2147483647)) { if (!hasError) { attribute_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ATTRIBUTE_T:{ if (!hasError) { attribute_specification(); } break; } case FOR_T:{ if (!hasError) { configuration_specification(); } break; } case DISCONNECT_T:{ if (!hasError) { disconnection_specification(); } break; } case USE_T:{ if (!hasError) { use_clause(); } break; } default: jj_la1[36] = jj_gen; if (jj_2_13(3)) { if (!hasError) { group_template_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GROUP_T:{ if (!hasError) { group_declaration(); } break; } default: jj_la1[37] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } } } } } void VhdlParser::block_declarative_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case COMPONENT_T: case CONSTANT_T: case DISCONNECT_T: case FILE_T: case FOR_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SIGNAL_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T: case VIEW_T:{ ; break; } default: jj_la1[38] = jj_gen; goto end_label_8; } if (!hasError) { block_declarative_item(); } } end_label_8: ; } } void VhdlParser::block_header() { if (!hasError) { if (jj_2_14(2147483647)) { if (!hasError) { generic_clause(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_map_aspect(); } if (!hasError) { jj_consume_token(SEMI_T); } break; } default: jj_la1[39] = jj_gen; ; } } } else { ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PORT_T:{ if (!hasError) { port_clause(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PORT_T:{ if (!hasError) { port_map_aspect(); } if (!hasError) { jj_consume_token(SEMI_T); } break; } default: jj_la1[40] = jj_gen; ; } } break; } default: jj_la1[41] = jj_gen; ; } } } void VhdlParser::block_specification() { if (!hasError) { name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { index_specification(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[42] = jj_gen; ; } } } void VhdlParser::block_statement() {QCString s; if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { jj_consume_token(BLOCK_T); } if (!hasError) { outlineParser()->pushLabel(m_sharedState->genLabels,s); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[43] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IS_T:{ if (!hasError) { jj_consume_token(IS_T); } break; } default: jj_la1[44] = jj_gen; ; } } if (!hasError) { block_header(); } if (!hasError) { block_declarative_part(); } if (!hasError) { jj_consume_token(BEGIN_T); } if (!hasError) { block_statement_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(BLOCK_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[45] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->genLabels=outlineParser()->popLabel(m_sharedState->genLabels); } void VhdlParser::block_statement_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ASSERT_T: case POSTPONED_T: case PROCESS_T: case WITH_T: case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case VHDL2008TOOLDIR:{ ; break; } default: jj_la1[46] = jj_gen; goto end_label_9; } if (!hasError) { concurrent_statement(); } } end_label_9: ; } } void VhdlParser::case_statement() {QCString s; if (!hasError) { if (jj_2_15(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { jj_consume_token(CASE_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case Q_T:{ if (!hasError) { jj_consume_token(Q_T); } break; } default: jj_la1[47] = jj_gen; ; } } if (!hasError) { s = expression(); } if (!hasError) { QCString ca="case "+s; FlowChart::addFlowChart(FlowChart::CASE_NO,QCString(),ca); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { case_statement_alternative(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ ; break; } default: jj_la1[48] = jj_gen; goto end_label_10; } if (!hasError) { case_statement_alternative(); } } end_label_10: ; } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(CASE_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case Q_T:{ if (!hasError) { jj_consume_token(Q_T); } break; } default: jj_la1[49] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[50] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } FlowChart::moveToPrevLevel(); FlowChart::addFlowChart(FlowChart::END_CASE,"end case",QCString()); } void VhdlParser::case_scheme() { if (!hasError) { jj_consume_token(CASE_T); } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(GENERATE_T); } if (!hasError) { when_stats(); } if (!hasError) { if (jj_2_16(3)) { if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[51] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } } else { ; } } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(GENERATE_T); } if (!hasError) { generate_statement_body(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::when_stats() { if (!hasError) { while (!hasError) { if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { if (jj_2_17(2)) { if (!hasError) { label(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { choices(); } if (!hasError) { jj_consume_token(ARROW_T); } if (!hasError) { generate_statement_body(); } switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ ; break; } default: jj_la1[52] = jj_gen; goto end_label_11; } } end_label_11: ; } } void VhdlParser::case_statement_alternative() {QCString s; if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { s = choices(); } if (!hasError) { jj_consume_token(ARROW_T); } if (!hasError) { QCString t("when "); t+=s+"=> "; FlowChart::addFlowChart(FlowChart::WHEN_NO,s,t); } if (!hasError) { sequential_statement_body(); } FlowChart::moveToPrevLevel(); } QCString VhdlParser::character_literal() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(CHARACTER_LITERAL); } return QCString(tok->image); assert(false); } QCString VhdlParser::choice() {QCString s; if (jj_2_18(2147483647)) { if (!hasError) { s = range(); } if (!hasError) { return s; } } else if (jj_2_19(2147483647)) { if (!hasError) { s = simple_expression(); } if (!hasError) { return s; } } else if (jj_2_20(2147483647)) { if (!hasError) { s = discrete_range(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { return s; } break; } case OTHER_T:{ if (!hasError) { jj_consume_token(OTHER_T); } if (!hasError) { return " others "; } break; } default: jj_la1[53] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::choices() {QCString s,s1; if (!hasError) { s = choice(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BAR_T:{ ; break; } default: jj_la1[54] = jj_gen; goto end_label_12; } if (!hasError) { jj_consume_token(BAR_T); } if (!hasError) { s1 = choice(); } if (!hasError) { s+="|";s+=s1; } } end_label_12: ; } return s; assert(false); } void VhdlParser::component_configuration() { if (!hasError) { jj_consume_token(FOR_T); } if (!hasError) { component_specification(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T: case PORT_T: case USE_T: case SEMI_T:{ if (!hasError) { binding_indication(); } if (!hasError) { jj_consume_token(SEMI_T); } break; } default: jj_la1[55] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FOR_T:{ if (!hasError) { block_configuration(); } break; } default: jj_la1[56] = jj_gen; ; } } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(FOR_T); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::component_declaration() {QCString s; if (!hasError) { jj_consume_token(COMPONENT_T); } if (!hasError) { s = identifier(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IS_T:{ if (!hasError) { jj_consume_token(IS_T); } break; } default: jj_la1[57] = jj_gen; ; } } if (!hasError) { m_sharedState->currP=VhdlSpecifier::COMPONENT; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_clause(); } break; } default: jj_la1[58] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PORT_T:{ if (!hasError) { port_clause(); } break; } default: jj_la1[59] = jj_gen; ; } } if (!hasError) { outlineParser()->addVhdlType(s,outlineParser()->getLine(COMPONENT_T), EntryType::makeVariable(),VhdlSpecifier::COMPONENT,QCString(),QCString(),Protection::Public); m_sharedState->currP=VhdlSpecifier::UNKNOWN; } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMPONENT_T:{ if (!hasError) { jj_consume_token(COMPONENT_T); } break; } default: jj_la1[60] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[61] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::component_instantiation_statement() {QCString s,s1; if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = instantiation_unit(); } if (!hasError) { QCString s3; if (s1.contains("|")) { s3=VhdlDocGen::getIndexWord(s1,0); s1=VhdlDocGen::getIndexWord(s1,1); } outlineParser()->addCompInst(s.lower(),s1.lower(),s3,outlineParser()->getLine()); } if (!hasError) { if (jj_2_21(2147483647)) { if (!hasError) { generic_map_aspect(); } } else { ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PORT_T:{ if (!hasError) { port_map_aspect(); } break; } default: jj_la1[62] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::component_specification() { if (!hasError) { instantiation_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { name(); } } QCString VhdlParser::composite_type_definition() {QCString s,s1; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ARRAY_T:{ if (!hasError) { s = array_type_definition(); } if (!hasError) { return s; } break; } case RECORD_T:{ if (!hasError) { record_type_definition(); } if (!hasError) { return s+"#"; } break; } default: jj_la1[63] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } void VhdlParser::concurrent_assertion_statement() { if (!hasError) { if (jj_2_22(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case POSTPONED_T:{ if (!hasError) { jj_consume_token(POSTPONED_T); } break; } default: jj_la1[64] = jj_gen; ; } } if (!hasError) { assertion(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::concurrent_procedure_call_statement() { if (!hasError) { if (jj_2_23(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case POSTPONED_T:{ if (!hasError) { jj_consume_token(POSTPONED_T); } break; } default: jj_la1[65] = jj_gen; ; } } if (!hasError) { procedure_call(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::concurrent_signal_assignment_statement() { if (!hasError) { if (jj_2_24(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case POSTPONED_T:{ if (!hasError) { jj_consume_token(POSTPONED_T); } break; } default: jj_la1[66] = jj_gen; ; } } if (!hasError) { if (jj_2_25(2147483647)) { if (!hasError) { concurrent_conditional_signal_assignment(); } } else if (jj_2_26(2147483647)) { if (!hasError) { concurrent_selected_signal_assignment(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { concurrent_simple_signal_assignment(); } break; } default: jj_la1[67] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } void VhdlParser::concurrent_conditional_signal_assignment() { if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GUARDED_T:{ if (!hasError) { jj_consume_token(GUARDED_T); } break; } default: jj_la1[68] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INERTIAL_T: case REJECT_T: case TRANSPORT_T:{ if (!hasError) { delay_mechanism(); } break; } default: jj_la1[69] = jj_gen; ; } } if (!hasError) { conditional_waveforms(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::concurrent_simple_signal_assignment() { if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GUARDED_T:{ if (!hasError) { jj_consume_token(GUARDED_T); } break; } default: jj_la1[70] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INERTIAL_T: case REJECT_T: case TRANSPORT_T:{ if (!hasError) { delay_mechanism(); } break; } default: jj_la1[71] = jj_gen; ; } } if (!hasError) { waveform(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::concurrent_selected_signal_assignment() { if (!hasError) { jj_consume_token(WITH_T); } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(SELECT_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case Q_T:{ if (!hasError) { jj_consume_token(Q_T); } break; } default: jj_la1[72] = jj_gen; ; } } if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GUARDED_T:{ if (!hasError) { jj_consume_token(GUARDED_T); } break; } default: jj_la1[73] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INERTIAL_T: case REJECT_T: case TRANSPORT_T:{ if (!hasError) { delay_mechanism(); } break; } default: jj_la1[74] = jj_gen; ; } } if (!hasError) { selected_waveforms(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::concurrent_signal_association_statement() { if (!hasError) { if (jj_2_27(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { concurrent_simple_signal_association(); } } void VhdlParser::concurrent_simple_signal_association() { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(LGT_T); } if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::concurrent_statement() { if (jj_2_28(2147483647)) { if (!hasError) { block_statement(); } } else if (jj_2_29(2147483647)) { if (!hasError) { process_statement(); } } else if (jj_2_30(3)) { if (!hasError) { generate_statement(); } } else if (jj_2_31(2147483647)) { if (!hasError) { concurrent_assertion_statement(); } } else if (jj_2_32(2147483647)) { if (!hasError) { concurrent_signal_assignment_statement(); } } else if (jj_2_33(2147483647)) { if (!hasError) { concurrent_signal_association_statement(); } } else if (jj_2_34(2147483647)) { if (!hasError) { component_instantiation_statement(); } } else if (jj_2_35(2147483647)) { if (!hasError) { concurrent_procedure_call_statement(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VHDL2008TOOLDIR:{ if (!hasError) { jj_consume_token(VHDL2008TOOLDIR); } break; } default: jj_la1[75] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } QCString VhdlParser::condition() {QCString s; if (!hasError) { s = expression(); } return s; assert(false); } QCString VhdlParser::condition_operator() {QCString s; if (!hasError) { jj_consume_token(QQ_T); } return "??"; assert(false); } QCString VhdlParser::condition_clause() {QCString s; if (!hasError) { jj_consume_token(UNTIL_T); } if (!hasError) { s = condition(); } return " until "+s; assert(false); } void VhdlParser::conditional_signal_assignment_wave() { if (jj_2_36(2147483647)) { if (!hasError) { conditional_force_assignment(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { conditional_waveform_assignment(); } break; } default: jj_la1[76] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::conditional_waveform_assignment() { if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INERTIAL_T: case REJECT_T: case TRANSPORT_T:{ if (!hasError) { delay_mechanism(); } break; } default: jj_la1[77] = jj_gen; ; } } if (!hasError) { waveform_element(); } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { expression(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ELSE_T:{ if (!hasError) { else_wave_list(); } break; } default: jj_la1[78] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::else_wave_list() { if (!hasError) { jj_consume_token(ELSE_T); } if (!hasError) { expression(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { expression(); } break; } default: jj_la1[79] = jj_gen; ; } } } void VhdlParser::conditional_force_assignment() { if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { jj_consume_token(FORCE_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IN_T: case OUT_T:{ switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IN_T:{ if (!hasError) { jj_consume_token(IN_T); } break; } case OUT_T:{ if (!hasError) { jj_consume_token(OUT_T); } break; } default: jj_la1[80] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } break; } default: jj_la1[81] = jj_gen; ; } } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ABS_T: case AND_T: case NAND_T: case NEW_T: case NOR_T: case NOT_T: case NULL_T: case OR_T: case XOR_T: case XNOR_T: case LPAREN_T: case PLUS_T: case MINUS_T: case SLSL_T: case QQ_T: case INTEGER: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case CHARACTER_LITERAL: case DECIMAL_LITERAL: case BASED_LITERAL: case BIT_STRING_LITERAL:{ if (!hasError) { expression(); } if (!hasError) { else_stat(); } break; } default: jj_la1[82] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::else_stat() { if (!hasError) { while (!hasError) { if (!hasError) { jj_consume_token(ELSE_T); } if (!hasError) { expression(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { expression(); } break; } default: jj_la1[83] = jj_gen; ; } } switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ELSE_T:{ ; break; } default: jj_la1[84] = jj_gen; goto end_label_13; } } end_label_13: ; } } QCString VhdlParser::conditional_expression() {QCString s; if (!hasError) { s = expression(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ ; break; } default: jj_la1[85] = jj_gen; goto end_label_14; } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { condition(); } if (!hasError) { jj_consume_token(ELSE_T); } if (!hasError) { expression(); } } end_label_14: ; } return s; assert(false); } QCString VhdlParser::conditional_or_unaffected_expression() {QCString s; if (!hasError) { s = expression_or_unaffected(); } if (!hasError) { while (!hasError) { if (jj_2_37(2147483647)) { ; } else { goto end_label_15; } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { condition(); } if (!hasError) { jj_consume_token(ELSE_T); } if (!hasError) { expression_or_unaffected(); } } end_label_15: ; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { condition(); } break; } default: jj_la1[86] = jj_gen; ; } } return s; assert(false); } void VhdlParser::conditional_signal_assignment() { if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { options(); } if (!hasError) { conditional_waveforms(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::conditional_waveforms() { if (!hasError) { waveform(); } if (!hasError) { while (!hasError) { if (jj_2_38(2147483647)) { ; } else { goto end_label_16; } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { condition(); } if (!hasError) { jj_consume_token(ELSE_T); } if (!hasError) { waveform(); } } end_label_16: ; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { condition(); } break; } default: jj_la1[87] = jj_gen; ; } } } void VhdlParser::configuration_declaration() {QCString s,s1; if (!hasError) { jj_consume_token(CONFIGURATION_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { s1 = name(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { m_sharedState->confName=s+"::"+s1; outlineParser()->addVhdlType(s,outlineParser()->getLine(CONFIGURATION_T), EntryType::makeVariable(),VhdlSpecifier::CONFIG,"configuration",s1,Protection::Public); } if (!hasError) { configuration_declarative_part(); } if (!hasError) { block_configuration(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CONFIGURATION_T:{ if (!hasError) { jj_consume_token(CONFIGURATION_T); } break; } default: jj_la1[88] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } default: jj_la1[89] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->genLabels.clear(); m_sharedState->confName=""; } void VhdlParser::configuration_declarative_item() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case USE_T:{ if (!hasError) { use_clause(); } break; } case ATTRIBUTE_T:{ if (!hasError) { attribute_specification(); } break; } case GROUP_T:{ if (!hasError) { group_declaration(); } break; } default: jj_la1[90] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } void VhdlParser::configuration_declarative_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ATTRIBUTE_T: case GROUP_T: case USE_T:{ ; break; } default: jj_la1[91] = jj_gen; goto end_label_17; } if (!hasError) { configuration_declarative_item(); } } end_label_17: ; } } void VhdlParser::configuration_item() { if (jj_2_39(2147483647)) { if (!hasError) { component_configuration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FOR_T:{ if (!hasError) { block_configuration(); } break; } default: jj_la1[92] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::configuration_specification() { if (!hasError) { jj_consume_token(FOR_T); } if (!hasError) { component_specification(); } if (!hasError) { binding_indication(); } if (!hasError) { jj_consume_token(SEMI_T); } } QCString VhdlParser::constant_declaration() {QCString s,s1,s2;Token *t=nullptr; if (!hasError) { jj_consume_token(CONSTANT_T); } if (!hasError) { s = identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = subtype_indication(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VARASSIGN_T:{ if (!hasError) { t = jj_consume_token(VARASSIGN_T); } if (!hasError) { s2 = conditional_expression(); } break; } default: jj_la1[93] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if(t!=nullptr) s2.prepend(":="); QCString it=s1+s2; outlineParser()->addVhdlType(s,outlineParser()->getLine(CONSTANT_T), EntryType::makeVariable(),VhdlSpecifier::CONSTANT,QCString(),it,Protection::Public); it.prepend("constant "); return it; assert(false); } QCString VhdlParser::constraint_array_definition() {QCString s,s1; if (!hasError) { jj_consume_token(ARRAY_T); } if (!hasError) { s = index_constraint(); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { s1 = subtype_indication(); } return s+" "+s1; assert(false); } void VhdlParser::context_clause() { if (!hasError) { while (!hasError) { if (!hasError) { context_item(); } if (jj_2_40(3)) { ; } else { goto end_label_18; } } end_label_18: ; } } QCString VhdlParser::constraint() {QCString s; if (jj_2_41(2147483647)) { if (!hasError) { s = range_constraint(); } if (!hasError) { return s; } } else if (jj_2_42(2147483647)) { if (!hasError) { s = index_constraint(); } if (!hasError) { return s; } } else { jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } void VhdlParser::context_item() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LIBRARY_T:{ if (!hasError) { library_clause(); } break; } case USE_T:{ if (!hasError) { use_clause(); } break; } case CONTEXT_T:{ if (!hasError) { context_ref(); } break; } default: jj_la1[94] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } QCString VhdlParser::context_ref() {QCString s, s1; if (!hasError) { jj_consume_token(CONTEXT_T); } if (!hasError) { s = identifier(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case DOT_T:{ ; break; } default: jj_la1[95] = jj_gen; goto end_label_19; } if (!hasError) { jj_consume_token(DOT_T); } if (!hasError) { s1 = identifier(); } if (!hasError) { s+=".";s+=s1; } } end_label_19: ; } if (!hasError) { jj_consume_token(SEMI_T); } return "context "+s ; assert(false); } void VhdlParser::context_declaration() {QCString s,s1; if (!hasError) { jj_consume_token(CONTEXT_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { m_sharedState->parse_sec=VhdlSection::CONTEXT_SEC; } if (!hasError) { context_clause(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CONTEXT_T:{ if (!hasError) { jj_consume_token(CONTEXT_T); } break; } default: jj_la1[96] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[97] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->parse_sec=VhdlSection::UNKNOWN; outlineParser()->addVhdlType(s,outlineParser()->getLine(LIBRARY_T), EntryType::makeVariable(),VhdlSpecifier::LIBRARY,"context",s1,Protection::Public); } QCString VhdlParser::decimal_literal() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(DECIMAL_LITERAL); } return QCString(tok->image); assert(false); } QCString VhdlParser::delay_mechanism() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case TRANSPORT_T:{ if (!hasError) { jj_consume_token(TRANSPORT_T); } if (!hasError) { return " transport "; } break; } case INERTIAL_T: case REJECT_T:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case REJECT_T:{ if (!hasError) { jj_consume_token(REJECT_T); } if (!hasError) { s = expression(); } if (!hasError) { s.prepend(" reject "); } break; } default: jj_la1[98] = jj_gen; ; } } if (!hasError) { jj_consume_token(INERTIAL_T); } if (!hasError) { return s+" inertial "; } break; } default: jj_la1[99] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } void VhdlParser::design_file() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ARCHITECTURE_T: case CONFIGURATION_T: case CONTEXT_T: case ENTITY_T: case LIBRARY_T: case PACKAGE_T: case USE_T:{ if (!hasError) { while (!hasError) { if (!hasError) { design_unit(); } switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ARCHITECTURE_T: case CONFIGURATION_T: case CONTEXT_T: case ENTITY_T: case LIBRARY_T: case PACKAGE_T: case USE_T:{ ; break; } default: jj_la1[100] = jj_gen; goto end_label_20; } } end_label_20: ; } if (!hasError) { } break; } case 0:{ if (!hasError) { jj_consume_token(0); } break; } default: jj_la1[101] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } void VhdlParser::design_unit() { if (!hasError) { if (jj_2_43(3)) { if (!hasError) { context_clause(); } } else { ; } } if (!hasError) { library_unit(); } } QCString VhdlParser::designator() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { return s; } break; } case STRINGLITERAL:{ if (!hasError) { s = operator_symbol(); } if (!hasError) { return s; } break; } default: jj_la1[102] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::direction() {Token *tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case TO_T:{ if (!hasError) { tok = jj_consume_token(TO_T); } if (!hasError) { return QCString(tok->image); } break; } case DOWNTO_T:{ if (!hasError) { tok = jj_consume_token(DOWNTO_T); } if (!hasError) { return QCString(tok->image); } break; } default: jj_la1[103] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::discrete_incomplete_type_definition() {Token *tok=nullptr; if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { jj_consume_token(BOX_T); } if (!hasError) { jj_consume_token(RPAREN_T); } return "(<>)"; assert(false); } void VhdlParser::disconnection_specification() { if (!hasError) { jj_consume_token(DISCONNECT_T); } if (!hasError) { guarded_signal_specificatio(); } if (!hasError) { jj_consume_token(AFTER_T); } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::guarded_signal_specificatio() { if (!hasError) { signal_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { name(); } } QCString VhdlParser::discrete_range() {QCString s; if (jj_2_44(2147483647)) { if (!hasError) { s = range(); } if (!hasError) { return s; } } else if (jj_2_45(2147483647)) { if (!hasError) { s = subtype_indication(); } if (!hasError) { return s; } } else { jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::element_array_mode_view_indication() {QCString s; if (!hasError) { jj_consume_token(VIEW_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(RPAREN_T); } return "view("+s+")"; assert(false); } QCString VhdlParser::element_association() {QCString s,s1; if (!hasError) { if (jj_2_46(2147483647)) { if (!hasError) { s = choices(); } if (!hasError) { jj_consume_token(ARROW_T); } } else { ; } } if (!hasError) { s1 = expression(); } if(!s.isEmpty()) return s+"=>"+s1; return s1; assert(false); } QCString VhdlParser::element_constraint() {QCString s,s1; if (jj_2_47(5)) { if (!hasError) { record_constraint(); } if (!hasError) { return " "; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { array_constraint(); } if (!hasError) { return " "; } break; } default: jj_la1[104] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::element_declaration() {QCString rec_name,s1,s2; if (!hasError) { rec_name = identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = subtype_indication(); } if (!hasError) { jj_consume_token(SEMI_T); } auto ql = split(rec_name.str(),","); for (const auto &n : ql) { std::string name=n+"~"; name+=outlineParser()->getNameID().str(); outlineParser()->addVhdlType( name.c_str(),outlineParser()->getLine(), EntryType::makeVariable(), VhdlSpecifier::RECORD,QCString(), s1, Protection::Public); } s2=rec_name+":"+s1; return s2; assert(false); } QCString VhdlParser::element_resolution() {QCString s,s1; if (jj_2_48(2147483647)) { if (!hasError) { array_element_resolution(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { record_resolution(); } break; } default: jj_la1[105] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::element_mode_indication() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BUFFER_T: case IN_T: case INOUT_T: case LINKAGE_T: case OUT_T:{ if (!hasError) { s = mode(); } if (!hasError) { return s; } break; } case VIEW_T:{ if (!hasError) { s = element_mode_view_indication(); } if (!hasError) { return s; } break; } default: jj_la1[106] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::element_mode_view_indication() {QCString s; if (jj_2_49(2)) { if (!hasError) { s = element_record_mode_view_indication(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VIEW_T:{ if (!hasError) { s = element_array_mode_view_indication(); } if (!hasError) { return s; } break; } default: jj_la1[107] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::element_record_mode_view_indication() {QCString s; if (!hasError) { jj_consume_token(VIEW_T); } if (!hasError) { s = identifier(); } return "view "+s; assert(false); } QCString VhdlParser::entity_aspect() {Token *tok=nullptr;QCString s,s1; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ENTITY_T:{ if (!hasError) { tok = jj_consume_token(ENTITY_T); } if (!hasError) { s = name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = identifier(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+="("+s1+")"; } break; } default: jj_la1[108] = jj_gen; ; } } if (!hasError) { return s; } break; } case CONFIGURATION_T:{ if (!hasError) { tok = jj_consume_token(CONFIGURATION_T); } if (!hasError) { s = name(); } if (!hasError) { return QCString(tok->image)+s; } break; } case OPEN_T:{ if (!hasError) { tok = jj_consume_token(OPEN_T); } if (!hasError) { return QCString(tok->image); } break; } default: jj_la1[109] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::entity_class() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ENTITY_T:{ if (!hasError) { jj_consume_token(ENTITY_T); } if (!hasError) { return "entity"; } break; } case ARCHITECTURE_T:{ if (!hasError) { jj_consume_token(ARCHITECTURE_T); } if (!hasError) { return "architecture"; } break; } case CONFIGURATION_T:{ if (!hasError) { jj_consume_token(CONFIGURATION_T); } if (!hasError) { return "configuration"; } break; } case PROCEDURE_T:{ if (!hasError) { jj_consume_token(PROCEDURE_T); } if (!hasError) { return "procedure"; } break; } case FUNCTION_T:{ if (!hasError) { jj_consume_token(FUNCTION_T); } if (!hasError) { return "function"; } break; } case PACKAGE_T:{ if (!hasError) { jj_consume_token(PACKAGE_T); } if (!hasError) { return "package"; } break; } case TYPE_T:{ if (!hasError) { jj_consume_token(TYPE_T); } if (!hasError) { return "type"; } break; } case SUBTYPE_T:{ if (!hasError) { jj_consume_token(SUBTYPE_T); } if (!hasError) { return "subtype"; } break; } case CONSTANT_T:{ if (!hasError) { jj_consume_token(CONSTANT_T); } if (!hasError) { return "constant"; } break; } case SIGNAL_T:{ if (!hasError) { jj_consume_token(SIGNAL_T); } if (!hasError) { return "signal"; } break; } case VARIABLE_T:{ if (!hasError) { jj_consume_token(VARIABLE_T); } if (!hasError) { return "variable"; } break; } case COMPONENT_T:{ if (!hasError) { jj_consume_token(COMPONENT_T); } if (!hasError) { return "component"; } break; } case LABEL_T:{ if (!hasError) { jj_consume_token(LABEL_T); } if (!hasError) { return "label"; } break; } case LITERAL_T:{ if (!hasError) { jj_consume_token(LITERAL_T); } if (!hasError) { return "literal"; } break; } case UNITS_T:{ if (!hasError) { jj_consume_token(UNITS_T); } if (!hasError) { return "units"; } break; } case GROUP_T:{ if (!hasError) { jj_consume_token(GROUP_T); } if (!hasError) { return "group"; } break; } case FILE_T:{ if (!hasError) { jj_consume_token(FILE_T); } if (!hasError) { return "file"; } break; } default: jj_la1[110] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::entity_class_entry() {QCString s; if (!hasError) { s = entity_class(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BOX_T:{ if (!hasError) { jj_consume_token(BOX_T); } if (!hasError) { s+="<>"; } break; } default: jj_la1[111] = jj_gen; ; } } return s; assert(false); } QCString VhdlParser::entity_class_entry_list() {QCString s,s1,s2; if (!hasError) { if (!hasError) { s1 = entity_class_entry(); } if (!hasError) { s+=s1; } } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[112] = jj_gen; goto end_label_21; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s = entity_class_entry(); } if (!hasError) { s2+=",";s2+=s; } } end_label_21: ; } return s1+s2; assert(false); } void VhdlParser::entity_declaration() {QCString s; if (!hasError) { jj_consume_token(ENTITY_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { m_sharedState->lastEntity=m_sharedState->current; m_sharedState->lastCompound=nullptr; outlineParser()->addVhdlType(s,outlineParser()->getLine(ENTITY_T), EntryType::makeClass(),VhdlSpecifier::ENTITY,QCString(),QCString(),Protection::Public); } if (!hasError) { entity_header(); } if (!hasError) { entity_declarative_part(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BEGIN_T:{ if (!hasError) { jj_consume_token(BEGIN_T); } if (!hasError) { entity_statement_part(); } break; } default: jj_la1[113] = jj_gen; ; } } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ENTITY_T:{ if (!hasError) { jj_consume_token(ENTITY_T); } break; } default: jj_la1[114] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } default: jj_la1[115] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->lastEntity=nullptr;m_sharedState->lastCompound=nullptr; m_sharedState->genLabels.clear(); } void VhdlParser::entity_declarative_item() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_declaration(); } break; } case TYPE_T:{ if (!hasError) { type_declaration(); } break; } case SUBTYPE_T:{ if (!hasError) { subtype_declaration(); } break; } case CONSTANT_T:{ if (!hasError) { constant_declaration(); } break; } case SIGNAL_T:{ if (!hasError) { signal_declaration(); } break; } default: jj_la1[116] = jj_gen; if (jj_2_50(5)) { if (!hasError) { package_instantiation_declaration(); } } else if (jj_2_51(3)) { if (!hasError) { package_body(); } } else if (jj_2_52(3)) { if (!hasError) { package_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SHARED_T: case VARIABLE_T:{ if (!hasError) { variable_declaration(); } break; } case FILE_T:{ if (!hasError) { file_declaration(); } break; } case ALIAS_T:{ if (!hasError) { alias_declaration(); } break; } case VIEW_T:{ if (!hasError) { mode_view_declaration(); } break; } default: jj_la1[117] = jj_gen; if (jj_2_53(2147483647)) { if (!hasError) { attribute_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ATTRIBUTE_T:{ if (!hasError) { attribute_specification(); } break; } case DISCONNECT_T:{ if (!hasError) { disconnection_specification(); } break; } case USE_T:{ if (!hasError) { use_clause(); } break; } default: jj_la1[118] = jj_gen; if (jj_2_54(3)) { if (!hasError) { group_template_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GROUP_T:{ if (!hasError) { group_declaration(); } break; } default: jj_la1[119] = jj_gen; if (jj_2_55(5)) { if (!hasError) { package_instantiation_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { package_declaration(); } break; } case VHDL2008TOOLDIR:{ if (!hasError) { jj_consume_token(VHDL2008TOOLDIR); } break; } default: jj_la1[120] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } } } } } } } void VhdlParser::entity_declarative_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case CONSTANT_T: case DISCONNECT_T: case FILE_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SIGNAL_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T: case VIEW_T: case VHDL2008TOOLDIR:{ ; break; } default: jj_la1[121] = jj_gen; goto end_label_22; } if (!hasError) { entity_declarative_item(); } } end_label_22: ; } } QCString VhdlParser::entity_designator() {QCString s,s1; if (!hasError) { s = entity_tag(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LBRACKET_T:{ if (!hasError) { s1 = signature(); } break; } default: jj_la1[122] = jj_gen; ; } } return s+s1; assert(false); } void VhdlParser::entity_header() { if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { m_sharedState->currP=VhdlSpecifier::GENERIC;m_sharedState->parse_sec=VhdlSection::GEN_SEC; } if (!hasError) { generic_clause(); } break; } default: jj_la1[123] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PORT_T:{ if (!hasError) { m_sharedState->currP=VhdlSpecifier::PORT; } if (!hasError) { port_clause(); } break; } default: jj_la1[124] = jj_gen; ; } } } QCString VhdlParser::entity_name_list() {QCString s,s1,s2; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case CHARACTER_LITERAL:{ if (!hasError) { if (!hasError) { s1 = entity_designator(); } } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[125] = jj_gen; goto end_label_23; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s = entity_designator(); } if (!hasError) { s2+=s; } } end_label_23: ; } if (!hasError) { return s2; } break; } case OTHER_T:{ if (!hasError) { jj_consume_token(OTHER_T); } if (!hasError) { return "other"; } break; } case ALL_T:{ if (!hasError) { jj_consume_token(ALL_T); } if (!hasError) { return "all"; } break; } default: jj_la1[126] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::entity_specification() {QCString s,s1; if (!hasError) { s = entity_name_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = entity_class(); } return s+":"+s1; assert(false); } void VhdlParser::entity_statement() { if (jj_2_56(2147483647)) { if (!hasError) { concurrent_assertion_statement(); } } else if (jj_2_57(2147483647)) { if (!hasError) { process_statement(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case POSTPONED_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { concurrent_procedure_call_statement(); } break; } default: jj_la1[127] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::entity_statement_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ASSERT_T: case POSTPONED_T: case PROCESS_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ ; break; } default: jj_la1[128] = jj_gen; goto end_label_24; } if (!hasError) { entity_statement(); } } end_label_24: ; } } QCString VhdlParser::entity_tag() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = name(); } if (!hasError) { return s; } break; } case CHARACTER_LITERAL:{ if (!hasError) { s = character_literal(); } if (!hasError) { return s; } break; } default: jj_la1[129] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::enumeration_literal() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { return s; } break; } case CHARACTER_LITERAL:{ if (!hasError) { s = character_literal(); } if (!hasError) { return s; } break; } default: jj_la1[130] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::enumeration_type_definition() {QCString s,s1; if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s = enumeration_literal(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[131] = jj_gen; goto end_label_25; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = enumeration_literal(); } if (!hasError) { s+=",";s+=s1; } } end_label_25: ; } if (!hasError) { jj_consume_token(RPAREN_T); } return "("+s+")"; assert(false); } QCString VhdlParser::exit_statement() {QCString s,s1,s2;Token *t=nullptr;Token *t1=nullptr; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { t = jj_consume_token(COLON_T); } break; } default: jj_la1[132] = jj_gen; ; } } if (!hasError) { jj_consume_token(EXIT_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s1 = identifier(); } break; } default: jj_la1[133] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ if (!hasError) { t1 = jj_consume_token(WHEN_T); } if (!hasError) { s2 = condition(); } break; } default: jj_la1[134] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->lab.clear(); if(t!=nullptr) s+=":"; if(t1!=nullptr) s2.prepend(" when "); FlowChart::addFlowChart(FlowChart::EXIT_NO,"exit",s2,s1); return s+s1+s2+";"; assert(false); } QCString VhdlParser::expression() {QCString s,s1,s2; if (!hasError) { /* LOOKAHEAD(5) */ s = relation(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case AND_T: case NAND_T: case NOR_T: case OR_T: case XOR_T: case XNOR_T:{ ; break; } default: jj_la1[135] = jj_gen; goto end_label_26; } if (!hasError) { s1 = logop(); } if (!hasError) { s2 = relation(); } if (!hasError) { s+=s1;s+=s2; } } end_label_26: ; } return s; assert(false); } QCString VhdlParser::expression_or_unaffected() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ABS_T: case AND_T: case NAND_T: case NEW_T: case NOR_T: case NOT_T: case NULL_T: case OR_T: case XOR_T: case XNOR_T: case LPAREN_T: case PLUS_T: case MINUS_T: case SLSL_T: case QQ_T: case INTEGER: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case CHARACTER_LITERAL: case DECIMAL_LITERAL: case BASED_LITERAL: case BIT_STRING_LITERAL:{ if (!hasError) { s = expression(); } if (!hasError) { return s; } break; } case UNAFFECTED_T:{ if (!hasError) { jj_consume_token(UNAFFECTED_T); } if (!hasError) { return "unaffected"; } break; } default: jj_la1[136] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::external_pathname() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case DOT_T:{ if (!hasError) { s = absolute_pathname(); } if (!hasError) { return s; } break; } case NEG_T:{ if (!hasError) { s = relative_pathname(); } if (!hasError) { return s; } break; } case AT_T:{ if (!hasError) { s = package_path_name(); } if (!hasError) { return s; } break; } default: jj_la1[137] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::external_name() {QCString s,s1,s2; if (!hasError) { jj_consume_token(SLSL_T); } if (!hasError) { s = sig_stat(); } if (!hasError) { s1 = external_pathname(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s2 = subtype_indication(); } if (!hasError) { jj_consume_token(RSRS_T); } QCString t="<<"+s; QCString t1=s1+":"+s2+">>"; return s+s1; assert(false); } QCString VhdlParser::sig_stat() {Token *t; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CONSTANT_T:{ if (!hasError) { t = jj_consume_token(CONSTANT_T); } if (!hasError) { return QCString(t->image); } break; } case SIGNAL_T:{ if (!hasError) { t = jj_consume_token(SIGNAL_T); } if (!hasError) { return QCString(t->image); } break; } case VARIABLE_T:{ if (!hasError) { t = jj_consume_token(VARIABLE_T); } if (!hasError) { return QCString(t->image); } break; } default: jj_la1[138] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::logop() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case AND_T:{ if (!hasError) { jj_consume_token(AND_T); } if (!hasError) { return "and" ; } break; } case NAND_T:{ if (!hasError) { jj_consume_token(NAND_T); } if (!hasError) { return "nand" ; } break; } case NOR_T:{ if (!hasError) { jj_consume_token(NOR_T); } if (!hasError) { return "nor" ; } break; } case XNOR_T:{ if (!hasError) { jj_consume_token(XNOR_T); } if (!hasError) { return "xnor" ; } break; } case XOR_T:{ if (!hasError) { jj_consume_token(XOR_T); } if (!hasError) { return "xor" ; } break; } case OR_T:{ if (!hasError) { jj_consume_token(OR_T); } if (!hasError) { return "or" ; } break; } default: jj_la1[139] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::extended_identifier() {Token *t; if (!hasError) { t = jj_consume_token(EXTENDED_CHARACTER); } return QCString(t->image); assert(false); } QCString VhdlParser::factor() {QCString s,s1; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NEW_T: case NULL_T: case LPAREN_T: case SLSL_T: case INTEGER: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case CHARACTER_LITERAL: case DECIMAL_LITERAL: case BASED_LITERAL: case BIT_STRING_LITERAL:{ if (!hasError) { s = primary(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case DOUBLEMULT_T:{ if (!hasError) { jj_consume_token(DOUBLEMULT_T); } if (!hasError) { s1 = primary(); } if (!hasError) { s+="**";s+=s1; } break; } default: jj_la1[140] = jj_gen; ; } } if (!hasError) { return s; } break; } case ABS_T:{ if (!hasError) { jj_consume_token(ABS_T); } if (!hasError) { s = primary(); } if (!hasError) { s1 = "abs "; return s1+s; } break; } case NOT_T:{ if (!hasError) { jj_consume_token(NOT_T); } if (!hasError) { s = primary(); } if (!hasError) { s1="not ";return s1+s; } break; } case QQ_T:{ if (!hasError) { jj_consume_token(QQ_T); } if (!hasError) { s = primary(); } if (!hasError) { s1="?? ";return s1; } break; } case AND_T: case NAND_T: case NOR_T: case OR_T: case XOR_T: case XNOR_T:{ if (!hasError) { s = logop(); } if (!hasError) { s1 = primary(); } if (!hasError) { return s; } break; } default: jj_la1[141] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::file_declaration() {QCString s,s1,s2,s3; if (!hasError) { jj_consume_token(FILE_T); } if (!hasError) { s = identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s2 = subtype_indication(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IS_T: case OPEN_T:{ if (!hasError) { s3 = file_open_information(); } break; } default: jj_la1[142] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } QCString t1=s2+" "+s3; outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),VhdlSpecifier::VFILE,QCString(),t1,Protection::Public); return " file "+s+":"+s2+" "+s3+";"; assert(false); } QCString VhdlParser::file_logical_name() {QCString s; if (!hasError) { s = expression(); } return s; assert(false); } QCString VhdlParser::file_open_information() {QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case OPEN_T:{ if (!hasError) { jj_consume_token(OPEN_T); } if (!hasError) { s = expression(); } break; } default: jj_la1[143] = jj_gen; ; } } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IN_T: case OUT_T:{ switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IN_T:{ if (!hasError) { jj_consume_token(IN_T); } break; } case OUT_T:{ if (!hasError) { jj_consume_token(OUT_T); } break; } default: jj_la1[144] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } break; } default: jj_la1[145] = jj_gen; ; } } if (!hasError) { s1 = file_logical_name(); } s2="open "+s+" is "+s1; return s2; assert(false); } QCString VhdlParser::file_type_definition() {QCString s,s1; if (!hasError) { jj_consume_token(FILE_T); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { s = type_mark(); } s1=" file of "+s; return s1; assert(false); } QCString VhdlParser::file_incomplete_type_definition() {QCString s,s1; if (!hasError) { jj_consume_token(FILE_T); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { type_mark(); } return ""; assert(false); } QCString VhdlParser::floating_incomplete_type_definition() {QCString s,s1; if (!hasError) { jj_consume_token(RANGE_T); } if (!hasError) { jj_consume_token(BOX_T); } if (!hasError) { jj_consume_token(DOT_T); } if (!hasError) { jj_consume_token(BOX_T); } return "range <>.<>"; assert(false); } QCString VhdlParser::floating_type_definition() {QCString s; if (!hasError) { s = range_constraint(); } return s; assert(false); } QCString VhdlParser::formal_designator() {QCString s;Token *tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = name(); } if (!hasError) { return s; } break; } case INTEGER:{ if (!hasError) { tok = jj_consume_token(INTEGER); } if (!hasError) { return QCString(tok->image); } break; } default: jj_la1[146] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::formal_parameter_list() {QCString s; if (!hasError) { s = interface_list(); } return s; assert(false); } QCString VhdlParser::formal_part() {QCString s,s1; if (!hasError) { s = name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { formal_designator(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+"("+s1+")"; } break; } default: jj_la1[147] = jj_gen; ; } } return s; assert(false); } QCString VhdlParser::full_type_declaration() {std::shared_ptr<Entry> tmpEntry;QCString s,s1,s2; if (!hasError) { jj_consume_token(TYPE_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { tmpEntry=m_sharedState->current; outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),VhdlSpecifier::RECORD,QCString(),QCString(),Protection::Public); } if (!hasError) { s2 = type_definition(); } if (!hasError) { jj_consume_token(SEMI_T); } if (s2.contains("#")) { VhdlDocGen::deleteAllChars(s2,'#'); tmpEntry->vhdlSpec=VhdlSpecifier::RECORD; tmpEntry->type=s2; } else if (s2.contains("%")) { VhdlDocGen::deleteAllChars(s2,'%'); tmpEntry->vhdlSpec=VhdlSpecifier::UNITS; tmpEntry->type=s2; } else { tmpEntry->vhdlSpec=VhdlSpecifier::TYPE; tmpEntry->type=s2; } tmpEntry.reset(); return "type "+s+" is "+s2+";"; assert(false); } QCString VhdlParser::function_call() {QCString s,s1; if (!hasError) { s = name(); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = actual_parameter_part(); } if (!hasError) { jj_consume_token(RPAREN_T); } return s+"("+s1+")"; assert(false); } void VhdlParser::geninter() { if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { gen_interface_list(); } if (!hasError) { jj_consume_token(SEMI_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { gen_assoc_list(); } if (!hasError) { jj_consume_token(SEMI_T); } break; } default: jj_la1[148] = jj_gen; ; } } break; } default: jj_la1[149] = jj_gen; ; } } } void VhdlParser::gen_assoc_list() { if (!hasError) { jj_consume_token(GENERIC_T); } if (!hasError) { jj_consume_token(MAP_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { association_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } } void VhdlParser::gen_interface_list() { if (!hasError) { jj_consume_token(GENERIC_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { m_sharedState->parse_sec=VhdlSection::GEN_SEC; } if (!hasError) { interface_list(); } if (!hasError) { m_sharedState->parse_sec=VhdlSection::UNKNOWN; } if (!hasError) { jj_consume_token(RPAREN_T); } } void VhdlParser::generate_statement_body() { if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case BEGIN_T: case COMPONENT_T: case CONSTANT_T: case DISCONNECT_T: case FILE_T: case FOR_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SIGNAL_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T: case VIEW_T:{ if (!hasError) { while (!hasError) { if (jj_2_58(2147483647)) { ; } else { goto end_label_27; } if (!hasError) { block_declarative_item(); } } end_label_27: ; } if (!hasError) { jj_consume_token(BEGIN_T); } break; } default: jj_la1[150] = jj_gen; ; } } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ASSERT_T: case POSTPONED_T: case PROCESS_T: case WITH_T: case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case VHDL2008TOOLDIR:{ ; break; } default: jj_la1[151] = jj_gen; goto end_label_28; } if (!hasError) { concurrent_statement(); } } end_label_28: ; } } void VhdlParser::generate_statement_body1() { if (!hasError) { generate_statement_body(); } if (!hasError) { generate_scheme_1(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ELSE_T:{ if (!hasError) { generate_scheme_2(); } break; } default: jj_la1[152] = jj_gen; ; } } } void VhdlParser::generate_scheme_1() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ELSIF_T:{ ; break; } default: jj_la1[153] = jj_gen; goto end_label_29; } if (!hasError) { generate_scheme_3(); } } end_label_29: ; } } void VhdlParser::generate_scheme_2() { if (!hasError) { jj_consume_token(ELSE_T); } if (!hasError) { if (jj_2_59(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { jj_consume_token(GENERATE_T); } if (!hasError) { generate_statement_body(); } } void VhdlParser::generate_scheme_3() { if (!hasError) { jj_consume_token(ELSIF_T); } if (!hasError) { if (jj_2_60(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(GENERATE_T); } if (!hasError) { generate_statement_body(); } } void VhdlParser::generate_statement() {QCString s; if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { try { if (!hasError) { generate_scheme(); } if (!hasError) { jj_consume_token(GENERATE_T); } if (!hasError) { outlineParser()->pushLabel(m_sharedState->genLabels,s); } if (!hasError) { generate_statement_body1(); } if (!hasError) { jj_consume_token(END_T); } } catch ( ...) { outlineParser()->error_skipto(GENERATE_T); } } if (!hasError) { jj_consume_token(GENERATE_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[154] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->genLabels=outlineParser()->popLabel(m_sharedState->genLabels); } void VhdlParser::generate_scheme() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FOR_T:{ if (!hasError) { jj_consume_token(FOR_T); } if (!hasError) { parameter_specification(); } break; } case IF_T:{ if (!hasError) { jj_consume_token(IF_T); } if (!hasError) { if (jj_2_61(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } } else { ; } } if (!hasError) { condition(); } break; } default: jj_la1[155] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } void VhdlParser::generic_clause() {QCString s; if (!hasError) { jj_consume_token(GENERIC_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { m_sharedState->parse_sec=VhdlSection::GEN_SEC; } if (!hasError) { s = generic_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->parse_sec=VhdlSection::UNKNOWN; } QCString VhdlParser::generic_list() {QCString s; if (!hasError) { s = interface_list(); } return s; assert(false); } void VhdlParser::generic_map_aspect() { if (!hasError) { jj_consume_token(GENERIC_T); } if (!hasError) { jj_consume_token(MAP_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { association_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } } QCString VhdlParser::group_constituent() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = name(); } if (!hasError) { return s; } break; } case CHARACTER_LITERAL:{ if (!hasError) { s = character_literal(); } if (!hasError) { return s; } break; } default: jj_la1[156] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::group_constituent_list() {QCString s,s1,s2; if (!hasError) { if (!hasError) { s1 = group_constituent(); } } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[157] = jj_gen; goto end_label_30; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s = group_constituent(); } if (!hasError) { s2+=",";s2+=s1; } } end_label_30: ; } return s+s2; assert(false); } QCString VhdlParser::group_declaration() {QCString s,s1,s2; if (!hasError) { jj_consume_token(GROUP_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = identifier(); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s2 = group_constituent_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { jj_consume_token(SEMI_T); } return "group "+s+":"+s1+"("+s2+");"; assert(false); } QCString VhdlParser::group_template_declaration() {QCString s,s1; if (!hasError) { jj_consume_token(GROUP_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = entity_class_entry_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { jj_consume_token(SEMI_T); } return "group "+s+ "is ("+s1+");"; assert(false); } void VhdlParser::guarded_signal_specification() { if (!hasError) { signal_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { type_mark(); } } QCString VhdlParser::identifier() {Token *tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case EXTENDED_CHARACTER:{ if (!hasError) { tok = jj_consume_token(EXTENDED_CHARACTER); } if (!hasError) { return QCString(tok->image); } break; } case BASIC_IDENTIFIER:{ if (!hasError) { tok = jj_consume_token(BASIC_IDENTIFIER); } if (!hasError) { return QCString(tok->image); } break; } default: jj_la1[158] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::identifier_list() {QCString str,str1; if (!hasError) { str = name(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[159] = jj_gen; goto end_label_31; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { str1 = name(); } if (!hasError) { str+=",";str+=str1; } } end_label_31: ; } if (!hasError) { if (jj_2_62(1) && (checkListTok())) { if (!hasError) { jj_consume_token(SEMI_T); } } else { ; } } return str; assert(false); } void VhdlParser::if_statement() {QCString s,s1; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(COLON_T); } break; } default: jj_la1[160] = jj_gen; ; } } if (!hasError) { jj_consume_token(IF_T); } if (!hasError) { s = condition(); } if (!hasError) { jj_consume_token(THEN_T); } if (!hasError) { s.prepend("if "); FlowChart::addFlowChart(FlowChart::IF_NO,QCString(),s); } if (!hasError) { sequence_of_statements(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ELSIF_T:{ ; break; } default: jj_la1[161] = jj_gen; goto end_label_32; } if (!hasError) { jj_consume_token(ELSIF_T); } if (!hasError) { s1 = condition(); } if (!hasError) { jj_consume_token(THEN_T); } if (!hasError) { s1.prepend("elsif "); FlowChart::addFlowChart(FlowChart::ELSIF_NO,QCString(),s1); } if (!hasError) { sequence_of_statements(); } } end_label_32: ; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ELSE_T:{ if (!hasError) { jj_consume_token(ELSE_T); } if (!hasError) { FlowChart::addFlowChart(FlowChart::ELSE_NO,QCString(),QCString()); } if (!hasError) { sequence_of_statements(); } break; } default: jj_la1[162] = jj_gen; ; } } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(IF_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[163] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } FlowChart::moveToPrevLevel(); FlowChart::addFlowChart(FlowChart::ENDIF_NO,QCString(),QCString()); } QCString VhdlParser::incomplete_subtype_indication() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { subtype_indication(); } if (!hasError) { return ""; } break; } case TYPE_T:{ if (!hasError) { anonymous_type_indication(); } if (!hasError) { return ""; } break; } default: jj_la1[164] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::incomplete_type_definition() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PRIVATE_T:{ if (!hasError) { private_incomplete_type_definition(); } if (!hasError) { return ""; } break; } case BOX_T:{ if (!hasError) { scalar_incomplete_type_definition(); } if (!hasError) { return ""; } break; } case LPAREN_T:{ if (!hasError) { discrete_incomplete_type_definition(); } if (!hasError) { return ""; } break; } case UNITS_T:{ if (!hasError) { physical_incomplete_type_definition(); } if (!hasError) { return ""; } break; } default: jj_la1[165] = jj_gen; if (jj_2_63(4)) { if (!hasError) { floating_incomplete_type_definition(); } if (!hasError) { return ""; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case RANGE_T:{ if (!hasError) { integer_incomplete_type_definition(); } if (!hasError) { return ""; } break; } case ARRAY_T:{ if (!hasError) { array_incomplete_type_definition(); } if (!hasError) { return ""; } break; } case ACCESS_T:{ if (!hasError) { access_incomplete_type_definition(); } if (!hasError) { return ""; } break; } case FILE_T:{ if (!hasError) { file_incomplete_type_definition(); } if (!hasError) { return ""; } break; } default: jj_la1[166] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } assert(false); } QCString VhdlParser::incomplete_type_mark() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { type_mark(); } if (!hasError) { return ""; } break; } case TYPE_T:{ if (!hasError) { anonymous_type_indication(); } if (!hasError) { return ""; } break; } default: jj_la1[167] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::integer_incomplete_type_definition() {QCString s; if (!hasError) { jj_consume_token(RANGE_T); } if (!hasError) { jj_consume_token(BOX_T); } return "range <>"; assert(false); } QCString VhdlParser::incomplete_type_declaration() {QCString s; if (!hasError) { jj_consume_token(TYPE_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(SEMI_T); } return "type "+s+";"; assert(false); } QCString VhdlParser::index_constraint() {QCString s("("); QCString s1,s2; if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s2 = discrete_range(); } if (!hasError) { s+=s2; } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[168] = jj_gen; goto end_label_33; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = discrete_range(); } if (!hasError) { s+=",";s+=s1; } } end_label_33: ; } if (!hasError) { jj_consume_token(RPAREN_T); } return s+")"; assert(false); } QCString VhdlParser::index_specification() {QCString s; if (jj_2_64(2147483647)) { if (!hasError) { s = discrete_range(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ABS_T: case AND_T: case NAND_T: case NEW_T: case NOR_T: case NOT_T: case NULL_T: case OR_T: case XOR_T: case XNOR_T: case LPAREN_T: case PLUS_T: case MINUS_T: case SLSL_T: case QQ_T: case INTEGER: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case CHARACTER_LITERAL: case DECIMAL_LITERAL: case BASED_LITERAL: case BIT_STRING_LITERAL:{ if (!hasError) { s = expression(); } if (!hasError) { return s; } break; } default: jj_la1[169] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::index_subtype_definition() {QCString s; if (!hasError) { s = type_mark(); } if (!hasError) { jj_consume_token(RANGE_T); } if (!hasError) { jj_consume_token(BOX_T); } return s+" range <> "; assert(false); } QCString VhdlParser::instantiation_unit() {QCString s,s1,s2; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMPONENT_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMPONENT_T:{ if (!hasError) { jj_consume_token(COMPONENT_T); } break; } default: jj_la1[170] = jj_gen; ; } } if (!hasError) { s = name(); } if (!hasError) { s1="component "; return s; } break; } case ENTITY_T:{ if (!hasError) { jj_consume_token(ENTITY_T); } if (!hasError) { if (jj_2_65(2)) { if (!hasError) { jj_consume_token(BASIC_IDENTIFIER); } if (!hasError) { jj_consume_token(DOT_T); } } else { ; } } if (!hasError) { s2 = name(); } if (!hasError) { s="entity|"+s2; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = identifier(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+="(";s+=s1;s+=")" ; } break; } default: jj_la1[171] = jj_gen; ; } } if (!hasError) { return s; } break; } case CONFIGURATION_T:{ if (!hasError) { jj_consume_token(CONFIGURATION_T); } if (!hasError) { s = name(); } if (!hasError) { s1="configuration ";return s; } break; } default: jj_la1[172] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::instantiation_list() {QCString s;Token *tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier_list(); } if (!hasError) { return s; } break; } case OTHER_T:{ if (!hasError) { tok = jj_consume_token(OTHER_T); } if (!hasError) { return QCString(tok->image); } break; } case ALL_T:{ if (!hasError) { tok = jj_consume_token(ALL_T); } if (!hasError) { return QCString(tok->image); } break; } default: jj_la1[173] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::integer() {Token *t; if (!hasError) { t = jj_consume_token(INTEGER); } return QCString(t->image); assert(false); } QCString VhdlParser::integer_type_definition() {QCString s; if (!hasError) { s = range_constraint(); } return s; assert(false); } QCString VhdlParser::interface_declaration() {QCString s,s1; if (jj_2_66(2147483647)) { if (!hasError) { s = interface_variable_declaration(); } if (!hasError) { return s; } } else if (jj_2_67(2147483647)) { if (!hasError) { interface_object_declaration(); } if (!hasError) { return " "; } } else if (jj_2_68(2147483647)) { if (!hasError) { m_sharedState->interf_sec=true; } if (!hasError) { s = interface_subprogram_declaration(); } if (!hasError) { m_sharedState->interf_sec=false ;return s; } } else if (jj_2_69(2147483647)) { if (!hasError) { interface_package_declaration(); } if (!hasError) { return s; } } else if (jj_2_70(5)) { if (!hasError) { s = interface_type_declaration(); } if (!hasError) { return s; } } else if (jj_2_71(2147483647)) { if (!hasError) { interface_subprogram_declaration(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CONSTANT_T: case FILE_T: case SIGNAL_T: case SHARED_T: case TYPE_T: case VARIABLE_T:{ if (!hasError) { s = object_class(); } if (!hasError) { s1 = identifier(); } if (!hasError) { if (m_sharedState->parse_sec==VhdlSection::GEN_SEC) outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),m_sharedState->currP,s1,QCString(),Protection::Public); return s; } break; } default: jj_la1[174] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } void VhdlParser::interface_object_declaration() {QCString s,s1,s2; if (jj_2_72(2147483647)) { if (!hasError) { interface_constant_declaration(); } } else if (jj_2_73(2147483647)) { if (!hasError) { interface_signal_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FILE_T:{ if (!hasError) { interface_file_declaration(); } break; } default: jj_la1[175] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } QCString VhdlParser::interface_constant_declaration() {QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CONSTANT_T:{ if (!hasError) { jj_consume_token(CONSTANT_T); } break; } default: jj_la1[176] = jj_gen; ; } } if (!hasError) { identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IN_T:{ if (!hasError) { jj_consume_token(IN_T); } break; } default: jj_la1[177] = jj_gen; ; } } if (!hasError) { interface_type_indication(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VARASSIGN_T:{ if (!hasError) { jj_consume_token(VARASSIGN_T); } if (!hasError) { conditional_expression(); } break; } default: jj_la1[178] = jj_gen; ; } } return ""; assert(false); } QCString VhdlParser::interface_element() {QCString s; if (!hasError) { s = interface_declaration(); } return s; assert(false); } QCString VhdlParser::interface_file_declaration() {QCString s,s1; if (!hasError) { jj_consume_token(FILE_T); } if (!hasError) { s = identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = subtype_indication(); } outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),VhdlSpecifier::VFILE,QCString(),s1,Protection::Public); return QCString(" file "+s+":"+s1); assert(false); } QCString VhdlParser::interface_list() {QCString s,s1,s2; if (!hasError) { s = interface_element(); } if (!hasError) { while (!hasError) { if (jj_2_74(2)) { ; } else { goto end_label_34; } if (!hasError) { jj_consume_token(SEMI_T); } if (!hasError) { s1 = interface_element(); } if (!hasError) { s2+=";";s2+=s1; } } end_label_34: ; } if (!hasError) { if (jj_2_75(1) && (checkListTok())) { if (!hasError) { jj_consume_token(SEMI_T); } } else { ; } } return s+s2; assert(false); } QCString VhdlParser::interface_package_declaration() {QCString s,s1,s2; if (!hasError) { jj_consume_token(PACKAGE_T); } if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { jj_consume_token(NEW_T); } if (!hasError) { name(); } if (!hasError) { interface_package_generic_map_aspect(); } return ""; assert(false); } QCString VhdlParser::interface_package_generic_map_aspect() {QCString s,s1,s2; if (jj_2_76(4)) { if (!hasError) { jj_consume_token(GENERIC_T); } if (!hasError) { jj_consume_token(MAP_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { jj_consume_token(BOX_T); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { return ""; } } else if (jj_2_77(4)) { if (!hasError) { jj_consume_token(GENERIC_T); } if (!hasError) { jj_consume_token(MAP_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { jj_consume_token(DEFAULT_T); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { return ""; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_map_aspect(); } if (!hasError) { return ""; } break; } default: jj_la1[179] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::interface_procedure_specification() {QCString s,s1,s2; if (!hasError) { jj_consume_token(PROCEDURE_T); } if (!hasError) { designator(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T: case LPAREN_T:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T:{ if (!hasError) { jj_consume_token(PARAMETER_T); } break; } default: jj_la1[180] = jj_gen; ; } } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { formal_parameter_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[181] = jj_gen; ; } } return ""; assert(false); } QCString VhdlParser::interface_signal_declaration() {QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SIGNAL_T:{ if (!hasError) { jj_consume_token(SIGNAL_T); } break; } default: jj_la1[182] = jj_gen; ; } } if (!hasError) { identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { interface_type_indication(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BUS_T:{ if (!hasError) { jj_consume_token(BUS_T); } break; } default: jj_la1[183] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VARASSIGN_T:{ if (!hasError) { jj_consume_token(VARASSIGN_T); } if (!hasError) { conditional_expression(); } break; } default: jj_la1[184] = jj_gen; ; } } return ""; assert(false); } QCString VhdlParser::interface_subprogram_declaration() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PROCEDURE_T:{ if (!hasError) { s = iproc(); } if (!hasError) { return s; } break; } case FUNCTION_T: case IMPURE_T: case PURE_T:{ if (!hasError) { s = ifunc(); } if (!hasError) { return s; } break; } default: jj_la1[185] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::iproc() {QCString s,s1; if (!hasError) { jj_consume_token(PROCEDURE_T); } if (!hasError) { s = identifier(); } if (!hasError) { s1 = param(); } m_sharedState->current->name=s; return "procedure "+s+s1; assert(false); } QCString VhdlParser::ifunc() {QCString s,s1,s2,s3;Token *t=nullptr;Token *t1=nullptr;Token *t2=nullptr; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IMPURE_T: case PURE_T:{ switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PURE_T:{ if (!hasError) { t = jj_consume_token(PURE_T); } break; } case IMPURE_T:{ if (!hasError) { t = jj_consume_token(IMPURE_T); } break; } default: jj_la1[186] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } break; } default: jj_la1[187] = jj_gen; ; } } if (!hasError) { jj_consume_token(FUNCTION_T); } if (!hasError) { s = name(); } if (!hasError) { s1 = param(); } if (!hasError) { jj_consume_token(RETURN_T); } if (!hasError) { s2 = name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IS_T:{ if (!hasError) { t1 = jj_consume_token(IS_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s3 = identifier(); } break; } case BOX_T:{ if (!hasError) { t2 = jj_consume_token(BOX_T); } break; } default: jj_la1[188] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } break; } default: jj_la1[189] = jj_gen; ; } } QCString q; if(t!=nullptr) q=t->image; if(t2!=nullptr) s3="<>"; if (!s3.isEmpty()) { s3.prepend(" is "); } m_sharedState->current->name=s; if (m_sharedState->parse_sec==VhdlSection::GEN_SEC) { QCString ss=q+" function "+s1+" return "+s2+s3; int a=outlineParser()->getLine(FUNCTION_T); int b=outlineParser()->getLine(PROCEDURE_T); if (a>b) b=a; outlineParser()->addVhdlType(m_sharedState->current->name,b,EntryType::makeVariable(), VhdlSpecifier::GENERIC,ss,QCString(),Protection::Public); } m_sharedState->currP=VhdlSpecifier::UNKNOWN;return QCString(); assert(false); } QCString VhdlParser::param() {QCString s,s1;Token *tok=nullptr; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T:{ if (!hasError) { tok = jj_consume_token(PARAMETER_T); } break; } default: jj_la1[190] = jj_gen; ; } } if (!hasError) { m_sharedState->param_sec=VhdlSection::PARAM_SEC; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = interface_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[191] = jj_gen; ; } } if(tok!=nullptr) { s = tok->image; } m_sharedState->param_sec=VhdlSection::UNKNOWN; return s+"("+s1+")"; assert(false); } QCString VhdlParser::interface_subprogram_default() {QCString s,s1,s2; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } case BOX_T:{ if (!hasError) { jj_consume_token(BOX_T); } break; } default: jj_la1[192] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::interface_subprogram_specification() {QCString s,s1,s2; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PROCEDURE_T:{ if (!hasError) { interface_procedure_specification(); } if (!hasError) { return ""; } break; } case FUNCTION_T: case IMPURE_T: case PURE_T:{ if (!hasError) { interface_function_specification(); } if (!hasError) { return ""; } break; } default: jj_la1[193] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::interface_function_specification() {QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IMPURE_T: case PURE_T:{ switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PURE_T:{ if (!hasError) { jj_consume_token(PURE_T); } break; } case IMPURE_T:{ if (!hasError) { jj_consume_token(IMPURE_T); } break; } default: jj_la1[194] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } break; } default: jj_la1[195] = jj_gen; ; } } if (!hasError) { jj_consume_token(FUNCTION_T); } if (!hasError) { designator(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { subprogram_header(); } break; } default: jj_la1[196] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T: case LPAREN_T:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T:{ if (!hasError) { jj_consume_token(PARAMETER_T); } break; } default: jj_la1[197] = jj_gen; ; } } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { formal_parameter_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[198] = jj_gen; ; } } if (!hasError) { jj_consume_token(RETURN_T); } if (!hasError) { if (jj_2_78(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(OF_T); } } else { ; } } if (!hasError) { type_mark(); } return ""; assert(false); } QCString VhdlParser::interface_incomplete_type_declaration() {QCString s="type";QCString s1; if (!hasError) { jj_consume_token(TYPE_T); } if (!hasError) { s1 = identifier(); } if (m_sharedState->currP!=VhdlSpecifier::COMPONENT && m_sharedState->interf_sec==false) { if (m_sharedState->currP==VhdlSpecifier::FUNCTION || m_sharedState->currP==VhdlSpecifier::PROCEDURE) { outlineParser()->addProto("",s1,s,"","",""); } else if(m_sharedState->parse_sec==VhdlSection::GEN_SEC) { outlineParser()->addVhdlType(s,outlineParser()->getLine(),EntryType::makeVariable(),VhdlSpecifier::GENERIC,s1,"",Protection::Public); } return s+" "+s1; } assert(false); } QCString VhdlParser::interface_type_declaration() {QCString s; if (!hasError) { s = interface_incomplete_type_declaration(); } return s; assert(false); } QCString VhdlParser::interface_type_indication() {QCString s,s1,s2; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { subtype_indication(); } if (!hasError) { return ""; } break; } case TYPE_T:{ if (!hasError) { anonymous_type_indication(); } if (!hasError) { return ""; } break; } case VIEW_T:{ if (!hasError) { mode_view_indication(); } if (!hasError) { return ""; } break; } default: jj_la1[199] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::interface_variable_declaration() {Token *tok=nullptr;Token *tok1=nullptr;Token *tok2=nullptr;QCString s,s1,s2,s3,s4,s5; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CONSTANT_T: case SIGNAL_T: case SHARED_T: case VARIABLE_T:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VARIABLE_T:{ if (!hasError) { tok = jj_consume_token(VARIABLE_T); } break; } case SIGNAL_T:{ if (!hasError) { tok = jj_consume_token(SIGNAL_T); } break; } case CONSTANT_T:{ if (!hasError) { tok = jj_consume_token(CONSTANT_T); } break; } case SHARED_T:{ if (!hasError) { tok = jj_consume_token(SHARED_T); } break; } default: jj_la1[200] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } break; } default: jj_la1[201] = jj_gen; ; } } if (!hasError) { s = identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BUFFER_T: case IN_T: case INOUT_T: case LINKAGE_T: case OUT_T:{ if (!hasError) { s1 = mode(); } break; } default: jj_la1[202] = jj_gen; ; } } if (!hasError) { s2 = subtype_indication(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BUS_T:{ if (!hasError) { tok1 = jj_consume_token(BUS_T); } break; } default: jj_la1[203] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VARASSIGN_T:{ if (!hasError) { tok2 = jj_consume_token(VARASSIGN_T); } if (!hasError) { s4 = expression(); } break; } default: jj_la1[204] = jj_gen; ; } } if(tok!=nullptr) s5=QCString(tok->image); if(tok1!=nullptr) s3=tok1->image; if(tok2!=nullptr) s3+=":="; QCString it=s+":"+s1+" "+s2+" "+s3+" "+s4; if (m_sharedState->currP!=VhdlSpecifier::COMPONENT && m_sharedState->interf_sec==false) { if (m_sharedState->currP==VhdlSpecifier::FUNCTION || m_sharedState->currP==VhdlSpecifier::PROCEDURE) { outlineParser()->addProto(s5,s,s1,s2,s3,s4); } else { QCString i=s2+s3+s4; outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),m_sharedState->currP,i,s1,Protection::Public); } } // if component return it; assert(false); } QCString VhdlParser::iteration_scheme() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHILE_T:{ if (!hasError) { jj_consume_token(WHILE_T); } if (!hasError) { s = condition(); } if (!hasError) { s.prepend("while "); FlowChart::addFlowChart(FlowChart::WHILE_NO,QCString(),s,m_sharedState->lab); m_sharedState->lab=""; return s; } break; } case FOR_T:{ if (!hasError) { jj_consume_token(FOR_T); } if (!hasError) { s = parameter_specification(); } if (!hasError) { QCString q=m_sharedState->lab+" for "+s; FlowChart::addFlowChart(FlowChart::FOR_NO,QCString(),q,m_sharedState->lab); m_sharedState->lab=""; return q; } break; } default: jj_la1[205] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::label() {QCString s; if (!hasError) { s = identifier(); } return s; assert(false); } QCString VhdlParser::library_clause() {QCString s; if (!hasError) { if (!hasError) { jj_consume_token(LIBRARY_T); } if (!hasError) { s = identifier_list(); } if (!hasError) { jj_consume_token(SEMI_T); } } if ( m_sharedState->parse_sec==VhdlSection::UNKNOWN && Config_getBool(SHOW_INCLUDE_FILES) ) { outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),VhdlSpecifier::LIBRARY,s,"_library_",Protection::Public); } QCString s1="library "+s; return s1; assert(false); } QCString VhdlParser::library_unit() {QCString s; if (jj_2_79(2)) { if (!hasError) { primary_unit(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ARCHITECTURE_T: case PACKAGE_T:{ if (!hasError) { secondary_unit(); } if (!hasError) { return s; } break; } default: jj_la1[206] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::literal() {QCString s; if (jj_2_80(2147483647)) { if (!hasError) { s = bit_string_literal(); } if (!hasError) { return s; } } else if (jj_2_81(2147483647)) { if (!hasError) { s = numeric_literal(); } if (!hasError) { return s; } } else if (jj_2_82(2147483647)) { if (!hasError) { s = enumeration_literal(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case STRINGLITERAL:{ if (!hasError) { s = string_literal(); } if (!hasError) { return s; } break; } case NULL_T:{ if (!hasError) { jj_consume_token(NULL_T); } if (!hasError) { return "null"; } break; } default: jj_la1[207] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::logical_operator() {QCString s; if (!hasError) { s = logop(); } return s; assert(false); } QCString VhdlParser::loop_statement() {QCString s,s1,s2,s3; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s+=":"; } break; } default: jj_la1[208] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FOR_T: case WHILE_T:{ if (!hasError) { s1 = iteration_scheme(); } break; } default: jj_la1[209] = jj_gen; ; } } if (!hasError) { if(s1.isEmpty()) FlowChart::addFlowChart(FlowChart::LOOP_NO,QCString(),"infinite"); } if (!hasError) { jj_consume_token(LOOP_T); } if (!hasError) { s2 = sequence_of_statements(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(LOOP_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s3 = identifier(); } break; } default: jj_la1[210] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } QCString q = s+" loop "+s2+" end loop" +s3; QCString endLoop="end loop" + s3; FlowChart::moveToPrevLevel(); FlowChart::addFlowChart(FlowChart::END_LOOP,endLoop,QCString()); return q; assert(false); } QCString VhdlParser::miscellaneous_operator() {Token *t=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case DOUBLEMULT_T:{ if (!hasError) { jj_consume_token(DOUBLEMULT_T); } if (!hasError) { return "**"; } break; } case ABS_T:{ if (!hasError) { jj_consume_token(ABS_T); } if (!hasError) { return "abs"; } break; } case NOT_T:{ if (!hasError) { jj_consume_token(NOT_T); } if (!hasError) { return "not"; } break; } default: jj_la1[211] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::mode() {Token *tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IN_T:{ if (!hasError) { tok = jj_consume_token(IN_T); } if (!hasError) { return "in"; } break; } case OUT_T:{ if (!hasError) { tok = jj_consume_token(OUT_T); } if (!hasError) { return "out"; } break; } case INOUT_T:{ if (!hasError) { tok = jj_consume_token(INOUT_T); } if (!hasError) { return "inout"; } break; } case BUFFER_T:{ if (!hasError) { tok = jj_consume_token(BUFFER_T); } if (!hasError) { return "buffer"; } break; } case LINKAGE_T:{ if (!hasError) { tok = jj_consume_token(LINKAGE_T); } if (!hasError) { return "linkage"; } break; } default: jj_la1[212] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::mode_indication() {Token *tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BUFFER_T: case IN_T: case INOUT_T: case LINKAGE_T: case OUT_T: case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { simple_mode_indication(); } if (!hasError) { return " "; } break; } case VIEW_T:{ if (!hasError) { mode_view_indication(); } if (!hasError) { return " "; } break; } default: jj_la1[213] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::mode_view_declaration() {Token *tok=nullptr; if (!hasError) { jj_consume_token(VIEW_T); } if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { subtype_indication(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ ; break; } default: jj_la1[214] = jj_gen; goto end_label_35; } if (!hasError) { mode_view_element_definition(); } } end_label_35: ; } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(VIEW_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[215] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } return ""; assert(false); } QCString VhdlParser::mode_view_element_definition() {Token *tok=nullptr; if (!hasError) { record_element_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { element_mode_indication(); } if (!hasError) { jj_consume_token(SEMI_T); } return ""; assert(false); } QCString VhdlParser::mode_view_indication() {Token *tok=nullptr; if (jj_2_83(3)) { if (!hasError) { array_mode_view_indication(); } if (!hasError) { return ""; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VIEW_T:{ if (!hasError) { record_mode_view_indication(); } if (!hasError) { return ""; } break; } default: jj_la1[216] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::multiplying_operation() {Token *tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case MULT_T:{ if (!hasError) { tok = jj_consume_token(MULT_T); } if (!hasError) { return QCString(tok->image); } break; } case SLASH_T:{ if (!hasError) { tok = jj_consume_token(SLASH_T); } if (!hasError) { return QCString(tok->image); } break; } case MOD_T:{ if (!hasError) { tok = jj_consume_token(MOD_T); } if (!hasError) { return QCString(tok->image); } break; } case REM_T:{ if (!hasError) { tok = jj_consume_token(REM_T); } if (!hasError) { return QCString(tok->image); } break; } default: jj_la1[217] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::name() {QCString s,s1; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case STRINGLITERAL:{ if (!hasError) { s = operator_symbol(); } if (!hasError) { if (jj_2_84(2147483647)) { if (!hasError) { s1 = name_ext1(); } if (!hasError) { s+=s1; } } else { ; } } if (!hasError) { return s; } break; } case SLSL_T:{ if (!hasError) { s = external_name(); } if (!hasError) { if (jj_2_85(2147483647)) { if (!hasError) { s1 = name_ext1(); } if (!hasError) { s+=s1; } } else { ; } } if (!hasError) { return s; } break; } case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { if (jj_2_86(2147483647)) { if (!hasError) { s1 = name_ext1(); } if (!hasError) { s+=s1; } } else { ; } } if (!hasError) { return s; } break; } default: jj_la1[218] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::name_ext1() {QCString s,s1,s2; if (!hasError) { s = name_ext(); } if (!hasError) { while (!hasError) { if (jj_2_87(2147483647)) { ; } else { goto end_label_36; } if (!hasError) { s1 = name_ext(); } if (!hasError) { s+=s1; } } end_label_36: ; } return s; assert(false); } QCString VhdlParser::name_ext() {QCString s,s1,s2; if (!hasError) { if (jj_2_88(2147483647)) { if (!hasError) { jj_consume_token(APOSTROPHE_T); } if (!hasError) { jj_consume_token(SUBTYPE_T); } if (!hasError) { s+="'subtype"; return s; } } else if (jj_2_89(2147483647)) { if (!hasError) { jj_consume_token(DOT_T); } if (!hasError) { s1 = suffix(); } if (!hasError) { s+=".";s+=s1; return s; } } else if (jj_2_90(2147483647)) { if (!hasError) { s1 = test_att_name(); } if (!hasError) { s+=s1;return s; } } else if (jj_2_91(2147483647)) { if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = discrete_range(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+="(";s+=s1;s+=")";return s; } } else if (jj_2_92(2147483647)) { if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = expression(); } if (!hasError) { s+="(";s+=s1; } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[219] = jj_gen; goto end_label_37; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = expression(); } if (!hasError) { s+=",";s+=s1; } } end_label_37: ; } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+=")";return s; } } else { jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::test_att_name() {QCString s,s1; if (jj_2_94(4)) { if (!hasError) { jj_consume_token(CHARACTER_LITERAL); } if (!hasError) { jj_consume_token(INTEGER); } if (!hasError) { jj_consume_token(APOSTROPHE_T); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { return "kkk"; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case APOSTROPHE_T: case LBRACKET_T:{ if (!hasError) { if (jj_2_93(2147483647)) { if (!hasError) { s1 = signature(); } if (!hasError) { s=s1; } } else { ; } } if (!hasError) { jj_consume_token(APOSTROPHE_T); } if (!hasError) { s1 = attribute_designator(); } if (!hasError) { s+="'";s+=s1; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+="(";s+=s1;s+=")"; } break; } default: jj_la1[220] = jj_gen; ; } } if (!hasError) { return s; } break; } default: jj_la1[221] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::indexed_name() {QCString s,s1,s2; if (!hasError) { s2 = identifier(); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = expression(); } if (!hasError) { s=s2+"("+s1; } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[222] = jj_gen; goto end_label_38; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = expression(); } if (!hasError) { s+=",";s+=s1; } } end_label_38: ; } if (!hasError) { jj_consume_token(RPAREN_T); } return s+")"; assert(false); } QCString VhdlParser::next_statement() {QCString s,s1,s2;Token *t=nullptr;Token *t1=nullptr; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { t = jj_consume_token(COLON_T); } break; } default: jj_la1[223] = jj_gen; ; } } if (!hasError) { jj_consume_token(NEXT_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s1 = identifier(); } break; } default: jj_la1[224] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ if (!hasError) { t1 = jj_consume_token(WHEN_T); } if (!hasError) { s2 = condition(); } break; } default: jj_la1[225] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if(t!=nullptr) s+=":"; FlowChart::addFlowChart(FlowChart::NEXT_NO,"next ",s2,s1); m_sharedState->lab.clear(); if(t1!=nullptr) s2.prepend("when "); return s+s1+s2+";"; assert(false); } QCString VhdlParser::null_statement() {QCString s; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s+=":"; } break; } default: jj_la1[226] = jj_gen; ; } } if (!hasError) { jj_consume_token(NULL_T); } if (!hasError) { jj_consume_token(SEMI_T); } return s+="null"; assert(false); } QCString VhdlParser::numeric_literal() {QCString s; if (jj_2_95(2147483647)) { if (!hasError) { s = physical_literal(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INTEGER: case DECIMAL_LITERAL: case BASED_LITERAL:{ if (!hasError) { s = abstract_literal(); } if (!hasError) { return s; } break; } default: jj_la1[227] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::object_class() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CONSTANT_T:{ if (!hasError) { jj_consume_token(CONSTANT_T); } if (!hasError) { return "constant"; } break; } case SIGNAL_T:{ if (!hasError) { jj_consume_token(SIGNAL_T); } if (!hasError) { return "signal"; } break; } case VARIABLE_T:{ if (!hasError) { jj_consume_token(VARIABLE_T); } if (!hasError) { return "variable"; } break; } case SHARED_T:{ if (!hasError) { jj_consume_token(SHARED_T); } if (!hasError) { jj_consume_token(VARIABLE_T); } if (!hasError) { return "shared variable"; } break; } case FILE_T:{ if (!hasError) { jj_consume_token(FILE_T); } if (!hasError) { return "file"; } break; } case TYPE_T:{ if (!hasError) { jj_consume_token(TYPE_T); } if (!hasError) { return "type"; } break; } default: jj_la1[228] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::operator_symbol() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(STRINGLITERAL); } return QCString(tok->image); assert(false); } void VhdlParser::options() { if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GUARDED_T:{ if (!hasError) { jj_consume_token(GUARDED_T); } break; } default: jj_la1[229] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INERTIAL_T: case REJECT_T: case TRANSPORT_T:{ if (!hasError) { delay_mechanism(); } break; } default: jj_la1[230] = jj_gen; ; } } } void VhdlParser::package_body() {QCString s; if (!hasError) { jj_consume_token(PACKAGE_T); } if (!hasError) { jj_consume_token(BODY_T); } if (!hasError) { s = name(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { m_sharedState->lastCompound=m_sharedState->current; s.prepend("_"); outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeClass(),VhdlSpecifier::PACKAGE_BODY,QCString(),QCString(),Protection::Protected); } if (!hasError) { package_body_declarative_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { jj_consume_token(PACKAGE_T); } if (!hasError) { jj_consume_token(BODY_T); } break; } default: jj_la1[231] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } default: jj_la1[232] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->lastCompound=nullptr; m_sharedState->genLabels.clear(); } void VhdlParser::package_body_declarative_item() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_declaration(); } break; } case TYPE_T:{ if (!hasError) { type_declaration(); } break; } case SUBTYPE_T:{ if (!hasError) { subtype_declaration(); } break; } case CONSTANT_T:{ if (!hasError) { constant_declaration(); } break; } case SHARED_T: case VARIABLE_T:{ if (!hasError) { variable_declaration(); } break; } default: jj_la1[233] = jj_gen; if (jj_2_96(2)) { if (!hasError) { package_body(); } } else if (jj_2_97(4)) { if (!hasError) { package_instantiation_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { package_declaration(); } break; } case FILE_T:{ if (!hasError) { file_declaration(); } break; } case ALIAS_T:{ if (!hasError) { alias_declaration(); } break; } case VIEW_T:{ if (!hasError) { mode_view_declaration(); } break; } case USE_T:{ if (!hasError) { use_clause(); } break; } default: jj_la1[234] = jj_gen; if (jj_2_98(3)) { if (!hasError) { group_template_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GROUP_T:{ if (!hasError) { group_declaration(); } break; } default: jj_la1[235] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } } } void VhdlParser::package_body_declarative_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case CONSTANT_T: case FILE_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T: case VIEW_T:{ ; break; } default: jj_la1[236] = jj_gen; goto end_label_39; } if (!hasError) { package_body_declarative_item(); } } end_label_39: ; } } void VhdlParser::package_header() {QCString s; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_clause(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_map_aspect(); } if (!hasError) { jj_consume_token(SEMI_T); } break; } default: jj_la1[237] = jj_gen; ; } } break; } default: jj_la1[238] = jj_gen; ; } } } void VhdlParser::package_declaration() {QCString s; if (!hasError) { jj_consume_token(PACKAGE_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { m_sharedState->lastCompound=m_sharedState->current; std::shared_ptr<Entry> clone=std::make_shared<Entry>(*m_sharedState->current); clone->section=EntryType::makeNamespace(); clone->vhdlSpec=VhdlSpecifier::PACKAGE; clone->name=s; clone->startLine=outlineParser()->getLine(PACKAGE_T); clone->bodyLine=outlineParser()->getLine(PACKAGE_T); clone->protection=Protection::Package; m_sharedState->current_root->moveToSubEntryAndKeep(clone); outlineParser()->addVhdlType(s,outlineParser()->getLine(PACKAGE_T), EntryType::makeClass(),VhdlSpecifier::PACKAGE,QCString(),QCString(),Protection::Package); } if (!hasError) { package_header(); } if (!hasError) { package_declarative_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { jj_consume_token(PACKAGE_T); } break; } default: jj_la1[239] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } default: jj_la1[240] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->lastEntity=nullptr;m_sharedState->lastCompound=nullptr; m_sharedState->genLabels.clear(); } void VhdlParser::package_declarative_item() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_declaration(); } break; } case TYPE_T:{ if (!hasError) { type_declaration(); } break; } case SUBTYPE_T:{ if (!hasError) { subtype_declaration(); } break; } default: jj_la1[241] = jj_gen; if (jj_2_99(5)) { if (!hasError) { package_instantiation_declaration(); } } else if (jj_2_100(3)) { if (!hasError) { package_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CONSTANT_T:{ if (!hasError) { constant_declaration(); } break; } case SIGNAL_T:{ if (!hasError) { signal_declaration(); } break; } case SHARED_T: case VARIABLE_T:{ if (!hasError) { variable_declaration(); } break; } case FILE_T:{ if (!hasError) { file_declaration(); } break; } case ALIAS_T:{ if (!hasError) { alias_declaration(); } break; } case COMPONENT_T:{ if (!hasError) { component_declaration(); } break; } case VIEW_T:{ if (!hasError) { mode_view_declaration(); } break; } default: jj_la1[242] = jj_gen; if (jj_2_101(2147483647)) { if (!hasError) { attribute_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ATTRIBUTE_T:{ if (!hasError) { attribute_specification(); } break; } case DISCONNECT_T:{ if (!hasError) { disconnection_specification(); } break; } case USE_T:{ if (!hasError) { use_clause(); } break; } default: jj_la1[243] = jj_gen; if (jj_2_102(3)) { if (!hasError) { group_template_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GROUP_T:{ if (!hasError) { group_declaration(); } break; } default: jj_la1[244] = jj_gen; if (jj_2_103(5)) { if (!hasError) { package_instantiation_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { package_declaration(); } break; } default: jj_la1[245] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } } } } } } } void VhdlParser::package_declarative_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case COMPONENT_T: case CONSTANT_T: case DISCONNECT_T: case FILE_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SIGNAL_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T: case VIEW_T:{ ; break; } default: jj_la1[246] = jj_gen; goto end_label_40; } if (!hasError) { package_declarative_item(); } } end_label_40: ; } } void VhdlParser::package_instantiation_declaration() {QCString s,s1,s2; if (!hasError) { jj_consume_token(PACKAGE_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { jj_consume_token(NEW_T); } if (!hasError) { s1 = name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { gen_assoc_list(); } break; } default: jj_la1[247] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } QCString q=" is new "+s1+s2; outlineParser()->addVhdlType(s,outlineParser()->getLine(PACKAGE_T), EntryType::makeVariable(),VhdlSpecifier::INSTANTIATION,"package",q,Protection::Public); } QCString VhdlParser::parameter_specification() {QCString s,s1; if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IN_T); } if (!hasError) { s1 = discrete_range(); } return s+" in "+s1; assert(false); } QCString VhdlParser::pathname_element() {QCString s,s1; if (!hasError) { s = identifier(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[248] = jj_gen; ; } } if(!s1.isEmpty()) return s+"("+s1+")"; return s; assert(false); } QCString VhdlParser::pathname_element_list() {QCString s,s1,s2; if (!hasError) { if (!hasError) { s = pathname_element(); } if (!hasError) { jj_consume_token(DOT_T); } } if (!hasError) { s+="."; } if (!hasError) { while (!hasError) { if (jj_2_104(2147483647)) { ; } else { goto end_label_41; } if (!hasError) { s1 = pathname_element(); } if (!hasError) { jj_consume_token(DOT_T); } if (!hasError) { s2+=s1;s2+="."; } } end_label_41: ; } return s+s2; assert(false); } QCString VhdlParser::package_path_name() {QCString s; if (!hasError) { jj_consume_token(AT_T); } if (!hasError) { s = name(); } return "@"+s; assert(false); } QCString VhdlParser::physical_literal() {QCString s,s1; if (!hasError) { if (jj_2_105(2147483647)) { if (!hasError) { s = abstract_literal(); } } else { ; } } if (!hasError) { s1 = name(); } s+=" ";s+=s1;s.prepend(" "); return s; assert(false); } QCString VhdlParser::physical_type_definition() {QCString s,s1,s2;Token *t=nullptr; if (!hasError) { t = jj_consume_token(UNITS_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(SEMI_T); } if (!hasError) { outlineParser()->addVhdlType(s,t->beginLine, EntryType::makeVariable(),VhdlSpecifier::UNITS, QCString(),QCString(),Protection::Public); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ ; break; } default: jj_la1[249] = jj_gen; goto end_label_42; } if (!hasError) { s1 = secondary_unit_declaration(); } } end_label_42: ; } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(UNITS_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } default: jj_la1[250] = jj_gen; ; } } return s; assert(false); } void VhdlParser::physical_incomplete_type_definition() { if (!hasError) { jj_consume_token(UNITS_T); } if (!hasError) { jj_consume_token(BOX_T); } } void VhdlParser::port_clause() { if (!hasError) { jj_consume_token(PORT_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { port_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->currP=VhdlSpecifier::UNKNOWN; } QCString VhdlParser::port_list() {QCString s; if (!hasError) { s = interface_list(); } return s; assert(false); } void VhdlParser::port_map_aspect() { if (!hasError) { jj_consume_token(PORT_T); } if (!hasError) { jj_consume_token(MAP_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { association_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } } QCString VhdlParser::primary() {QCString s,s1; if (jj_2_106(2147483647)) { if (!hasError) { s = function_call(); } if (!hasError) { return s; } } else if (jj_2_107(2147483647)) { if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = conditional_expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s="("+s1+")"; return s; } } else if (jj_2_108(2147483647)) { if (!hasError) { s = qualified_expression(); } if (!hasError) { return s; } } else if (jj_2_109(2147483647)) { if (!hasError) { s = type_conversion(); } if (!hasError) { return s; } } else if (jj_2_110(2147483647)) { if (!hasError) { s = literal(); } if (!hasError) { s.prepend(" ");return s; } } else if (jj_2_111(2147483647)) { if (!hasError) { s = name(); } if (!hasError) { return s; } } else if (jj_2_112(2147483647)) { if (!hasError) { allocator(); } if (!hasError) { return QCString(); } } else if (jj_2_113(2147483647)) { if (!hasError) { s = aggregate(); } if (!hasError) { return s; } } else { jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } void VhdlParser::primary_unit() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ENTITY_T:{ if (!hasError) { entity_declaration(); } break; } case CONFIGURATION_T:{ if (!hasError) { configuration_declaration(); } break; } default: jj_la1[251] = jj_gen; if (jj_2_114(2147483647)) { if (!hasError) { package_instantiation_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { package_declaration(); } break; } case CONTEXT_T:{ if (!hasError) { context_declaration(); } break; } default: jj_la1[252] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } QCString VhdlParser::private_variable_declaration() {QCString s,s1; if (!hasError) { jj_consume_token(PRIVATE_T); } if (!hasError) { variable_declaration(); } return "private"; assert(false); } QCString VhdlParser::private_incomplete_type_definition() {QCString s,s1; if (!hasError) { jj_consume_token(PRIVATE_T); } return "private"; assert(false); } QCString VhdlParser::parameter_map_aspect() {QCString s,s1; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T:{ if (!hasError) { jj_consume_token(PARAMETER_T); } if (!hasError) { jj_consume_token(MAP_T); } break; } default: jj_la1[253] = jj_gen; ; } } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { actual_parameter_part(); } if (!hasError) { jj_consume_token(RPAREN_T); } assert(false); } QCString VhdlParser::procedure_call() {QCString s,s1; if (!hasError) { name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T:{ if (!hasError) { jj_consume_token(PARAMETER_T); } if (!hasError) { jj_consume_token(MAP_T); } break; } default: jj_la1[254] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { actual_parameter_part(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[255] = jj_gen; ; } } return ""; assert(false); } QCString VhdlParser::procedure_call_statement() {QCString s,s1; if (!hasError) { if (jj_2_115(2)) { if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s+=":"; } } else { ; } } if (!hasError) { s1 = procedure_call(); } if (!hasError) { jj_consume_token(SEMI_T); } return s+s1+";"; assert(false); } QCString VhdlParser::procedure_specifiction() {QCString s,s1; if (!hasError) { jj_consume_token(PROCEDURE_T); } if (!hasError) { designator(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { subprogram_header(); } break; } default: jj_la1[256] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T: case LPAREN_T:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T:{ if (!hasError) { jj_consume_token(PARAMETER_T); } break; } default: jj_la1[257] = jj_gen; ; } } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { formal_parameter_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[258] = jj_gen; ; } } return s+s1+";"; assert(false); } QCString VhdlParser::process_declarative_item() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_declaration(); } if (!hasError) { return QCString(); } break; } case IS_T:{ if (!hasError) { subprogram_body(); } break; } default: jj_la1[259] = jj_gen; if (jj_2_116(2)) { if (!hasError) { package_body(); } if (!hasError) { return ""; } } else if (jj_2_117(2147483647)) { if (!hasError) { package_declaration(); } if (!hasError) { return ""; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { package_instantiation_declaration(); } if (!hasError) { return ""; } break; } case SUBTYPE_T:{ if (!hasError) { s = subtype_declaration(); } if (!hasError) { return s; } break; } case TYPE_T:{ if (!hasError) { s = type_declaration(); } if (!hasError) { return s; } break; } case CONSTANT_T:{ if (!hasError) { s = constant_declaration(); } if (!hasError) { return s; } break; } case SHARED_T: case VARIABLE_T:{ if (!hasError) { s = variable_declaration(); } if (!hasError) { return s; } break; } case FILE_T:{ if (!hasError) { s = file_declaration(); } if (!hasError) { return s; } break; } case ALIAS_T:{ if (!hasError) { s = alias_declaration(); } if (!hasError) { return s; } break; } default: jj_la1[260] = jj_gen; if (jj_2_118(3)) { if (!hasError) { s = attribute_declaration(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ATTRIBUTE_T:{ if (!hasError) { s = attribute_specification(); } if (!hasError) { return s; } break; } case USE_T:{ if (!hasError) { s = use_clause(); } if (!hasError) { return s; } break; } default: jj_la1[261] = jj_gen; if (jj_2_119(3)) { if (!hasError) { s = group_template_declaration(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GROUP_T:{ if (!hasError) { s = group_declaration(); } if (!hasError) { return s; } break; } default: jj_la1[262] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } } } } assert(false); } QCString VhdlParser::process_declarative_part() {QCString s,s1; if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case CONSTANT_T: case FILE_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case IS_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T:{ ; break; } default: jj_la1[263] = jj_gen; goto end_label_43; } if (!hasError) { s1 = process_declarative_item(); } if (!hasError) { s+=s1; } } end_label_43: ; } return s; assert(false); } void VhdlParser::process_statement() {QCString s,s1,s2;Token *tok=nullptr;Token *tok1=nullptr; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } break; } default: jj_la1[264] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case POSTPONED_T:{ if (!hasError) { jj_consume_token(POSTPONED_T); } break; } default: jj_la1[265] = jj_gen; ; } } if (!hasError) { tok1 = jj_consume_token(PROCESS_T); } if (!hasError) { m_sharedState->currP=VhdlSpecifier::PROCESS; m_sharedState->current->startLine=tok1->beginLine; m_sharedState->current->bodyLine=tok1->beginLine; } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { if (!hasError) { s1 = sensitivity_list(); } } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[266] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IS_T:{ if (!hasError) { jj_consume_token(IS_T); } break; } default: jj_la1[267] = jj_gen; ; } } if (!hasError) { s2 = process_declarative_part(); } if (!hasError) { if (!s2.isEmpty()) FlowChart::addFlowChart(FlowChart::VARIABLE_NO,s2,QCString()); FlowChart::addFlowChart(FlowChart::BEGIN_NO,"BEGIN",QCString()); } if (!hasError) { jj_consume_token(BEGIN_T); } if (!hasError) { process_statement_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case POSTPONED_T:{ if (!hasError) { jj_consume_token(POSTPONED_T); } break; } default: jj_la1[268] = jj_gen; ; } } if (!hasError) { jj_consume_token(PROCESS_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[269] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if(s.isEmpty()) m_sharedState->currName=VhdlDocGen::getProcessNumber(); else m_sharedState->currName=s; m_sharedState->current->name=m_sharedState->currName; m_sharedState->tempEntry=m_sharedState->current; m_sharedState->tempEntry->type=""; m_sharedState->current->endBodyLine=outlineParser()->getLine(); m_sharedState->currP=VhdlSpecifier::UNKNOWN; if(tok!=nullptr) s1=tok->image; outlineParser()->createFunction(m_sharedState->currName,VhdlSpecifier::PROCESS,s1); outlineParser()->createFlow(); m_sharedState->currName=""; outlineParser()->newEntry(); } void VhdlParser::process_statement_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ASSERT_T: case BLOCK_T: case CASE_T: case EXIT_T: case FOR_T: case IF_T: case LOOP_T: case NEXT_T: case NULL_T: case REPORT_T: case RETURN_T: case WAIT_T: case WHILE_T: case WITH_T: case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ ; break; } default: jj_la1[270] = jj_gen; goto end_label_44; } if (!hasError) { sequential_statement(); } } end_label_44: ; } } QCString VhdlParser::protected_type_body() { if (!hasError) { jj_consume_token(PROTECTED_T); } if (!hasError) { jj_consume_token(BODY_T); } if (!hasError) { protected_type_body_declarative_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(PROTECTED_T); } if (!hasError) { jj_consume_token(BODY_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[271] = jj_gen; ; } } return QCString(); assert(false); } void VhdlParser::protected_type_body_declarative_item() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_declaration(); } break; } case IS_T:{ if (!hasError) { subprogram_body(); } break; } default: jj_la1[272] = jj_gen; if (jj_2_120(2)) { if (!hasError) { package_body(); } } else if (jj_2_121(2147483647)) { if (!hasError) { package_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PACKAGE_T:{ if (!hasError) { package_instantiation_declaration(); } break; } case TYPE_T:{ if (!hasError) { type_declaration(); } break; } case SUBTYPE_T:{ if (!hasError) { subtype_declaration(); } break; } case CONSTANT_T:{ if (!hasError) { constant_declaration(); } break; } case SHARED_T: case VARIABLE_T:{ if (!hasError) { variable_declaration(); } break; } case FILE_T:{ if (!hasError) { file_declaration(); } break; } case ALIAS_T:{ if (!hasError) { alias_declaration(); } break; } default: jj_la1[273] = jj_gen; if (jj_2_122(2147483647)) { if (!hasError) { attribute_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ATTRIBUTE_T:{ if (!hasError) { attribute_specification(); } break; } case USE_T:{ if (!hasError) { use_clause(); } break; } default: jj_la1[274] = jj_gen; if (jj_2_123(3)) { if (!hasError) { group_template_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GROUP_T:{ if (!hasError) { group_declaration(); } break; } default: jj_la1[275] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } } } } } void VhdlParser::protected_type_body_declarative_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case CONSTANT_T: case FILE_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case IS_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T:{ ; break; } default: jj_la1[276] = jj_gen; goto end_label_45; } if (!hasError) { protected_type_body_declarative_item(); } } end_label_45: ; } } QCString VhdlParser::protected_type_declaration() { if (!hasError) { jj_consume_token(PROTECTED_T); } if (!hasError) { try { if (!hasError) { protected_type_header(); } if (!hasError) { protected_type_declarative_part(); } } catch ( ...) { outlineParser()->error_skipto(END_T); } } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(PROTECTED_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { identifier(); } break; } default: jj_la1[277] = jj_gen; ; } } return QCString(); assert(false); } void VhdlParser::protected_type_header() { if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_clause(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_map_aspect(); } break; } default: jj_la1[278] = jj_gen; ; } } break; } default: jj_la1[279] = jj_gen; ; } } } void VhdlParser::protected_type_declarative_item() { if (jj_2_124(2147483647)) { if (!hasError) { subprogram_declaration(); } } else if (jj_2_125(4)) { if (!hasError) { alias_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T:{ if (!hasError) { subprogram_instantiation_declaration(); } break; } case ATTRIBUTE_T:{ if (!hasError) { attribute_specification(); } break; } case PRIVATE_T:{ if (!hasError) { private_variable_declaration(); } break; } case USE_T:{ if (!hasError) { use_clause(); } break; } default: jj_la1[280] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::protected_type_declarative_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case FUNCTION_T: case IMPURE_T: case PRIVATE_T: case PROCEDURE_T: case PURE_T: case USE_T:{ ; break; } default: jj_la1[281] = jj_gen; goto end_label_46; } if (!hasError) { protected_type_declarative_item(); } } end_label_46: ; } } QCString VhdlParser::qualified_expression() {QCString s,s1;Token *tok=nullptr; if (jj_2_127(4)) { if (!hasError) { s1 = identifier(); } if (!hasError) { jj_consume_token(CHARACTER_LITERAL); } if (!hasError) { tok = jj_consume_token(LETTER_OR_DIGIT); } if (!hasError) { jj_consume_token(APOSTROPHE_T); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { return s1+"'('"+QCString(tok->image)+"')"; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s1 = identifier(); } if (!hasError) { jj_consume_token(APOSTROPHE_T); } if (!hasError) { s=s1+"'"; } if (!hasError) { if (jj_2_126(2147483647)) { if (!hasError) { s1 = aggregate(); } if (!hasError) { s+=s1; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { s+="(";s+=s1;s+=")"; } break; } default: jj_la1[282] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } if (!hasError) { return s; } break; } default: jj_la1[283] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::range() {QCString s,s1,s2; if (jj_2_128(2147483647)) { if (!hasError) { s = simple_expression(); } if (!hasError) { s1 = direction(); } if (!hasError) { s2 = simple_expression(); } if (!hasError) { return s+" "+s1+" "+s2; } } else if (jj_2_129(2147483647)) { if (!hasError) { s = attribute_name(); } if (!hasError) { return s; } } else { jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::range_constraint() {QCString s,s1; if (!hasError) { jj_consume_token(RANGE_T); } if (!hasError) { s = range(); } return " range "+s; assert(false); } void VhdlParser::record_type_definition() { if (!hasError) { jj_consume_token(RECORD_T); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ ; break; } default: jj_la1[284] = jj_gen; goto end_label_47; } if (!hasError) { element_declaration(); } } end_label_47: ; } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { jj_consume_token(RECORD_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } default: jj_la1[285] = jj_gen; ; } } } void VhdlParser::record_constraint() { if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { record_element_constraint(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[286] = jj_gen; goto end_label_48; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { record_element_constraint(); } } end_label_48: ; } if (!hasError) { jj_consume_token(RPAREN_T); } } void VhdlParser::record_element_constraint() { if (!hasError) { identifier(); } if (!hasError) { element_constraint(); } } void VhdlParser::record_element_list() { if (!hasError) { identifier(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[287] = jj_gen; goto end_label_49; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { identifier(); } } end_label_49: ; } } void VhdlParser::record_element_resolution() { if (!hasError) { identifier(); } if (!hasError) { resolution_indication(); } } void VhdlParser::record_resolution() { if (!hasError) { record_element_resolution(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[288] = jj_gen; goto end_label_50; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { record_element_resolution(); } } end_label_50: ; } } void VhdlParser::record_mode_view_indication() { if (!hasError) { jj_consume_token(VIEW_T); } if (!hasError) { name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case OF_T:{ if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { subtype_indication(); } break; } default: jj_la1[289] = jj_gen; ; } } } QCString VhdlParser::relation() {QCString s,s1,s2; if (!hasError) { s = shift_expression(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LESSTHAN_T: case GREATERTHAN_T: case LT_T: case GT_T: case EQU_T: case NOTEQU_T: case QGT_T: case QLT_T: case QG_T: case QL_T: case QEQU_T: case QNEQU_T:{ if (!hasError) { s1 = relation_operator(); } if (!hasError) { s2 = shift_expression(); } break; } default: jj_la1[290] = jj_gen; ; } } return s+s1+s2; assert(false); } QCString VhdlParser::relative_pathname() {QCString s,s1,s2; if (!hasError) { s = neg_list(); } if (!hasError) { if (jj_2_130(2147483647)) { if (!hasError) { s1 = pathname_element_list(); } } else { ; } } if (!hasError) { s2 = identifier(); } return s+s1+s2; assert(false); } QCString VhdlParser::neg_list() {QCString s; if (!hasError) { while (!hasError) { if (!hasError) { jj_consume_token(NEG_T); } if (!hasError) { jj_consume_token(DOT_T); } if (!hasError) { s+="^."; } switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NEG_T:{ ; break; } default: jj_la1[291] = jj_gen; goto end_label_51; } } end_label_51: ; } return s; assert(false); } QCString VhdlParser::relation_operator() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LT_T:{ if (!hasError) { jj_consume_token(LT_T); } if (!hasError) { return "<"; } break; } case GT_T:{ if (!hasError) { jj_consume_token(GT_T); } if (!hasError) { return ">"; } break; } case EQU_T:{ if (!hasError) { jj_consume_token(EQU_T); } if (!hasError) { return "="; } break; } case GREATERTHAN_T:{ if (!hasError) { jj_consume_token(GREATERTHAN_T); } if (!hasError) { return ">="; } break; } case LESSTHAN_T:{ if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { return "<="; } break; } case NOTEQU_T:{ if (!hasError) { jj_consume_token(NOTEQU_T); } if (!hasError) { return "/="; } break; } case QGT_T:{ if (!hasError) { jj_consume_token(QGT_T); } if (!hasError) { return "?>="; } break; } case QLT_T:{ if (!hasError) { jj_consume_token(QLT_T); } if (!hasError) { return "?<="; } break; } case QG_T:{ if (!hasError) { jj_consume_token(QG_T); } if (!hasError) { return "?>"; } break; } case QL_T:{ if (!hasError) { jj_consume_token(QL_T); } if (!hasError) { return "?<"; } break; } case QEQU_T:{ if (!hasError) { jj_consume_token(QEQU_T); } if (!hasError) { return "?="; } break; } case QNEQU_T:{ if (!hasError) { jj_consume_token(QNEQU_T); } if (!hasError) { return "?/="; } break; } default: jj_la1[292] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::report_statement() {Token *t=nullptr;Token *t1=nullptr;QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { t = jj_consume_token(COLON_T); } break; } default: jj_la1[293] = jj_gen; ; } } if (!hasError) { jj_consume_token(REPORT_T); } if (!hasError) { s1 = expression(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SEVERITY_T:{ if (!hasError) { t1 = jj_consume_token(SEVERITY_T); } if (!hasError) { s2 = expression(); } break; } default: jj_la1[294] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if(t!=nullptr) s.append(":"); s1.prepend(" report "); if(t1!=nullptr) s2.prepend(" severity "); return s+s1+s2+";"; assert(false); } QCString VhdlParser::resolution_indication() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { return s; } break; } case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s = expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { return "("+s+")"; } break; } default: jj_la1[295] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::return_statement() {QCString s,s1; if (jj_2_131(2147483647)) { if (!hasError) { s = plain_return_statement(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case RETURN_T: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = value_return_statement(); } if (!hasError) { return s; } break; } default: jj_la1[296] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::plain_return_statement() {QCString s,s1; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } break; } default: jj_la1[297] = jj_gen; ; } } if (!hasError) { jj_consume_token(RETURN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WHEN_T:{ if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { condition(); } break; } default: jj_la1[298] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } return s; assert(false); } QCString VhdlParser::value_return_statement() {QCString s,s1; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s+=":"; } break; } default: jj_la1[299] = jj_gen; ; } } if (!hasError) { jj_consume_token(RETURN_T); } if (!hasError) { s1 = conditional_or_unaffected_expression(); } if (!hasError) { jj_consume_token(SEMI_T); } return s+" return "+s1+";"; assert(false); } QCString VhdlParser::scalar_type_definition() {QCString s,s1; if (jj_2_132(2147483647)) { if (!hasError) { s = enumeration_type_definition(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case RANGE_T:{ if (!hasError) { s = range_constraint(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case UNITS_T:{ if (!hasError) { s1 = physical_type_definition(); } break; } default: jj_la1[300] = jj_gen; ; } } if (!hasError) { return s+" "+s1; } break; } default: jj_la1[301] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } void VhdlParser::scalar_incomplete_type_definition() { if (!hasError) { jj_consume_token(BOX_T); } } void VhdlParser::secondary_unit() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ARCHITECTURE_T:{ if (!hasError) { architecture_body(); } break; } case PACKAGE_T:{ if (!hasError) { package_body(); } break; } default: jj_la1[302] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } QCString VhdlParser::secondary_unit_declaration() {QCString s,s1;Token *t1=nullptr; if (!hasError) { s = identifier(); } if (!hasError) { t1 = jj_consume_token(EQU_T); } if (!hasError) { s1 = physical_literal(); } if (!hasError) { jj_consume_token(SEMI_T); } outlineParser()->addVhdlType(s,t1->beginLine, EntryType::makeVariable(),VhdlSpecifier::UNITS, QCString(),s1,Protection::Public); return s+"="+s1; assert(false); } QCString VhdlParser::selected_name() {QCString s,s1; if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(DOT_T); } if (!hasError) { s1 = suffix(); } return s+"."+s1; assert(false); } void VhdlParser::selected_signal_assignment() { if (!hasError) { jj_consume_token(WITH_T); } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(SELECT_T); } if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { options(); } if (!hasError) { selected_waveforms(); } if (!hasError) { jj_consume_token(SEMI_T); } } void VhdlParser::selected_waveforms() { if (!hasError) { waveform(); } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { choices(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[303] = jj_gen; goto end_label_52; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { waveform(); } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { choices(); } } end_label_52: ; } } QCString VhdlParser::sensitivity_clause() {QCString s; if (!hasError) { jj_consume_token(ON_T); } if (!hasError) { s = sensitivity_list(); } s.prepend(" on "); return s; assert(false); } void VhdlParser::selected_signal_assignment_wave() { if (jj_2_133(2147483647)) { if (!hasError) { selected_force_assignment(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case WITH_T:{ if (!hasError) { selected_waveform_assignment(); } break; } default: jj_la1[304] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::selected_variable_assignment() { if (!hasError) { jj_consume_token(WITH_T); } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(SELECT_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case Q_T:{ if (!hasError) { jj_consume_token(Q_T); } break; } default: jj_la1[305] = jj_gen; ; } } if (!hasError) { select_name(); } if (!hasError) { jj_consume_token(VARASSIGN_T); } if (!hasError) { sel_var_list(); } } void VhdlParser::select_name() { if (jj_2_134(2147483647)) { if (!hasError) { aggregate(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { name(); } break; } default: jj_la1[306] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::selected_waveform_assignment() { if (!hasError) { jj_consume_token(WITH_T); } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(SELECT_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case Q_T:{ if (!hasError) { jj_consume_token(Q_T); } break; } default: jj_la1[307] = jj_gen; ; } } if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INERTIAL_T: case REJECT_T: case TRANSPORT_T:{ if (!hasError) { delay_mechanism(); } break; } default: jj_la1[308] = jj_gen; ; } } if (!hasError) { sel_wave_list(); } } void VhdlParser::selected_force_assignment() { if (!hasError) { jj_consume_token(WITH_T); } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(SELECT_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case Q_T:{ if (!hasError) { jj_consume_token(Q_T); } break; } default: jj_la1[309] = jj_gen; ; } } if (!hasError) { target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { jj_consume_token(FORCE_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IN_T: case OUT_T:{ switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IN_T:{ if (!hasError) { jj_consume_token(IN_T); } break; } case OUT_T:{ if (!hasError) { jj_consume_token(OUT_T); } break; } default: jj_la1[310] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } break; } default: jj_la1[311] = jj_gen; ; } } if (!hasError) { sel_var_list(); } } void VhdlParser::sel_var_list() { if (!hasError) { if (!hasError) { expression(); } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { choices(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ if (!hasError) { jj_consume_token(COMMA_T); } break; } case SEMI_T:{ if (!hasError) { jj_consume_token(SEMI_T); } break; } default: jj_la1[312] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } if (!hasError) { while (!hasError) { if (jj_2_135(2147483647)) { ; } else { goto end_label_53; } if (!hasError) { expression(); } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { choices(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ if (!hasError) { jj_consume_token(COMMA_T); } break; } case SEMI_T:{ if (!hasError) { jj_consume_token(SEMI_T); } break; } default: jj_la1[313] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } end_label_53: ; } } void VhdlParser::sel_wave_list() { if (!hasError) { waveform_element(); } if (!hasError) { jj_consume_token(WHEN_T); } if (!hasError) { choices(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[314] = jj_gen; goto end_label_54; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { sel_wave_list(); } } end_label_54: ; } if (!hasError) { jj_consume_token(SEMI_T); } } QCString VhdlParser::sensitivity_list() {QCString s,s1;Token* tok=nullptr; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALL_T:{ if (!hasError) { tok = jj_consume_token(ALL_T); } if (!hasError) { if(tok!=nullptr) return "all" ; } break; } case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = name(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[315] = jj_gen; goto end_label_55; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = name(); } if (!hasError) { s+=",";s+=s1; } } end_label_55: ; } if (!hasError) { return s; } break; } default: jj_la1[316] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::sequence_of_statements() {QCString s,s1; if (!hasError) { while (!hasError) { if (jj_2_136(3)) { ; } else { goto end_label_56; } if (!hasError) { s1 = sequential_statement(); } if (!hasError) { s+=s1; } } end_label_56: ; } return s; assert(false); } QCString VhdlParser::sequential_statement() {QCString s; if (jj_2_137(2147483647)) { if (!hasError) { s = signal_assignment_statement(); } if (!hasError) { FlowChart::addFlowChart(FlowChart::TEXT_NO,s,QCString());return s; } } else if (jj_2_138(3)) { if (!hasError) { s = assertion_statement(); } if (!hasError) { FlowChart::addFlowChart(FlowChart::TEXT_NO,s,QCString());return s; } } else if (jj_2_139(3)) { if (!hasError) { s = report_statement(); } if (!hasError) { FlowChart::addFlowChart(FlowChart::TEXT_NO,s,QCString());return s; } } else if (jj_2_140(3)) { if (!hasError) { s = wait_statement(); } if (!hasError) { FlowChart::addFlowChart(FlowChart::TEXT_NO,s,QCString());return s; } } else if (jj_2_141(2147483647)) { if (!hasError) { s = variable_assignment_statement(); } if (!hasError) { FlowChart::addFlowChart(FlowChart::TEXT_NO,s,QCString());return s; } } else if (jj_2_142(3)) { if (!hasError) { s = procedure_call_statement(); } if (!hasError) { FlowChart::addFlowChart(FlowChart::TEXT_NO,s,QCString());return s; } } else if (jj_2_143(3)) { if (!hasError) { if_statement(); } if (!hasError) { return s; } } else if (jj_2_144(3)) { if (!hasError) { case_statement(); } if (!hasError) { return s; } } else if (jj_2_145(3)) { if (!hasError) { loop_statement(); } if (!hasError) { return s; } } else if (jj_2_146(3)) { if (!hasError) { s = next_statement(); } if (!hasError) { return s; } } else if (jj_2_147(3)) { if (!hasError) { s = exit_statement(); } if (!hasError) { return s; } } else if (jj_2_148(3)) { if (!hasError) { s = return_statement(); } if (!hasError) { FlowChart::addFlowChart(FlowChart::RETURN_NO,s,QCString());return s; } } else if (jj_2_149(3)) { if (!hasError) { sequential_bock_statement(); } if (!hasError) { return ""; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case NULL_T: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = null_statement(); } if (!hasError) { FlowChart::addFlowChart(FlowChart::TEXT_NO,s,QCString());return s; } break; } default: jj_la1[317] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::sequential_bock_statement() {QCString s,s1,s2; if (jj_2_150(6)) { if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { label(); } if (!hasError) { jj_consume_token(COLON_T); } break; } default: jj_la1[318] = jj_gen; ; } } if (!hasError) { jj_consume_token(BLOCK_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IS_T:{ if (!hasError) { jj_consume_token(IS_T); } break; } default: jj_la1[319] = jj_gen; ; } } if (!hasError) { jj_consume_token(BEGIN_T); } if (!hasError) { sequential_block_statement_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BLOCK_T:{ if (!hasError) { jj_consume_token(BLOCK_T); } break; } default: jj_la1[320] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { label(); } break; } default: jj_la1[321] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if (!hasError) { return ""; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BLOCK_T: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { label(); } if (!hasError) { jj_consume_token(COLON_T); } break; } default: jj_la1[322] = jj_gen; ; } } if (!hasError) { jj_consume_token(BLOCK_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IS_T:{ if (!hasError) { jj_consume_token(IS_T); } break; } default: jj_la1[323] = jj_gen; ; } } if (!hasError) { sequential_block_declarative_part(); } if (!hasError) { jj_consume_token(BEGIN_T); } if (!hasError) { sequential_block_statement_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BLOCK_T:{ if (!hasError) { jj_consume_token(BLOCK_T); } break; } default: jj_la1[324] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { label(); } break; } default: jj_la1[325] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if (!hasError) { return ""; } break; } default: jj_la1[326] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::sequential_block_declarative_part() {QCString s,s1,s2; if (!hasError) { process_declarative_part(); } return ""; assert(false); } QCString VhdlParser::sequential_block_statement_part() {QCString s,s1,s2; if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ASSERT_T: case BLOCK_T: case CASE_T: case EXIT_T: case FOR_T: case IF_T: case LOOP_T: case NEXT_T: case NULL_T: case REPORT_T: case RETURN_T: case WAIT_T: case WHILE_T: case WITH_T: case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ ; break; } default: jj_la1[327] = jj_gen; goto end_label_57; } if (!hasError) { sequential_statement(); } } end_label_57: ; } return ""; assert(false); } QCString VhdlParser::sequential_statement_body() {QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case BEGIN_T: case CONSTANT_T: case FILE_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case IS_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T:{ if (!hasError) { sequential_statement_declarative_part(); } if (!hasError) { jj_consume_token(BEGIN_T); } break; } default: jj_la1[328] = jj_gen; ; } } if (!hasError) { sequence_of_statements(); } return ""; assert(false); } QCString VhdlParser::sequential_statement_declarative_part() {QCString s,s1,s2; if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case CONSTANT_T: case FILE_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case IS_T: case PACKAGE_T: case PROCEDURE_T: case PURE_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T:{ ; break; } default: jj_la1[329] = jj_gen; goto end_label_58; } if (!hasError) { process_declarative_item(); } } end_label_58: ; } return ""; assert(false); } QCString VhdlParser::shift_expression() {QCString s,s1,s2; if (!hasError) { s = simple_expression(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ROL_T: case ROR_T: case SLA_T: case SLL_T: case SRA_T: case SRL_T:{ if (!hasError) { s1 = shift_operator(); } if (!hasError) { s2 = simple_expression(); } break; } default: jj_la1[330] = jj_gen; ; } } return s+s1+s2; assert(false); } QCString VhdlParser::shift_operator() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLL_T:{ if (!hasError) { jj_consume_token(SLL_T); } if (!hasError) { return "sll"; } break; } case SRL_T:{ if (!hasError) { jj_consume_token(SRL_T); } if (!hasError) { return "srl"; } break; } case SLA_T:{ if (!hasError) { jj_consume_token(SLA_T); } if (!hasError) { return "sla"; } break; } case SRA_T:{ if (!hasError) { jj_consume_token(SRA_T); } if (!hasError) { return "sra"; } break; } case ROL_T:{ if (!hasError) { jj_consume_token(ROL_T); } if (!hasError) { return "rol"; } break; } case ROR_T:{ if (!hasError) { jj_consume_token(ROR_T); } if (!hasError) { return "ror"; } break; } default: jj_la1[331] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::sign() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PLUS_T:{ if (!hasError) { jj_consume_token(PLUS_T); } if (!hasError) { return "+"; } break; } case MINUS_T:{ if (!hasError) { jj_consume_token(MINUS_T); } if (!hasError) { return "-"; } break; } default: jj_la1[332] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::signal_assignment_statement() {QCString s,s1,s2,s3; if (jj_2_152(2147483647)) { if (!hasError) { conditional_signal_assignment_wave(); } if (!hasError) { return QCString(); } } else if (jj_2_153(2147483647)) { if (!hasError) { selected_signal_assignment_wave(); } if (!hasError) { return QCString(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { if (jj_2_151(2)) { if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s+=":"; } } else { ; } } if (!hasError) { s1 = target(); } if (!hasError) { jj_consume_token(LESSTHAN_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case INERTIAL_T: case REJECT_T: case TRANSPORT_T:{ if (!hasError) { s2 = delay_mechanism(); } break; } default: jj_la1[333] = jj_gen; ; } } if (!hasError) { s3 = waveform(); } if (!hasError) { jj_consume_token(SEMI_T); } if (!hasError) { return s+s1+"<="+s2+s3+";"; } break; } default: jj_la1[334] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } void VhdlParser::signal_declaration() {Token* tok=nullptr;QCString s,s1,s2,s3,s4; if (!hasError) { jj_consume_token(SIGNAL_T); } if (!hasError) { s = identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = subtype_indication(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BUS_T: case REGISTER_T:{ if (!hasError) { s2 = signal_kind(); } break; } default: jj_la1[335] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VARASSIGN_T:{ if (!hasError) { tok = jj_consume_token(VARASSIGN_T); } if (!hasError) { s3 = expression(); } break; } default: jj_la1[336] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if(tok!=nullptr) s3.prepend(":="); s4=s1+s2+s3; outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),VhdlSpecifier::SIGNAL,QCString(),s4,Protection::Public); } QCString VhdlParser::signal_kind() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case REGISTER_T:{ if (!hasError) { jj_consume_token(REGISTER_T); } if (!hasError) { return "register"; } break; } case BUS_T:{ if (!hasError) { jj_consume_token(BUS_T); } if (!hasError) { return "bus"; } break; } default: jj_la1[337] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::signal_list() {QCString s,s1; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = name(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[338] = jj_gen; goto end_label_59; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = name(); } if (!hasError) { s+=",";s+=s1; } } end_label_59: ; } break; } case OTHER_T:{ if (!hasError) { jj_consume_token(OTHER_T); } if (!hasError) { return "other"; } break; } case ALL_T:{ if (!hasError) { jj_consume_token(ALL_T); } if (!hasError) { return "all"; } break; } default: jj_la1[339] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::simple_mode_indication() {QCString s,s1; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BUFFER_T: case IN_T: case INOUT_T: case LINKAGE_T: case OUT_T:{ if (!hasError) { mode(); } break; } default: jj_la1[340] = jj_gen; ; } } if (!hasError) { subtype_indication(); } if (!hasError) { interface_type_indication(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BUS_T:{ if (!hasError) { jj_consume_token(BUS_T); } break; } default: jj_la1[341] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VARASSIGN_T:{ if (!hasError) { jj_consume_token(VARASSIGN_T); } if (!hasError) { expression(); } break; } default: jj_la1[342] = jj_gen; ; } } assert(false); } QCString VhdlParser::signature() {QCString s,s1,s2; if (!hasError) { jj_consume_token(LBRACKET_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = name(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[343] = jj_gen; goto end_label_60; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = name(); } if (!hasError) { s+=",";s+=s1; } } end_label_60: ; } break; } default: jj_la1[344] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case RETURN_T:{ if (!hasError) { jj_consume_token(RETURN_T); } if (!hasError) { s1 = name(); } if (!hasError) { s+="return ";s+=s1; } break; } default: jj_la1[345] = jj_gen; ; } } if (!hasError) { jj_consume_token(RBRACKET_T); } s1="["+s+"]";return s1; assert(false); } QCString VhdlParser::simple_expression() {QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PLUS_T: case MINUS_T:{ if (!hasError) { s = sign(); } break; } default: jj_la1[346] = jj_gen; ; } } if (!hasError) { s1 = simpleTerm(); } if (!hasError) { s+=s1; } if (!hasError) { while (!hasError) { if (jj_2_154(2147483647)) { ; } else { goto end_label_61; } if (!hasError) { s1 = adding_operator(); } if (!hasError) { s2 = simpleTerm(); } if (!hasError) { s+=s1;s+=s2; } } end_label_61: ; } return s; assert(false); } void VhdlParser::simple_name() { if (!hasError) { name(); } } QCString VhdlParser::slice_name() {QCString s,s1; if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = discrete_range(); } if (!hasError) { jj_consume_token(RPAREN_T); } return s+"("+s1+")"; assert(false); } QCString VhdlParser::string_literal() {Token *tok=nullptr; if (!hasError) { tok = jj_consume_token(STRINGLITERAL); } return QCString(tok->image); assert(false); } void VhdlParser::subprogram_body() {QCString s; if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { s = subprogram_declarative_part(); } if (!hasError) { if (!s.isEmpty()) { FlowChart::addFlowChart(FlowChart::VARIABLE_NO,s,QCString()); } FlowChart::addFlowChart(FlowChart::BEGIN_NO,"BEGIN",QCString()); } if (!hasError) { jj_consume_token(BEGIN_T); } if (!hasError) { subprogram_statement_part(); } if (!hasError) { jj_consume_token(END_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case PROCEDURE_T:{ if (!hasError) { subprogram_kind(); } break; } default: jj_la1[347] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { designator(); } break; } default: jj_la1[348] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } m_sharedState->tempEntry->endBodyLine=outlineParser()->getLine(END_T); outlineParser()->createFlow(); m_sharedState->currP=VhdlSpecifier::UNKNOWN; } void VhdlParser::subprogram_declaration() { if (jj_2_155(2147483647)) { if (!hasError) { subprogram_instantiation_declaration(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_specification(); } if (!hasError) { subprogram_1(); } if (!hasError) { m_sharedState->currP=VhdlSpecifier::UNKNOWN; } break; } default: jj_la1[349] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } void VhdlParser::subprogram_1() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IS_T:{ if (!hasError) { subprogram_body(); } break; } case SEMI_T:{ if (!hasError) { jj_consume_token(SEMI_T); } break; } default: jj_la1[350] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } QCString VhdlParser::subprogram_declarative_item() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_declaration(); } if (!hasError) { return QCString(); } break; } case TYPE_T:{ if (!hasError) { s = type_declaration(); } if (!hasError) { return s; } break; } case IS_T:{ if (!hasError) { subprogram_body(); } if (!hasError) { return QCString(); } break; } case SUBTYPE_T:{ if (!hasError) { s = subtype_declaration(); } if (!hasError) { return s; } break; } case CONSTANT_T:{ if (!hasError) { s = constant_declaration(); } if (!hasError) { return s; } break; } case SHARED_T: case VARIABLE_T:{ if (!hasError) { s = variable_declaration(); } if (!hasError) { return s; } break; } case FILE_T:{ if (!hasError) { s = file_declaration(); } if (!hasError) { return s; } break; } case ALIAS_T:{ if (!hasError) { s = alias_declaration(); } if (!hasError) { return s; } break; } default: jj_la1[351] = jj_gen; if (jj_2_156(2147483647)) { if (!hasError) { s = attribute_declaration(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ATTRIBUTE_T:{ if (!hasError) { s = attribute_specification(); } if (!hasError) { return s; } break; } case USE_T:{ if (!hasError) { s = use_clause(); } if (!hasError) { return s; } break; } default: jj_la1[352] = jj_gen; if (jj_2_157(3)) { if (!hasError) { s = group_template_declaration(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GROUP_T:{ if (!hasError) { s = group_declaration(); } if (!hasError) { return s; } break; } default: jj_la1[353] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } } } assert(false); } QCString VhdlParser::subprogram_declarative_part() {QCString s,s1; if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ALIAS_T: case ATTRIBUTE_T: case CONSTANT_T: case FILE_T: case FUNCTION_T: case GROUP_T: case IMPURE_T: case IS_T: case PROCEDURE_T: case PURE_T: case SHARED_T: case SUBTYPE_T: case TYPE_T: case USE_T: case VARIABLE_T:{ ; break; } default: jj_la1[354] = jj_gen; goto end_label_62; } if (!hasError) { s1 = subprogram_declarative_item(); } if (!hasError) { s+=s1; } } end_label_62: ; } return s; assert(false); } void VhdlParser::subprogram_kind() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FUNCTION_T:{ if (!hasError) { jj_consume_token(FUNCTION_T); } break; } case PROCEDURE_T:{ if (!hasError) { jj_consume_token(PROCEDURE_T); } break; } default: jj_la1[355] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } void VhdlParser::subprogram_header() { if (!hasError) { jj_consume_token(GENERIC_T); } if (!hasError) { m_sharedState->parse_sec=VhdlSection::GEN_SEC; } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { generic_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { m_sharedState->parse_sec=VhdlSection::UNKNOWN; } if (!hasError) { if (jj_2_158(2)) { if (!hasError) { generic_map_aspect(); } } else { ; } } } void VhdlParser::subprogram_specification() {QCString s;Token *tok=nullptr;Token *t; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PROCEDURE_T:{ if (!hasError) { jj_consume_token(PROCEDURE_T); } if (!hasError) { s = designator(); } if (!hasError) { m_sharedState->currP=VhdlSpecifier::PROCEDURE; outlineParser()->createFunction(s,m_sharedState->currP,QCString()); m_sharedState->tempEntry=m_sharedState->current; m_sharedState->current->startLine=outlineParser()->getLine(PROCEDURE_T); m_sharedState->current->bodyLine=outlineParser()->getLine(PROCEDURE_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { m_sharedState->param_sec=VhdlSection::PARAM_SEC; } if (!hasError) { interface_list(); } if (!hasError) { m_sharedState->param_sec=VhdlSection::UNKNOWN; } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[356] = jj_gen; ; } } if (!hasError) { if (jj_2_159(2)) { if (!hasError) { gen_interface_list(); } } else { ; } } if (!hasError) { if (jj_2_160(2)) { if (!hasError) { gen_assoc_list(); } } else { ; } } if (!hasError) { param(); } if (!hasError) { outlineParser()->newEntry(); } break; } case FUNCTION_T: case IMPURE_T: case PURE_T:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case IMPURE_T: case PURE_T:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PURE_T:{ if (!hasError) { tok = jj_consume_token(PURE_T); } break; } case IMPURE_T:{ if (!hasError) { tok = jj_consume_token(IMPURE_T); } break; } default: jj_la1[357] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } break; } default: jj_la1[358] = jj_gen; ; } } if (!hasError) { t = jj_consume_token(FUNCTION_T); } if (!hasError) { m_sharedState->currP=VhdlSpecifier::FUNCTION; } if (!hasError) { s = designator(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { subprogram_header(); } break; } default: jj_la1[359] = jj_gen; ; } } if (!hasError) { if (tok!=nullptr) outlineParser()->createFunction(tok->image,m_sharedState->currP,s); else outlineParser()->createFunction(QCString(),m_sharedState->currP,s); m_sharedState->tempEntry=m_sharedState->current; m_sharedState->current->startLine=outlineParser()->getLine(FUNCTION_T); m_sharedState->current->bodyLine=outlineParser()->getLine(FUNCTION_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T: case LPAREN_T:{ if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PARAMETER_T:{ if (!hasError) { jj_consume_token(PARAMETER_T); } break; } default: jj_la1[360] = jj_gen; ; } } if (!hasError) { m_sharedState->param_sec=VhdlSection::PARAM_SEC; } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { formal_parameter_list(); } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { m_sharedState->param_sec=VhdlSection::UNKNOWN; } break; } default: jj_la1[361] = jj_gen; ; } } if (!hasError) { jj_consume_token(RETURN_T); } if (!hasError) { if (jj_2_161(2)) { if (!hasError) { identifier(); } if (!hasError) { jj_consume_token(OF_T); } } else { ; } } if (!hasError) { s = type_mark(); } if (!hasError) { m_sharedState->tempEntry=m_sharedState->current; m_sharedState->current->type=s; outlineParser()->newEntry(); } break; } default: jj_la1[362] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } void VhdlParser::subprogram_statement_part() { if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ASSERT_T: case BLOCK_T: case CASE_T: case EXIT_T: case FOR_T: case IF_T: case LOOP_T: case NEXT_T: case NULL_T: case REPORT_T: case RETURN_T: case WAIT_T: case WHILE_T: case WITH_T: case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ ; break; } default: jj_la1[363] = jj_gen; goto end_label_63; } if (!hasError) { sequential_statement(); } } end_label_63: ; } } QCString VhdlParser::subprogram_instantiation_declaration() {QCString s,s1,s2; if (!hasError) { jj_consume_token(FUNCTION_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { jj_consume_token(NEW_T); } if (!hasError) { s1 = name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LBRACKET_T:{ if (!hasError) { s2 = signature(); } break; } default: jj_la1[364] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { gen_assoc_list(); } break; } default: jj_la1[365] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } QCString q= " is new "+s1+s2; outlineParser()->addVhdlType(s,outlineParser()->getLine(FUNCTION_T), EntryType::makeVariable(),VhdlSpecifier::INSTANTIATION,"function ",q,Protection::Public); return q; assert(false); } QCString VhdlParser::subtype_declaration() {QCString s,s1; if (!hasError) { jj_consume_token(SUBTYPE_T); } if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(IS_T); } if (!hasError) { s1 = subtype_indication(); } if (!hasError) { jj_consume_token(SEMI_T); } outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),VhdlSpecifier::SUBTYPE,QCString(),s1,Protection::Public); return " subtype "+s+" is "+s1+";"; assert(false); } QCString VhdlParser::subtype_indication() {QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T:{ if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s = expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } break; } default: jj_la1[366] = jj_gen; ; } } if (!hasError) { while (!hasError) { if (!hasError) { s1 = name(); } if (jj_2_162(2)) { ; } else { goto end_label_64; } } end_label_64: ; } if (!hasError) { if (jj_2_163(2147483647)) { if (!hasError) { s2 = constraint(); } } else { ; } } return s+" "+s1+" "+s2; assert(false); } QCString VhdlParser::suffix() {QCString s; if (jj_2_164(2147483647)) { if (!hasError) { s = name(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case CHARACTER_LITERAL:{ if (!hasError) { s = character_literal(); } if (!hasError) { return s; } break; } case STRINGLITERAL:{ if (!hasError) { s = operator_symbol(); } if (!hasError) { return s; } break; } case ALL_T:{ if (!hasError) { jj_consume_token(ALL_T); } if (!hasError) { return " all "; } break; } default: jj_la1[367] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::target() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = name(); } if (!hasError) { return s; } break; } case LPAREN_T:{ if (!hasError) { s = aggregate(); } if (!hasError) { return s; } break; } default: jj_la1[368] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::simpleTerm() {QCString s,s1,s2; if (!hasError) { s = factor(); } if (!hasError) { while (!hasError) { if (jj_2_165(2)) { ; } else { goto end_label_65; } if (!hasError) { s1 = multiplying_operation(); } if (!hasError) { s2 = factor(); } if (!hasError) { s+=s1;s+=s2; } } end_label_65: ; } return s; assert(false); } QCString VhdlParser::timeout_clause() {QCString s; if (!hasError) { jj_consume_token(FOR_T); } if (!hasError) { s = expression(); } return " for "+s; assert(false); } QCString VhdlParser::type_conversion() {QCString s,s1; if (!hasError) { s = name(); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s1 = expression(); } if (!hasError) { jj_consume_token(RPAREN_T); } return s+"("+s1+")"; assert(false); } QCString VhdlParser::type_declaration() {QCString s; if (jj_2_166(3)) { if (!hasError) { s = full_type_declaration(); } if (!hasError) { return s; } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case TYPE_T:{ if (!hasError) { s = incomplete_type_declaration(); } if (!hasError) { return s; } break; } default: jj_la1[369] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } assert(false); } QCString VhdlParser::type_definition() {QCString s; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case RANGE_T: case LPAREN_T:{ if (!hasError) { s = scalar_type_definition(); } if (!hasError) { return s; } break; } case ARRAY_T: case RECORD_T:{ if (!hasError) { s = composite_type_definition(); } if (!hasError) { return s; } break; } case ACCESS_T:{ if (!hasError) { s = access_type_definition(); } if (!hasError) { return s; } break; } case FILE_T:{ if (!hasError) { s = file_type_definition(); } if (!hasError) { return s; } break; } case NEW_T:{ if (!hasError) { protected_type_instantiation_definition(); } if (!hasError) { return QCString(); } break; } default: jj_la1[370] = jj_gen; if (jj_2_167(2)) { if (!hasError) { protected_type_body(); } if (!hasError) { return QCString(); } } else { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case PROTECTED_T:{ if (!hasError) { protected_type_declaration(); } if (!hasError) { return QCString(); } break; } default: jj_la1[371] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } } assert(false); } void VhdlParser::protected_type_instantiation_definition() {QCString s; if (!hasError) { jj_consume_token(NEW_T); } if (!hasError) { name(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_map_aspect(); } break; } default: jj_la1[372] = jj_gen; ; } } } QCString VhdlParser::type_mark() {QCString s; if (!hasError) { s = name(); } return s; assert(false); } QCString VhdlParser::unconstraint_array_definition() {QCString s,s1,s2,s3; if (!hasError) { jj_consume_token(ARRAY_T); } if (!hasError) { jj_consume_token(LPAREN_T); } if (!hasError) { s = index_subtype_definition(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[373] = jj_gen; goto end_label_66; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = index_subtype_definition(); } if (!hasError) { s3+=",";s3+=s1; } } end_label_66: ; } if (!hasError) { jj_consume_token(RPAREN_T); } if (!hasError) { jj_consume_token(OF_T); } if (!hasError) { s2 = subtype_indication(); } return "array("+s+s3+") of "+s2; assert(false); } QCString VhdlParser::use_clause() {QCString s,s1; if (!hasError) { jj_consume_token(USE_T); } if (!hasError) { s = selected_name(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[374] = jj_gen; goto end_label_67; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = selected_name(); } if (!hasError) { s+=",";s+=s1; } } end_label_67: ; } if (!hasError) { jj_consume_token(SEMI_T); } auto ql1=split(s.str(),","); for (const auto &name : ql1) { auto ql2=split(name,"."); if (ql2.size()>1) { std::string it=ql2[1]; if ( m_sharedState->parse_sec==VhdlSection::UNKNOWN && Config_getBool(SHOW_INCLUDE_FILES) ) { outlineParser()->addVhdlType(it.c_str(), outlineParser()->getLine(), EntryType::makeVariable(), VhdlSpecifier::USE, it.c_str(), "_use_",Protection::Public); } } } s1="use "+s; return s1; assert(false); } QCString VhdlParser::variable_assignment_statement() {QCString s,s1,s2; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LPAREN_T: case SLSL_T: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { if (jj_2_168(2)) { if (!hasError) { s = identifier(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s+=":"; } } else { ; } } if (!hasError) { s1 = target(); } if (!hasError) { jj_consume_token(VARASSIGN_T); } if (!hasError) { s2 = conditional_or_unaffected_expression(); } if (!hasError) { jj_consume_token(SEMI_T); } if (!hasError) { return s+s1+":="+s2+";"; } break; } case WITH_T:{ if (!hasError) { selected_variable_assignment(); } if (!hasError) { return QCString(); } break; } default: jj_la1[375] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::variable_declaration() {Token *tok=nullptr;Token *t1=nullptr;QCString s,s1,s2; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case SHARED_T:{ if (!hasError) { tok = jj_consume_token(SHARED_T); } break; } default: jj_la1[376] = jj_gen; ; } } if (!hasError) { jj_consume_token(VARIABLE_T); } if (!hasError) { s = identifier_list(); } if (!hasError) { jj_consume_token(COLON_T); } if (!hasError) { s1 = subtype_indication(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case GENERIC_T:{ if (!hasError) { generic_map_aspect(); } break; } default: jj_la1[377] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case VARASSIGN_T:{ if (!hasError) { t1 = jj_consume_token(VARASSIGN_T); } if (!hasError) { s2 = conditional_expression(); } break; } default: jj_la1[378] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if(t1!=nullptr) s2.prepend(":="); QCString val=" variable "+s+":"+s1+s2+";"; QCString it=s1; if(tok != nullptr) { it.prepend(" shared "); val.prepend(" shared"); } VhdlSpecifier spec=VhdlSpecifier::SHAREDVARIABLE; if(t1 != nullptr) { it+=":="; it+=s2; } outlineParser()->addVhdlType(s,outlineParser()->getLine(), EntryType::makeVariable(),spec,QCString(),it,Protection::Public); return val; assert(false); } QCString VhdlParser::wait_statement() {QCString s,s1,s2,s3;Token *t=nullptr; if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { s = identifier(); } if (!hasError) { t = jj_consume_token(COLON_T); } break; } default: jj_la1[379] = jj_gen; ; } } if (!hasError) { jj_consume_token(WAIT_T); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ON_T:{ if (!hasError) { s1 = sensitivity_clause(); } break; } default: jj_la1[380] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case UNTIL_T:{ if (!hasError) { s2 = condition_clause(); } break; } default: jj_la1[381] = jj_gen; ; } } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case FOR_T:{ if (!hasError) { s3 = timeout_clause(); } break; } default: jj_la1[382] = jj_gen; ; } } if (!hasError) { jj_consume_token(SEMI_T); } if(t!=nullptr) s.append(":"); return s+" wait "+s1+s2+s3+";"; assert(false); } QCString VhdlParser::waveform() {QCString s,s1; switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case ABS_T: case AND_T: case NAND_T: case NEW_T: case NOR_T: case NOT_T: case NULL_T: case OR_T: case XOR_T: case XNOR_T: case LPAREN_T: case PLUS_T: case MINUS_T: case SLSL_T: case QQ_T: case INTEGER: case STRINGLITERAL: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER: case CHARACTER_LITERAL: case DECIMAL_LITERAL: case BASED_LITERAL: case BIT_STRING_LITERAL:{ if (!hasError) { s = waveform_element(); } if (!hasError) { while (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case COMMA_T:{ ; break; } default: jj_la1[383] = jj_gen; goto end_label_68; } if (!hasError) { jj_consume_token(COMMA_T); } if (!hasError) { s1 = waveform_element(); } if (!hasError) { s+=","; s+=s1; } } end_label_68: ; } if (!hasError) { return s; } break; } case UNAFFECTED_T:{ if (!hasError) { jj_consume_token(UNAFFECTED_T); } if (!hasError) { return " unaffected "; } break; } default: jj_la1[384] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } assert(false); } QCString VhdlParser::waveform_element() {QCString s,s1; if (!hasError) { s = expression(); } if (!hasError) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case AFTER_T:{ if (!hasError) { jj_consume_token(AFTER_T); } if (!hasError) { s1 = expression(); } if (!hasError) { s1.prepend(" after "); } break; } default: jj_la1[385] = jj_gen; ; } } return s+s1; assert(false); } void VhdlParser::parseInline() { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case POSTPONED_T: case PROCESS_T: case BASIC_IDENTIFIER: case EXTENDED_CHARACTER:{ if (!hasError) { process_statement(); } break; } case FUNCTION_T: case IMPURE_T: case PROCEDURE_T: case PURE_T:{ if (!hasError) { subprogram_declaration(); } break; } default: jj_la1[386] = jj_gen; jj_consume_token(-1); errorHandler->handleParseError(token, getToken(1), __FUNCTION__, this), hasError = true; } } VhdlParser::VhdlParser(TokenManager *tokenManager){ head = nullptr; ReInit(tokenManager); } VhdlParser::~VhdlParser() { clear(); } void VhdlParser::ReInit(TokenManager* tokenManager){ clear(); errorHandler = new ErrorHandler(); hasError = false; token_source = tokenManager; head = token = new Token(); token->kind = 0; token->next = nullptr; jj_lookingAhead = false; jj_rescan = false; jj_done = false; jj_scanpos = jj_lastpos = nullptr; jj_gc = 0; jj_kind = -1; indent = 0; trace = false; jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 387; i++) jj_la1[i] = -1; } void VhdlParser::clear(){ //Since token manager was generate from outside, //parser should not take care of deleting //if (token_source) delete token_source; if (head) { Token *next, *t = head; while (t) { next = t->next; delete t; t = next; } } if (errorHandler) { delete errorHandler, errorHandler = nullptr; } } Token * VhdlParser::jj_consume_token(int kind) { Token *oldToken; if ((oldToken = token)->next != nullptr) token = token->next; else token = token->next = token_source->getNextToken(); jj_ntk = -1; if (token->kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < 168; i++) { JJCalls *c = &jj_2_rtns[i]; while (c != nullptr) { if (c->gen < jj_gen) c->first = nullptr; c = c->next; } } } return token; } token = oldToken; jj_kind = kind; JJString image = kind >= 0 ? tokenImage[kind] : tokenImage[0]; errorHandler->handleUnexpectedToken(kind, image.substr(1, image.size() - 2), getToken(1), this); hasError = true; return token; } bool VhdlParser::jj_scan_token(int kind){ if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos->next == nullptr) { jj_lastpos = jj_scanpos = jj_scanpos->next = token_source->getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos->next; } } else { jj_scanpos = jj_scanpos->next; } if (jj_rescan) { int i = 0; Token *tok = token; while (tok != nullptr && tok != jj_scanpos) { i++; tok = tok->next; } if (tok != nullptr) jj_add_error_token(kind, i); } if (jj_scanpos->kind != kind) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) { return jj_done = true; } return false; } /** Get the next Token. */ Token * VhdlParser::getNextToken(){ if (token->next != nullptr) token = token->next; else token = token->next = token_source->getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ Token * VhdlParser::getToken(int index){ Token *t = token; for (int i = 0; i < index; i++) { if (t->next != nullptr) t = t->next; else t = t->next = token_source->getNextToken(); } return t; } int VhdlParser::jj_ntk_f(){ if ((jj_nt=token->next) == nullptr) return (jj_ntk = (token->next=token_source->getNextToken())->kind); else return (jj_ntk = jj_nt->kind); } void VhdlParser::jj_add_error_token(int kind, int pos) { } void VhdlParser::parseError() { fprintf(stderr, "Parse error at: %d:%d, after token: %s encountered: %s\n", token->beginLine, token->beginColumn, addUnicodeEscapes(token->image).c_str(), addUnicodeEscapes(getToken(1)->image).c_str()); } bool VhdlParser::trace_enabled() { return trace; } void VhdlParser::enable_tracing() { } void VhdlParser::disable_tracing() { } void VhdlParser::jj_rescan_token(){ jj_rescan = true; for (int i = 0; i < 168; i++) { JJCalls *p = &jj_2_rtns[i]; do { if (p->gen > jj_gen) { jj_la = p->arg; jj_lastpos = jj_scanpos = p->first; switch (i) { case 0: jj_3_1(); break; case 1: jj_3_2(); break; case 2: jj_3_3(); break; case 3: jj_3_4(); break; case 4: jj_3_5(); break; case 5: jj_3_6(); break; case 6: jj_3_7(); break; case 7: jj_3_8(); break; case 8: jj_3_9(); break; case 9: jj_3_10(); break; case 10: jj_3_11(); break; case 11: jj_3_12(); break; case 12: jj_3_13(); break; case 13: jj_3_14(); break; case 14: jj_3_15(); break; case 15: jj_3_16(); break; case 16: jj_3_17(); break; case 17: jj_3_18(); break; case 18: jj_3_19(); break; case 19: jj_3_20(); break; case 20: jj_3_21(); break; case 21: jj_3_22(); break; case 22: jj_3_23(); break; case 23: jj_3_24(); break; case 24: jj_3_25(); break; case 25: jj_3_26(); break; case 26: jj_3_27(); break; case 27: jj_3_28(); break; case 28: jj_3_29(); break; case 29: jj_3_30(); break; case 30: jj_3_31(); break; case 31: jj_3_32(); break; case 32: jj_3_33(); break; case 33: jj_3_34(); break; case 34: jj_3_35(); break; case 35: jj_3_36(); break; case 36: jj_3_37(); break; case 37: jj_3_38(); break; case 38: jj_3_39(); break; case 39: jj_3_40(); break; case 40: jj_3_41(); break; case 41: jj_3_42(); break; case 42: jj_3_43(); break; case 43: jj_3_44(); break; case 44: jj_3_45(); break; case 45: jj_3_46(); break; case 46: jj_3_47(); break; case 47: jj_3_48(); break; case 48: jj_3_49(); break; case 49: jj_3_50(); break; case 50: jj_3_51(); break; case 51: jj_3_52(); break; case 52: jj_3_53(); break; case 53: jj_3_54(); break; case 54: jj_3_55(); break; case 55: jj_3_56(); break; case 56: jj_3_57(); break; case 57: jj_3_58(); break; case 58: jj_3_59(); break; case 59: jj_3_60(); break; case 60: jj_3_61(); break; case 61: jj_3_62(); break; case 62: jj_3_63(); break; case 63: jj_3_64(); break; case 64: jj_3_65(); break; case 65: jj_3_66(); break; case 66: jj_3_67(); break; case 67: jj_3_68(); break; case 68: jj_3_69(); break; case 69: jj_3_70(); break; case 70: jj_3_71(); break; case 71: jj_3_72(); break; case 72: jj_3_73(); break; case 73: jj_3_74(); break; case 74: jj_3_75(); break; case 75: jj_3_76(); break; case 76: jj_3_77(); break; case 77: jj_3_78(); break; case 78: jj_3_79(); break; case 79: jj_3_80(); break; case 80: jj_3_81(); break; case 81: jj_3_82(); break; case 82: jj_3_83(); break; case 83: jj_3_84(); break; case 84: jj_3_85(); break; case 85: jj_3_86(); break; case 86: jj_3_87(); break; case 87: jj_3_88(); break; case 88: jj_3_89(); break; case 89: jj_3_90(); break; case 90: jj_3_91(); break; case 91: jj_3_92(); break; case 92: jj_3_93(); break; case 93: jj_3_94(); break; case 94: jj_3_95(); break; case 95: jj_3_96(); break; case 96: jj_3_97(); break; case 97: jj_3_98(); break; case 98: jj_3_99(); break; case 99: jj_3_100(); break; case 100: jj_3_101(); break; case 101: jj_3_102(); break; case 102: jj_3_103(); break; case 103: jj_3_104(); break; case 104: jj_3_105(); break; case 105: jj_3_106(); break; case 106: jj_3_107(); break; case 107: jj_3_108(); break; case 108: jj_3_109(); break; case 109: jj_3_110(); break; case 110: jj_3_111(); break; case 111: jj_3_112(); break; case 112: jj_3_113(); break; case 113: jj_3_114(); break; case 114: jj_3_115(); break; case 115: jj_3_116(); break; case 116: jj_3_117(); break; case 117: jj_3_118(); break; case 118: jj_3_119(); break; case 119: jj_3_120(); break; case 120: jj_3_121(); break; case 121: jj_3_122(); break; case 122: jj_3_123(); break; case 123: jj_3_124(); break; case 124: jj_3_125(); break; case 125: jj_3_126(); break; case 126: jj_3_127(); break; case 127: jj_3_128(); break; case 128: jj_3_129(); break; case 129: jj_3_130(); break; case 130: jj_3_131(); break; case 131: jj_3_132(); break; case 132: jj_3_133(); break; case 133: jj_3_134(); break; case 134: jj_3_135(); break; case 135: jj_3_136(); break; case 136: jj_3_137(); break; case 137: jj_3_138(); break; case 138: jj_3_139(); break; case 139: jj_3_140(); break; case 140: jj_3_141(); break; case 141: jj_3_142(); break; case 142: jj_3_143(); break; case 143: jj_3_144(); break; case 144: jj_3_145(); break; case 145: jj_3_146(); break; case 146: jj_3_147(); break; case 147: jj_3_148(); break; case 148: jj_3_149(); break; case 149: jj_3_150(); break; case 150: jj_3_151(); break; case 151: jj_3_152(); break; case 152: jj_3_153(); break; case 153: jj_3_154(); break; case 154: jj_3_155(); break; case 155: jj_3_156(); break; case 156: jj_3_157(); break; case 157: jj_3_158(); break; case 158: jj_3_159(); break; case 159: jj_3_160(); break; case 160: jj_3_161(); break; case 161: jj_3_162(); break; case 162: jj_3_163(); break; case 163: jj_3_164(); break; case 164: jj_3_165(); break; case 165: jj_3_166(); break; case 166: jj_3_167(); break; case 167: jj_3_168(); break; } } p = p->next; } while (p != nullptr); } jj_rescan = false; } void VhdlParser::jj_save(int index, int xla){ JJCalls *p = &jj_2_rtns[index]; while (p->gen > jj_gen) { if (p->next == nullptr) { p = p->next = new JJCalls(); break; } p = p->next; } p->gen = jj_gen + xla - jj_la; p->first = token; p->arg = xla; } } }
305,892
C++
.cc
13,650
15.94022
2,116
0.521851
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,521
file.h
doxygen_doxygen/examples/file.h
/** \file file.h * A brief file description. * A more elaborated file description. */ /** * A global integer value. * More details about this value. */ extern int globalValue;
183
C++
.h
9
18.555556
38
0.716763
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,523
define.h
doxygen_doxygen/examples/define.h
/*! \file define.h \brief testing defines This is to test the documentation of defines. */ /*! \def MAX(x,y) Computes the maximum of \a x and \a y. */ /*! \brief Computes the absolute value of its argument \a x. \param x input value. \returns absolute value of \a x. */ #define ABS(x) (((x)>0)?(x):-(x)) #define MAX(x,y) ((x)>(y)?(x):(y)) #define MIN(x,y) ((x)>(y)?(y):(x)) /*!< Computes the minimum of \a x and \a y. */
459
C++
.h
17
23.764706
59
0.590805
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,527
diagrams_a.h
doxygen_doxygen/examples/diagrams_a.h
#ifndef DIAGRAMS_A_H #define DIAGRAMS_A_H class A { public: A *m_self; }; #endif
81
C++
.h
4
19.25
31
0.714286
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,529
structcmd.h
doxygen_doxygen/examples/structcmd.h
/*! \file structcmd.h \brief A Documented file. Details. */ /*! \def MAX(a,b) \brief A macro that returns the maximum of \a a and \a b. Details. */ /*! \var typedef unsigned int UINT32 \brief A type definition for a . Details. */ /*! \var int errno \brief Contains the last error code. \warning Not thread safe! */ /*! \fn int open(const char *pathname,int flags) \brief Opens a file descriptor. \param pathname The name of the descriptor. \param flags Opening flags. */ /*! \fn int close(int fd) \brief Closes the file descriptor \a fd. \param fd The descriptor to close. */ /*! \fn size_t write(int fd,const char *buf, size_t count) \brief Writes \a count bytes from \a buf to the filedescriptor \a fd. \param fd The descriptor to write to. \param buf The data buffer to write. \param count The number of bytes to write. */ /*! \fn int read(int fd,char *buf,size_t count) \brief Read bytes from a file descriptor. \param fd The descriptor to read from. \param buf The buffer to read into. \param count The number of bytes to read. */ #define MAX(a,b) (((a)>(b))?(a):(b)) typedef unsigned int UINT32; int errno; int open(const char *,int); int close(int); size_t write(int,const char *, size_t); int read(int,char *,size_t);
1,334
C++
.h
44
26.863636
73
0.680095
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,531
diagrams_c.h
doxygen_doxygen/examples/diagrams_c.h
#ifndef DIAGRAMS_C_H #define DIAGRAMS_C_H #include "diagrams_c.h" class D; class C : public A { public: D *m_d; }; #endif
122
C++
.h
6
19.333333
39
0.706897
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,532
VhdlParserErrorHandler.hpp
doxygen_doxygen/vhdlparser/VhdlParserErrorHandler.hpp
#ifndef VHDLPARSERERRORHANDLER_H #define VHDLPARSERERRORHANDLER_H #include <stdio.h> #include <stdlib.h> #include <exception> #include "VhdlParser.h" #include "ErrorHandler.h" #include "vhdlstring.h" #include "message.h" const char *getVhdlFileName(void); namespace vhdl { namespace parser { class VhdlErrorHandler: public ErrorHandler { public: VhdlErrorHandler(const char *fileName) : m_fileName(fileName) {} virtual void handleUnexpectedToken(int /* expectedKind */, const JJString& /* expectedToken */, Token *actual, VhdlParser * /* parser */) { warn(m_fileName,actual->beginLine,"syntax error '%s'",actual->image.data()); error_count++; throw std::exception(); } virtual void handleParseError(Token *last, Token *unexpected, const JJSimpleString& /* production */, VhdlParser * /* parser */) { warn(m_fileName,last->beginLine,"unexpected token: '%s'", unexpected->image.data()); error_count++; throw std::exception(); } virtual void handleOtherError(const JJString& message, VhdlParser * /* parser */) { warn(m_fileName, -1, "unexpected error: '%s'", (char*)message.c_str()); error_count++; throw std::exception(); } private: QCString m_fileName; }; class VhdlTokenManagerErrorHandler: public TokenManagerErrorHandler { public: VhdlTokenManagerErrorHandler(const char *fileName) : m_fileName(fileName) {} virtual void lexicalError(bool EOFSeen, int /* lexState */, int errorLine, int /* errorColumn */, const JJString& errorAfter, JJChar curChar, VhdlParserTokenManager* /* token_manager */) { warn(m_fileName,errorLine,"Lexical error, Encountered: '%c' after: '%s'",curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str())); } virtual void lexicalError(const JJString& errorMessage, VhdlParserTokenManager* /* token_manager */) { warn(m_fileName,-1,"Unknown error: '%s'", (char*)errorMessage.c_str()); } private: QCString m_fileName; }; } } #endif
2,023
C++
.h
53
34.056604
190
0.700767
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
28,533
VhdlParser.h
doxygen_doxygen/vhdlparser/VhdlParser.h
#ifndef VHDLPARSER_H #define VHDLPARSER_H #include "JavaCC.h" #include "CharStream.h" #include "Token.h" #include "TokenManager.h" #include "vhdljjparser.h" #include "VhdlParserConstants.h" #include "ErrorHandler.h" namespace vhdl { namespace parser { struct JJCalls { int gen; int arg; JJCalls* next; Token* first; ~JJCalls() { if (next) delete next; } JJCalls() { next = nullptr; arg = 0; gen = -1; first = nullptr; } }; class VhdlParser { public: QCString absolute_pathname(); QCString abstract_literal(); QCString access_type_definition(); QCString access_incomplete_type_definition(); QCString actual_designator(); QCString actual_parameter_part(); QCString actual_part(); QCString adding_operator(); QCString aggregate(); QCString alias_declaration(); QCString alias_designator(); void allocator(); void architecture_body(); void anonymous_type_indication(); void architecture_declarative_part(); void architecture_statement_part(); void array_constraint(); void array_element_constraint(); void array_element_resolution(); void array_incomplete_type_definition(); void array_index_incomplete_type(); void array_index_incomplete_type_list(); QCString array_mode_view_indication(); QCString array_type_definition(); QCString assertion(); QCString assertion_statement(); QCString association_element(); QCString association_list(); QCString attribute_declaration(); QCString attribute_designator(); QCString attribute_name(); QCString attribute_specification(); QCString base(); QCString base_specifier(); QCString base_unit_declaration(); QCString based_integer(); QCString based_literal(); QCString basic_identifier(); void binding_indication(); QCString bit_string_literal(); QCString bit_value(); void block_configuration(); void block_declarative_item(); void block_declarative_part(); void block_header(); void block_specification(); void block_statement(); void block_statement_part(); void case_statement(); void case_scheme(); void when_stats(); void case_statement_alternative(); QCString character_literal(); QCString choice(); QCString choices(); void component_configuration(); void component_declaration(); void component_instantiation_statement(); void component_specification(); QCString composite_type_definition(); void concurrent_assertion_statement(); void concurrent_procedure_call_statement(); void concurrent_signal_assignment_statement(); void concurrent_conditional_signal_assignment(); void concurrent_simple_signal_assignment(); void concurrent_selected_signal_assignment(); void concurrent_signal_association_statement(); void concurrent_simple_signal_association(); void concurrent_statement(); QCString condition(); QCString condition_operator(); QCString condition_clause(); void conditional_signal_assignment_wave(); void conditional_waveform_assignment(); void else_wave_list(); void conditional_force_assignment(); void else_stat(); QCString conditional_expression(); QCString conditional_or_unaffected_expression(); void conditional_signal_assignment(); void conditional_waveforms(); void configuration_declaration(); void configuration_declarative_item(); void configuration_declarative_part(); void configuration_item(); void configuration_specification(); QCString constant_declaration(); QCString constraint_array_definition(); void context_clause(); QCString constraint(); void context_item(); QCString context_ref(); void context_declaration(); QCString decimal_literal(); QCString delay_mechanism(); void design_file(); void design_unit(); QCString designator(); QCString direction(); QCString discrete_incomplete_type_definition(); void disconnection_specification(); void guarded_signal_specificatio(); QCString discrete_range(); QCString element_array_mode_view_indication(); QCString element_association(); QCString element_constraint(); QCString element_declaration(); QCString element_resolution(); QCString element_mode_indication(); QCString element_mode_view_indication(); QCString element_record_mode_view_indication(); QCString entity_aspect(); QCString entity_class(); QCString entity_class_entry(); QCString entity_class_entry_list(); void entity_declaration(); void entity_declarative_item(); void entity_declarative_part(); QCString entity_designator(); void entity_header(); QCString entity_name_list(); QCString entity_specification(); void entity_statement(); void entity_statement_part(); QCString entity_tag(); QCString enumeration_literal(); QCString enumeration_type_definition(); QCString exit_statement(); QCString expression(); QCString expression_or_unaffected(); QCString external_pathname(); QCString external_name(); QCString sig_stat(); QCString logop(); QCString extended_identifier(); QCString factor(); QCString file_declaration(); QCString file_logical_name(); QCString file_open_information(); QCString file_type_definition(); QCString file_incomplete_type_definition(); QCString floating_incomplete_type_definition(); QCString floating_type_definition(); QCString formal_designator(); QCString formal_parameter_list(); QCString formal_part(); QCString full_type_declaration(); QCString function_call(); void geninter(); void gen_assoc_list(); void gen_interface_list(); void generate_statement_body(); void generate_statement_body1(); void generate_scheme_1(); void generate_scheme_2(); void generate_scheme_3(); void generate_statement(); void generate_scheme(); void generic_clause(); QCString generic_list(); void generic_map_aspect(); QCString group_constituent(); QCString group_constituent_list(); QCString group_declaration(); QCString group_template_declaration(); void guarded_signal_specification(); QCString identifier(); QCString identifier_list(); void if_statement(); QCString incomplete_subtype_indication(); QCString incomplete_type_definition(); QCString incomplete_type_mark(); QCString integer_incomplete_type_definition(); QCString incomplete_type_declaration(); QCString index_constraint(); QCString index_specification(); QCString index_subtype_definition(); QCString instantiation_unit(); QCString instantiation_list(); QCString integer(); QCString integer_type_definition(); QCString interface_declaration(); void interface_object_declaration(); QCString interface_constant_declaration(); QCString interface_element(); QCString interface_file_declaration(); QCString interface_list(); QCString interface_package_declaration(); QCString interface_package_generic_map_aspect(); QCString interface_procedure_specification(); QCString interface_signal_declaration(); QCString interface_subprogram_declaration(); QCString iproc(); QCString ifunc(); QCString param(); QCString interface_subprogram_default(); QCString interface_subprogram_specification(); QCString interface_function_specification(); QCString interface_incomplete_type_declaration(); QCString interface_type_declaration(); QCString interface_type_indication(); QCString interface_variable_declaration(); QCString iteration_scheme(); QCString label(); QCString library_clause(); QCString library_unit(); QCString literal(); QCString logical_operator(); QCString loop_statement(); QCString miscellaneous_operator(); QCString mode(); QCString mode_indication(); QCString mode_view_declaration(); QCString mode_view_element_definition(); QCString mode_view_indication(); QCString multiplying_operation(); QCString name(); QCString name_ext1(); QCString name_ext(); QCString test_att_name(); QCString indexed_name(); QCString next_statement(); QCString null_statement(); QCString numeric_literal(); QCString object_class(); QCString operator_symbol(); void options(); void package_body(); void package_body_declarative_item(); void package_body_declarative_part(); void package_header(); void package_declaration(); void package_declarative_item(); void package_declarative_part(); void package_instantiation_declaration(); QCString parameter_specification(); QCString pathname_element(); QCString pathname_element_list(); QCString package_path_name(); QCString physical_literal(); QCString physical_type_definition(); void physical_incomplete_type_definition(); void port_clause(); QCString port_list(); void port_map_aspect(); QCString primary(); void primary_unit(); QCString private_variable_declaration(); QCString private_incomplete_type_definition(); QCString parameter_map_aspect(); QCString procedure_call(); QCString procedure_call_statement(); QCString procedure_specifiction(); QCString process_declarative_item(); QCString process_declarative_part(); void process_statement(); void process_statement_part(); QCString protected_type_body(); void protected_type_body_declarative_item(); void protected_type_body_declarative_part(); QCString protected_type_declaration(); void protected_type_header(); void protected_type_declarative_item(); void protected_type_declarative_part(); QCString qualified_expression(); QCString range(); QCString range_constraint(); void record_type_definition(); void record_constraint(); void record_element_constraint(); void record_element_list(); void record_element_resolution(); void record_resolution(); void record_mode_view_indication(); QCString relation(); QCString relative_pathname(); QCString neg_list(); QCString relation_operator(); QCString report_statement(); QCString resolution_indication(); QCString return_statement(); QCString plain_return_statement(); QCString value_return_statement(); QCString scalar_type_definition(); void scalar_incomplete_type_definition(); void secondary_unit(); QCString secondary_unit_declaration(); QCString selected_name(); void selected_signal_assignment(); void selected_waveforms(); QCString sensitivity_clause(); void selected_signal_assignment_wave(); void selected_variable_assignment(); void select_name(); void selected_waveform_assignment(); void selected_force_assignment(); void sel_var_list(); void sel_wave_list(); QCString sensitivity_list(); QCString sequence_of_statements(); QCString sequential_statement(); QCString sequential_bock_statement(); QCString sequential_block_declarative_part(); QCString sequential_block_statement_part(); QCString sequential_statement_body(); QCString sequential_statement_declarative_part(); QCString shift_expression(); QCString shift_operator(); QCString sign(); QCString signal_assignment_statement(); void signal_declaration(); QCString signal_kind(); QCString signal_list(); QCString simple_mode_indication(); QCString signature(); QCString simple_expression(); void simple_name(); QCString slice_name(); QCString string_literal(); void subprogram_body(); void subprogram_declaration(); void subprogram_1(); QCString subprogram_declarative_item(); QCString subprogram_declarative_part(); void subprogram_kind(); void subprogram_header(); void subprogram_specification(); void subprogram_statement_part(); QCString subprogram_instantiation_declaration(); QCString subtype_declaration(); QCString subtype_indication(); QCString suffix(); QCString target(); QCString simpleTerm(); QCString timeout_clause(); QCString type_conversion(); QCString type_declaration(); QCString type_definition(); void protected_type_instantiation_definition(); QCString type_mark(); QCString unconstraint_array_definition(); QCString use_clause(); QCString variable_assignment_statement(); QCString variable_declaration(); QCString wait_statement(); QCString waveform(); QCString waveform_element(); void parseInline(); inline bool jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_1() || jj_done); { jj_save(0, xla); } } inline bool jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_2() || jj_done); { jj_save(1, xla); } } inline bool jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_3() || jj_done); { jj_save(2, xla); } } inline bool jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_4() || jj_done); { jj_save(3, xla); } } inline bool jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_5() || jj_done); { jj_save(4, xla); } } inline bool jj_2_6(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_6() || jj_done); { jj_save(5, xla); } } inline bool jj_2_7(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_7() || jj_done); { jj_save(6, xla); } } inline bool jj_2_8(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_8() || jj_done); { jj_save(7, xla); } } inline bool jj_2_9(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_9() || jj_done); { jj_save(8, xla); } } inline bool jj_2_10(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_10() || jj_done); { jj_save(9, xla); } } inline bool jj_2_11(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_11() || jj_done); { jj_save(10, xla); } } inline bool jj_2_12(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_12() || jj_done); { jj_save(11, xla); } } inline bool jj_2_13(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_13() || jj_done); { jj_save(12, xla); } } inline bool jj_2_14(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_14() || jj_done); { jj_save(13, xla); } } inline bool jj_2_15(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_15() || jj_done); { jj_save(14, xla); } } inline bool jj_2_16(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_16() || jj_done); { jj_save(15, xla); } } inline bool jj_2_17(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_17() || jj_done); { jj_save(16, xla); } } inline bool jj_2_18(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_18() || jj_done); { jj_save(17, xla); } } inline bool jj_2_19(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_19() || jj_done); { jj_save(18, xla); } } inline bool jj_2_20(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_20() || jj_done); { jj_save(19, xla); } } inline bool jj_2_21(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_21() || jj_done); { jj_save(20, xla); } } inline bool jj_2_22(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_22() || jj_done); { jj_save(21, xla); } } inline bool jj_2_23(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_23() || jj_done); { jj_save(22, xla); } } inline bool jj_2_24(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_24() || jj_done); { jj_save(23, xla); } } inline bool jj_2_25(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_25() || jj_done); { jj_save(24, xla); } } inline bool jj_2_26(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_26() || jj_done); { jj_save(25, xla); } } inline bool jj_2_27(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_27() || jj_done); { jj_save(26, xla); } } inline bool jj_2_28(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_28() || jj_done); { jj_save(27, xla); } } inline bool jj_2_29(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_29() || jj_done); { jj_save(28, xla); } } inline bool jj_2_30(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_30() || jj_done); { jj_save(29, xla); } } inline bool jj_2_31(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_31() || jj_done); { jj_save(30, xla); } } inline bool jj_2_32(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_32() || jj_done); { jj_save(31, xla); } } inline bool jj_2_33(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_33() || jj_done); { jj_save(32, xla); } } inline bool jj_2_34(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_34() || jj_done); { jj_save(33, xla); } } inline bool jj_2_35(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_35() || jj_done); { jj_save(34, xla); } } inline bool jj_2_36(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_36() || jj_done); { jj_save(35, xla); } } inline bool jj_2_37(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_37() || jj_done); { jj_save(36, xla); } } inline bool jj_2_38(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_38() || jj_done); { jj_save(37, xla); } } inline bool jj_2_39(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_39() || jj_done); { jj_save(38, xla); } } inline bool jj_2_40(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_40() || jj_done); { jj_save(39, xla); } } inline bool jj_2_41(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_41() || jj_done); { jj_save(40, xla); } } inline bool jj_2_42(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_42() || jj_done); { jj_save(41, xla); } } inline bool jj_2_43(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_43() || jj_done); { jj_save(42, xla); } } inline bool jj_2_44(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_44() || jj_done); { jj_save(43, xla); } } inline bool jj_2_45(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_45() || jj_done); { jj_save(44, xla); } } inline bool jj_2_46(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_46() || jj_done); { jj_save(45, xla); } } inline bool jj_2_47(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_47() || jj_done); { jj_save(46, xla); } } inline bool jj_2_48(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_48() || jj_done); { jj_save(47, xla); } } inline bool jj_2_49(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_49() || jj_done); { jj_save(48, xla); } } inline bool jj_2_50(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_50() || jj_done); { jj_save(49, xla); } } inline bool jj_2_51(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_51() || jj_done); { jj_save(50, xla); } } inline bool jj_2_52(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_52() || jj_done); { jj_save(51, xla); } } inline bool jj_2_53(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_53() || jj_done); { jj_save(52, xla); } } inline bool jj_2_54(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_54() || jj_done); { jj_save(53, xla); } } inline bool jj_2_55(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_55() || jj_done); { jj_save(54, xla); } } inline bool jj_2_56(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_56() || jj_done); { jj_save(55, xla); } } inline bool jj_2_57(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_57() || jj_done); { jj_save(56, xla); } } inline bool jj_2_58(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_58() || jj_done); { jj_save(57, xla); } } inline bool jj_2_59(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_59() || jj_done); { jj_save(58, xla); } } inline bool jj_2_60(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_60() || jj_done); { jj_save(59, xla); } } inline bool jj_2_61(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_61() || jj_done); { jj_save(60, xla); } } inline bool jj_2_62(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_62() || jj_done); { jj_save(61, xla); } } inline bool jj_2_63(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_63() || jj_done); { jj_save(62, xla); } } inline bool jj_2_64(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_64() || jj_done); { jj_save(63, xla); } } inline bool jj_2_65(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_65() || jj_done); { jj_save(64, xla); } } inline bool jj_2_66(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_66() || jj_done); { jj_save(65, xla); } } inline bool jj_2_67(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_67() || jj_done); { jj_save(66, xla); } } inline bool jj_2_68(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_68() || jj_done); { jj_save(67, xla); } } inline bool jj_2_69(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_69() || jj_done); { jj_save(68, xla); } } inline bool jj_2_70(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_70() || jj_done); { jj_save(69, xla); } } inline bool jj_2_71(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_71() || jj_done); { jj_save(70, xla); } } inline bool jj_2_72(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_72() || jj_done); { jj_save(71, xla); } } inline bool jj_2_73(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_73() || jj_done); { jj_save(72, xla); } } inline bool jj_2_74(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_74() || jj_done); { jj_save(73, xla); } } inline bool jj_2_75(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_75() || jj_done); { jj_save(74, xla); } } inline bool jj_2_76(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_76() || jj_done); { jj_save(75, xla); } } inline bool jj_2_77(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_77() || jj_done); { jj_save(76, xla); } } inline bool jj_2_78(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_78() || jj_done); { jj_save(77, xla); } } inline bool jj_2_79(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_79() || jj_done); { jj_save(78, xla); } } inline bool jj_2_80(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_80() || jj_done); { jj_save(79, xla); } } inline bool jj_2_81(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_81() || jj_done); { jj_save(80, xla); } } inline bool jj_2_82(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_82() || jj_done); { jj_save(81, xla); } } inline bool jj_2_83(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_83() || jj_done); { jj_save(82, xla); } } inline bool jj_2_84(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_84() || jj_done); { jj_save(83, xla); } } inline bool jj_2_85(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_85() || jj_done); { jj_save(84, xla); } } inline bool jj_2_86(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_86() || jj_done); { jj_save(85, xla); } } inline bool jj_2_87(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_87() || jj_done); { jj_save(86, xla); } } inline bool jj_2_88(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_88() || jj_done); { jj_save(87, xla); } } inline bool jj_2_89(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_89() || jj_done); { jj_save(88, xla); } } inline bool jj_2_90(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_90() || jj_done); { jj_save(89, xla); } } inline bool jj_2_91(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_91() || jj_done); { jj_save(90, xla); } } inline bool jj_2_92(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_92() || jj_done); { jj_save(91, xla); } } inline bool jj_2_93(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_93() || jj_done); { jj_save(92, xla); } } inline bool jj_2_94(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_94() || jj_done); { jj_save(93, xla); } } inline bool jj_2_95(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_95() || jj_done); { jj_save(94, xla); } } inline bool jj_2_96(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_96() || jj_done); { jj_save(95, xla); } } inline bool jj_2_97(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_97() || jj_done); { jj_save(96, xla); } } inline bool jj_2_98(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_98() || jj_done); { jj_save(97, xla); } } inline bool jj_2_99(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_99() || jj_done); { jj_save(98, xla); } } inline bool jj_2_100(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_100() || jj_done); { jj_save(99, xla); } } inline bool jj_2_101(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_101() || jj_done); { jj_save(100, xla); } } inline bool jj_2_102(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_102() || jj_done); { jj_save(101, xla); } } inline bool jj_2_103(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_103() || jj_done); { jj_save(102, xla); } } inline bool jj_2_104(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_104() || jj_done); { jj_save(103, xla); } } inline bool jj_2_105(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_105() || jj_done); { jj_save(104, xla); } } inline bool jj_2_106(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_106() || jj_done); { jj_save(105, xla); } } inline bool jj_2_107(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_107() || jj_done); { jj_save(106, xla); } } inline bool jj_2_108(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_108() || jj_done); { jj_save(107, xla); } } inline bool jj_2_109(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_109() || jj_done); { jj_save(108, xla); } } inline bool jj_2_110(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_110() || jj_done); { jj_save(109, xla); } } inline bool jj_2_111(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_111() || jj_done); { jj_save(110, xla); } } inline bool jj_2_112(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_112() || jj_done); { jj_save(111, xla); } } inline bool jj_2_113(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_113() || jj_done); { jj_save(112, xla); } } inline bool jj_2_114(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_114() || jj_done); { jj_save(113, xla); } } inline bool jj_2_115(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_115() || jj_done); { jj_save(114, xla); } } inline bool jj_2_116(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_116() || jj_done); { jj_save(115, xla); } } inline bool jj_2_117(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_117() || jj_done); { jj_save(116, xla); } } inline bool jj_2_118(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_118() || jj_done); { jj_save(117, xla); } } inline bool jj_2_119(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_119() || jj_done); { jj_save(118, xla); } } inline bool jj_2_120(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_120() || jj_done); { jj_save(119, xla); } } inline bool jj_2_121(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_121() || jj_done); { jj_save(120, xla); } } inline bool jj_2_122(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_122() || jj_done); { jj_save(121, xla); } } inline bool jj_2_123(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_123() || jj_done); { jj_save(122, xla); } } inline bool jj_2_124(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_124() || jj_done); { jj_save(123, xla); } } inline bool jj_2_125(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_125() || jj_done); { jj_save(124, xla); } } inline bool jj_2_126(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_126() || jj_done); { jj_save(125, xla); } } inline bool jj_2_127(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_127() || jj_done); { jj_save(126, xla); } } inline bool jj_2_128(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_128() || jj_done); { jj_save(127, xla); } } inline bool jj_2_129(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_129() || jj_done); { jj_save(128, xla); } } inline bool jj_2_130(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_130() || jj_done); { jj_save(129, xla); } } inline bool jj_2_131(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_131() || jj_done); { jj_save(130, xla); } } inline bool jj_2_132(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_132() || jj_done); { jj_save(131, xla); } } inline bool jj_2_133(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_133() || jj_done); { jj_save(132, xla); } } inline bool jj_2_134(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_134() || jj_done); { jj_save(133, xla); } } inline bool jj_2_135(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_135() || jj_done); { jj_save(134, xla); } } inline bool jj_2_136(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_136() || jj_done); { jj_save(135, xla); } } inline bool jj_2_137(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_137() || jj_done); { jj_save(136, xla); } } inline bool jj_2_138(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_138() || jj_done); { jj_save(137, xla); } } inline bool jj_2_139(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_139() || jj_done); { jj_save(138, xla); } } inline bool jj_2_140(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_140() || jj_done); { jj_save(139, xla); } } inline bool jj_2_141(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_141() || jj_done); { jj_save(140, xla); } } inline bool jj_2_142(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_142() || jj_done); { jj_save(141, xla); } } inline bool jj_2_143(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_143() || jj_done); { jj_save(142, xla); } } inline bool jj_2_144(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_144() || jj_done); { jj_save(143, xla); } } inline bool jj_2_145(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_145() || jj_done); { jj_save(144, xla); } } inline bool jj_2_146(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_146() || jj_done); { jj_save(145, xla); } } inline bool jj_2_147(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_147() || jj_done); { jj_save(146, xla); } } inline bool jj_2_148(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_148() || jj_done); { jj_save(147, xla); } } inline bool jj_2_149(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_149() || jj_done); { jj_save(148, xla); } } inline bool jj_2_150(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_150() || jj_done); { jj_save(149, xla); } } inline bool jj_2_151(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_151() || jj_done); { jj_save(150, xla); } } inline bool jj_2_152(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_152() || jj_done); { jj_save(151, xla); } } inline bool jj_2_153(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_153() || jj_done); { jj_save(152, xla); } } inline bool jj_2_154(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_154() || jj_done); { jj_save(153, xla); } } inline bool jj_2_155(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_155() || jj_done); { jj_save(154, xla); } } inline bool jj_2_156(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_156() || jj_done); { jj_save(155, xla); } } inline bool jj_2_157(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_157() || jj_done); { jj_save(156, xla); } } inline bool jj_2_158(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_158() || jj_done); { jj_save(157, xla); } } inline bool jj_2_159(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_159() || jj_done); { jj_save(158, xla); } } inline bool jj_2_160(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_160() || jj_done); { jj_save(159, xla); } } inline bool jj_2_161(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_161() || jj_done); { jj_save(160, xla); } } inline bool jj_2_162(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_162() || jj_done); { jj_save(161, xla); } } inline bool jj_2_163(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_163() || jj_done); { jj_save(162, xla); } } inline bool jj_2_164(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_164() || jj_done); { jj_save(163, xla); } } inline bool jj_2_165(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_165() || jj_done); { jj_save(164, xla); } } inline bool jj_2_166(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_166() || jj_done); { jj_save(165, xla); } } inline bool jj_2_167(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_167() || jj_done); { jj_save(166, xla); } } inline bool jj_2_168(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; jj_done = false; return (!jj_3_168() || jj_done); { jj_save(167, xla); } } inline bool jj_3R_simple_expression_3063_3_199() { if (jj_done) return true; if (jj_3R_sign_2996_2_378()) return true; return false; } inline bool jj_3R_simple_expression_3063_1_85() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_simple_expression_3063_3_199()) jj_scanpos = xsp; if (jj_3R_simpleTerm_3246_2_169()) return true; while (true) { xsp = jj_scanpos; if (jj_3R_simple_expression_3063_41_200()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_signature_3056_4_568() { if (jj_done) return true; if (jj_scan_token(RETURN_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_signature_3055_4_567() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_signature_3055_15_674()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_signature_3054_1_472() { if (jj_done) return true; if (jj_scan_token(LBRACKET_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_signature_3055_4_567()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_signature_3056_4_568()) jj_scanpos = xsp; if (jj_scan_token(RBRACKET_T)) return true; return false; } inline bool jj_3R_signal_list_3039_12_783() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_file_declaration_1443_67_522() { if (jj_done) return true; if (jj_3R_file_open_information_1459_2_639()) return true; return false; } inline bool jj_3R_signal_list_3041_3_723() { if (jj_done) return true; if (jj_scan_token(ALL_T)) return true; return false; } inline bool jj_3R_signal_list_3040_3_722() { if (jj_done) return true; if (jj_scan_token(OTHER_T)) return true; return false; } inline bool jj_3R_formal_part_1496_11_191() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_formal_designator_1484_5_374()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_signal_list_3039_2_721() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_signal_list_3039_12_783()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_signal_list_3039_2_644() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_signal_list_3039_2_721()) { jj_scanpos = xsp; if (jj_3R_signal_list_3040_3_722()) { jj_scanpos = xsp; if (jj_3R_signal_list_3041_3_723()) return true; } } return false; } inline bool jj_3R_signal_kind_3034_5_695() { if (jj_done) return true; if (jj_scan_token(BUS_T)) return true; return false; } inline bool jj_3R_full_type_declaration_1501_3_176() { if (jj_done) return true; if (jj_scan_token(TYPE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(IS_T)) return true; if (jj_3R_type_definition_3271_1_691()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_signal_kind_3033_3_694() { if (jj_done) return true; if (jj_scan_token(REGISTER_T)) return true; return false; } inline bool jj_3R_signal_kind_3033_3_638() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_signal_kind_3033_3_694()) { jj_scanpos = xsp; if (jj_3R_signal_kind_3034_5_695()) return true; } return false; } inline bool jj_3R_file_open_information_1459_39_697() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(53)) { jj_scanpos = xsp; if (jj_scan_token(75)) return true; } return false; } inline bool jj_3R_formal_part_1496_1_76() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_formal_part_1496_11_191()) jj_scanpos = xsp; return false; } inline bool jj_3R_formal_parameter_list_1491_2_739() { if (jj_done) return true; if (jj_3R_interface_list_1836_3_377()) return true; return false; } inline bool jj_3R_formal_designator_1485_6_485() { if (jj_done) return true; if (jj_scan_token(INTEGER)) return true; return false; } inline bool jj_3R_formal_designator_1484_5_484() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_formal_designator_1484_5_374() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_formal_designator_1484_5_484()) { jj_scanpos = xsp; if (jj_3R_formal_designator_1485_6_485()) return true; } return false; } inline bool jj_3R_signal_declaration_3022_1_419() { if (jj_done) return true; if (jj_scan_token(SIGNAL_T)) return true; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_signal_declaration_3022_68_518()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_signal_declaration_3022_89_519()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_153() { if (jj_done) return true; if (jj_3R_selected_signal_assignment_wave_2849_3_167()) return true; return false; } inline bool jj_3_152() { if (jj_done) return true; if (jj_3R_conditional_signal_assignment_wave_926_3_166()) return true; return false; } inline bool jj_3R_signal_assignment_statement_3011_3_665() { if (jj_done) return true; if (jj_3R_delay_mechanism_1092_1_381()) return true; return false; } inline bool jj_3R_floating_incomplete_type_definition_1474_4_114() { if (jj_done) return true; if (jj_scan_token(RANGE_T)) return true; if (jj_scan_token(BOX_T)) return true; if (jj_scan_token(DOT_T)) return true; if (jj_scan_token(BOX_T)) return true; return false; } inline bool jj_3_151() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_signal_assignment_statement_3009_3_553() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_151()) jj_scanpos = xsp; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; xsp = jj_scanpos; if (jj_3R_signal_assignment_statement_3011_3_665()) jj_scanpos = xsp; if (jj_3R_waveform_3377_1_382()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_signal_assignment_statement_3006_3_552() { if (jj_done) return true; if (jj_3R_selected_signal_assignment_wave_2849_3_167()) return true; return false; } inline bool jj_3R_shift_expression_2982_26_474() { if (jj_done) return true; if (jj_3R_shift_operator_2986_3_577()) return true; if (jj_3R_simple_expression_3063_1_85()) return true; return false; } inline bool jj_3R_file_incomplete_type_definition_1469_2_790() { if (jj_done) return true; if (jj_scan_token(FILE_T)) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_type_mark_3291_3_195()) return true; return false; } inline bool jj_3R_signal_assignment_statement_3003_3_551() { if (jj_done) return true; if (jj_3R_conditional_signal_assignment_wave_926_3_166()) return true; return false; } inline bool jj_3R_signal_assignment_statement_3003_3_460() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_signal_assignment_statement_3003_3_551()) { jj_scanpos = xsp; if (jj_3R_signal_assignment_statement_3006_3_552()) { jj_scanpos = xsp; if (jj_3R_signal_assignment_statement_3009_3_553()) return true; } } return false; } inline bool jj_3R_file_type_definition_1464_2_801() { if (jj_done) return true; if (jj_scan_token(FILE_T)) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_type_mark_3291_3_195()) return true; return false; } inline bool jj_3R_sign_2997_4_489() { if (jj_done) return true; if (jj_scan_token(MINUS_T)) return true; return false; } inline bool jj_3R_file_open_information_1459_4_696() { if (jj_done) return true; if (jj_scan_token(OPEN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_sign_2996_2_488() { if (jj_done) return true; if (jj_scan_token(PLUS_T)) return true; return false; } inline bool jj_3R_sign_2996_2_378() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_sign_2996_2_488()) { jj_scanpos = xsp; if (jj_3R_sign_2997_4_489()) return true; } return false; } inline bool jj_3R_shift_operator_2991_5_680() { if (jj_done) return true; if (jj_scan_token(ROR_T)) return true; return false; } inline bool jj_3R_file_open_information_1459_2_639() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_file_open_information_1459_4_696()) jj_scanpos = xsp; if (jj_scan_token(IS_T)) return true; xsp = jj_scanpos; if (jj_3R_file_open_information_1459_39_697()) jj_scanpos = xsp; if (jj_3R_file_logical_name_1454_2_698()) return true; return false; } inline bool jj_3R_shift_operator_2990_5_679() { if (jj_done) return true; if (jj_scan_token(ROL_T)) return true; return false; } inline bool jj_3R_shift_operator_2989_5_678() { if (jj_done) return true; if (jj_scan_token(SRA_T)) return true; return false; } inline bool jj_3R_shift_operator_2988_5_677() { if (jj_done) return true; if (jj_scan_token(SLA_T)) return true; return false; } inline bool jj_3R_shift_operator_2987_5_676() { if (jj_done) return true; if (jj_scan_token(SRL_T)) return true; return false; } inline bool jj_3R_file_logical_name_1454_2_698() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_shift_operator_2986_3_675() { if (jj_done) return true; if (jj_scan_token(SLL_T)) return true; return false; } inline bool jj_3R_shift_operator_2986_3_577() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_shift_operator_2986_3_675()) { jj_scanpos = xsp; if (jj_3R_shift_operator_2987_5_676()) { jj_scanpos = xsp; if (jj_3R_shift_operator_2988_5_677()) { jj_scanpos = xsp; if (jj_3R_shift_operator_2989_5_678()) { jj_scanpos = xsp; if (jj_3R_shift_operator_2990_5_679()) { jj_scanpos = xsp; if (jj_3R_shift_operator_2991_5_680()) return true; } } } } } return false; } inline bool jj_3R_shift_expression_2982_2_365() { if (jj_done) return true; if (jj_3R_simple_expression_3063_1_85()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_shift_expression_2982_26_474()) jj_scanpos = xsp; return false; } inline bool jj_3R_factor_1433_14_566() { if (jj_done) return true; if (jj_scan_token(DOUBLEMULT_T)) return true; if (jj_3R_primary_2429_1_473()) return true; return false; } inline bool jj_3R_file_declaration_1443_2_421() { if (jj_done) return true; if (jj_scan_token(FILE_T)) return true; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_file_declaration_1443_67_522()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_sequential_statement_declarative_part_2974_3_854() { if (jj_done) return true; if (jj_3R_process_declarative_item_2507_1_513()) return true; return false; } inline bool jj_3R_sequential_statement_declarative_part_2974_2_843() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_sequential_statement_declarative_part_2974_3_854()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_factor_1437_3_364() { if (jj_done) return true; if (jj_3R_logop_1418_3_367()) return true; if (jj_3R_primary_2429_1_473()) return true; return false; } inline bool jj_3R_factor_1436_3_363() { if (jj_done) return true; if (jj_scan_token(QQ_T)) return true; if (jj_3R_primary_2429_1_473()) return true; return false; } inline bool jj_3R_factor_1435_3_362() { if (jj_done) return true; if (jj_scan_token(NOT_T)) return true; if (jj_3R_primary_2429_1_473()) return true; return false; } inline bool jj_3R_sequential_statement_body_2969_3_811() { if (jj_done) return true; if (jj_3R_sequential_statement_declarative_part_2974_2_843()) return true; if (jj_scan_token(BEGIN_T)) return true; return false; } inline bool jj_3R_factor_1434_3_361() { if (jj_done) return true; if (jj_scan_token(ABS_T)) return true; if (jj_3R_primary_2429_1_473()) return true; return false; } inline bool jj_3R_sequential_statement_body_2969_2_797() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_sequential_statement_body_2969_3_811()) jj_scanpos = xsp; if (jj_3R_sequence_of_statements_2902_2_334()) return true; return false; } inline bool jj_3R_factor_1433_1_175() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_factor_1433_1_360()) { jj_scanpos = xsp; if (jj_3R_factor_1434_3_361()) { jj_scanpos = xsp; if (jj_3R_factor_1435_3_362()) { jj_scanpos = xsp; if (jj_3R_factor_1436_3_363()) { jj_scanpos = xsp; if (jj_3R_factor_1437_3_364()) return true; } } } } return false; } inline bool jj_3R_factor_1433_1_360() { if (jj_done) return true; if (jj_3R_primary_2429_1_473()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_factor_1433_14_566()) jj_scanpos = xsp; return false; } inline bool jj_3R_sequential_bock_statement_2952_16_163() { if (jj_done) return true; if (jj_3R_label_2022_2_84()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_sequential_block_statement_part_2964_3_344() { if (jj_done) return true; if (jj_3R_sequential_statement_2907_5_148()) return true; return false; } inline bool jj_3R_sequential_block_statement_part_2964_2_164() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_sequential_block_statement_part_2964_3_344()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_logop_1423_4_481() { if (jj_done) return true; if (jj_scan_token(OR_T)) return true; return false; } inline bool jj_3R_logop_1422_4_480() { if (jj_done) return true; if (jj_scan_token(XOR_T)) return true; return false; } inline bool jj_3R_sequential_block_declarative_part_2959_2_469() { if (jj_done) return true; if (jj_3R_process_declarative_part_2532_2_236()) return true; return false; } inline bool jj_3R_logop_1421_4_479() { if (jj_done) return true; if (jj_scan_token(XNOR_T)) return true; return false; } inline bool jj_3R_logop_1420_4_478() { if (jj_done) return true; if (jj_scan_token(NOR_T)) return true; return false; } inline bool jj_3R_logop_1419_4_477() { if (jj_done) return true; if (jj_scan_token(NAND_T)) return true; return false; } inline bool jj_3R_sequential_bock_statement_2954_4_468() { if (jj_done) return true; if (jj_3R_label_2022_2_84()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_logop_1418_3_476() { if (jj_done) return true; if (jj_scan_token(AND_T)) return true; return false; } inline bool jj_3R_logop_1418_3_367() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_logop_1418_3_476()) { jj_scanpos = xsp; if (jj_3R_logop_1419_4_477()) { jj_scanpos = xsp; if (jj_3R_logop_1420_4_478()) { jj_scanpos = xsp; if (jj_3R_logop_1421_4_479()) { jj_scanpos = xsp; if (jj_3R_logop_1422_4_480()) { jj_scanpos = xsp; if (jj_3R_logop_1423_4_481()) return true; } } } } } return false; } inline bool jj_3R_sequential_bock_statement_2954_2_343() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_sequential_bock_statement_2954_4_468()) jj_scanpos = xsp; if (jj_scan_token(BLOCK_T)) return true; xsp = jj_scanpos; if (jj_scan_token(56)) jj_scanpos = xsp; if (jj_3R_sequential_block_declarative_part_2959_2_469()) return true; if (jj_scan_token(BEGIN_T)) return true; if (jj_3R_sequential_block_statement_part_2964_2_164()) return true; if (jj_scan_token(END_T)) return true; xsp = jj_scanpos; if (jj_scan_token(24)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_sequential_bock_statement_2954_159_795()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_sequential_bock_statement_2952_1_162() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_150()) { jj_scanpos = xsp; if (jj_3R_sequential_bock_statement_2954_2_343()) return true; } return false; } inline bool jj_3_150() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_sequential_bock_statement_2952_16_163()) jj_scanpos = xsp; if (jj_scan_token(BLOCK_T)) return true; xsp = jj_scanpos; if (jj_scan_token(56)) jj_scanpos = xsp; if (jj_scan_token(BEGIN_T)) return true; if (jj_3R_sequential_block_statement_part_2964_2_164()) return true; if (jj_scan_token(END_T)) return true; xsp = jj_scanpos; if (jj_scan_token(24)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_sequential_bock_statement_2952_124_165()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_sig_stat_1412_5_592() { if (jj_done) return true; if (jj_scan_token(VARIABLE_T)) return true; return false; } inline bool jj_3R_sig_stat_1411_5_591() { if (jj_done) return true; if (jj_scan_token(SIGNAL_T)) return true; return false; } inline bool jj_3_135() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(WHEN_T)) return true; return false; } inline bool jj_3R_sequential_statement_2946_5_321() { if (jj_done) return true; if (jj_3R_null_statement_2209_1_462()) return true; return false; } inline bool jj_3R_expression_1380_35_180() { if (jj_done) return true; if (jj_3R_logop_1418_3_367()) return true; if (jj_3R_relation_2723_3_179()) return true; return false; } inline bool jj_3R_sig_stat_1410_3_590() { if (jj_done) return true; if (jj_scan_token(CONSTANT_T)) return true; return false; } inline bool jj_3R_sig_stat_1410_3_482() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_sig_stat_1410_3_590()) { jj_scanpos = xsp; if (jj_3R_sig_stat_1411_5_591()) { jj_scanpos = xsp; if (jj_3R_sig_stat_1412_5_592()) return true; } } return false; } inline bool jj_3_149() { if (jj_done) return true; if (jj_3R_sequential_bock_statement_2952_1_162()) return true; return false; } inline bool jj_3_148() { if (jj_done) return true; if (jj_3R_return_statement_2776_5_161()) return true; return false; } inline bool jj_3R_exit_statement_1366_43_339() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3_147() { if (jj_done) return true; if (jj_3R_exit_statement_1366_1_160()) return true; return false; } inline bool jj_3R_sel_var_list_2883_58_459() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_choices_775_3_106()) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(136)) { jj_scanpos = xsp; if (jj_scan_token(139)) return true; } return false; } inline bool jj_3_146() { if (jj_done) return true; if (jj_3R_next_statement_2196_1_159()) return true; return false; } inline bool jj_3R_null_2919_19_154() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_external_name_1400_2_371() { if (jj_done) return true; if (jj_scan_token(SLSL_T)) return true; if (jj_3R_sig_stat_1410_3_482()) return true; if (jj_3R_external_pathname_1393_4_483()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; if (jj_scan_token(RSRS_T)) return true; return false; } inline bool jj_3_145() { if (jj_done) return true; if (jj_3R_loop_statement_2072_1_158()) return true; return false; } inline bool jj_3_141() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_null_2919_19_154()) jj_scanpos = xsp; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(VARASSIGN_T)) return true; return false; } inline bool jj_3R_expression_1380_20_70() { if (jj_done) return true; if (jj_3R_relation_2723_3_179()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_expression_1380_35_180()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_external_pathname_1395_4_595() { if (jj_done) return true; if (jj_3R_package_path_name_2384_3_683()) return true; return false; } inline bool jj_3_144() { if (jj_done) return true; if (jj_3R_case_statement_712_1_157()) return true; return false; } inline bool jj_3R_external_pathname_1394_4_594() { if (jj_done) return true; if (jj_3R_relative_pathname_2728_3_682()) return true; return false; } inline bool jj_3R_enumeration_type_definition_1360_38_316() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_enumeration_literal_1354_2_126()) return true; return false; } inline bool jj_3R_sel_wave_list_2889_43_673() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_sel_wave_list_2889_4_565()) return true; return false; } inline bool jj_3R_external_pathname_1393_4_593() { if (jj_done) return true; if (jj_3R_absolute_pathname_329_2_681()) return true; return false; } inline bool jj_3R_external_pathname_1393_4_483() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_external_pathname_1393_4_593()) { jj_scanpos = xsp; if (jj_3R_external_pathname_1394_4_594()) { jj_scanpos = xsp; if (jj_3R_external_pathname_1395_4_595()) return true; } } return false; } inline bool jj_3_143() { if (jj_done) return true; if (jj_3R_if_statement_1668_3_156()) return true; return false; } inline bool jj_3R_selected_force_assignment_2878_53_317() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(53)) { jj_scanpos = xsp; if (jj_scan_token(75)) return true; } return false; } inline bool jj_3R_expression_or_unaffected_1388_6_745() { if (jj_done) return true; if (jj_scan_token(UNAFFECTED_T)) return true; return false; } inline bool jj_3_142() { if (jj_done) return true; if (jj_3R_procedure_call_statement_2493_1_155()) return true; return false; } inline bool jj_3R_expression_or_unaffected_1387_4_744() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_expression_or_unaffected_1387_4_668() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_expression_or_unaffected_1387_4_744()) { jj_scanpos = xsp; if (jj_3R_expression_or_unaffected_1388_6_745()) return true; } return false; } inline bool jj_3R_null_2907_18_149() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_sequential_statement_2919_5_320() { if (jj_done) return true; if (jj_3R_variable_assignment_statement_3329_1_461()) return true; return false; } inline bool jj_3_137() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_null_2907_18_149()) jj_scanpos = xsp; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; return false; } inline bool jj_3_140() { if (jj_done) return true; if (jj_3R_wait_statement_3368_1_153()) return true; return false; } inline bool jj_3_139() { if (jj_done) return true; if (jj_3R_report_statement_2756_1_152()) return true; return false; } inline bool jj_3_138() { if (jj_done) return true; if (jj_3R_assertion_statement_539_3_151()) return true; return false; } inline bool jj_3R_sequential_statement_2907_5_148() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_sequential_statement_2907_5_319()) { jj_scanpos = xsp; if (jj_3_138()) { jj_scanpos = xsp; if (jj_3_139()) { jj_scanpos = xsp; if (jj_3_140()) { jj_scanpos = xsp; if (jj_3R_sequential_statement_2919_5_320()) { jj_scanpos = xsp; if (jj_3_142()) { jj_scanpos = xsp; if (jj_3_143()) { jj_scanpos = xsp; if (jj_3_144()) { jj_scanpos = xsp; if (jj_3_145()) { jj_scanpos = xsp; if (jj_3_146()) { jj_scanpos = xsp; if (jj_3_147()) { jj_scanpos = xsp; if (jj_3_148()) { jj_scanpos = xsp; if (jj_3_149()) { jj_scanpos = xsp; if (jj_3R_sequential_statement_2946_5_321()) return true; } } } } } } } } } } } } } return false; } inline bool jj_3R_sequential_statement_2907_5_319() { if (jj_done) return true; if (jj_3R_signal_assignment_statement_3003_3_460()) return true; return false; } inline bool jj_3R_sensitivity_list_2897_12_622() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3_136() { if (jj_done) return true; if (jj_3R_sequential_statement_2907_5_148()) return true; return false; } inline bool jj_3R_exit_statement_1367_3_340() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; return false; } inline bool jj_3R_exit_statement_1366_3_338() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_sequence_of_statements_2902_2_334() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3_136()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_exit_statement_1366_1_160() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_exit_statement_1366_3_338()) jj_scanpos = xsp; if (jj_scan_token(EXIT_T)) return true; xsp = jj_scanpos; if (jj_3R_exit_statement_1366_43_339()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_exit_statement_1367_3_340()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_sensitivity_list_2897_2_512() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_sensitivity_list_2897_12_622()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_sensitivity_list_2895_3_511() { if (jj_done) return true; if (jj_scan_token(ALL_T)) return true; return false; } inline bool jj_3R_enumeration_type_definition_1360_3_146() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_enumeration_literal_1354_2_126()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_enumeration_type_definition_1360_38_316()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_sensitivity_list_2895_3_412() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_sensitivity_list_2895_3_511()) { jj_scanpos = xsp; if (jj_3R_sensitivity_list_2897_2_512()) return true; } return false; } inline bool jj_3R_enumeration_literal_1355_4_280() { if (jj_done) return true; if (jj_3R_character_literal_754_3_445()) return true; return false; } inline bool jj_3R_sel_wave_list_2889_4_565() { if (jj_done) return true; if (jj_3R_waveform_element_3385_2_562()) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_choices_775_3_106()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_sel_wave_list_2889_43_673()) { jj_scanpos = xsp; break; } } if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_enumeration_literal_1354_2_126() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_enumeration_literal_1354_2_279()) { jj_scanpos = xsp; if (jj_3R_enumeration_literal_1355_4_280()) return true; } return false; } inline bool jj_3R_enumeration_literal_1354_2_279() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_selected_waveform_assignment_2872_17_564() { if (jj_done) return true; if (jj_3R_delay_mechanism_1092_1_381()) return true; return false; } inline bool jj_3R_entity_tag_1349_3_824() { if (jj_done) return true; if (jj_3R_character_literal_754_3_445()) return true; return false; } inline bool jj_3R_sel_var_list_2883_3_318() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_choices_775_3_106()) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(136)) { jj_scanpos = xsp; if (jj_scan_token(139)) return true; } while (true) { xsp = jj_scanpos; if (jj_3R_sel_var_list_2883_58_459()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_entity_tag_1348_1_823() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_entity_tag_1348_1_805() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_entity_tag_1348_1_823()) { jj_scanpos = xsp; if (jj_3R_entity_tag_1349_3_824()) return true; } return false; } inline bool jj_3R_entity_name_list_1317_28_782() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_entity_designator_1306_1_781()) return true; return false; } inline bool jj_3_57() { if (jj_done) return true; if (jj_3R_process_statement_2537_1_112()) return true; return false; } inline bool jj_3R_selected_force_assignment_2877_3_147() { if (jj_done) return true; if (jj_scan_token(WITH_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(SELECT_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(158)) jj_scanpos = xsp; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; if (jj_scan_token(FORCE_T)) return true; xsp = jj_scanpos; if (jj_3R_selected_force_assignment_2878_53_317()) jj_scanpos = xsp; if (jj_3R_sel_var_list_2883_3_318()) return true; return false; } inline bool jj_3_56() { if (jj_done) return true; if (jj_3R_concurrent_assertion_statement_831_1_111()) return true; return false; } inline bool jj_3_134() { if (jj_done) return true; if (jj_3R_aggregate_400_3_141()) return true; return false; } inline bool jj_3R_selected_waveform_assignment_2870_3_471() { if (jj_done) return true; if (jj_scan_token(WITH_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(SELECT_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(158)) jj_scanpos = xsp; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; xsp = jj_scanpos; if (jj_3R_selected_waveform_assignment_2872_17_564()) jj_scanpos = xsp; if (jj_3R_sel_wave_list_2889_4_565()) return true; return false; } inline bool jj_3R_select_name_2865_3_842() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_selected_waveforms_2835_32_385() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_waveform_3377_1_382()) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_choices_775_3_106()) return true; return false; } inline bool jj_3R_select_name_2863_3_841() { if (jj_done) return true; if (jj_3R_aggregate_400_3_141()) return true; return false; } inline bool jj_3R_select_name_2863_3_810() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_select_name_2863_3_841()) { jj_scanpos = xsp; if (jj_3R_select_name_2865_3_842()) return true; } return false; } inline bool jj_3R_entity_specification_1326_1_530() { if (jj_done) return true; if (jj_3R_entity_name_list_1317_1_642()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_entity_class_1219_1_643()) return true; return false; } inline bool jj_3_133() { if (jj_done) return true; if (jj_3R_selected_force_assignment_2877_3_147()) return true; return false; } inline bool jj_3R_entity_designator_1306_18_806() { if (jj_done) return true; if (jj_3R_signature_3054_1_472()) return true; return false; } inline bool jj_3R_selected_variable_assignment_2856_3_666() { if (jj_done) return true; if (jj_scan_token(WITH_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(SELECT_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(158)) jj_scanpos = xsp; if (jj_3R_select_name_2863_3_810()) return true; if (jj_scan_token(VARASSIGN_T)) return true; if (jj_3R_sel_var_list_2883_3_318()) return true; return false; } inline bool jj_3R_entity_name_list_1319_3_703() { if (jj_done) return true; if (jj_scan_token(ALL_T)) return true; return false; } inline bool jj_3R_entity_name_list_1318_3_702() { if (jj_done) return true; if (jj_scan_token(OTHER_T)) return true; return false; } inline bool jj_3R_selected_signal_assignment_wave_2851_3_348() { if (jj_done) return true; if (jj_3R_selected_waveform_assignment_2870_3_471()) return true; return false; } inline bool jj_3R_entity_name_list_1317_1_701() { if (jj_done) return true; if (jj_3R_entity_designator_1306_1_781()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_entity_name_list_1317_28_782()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_entity_name_list_1317_1_642() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_entity_name_list_1317_1_701()) { jj_scanpos = xsp; if (jj_3R_entity_name_list_1318_3_702()) { jj_scanpos = xsp; if (jj_3R_entity_name_list_1319_3_703()) return true; } } return false; } inline bool jj_3R_selected_signal_assignment_wave_2849_3_167() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_selected_signal_assignment_wave_2849_3_347()) { jj_scanpos = xsp; if (jj_3R_selected_signal_assignment_wave_2851_3_348()) return true; } return false; } inline bool jj_3R_selected_signal_assignment_wave_2849_3_347() { if (jj_done) return true; if (jj_3R_selected_force_assignment_2877_3_147()) return true; return false; } inline bool jj_3R_entity_designator_1306_1_781() { if (jj_done) return true; if (jj_3R_entity_tag_1348_1_805()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_entity_designator_1306_18_806()) jj_scanpos = xsp; return false; } inline bool jj_3R_sensitivity_clause_2840_2_463() { if (jj_done) return true; if (jj_scan_token(ON_T)) return true; if (jj_3R_sensitivity_list_2895_3_412()) return true; return false; } inline bool jj_3R_selected_waveforms_2835_2_209() { if (jj_done) return true; if (jj_3R_waveform_3377_1_382()) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_choices_775_3_106()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_selected_waveforms_2835_32_385()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3_55() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3_53() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3R_selected_name_2823_2_508() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(DOT_T)) return true; if (jj_3R_suffix_3230_1_130()) return true; return false; } inline bool jj_3_54() { if (jj_done) return true; if (jj_3R_group_template_declaration_1644_2_80()) return true; return false; } inline bool jj_3R_plain_return_statement_2782_42_315() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; return false; } inline bool jj_3R_scalar_type_definition_2796_26_844() { if (jj_done) return true; if (jj_3R_physical_type_definition_2394_9_855()) return true; return false; } inline bool jj_3R_entity_class_entry_list_1245_39_646() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_entity_class_entry_1240_2_645()) return true; return false; } inline bool jj_3_52() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3R_secondary_unit_declaration_2813_1_888() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(EQU_T)) return true; if (jj_3R_physical_literal_2389_2_133()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_51() { if (jj_done) return true; if (jj_3R_package_body_2242_1_77()) return true; return false; } inline bool jj_3_50() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3_132() { if (jj_done) return true; if (jj_3R_enumeration_type_definition_1360_3_146()) return true; return false; } inline bool jj_3R_scalar_type_definition_2796_3_813() { if (jj_done) return true; if (jj_3R_range_constraint_2678_1_103()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_scalar_type_definition_2796_26_844()) jj_scanpos = xsp; return false; } inline bool jj_3R_entity_class_entry_1240_21_724() { if (jj_done) return true; if (jj_scan_token(BOX_T)) return true; return false; } inline bool jj_3R_scalar_type_definition_2794_1_812() { if (jj_done) return true; if (jj_3R_enumeration_type_definition_1360_3_146()) return true; return false; } inline bool jj_3R_scalar_type_definition_2794_1_798() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_scalar_type_definition_2794_1_812()) { jj_scanpos = xsp; if (jj_3R_scalar_type_definition_2796_3_813()) return true; } return false; } inline bool jj_3R_entity_declaration_1251_5_442() { if (jj_done) return true; if (jj_scan_token(ENTITY_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3_131() { if (jj_done) return true; if (jj_3R_plain_return_statement_2782_1_145()) return true; return false; } inline bool jj_3R_value_return_statement_2787_3_559() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_value_return_statement_2787_1_467() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_value_return_statement_2787_3_559()) jj_scanpos = xsp; if (jj_scan_token(RETURN_T)) return true; if (jj_3R_conditional_or_unaffected_expression_965_2_560()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_plain_return_statement_2782_3_314() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_return_statement_2777_7_342() { if (jj_done) return true; if (jj_3R_value_return_statement_2787_1_467()) return true; return false; } inline bool jj_3R_plain_return_statement_2782_1_145() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_plain_return_statement_2782_3_314()) jj_scanpos = xsp; if (jj_scan_token(RETURN_T)) return true; xsp = jj_scanpos; if (jj_3R_plain_return_statement_2782_42_315()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_entity_class_entry_list_1245_2_533() { if (jj_done) return true; if (jj_3R_entity_class_entry_1240_2_645()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_entity_class_entry_list_1245_39_646()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_return_statement_2776_5_161() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_return_statement_2776_5_341()) { jj_scanpos = xsp; if (jj_3R_return_statement_2777_7_342()) return true; } return false; } inline bool jj_3R_return_statement_2776_5_341() { if (jj_done) return true; if (jj_3R_plain_return_statement_2782_1_145()) return true; return false; } inline bool jj_3R_entity_class_entry_1240_2_645() { if (jj_done) return true; if (jj_3R_entity_class_1219_1_643()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_entity_class_entry_1240_21_724()) jj_scanpos = xsp; return false; } inline bool jj_3R_resolution_indication_2770_5_409() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_entity_aspect_1212_27_755() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_entity_class_1235_3_720() { if (jj_done) return true; if (jj_scan_token(FILE_T)) return true; return false; } inline bool jj_3R_resolution_indication_2769_4_232() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_resolution_indication_2769_4_408()) { jj_scanpos = xsp; if (jj_3R_resolution_indication_2770_5_409()) return true; } return false; } inline bool jj_3R_resolution_indication_2769_4_408() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_entity_class_1234_3_719() { if (jj_done) return true; if (jj_scan_token(GROUP_T)) return true; return false; } inline bool jj_3R_entity_class_1233_3_718() { if (jj_done) return true; if (jj_scan_token(UNITS_T)) return true; return false; } inline bool jj_3R_entity_class_1232_3_717() { if (jj_done) return true; if (jj_scan_token(LITERAL_T)) return true; return false; } inline bool jj_3R_entity_class_1231_3_716() { if (jj_done) return true; if (jj_scan_token(LABEL_T)) return true; return false; } inline bool jj_3R_report_statement_2758_11_326() { if (jj_done) return true; if (jj_scan_token(SEVERITY_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_entity_class_1230_3_715() { if (jj_done) return true; if (jj_scan_token(COMPONENT_T)) return true; return false; } inline bool jj_3R_entity_class_1229_3_714() { if (jj_done) return true; if (jj_scan_token(VARIABLE_T)) return true; return false; } inline bool jj_3R_entity_class_1228_3_713() { if (jj_done) return true; if (jj_scan_token(SIGNAL_T)) return true; return false; } inline bool jj_3R_entity_class_1227_3_712() { if (jj_done) return true; if (jj_scan_token(CONSTANT_T)) return true; return false; } inline bool jj_3R_entity_class_1226_3_711() { if (jj_done) return true; if (jj_scan_token(SUBTYPE_T)) return true; return false; } inline bool jj_3R_entity_class_1225_3_710() { if (jj_done) return true; if (jj_scan_token(TYPE_T)) return true; return false; } inline bool jj_3R_entity_class_1224_3_709() { if (jj_done) return true; if (jj_scan_token(PACKAGE_T)) return true; return false; } inline bool jj_3R_entity_class_1223_3_708() { if (jj_done) return true; if (jj_scan_token(FUNCTION_T)) return true; return false; } inline bool jj_3R_entity_class_1222_3_707() { if (jj_done) return true; if (jj_scan_token(PROCEDURE_T)) return true; return false; } inline bool jj_3R_entity_class_1221_3_706() { if (jj_done) return true; if (jj_scan_token(CONFIGURATION_T)) return true; return false; } inline bool jj_3R_report_statement_2756_3_325() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_entity_class_1220_3_705() { if (jj_done) return true; if (jj_scan_token(ARCHITECTURE_T)) return true; return false; } inline bool jj_3R_report_statement_2756_1_152() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_report_statement_2756_3_325()) jj_scanpos = xsp; if (jj_scan_token(REPORT_T)) return true; if (jj_3R_expression_1380_20_70()) return true; xsp = jj_scanpos; if (jj_3R_report_statement_2758_11_326()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_130() { if (jj_done) return true; if (jj_3R_pathname_element_list_2378_3_69()) return true; return false; } inline bool jj_3R_entity_class_1219_1_704() { if (jj_done) return true; if (jj_scan_token(ENTITY_T)) return true; return false; } inline bool jj_3R_entity_class_1219_1_643() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_entity_class_1219_1_704()) { jj_scanpos = xsp; if (jj_3R_entity_class_1220_3_705()) { jj_scanpos = xsp; if (jj_3R_entity_class_1221_3_706()) { jj_scanpos = xsp; if (jj_3R_entity_class_1222_3_707()) { jj_scanpos = xsp; if (jj_3R_entity_class_1223_3_708()) { jj_scanpos = xsp; if (jj_3R_entity_class_1224_3_709()) { jj_scanpos = xsp; if (jj_3R_entity_class_1225_3_710()) { jj_scanpos = xsp; if (jj_3R_entity_class_1226_3_711()) { jj_scanpos = xsp; if (jj_3R_entity_class_1227_3_712()) { jj_scanpos = xsp; if (jj_3R_entity_class_1228_3_713()) { jj_scanpos = xsp; if (jj_3R_entity_class_1229_3_714()) { jj_scanpos = xsp; if (jj_3R_entity_class_1230_3_715()) { jj_scanpos = xsp; if (jj_3R_entity_class_1231_3_716()) { jj_scanpos = xsp; if (jj_3R_entity_class_1232_3_717()) { jj_scanpos = xsp; if (jj_3R_entity_class_1233_3_718()) { jj_scanpos = xsp; if (jj_3R_entity_class_1234_3_719()) { jj_scanpos = xsp; if (jj_3R_entity_class_1235_3_720()) return true; } } } } } } } } } } } } } } } } return false; } inline bool jj_3R_entity_aspect_1214_3_686() { if (jj_done) return true; if (jj_scan_token(OPEN_T)) return true; return false; } inline bool jj_3R_relation_operator_2749_3_589() { if (jj_done) return true; if (jj_scan_token(QNEQU_T)) return true; return false; } inline bool jj_3R_entity_aspect_1213_3_685() { if (jj_done) return true; if (jj_scan_token(CONFIGURATION_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_relation_operator_2748_3_588() { if (jj_done) return true; if (jj_scan_token(QEQU_T)) return true; return false; } inline bool jj_3R_relation_operator_2747_3_587() { if (jj_done) return true; if (jj_scan_token(QL_T)) return true; return false; } inline bool jj_3R_relation_operator_2746_3_586() { if (jj_done) return true; if (jj_scan_token(QG_T)) return true; return false; } inline bool jj_3R_entity_aspect_1212_1_684() { if (jj_done) return true; if (jj_scan_token(ENTITY_T)) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_entity_aspect_1212_27_755()) jj_scanpos = xsp; return false; } inline bool jj_3R_entity_aspect_1212_1_618() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_entity_aspect_1212_1_684()) { jj_scanpos = xsp; if (jj_3R_entity_aspect_1213_3_685()) { jj_scanpos = xsp; if (jj_3R_entity_aspect_1214_3_686()) return true; } } return false; } inline bool jj_3R_relation_operator_2745_3_585() { if (jj_done) return true; if (jj_scan_token(QLT_T)) return true; return false; } inline bool jj_3R_relation_2723_25_366() { if (jj_done) return true; if (jj_3R_relation_operator_2738_2_475()) return true; if (jj_3R_shift_expression_2982_2_365()) return true; return false; } inline bool jj_3R_relation_operator_2744_3_584() { if (jj_done) return true; if (jj_scan_token(QGT_T)) return true; return false; } inline bool jj_3R_relation_operator_2743_3_583() { if (jj_done) return true; if (jj_scan_token(NOTEQU_T)) return true; return false; } inline bool jj_3R_relative_pathname_2728_17_754() { if (jj_done) return true; if (jj_3R_pathname_element_list_2378_3_69()) return true; return false; } inline bool jj_3R_relation_operator_2742_3_582() { if (jj_done) return true; if (jj_scan_token(LESSTHAN_T)) return true; return false; } inline bool jj_3R_relation_operator_2741_3_581() { if (jj_done) return true; if (jj_scan_token(GREATERTHAN_T)) return true; return false; } inline bool jj_3R_relation_operator_2740_3_580() { if (jj_done) return true; if (jj_scan_token(EQU_T)) return true; return false; } inline bool jj_3R_element_record_mode_view_indication_1206_2_109() { if (jj_done) return true; if (jj_scan_token(VIEW_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_relation_operator_2739_3_579() { if (jj_done) return true; if (jj_scan_token(GT_T)) return true; return false; } inline bool jj_3R_element_mode_view_indication_1201_5_822() { if (jj_done) return true; if (jj_3R_element_array_mode_view_indication_1145_2_850()) return true; return false; } inline bool jj_3R_relation_operator_2738_2_578() { if (jj_done) return true; if (jj_scan_token(LT_T)) return true; return false; } inline bool jj_3R_relation_operator_2738_2_475() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_relation_operator_2738_2_578()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2739_3_579()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2740_3_580()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2741_3_581()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2742_3_582()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2743_3_583()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2744_3_584()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2745_3_585()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2746_3_586()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2747_3_587()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2748_3_588()) { jj_scanpos = xsp; if (jj_3R_relation_operator_2749_3_589()) return true; } } } } } } } } } } } return false; } inline bool jj_3R_element_mode_view_indication_1200_3_804() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_49()) { jj_scanpos = xsp; if (jj_3R_element_mode_view_indication_1201_5_822()) return true; } return false; } inline bool jj_3R_record_mode_view_indication_2717_21_791() { if (jj_done) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3_49() { if (jj_done) return true; if (jj_3R_element_record_mode_view_indication_1206_2_109()) return true; return false; } inline bool jj_3R_neg_list_2733_3_796() { if (jj_done) return true; if (jj_scan_token(NEG_T)) return true; if (jj_scan_token(DOT_T)) return true; return false; } inline bool jj_3_48() { if (jj_done) return true; if (jj_3R_array_element_resolution_487_3_108()) return true; return false; } inline bool jj_3R_element_mode_indication_1195_5_769() { if (jj_done) return true; if (jj_3R_element_mode_view_indication_1200_3_804()) return true; return false; } inline bool jj_3R_neg_list_2733_2_753() { if (jj_done) return true; Token * xsp; if (jj_3R_neg_list_2733_3_796()) return true; while (true) { xsp = jj_scanpos; if (jj_3R_neg_list_2733_3_796()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_element_mode_indication_1194_3_768() { if (jj_done) return true; if (jj_3R_mode_2101_1_428()) return true; return false; } inline bool jj_3R_element_mode_indication_1194_3_693() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_element_mode_indication_1194_3_768()) { jj_scanpos = xsp; if (jj_3R_element_mode_indication_1195_5_769()) return true; } return false; } inline bool jj_3R_relative_pathname_2728_3_682() { if (jj_done) return true; if (jj_3R_neg_list_2733_2_753()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_relative_pathname_2728_17_754()) jj_scanpos = xsp; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_relation_2723_3_179() { if (jj_done) return true; if (jj_3R_shift_expression_2982_2_365()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_relation_2723_25_366()) jj_scanpos = xsp; return false; } inline bool jj_3R_record_element_list_2702_20_767() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_record_mode_view_indication_2717_4_735() { if (jj_done) return true; if (jj_scan_token(VIEW_T)) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_record_mode_view_indication_2717_21_791()) jj_scanpos = xsp; return false; } inline bool jj_3R_record_type_definition_2686_21_859() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_record_element_list_2702_5_692() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_record_element_list_2702_20_767()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_element_declaration_1167_3_868() { if (jj_done) return true; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_record_element_constraint_2697_5_231() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_3R_element_constraint_1161_3_407()) return true; return false; } inline bool jj_3R_element_constraint_1162_4_510() { if (jj_done) return true; if (jj_3R_array_constraint_476_3_621()) return true; return false; } inline bool jj_3_47() { if (jj_done) return true; if (jj_3R_record_constraint_2691_6_107()) return true; return false; } inline bool jj_3R_element_constraint_1161_3_407() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_47()) { jj_scanpos = xsp; if (jj_3R_element_constraint_1162_4_510()) return true; } return false; } inline bool jj_3_46() { if (jj_done) return true; if (jj_3R_choices_775_3_106()) return true; if (jj_scan_token(ARROW_T)) return true; return false; } inline bool jj_3R_record_constraint_2691_6_107() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_record_element_constraint_2697_5_231()) return true; return false; } inline bool jj_3R_record_type_definition_2684_9_858() { if (jj_done) return true; if (jj_3R_element_declaration_1167_3_868()) return true; return false; } inline bool jj_3R_record_type_definition_2683_8_846() { if (jj_done) return true; if (jj_scan_token(RECORD_T)) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_record_type_definition_2684_9_858()) { jj_scanpos = xsp; break; } } if (jj_scan_token(END_T)) return true; if (jj_scan_token(RECORD_T)) return true; xsp = jj_scanpos; if (jj_3R_record_type_definition_2686_21_859()) jj_scanpos = xsp; return false; } inline bool jj_3R_element_association_1151_2_453() { if (jj_done) return true; if (jj_3R_choices_775_3_106()) return true; if (jj_scan_token(ARROW_T)) return true; return false; } inline bool jj_3_45() { if (jj_done) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_element_association_1151_1_305() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_element_association_1151_2_453()) jj_scanpos = xsp; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3_44() { if (jj_done) return true; if (jj_3R_range_2669_4_105()) return true; return false; } inline bool jj_3_128() { if (jj_done) return true; if (jj_3R_simple_expression_3063_1_85()) return true; if (jj_3R_direction_1115_1_86()) return true; if (jj_3R_simple_expression_3063_1_85()) return true; return false; } inline bool jj_3_129() { if (jj_done) return true; if (jj_3R_attribute_name_575_3_144()) return true; return false; } inline bool jj_3R_element_array_mode_view_indication_1145_2_850() { if (jj_done) return true; if (jj_scan_token(VIEW_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_range_constraint_2678_1_103() { if (jj_done) return true; if (jj_scan_token(RANGE_T)) return true; if (jj_3R_range_2669_4_105()) return true; return false; } inline bool jj_3R_discrete_range_1139_3_204() { if (jj_done) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3_126() { if (jj_done) return true; if (jj_3R_aggregate_400_3_141()) return true; return false; } inline bool jj_3R_discrete_range_1136_3_87() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_discrete_range_1136_3_203()) { jj_scanpos = xsp; if (jj_3R_discrete_range_1139_3_204()) return true; } return false; } inline bool jj_3R_discrete_range_1136_3_203() { if (jj_done) return true; if (jj_3R_range_2669_4_105()) return true; return false; } inline bool jj_3R_range_2672_2_228() { if (jj_done) return true; if (jj_3R_attribute_name_575_3_144()) return true; return false; } inline bool jj_3R_range_2669_4_105() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_range_2669_4_227()) { jj_scanpos = xsp; if (jj_3R_range_2672_2_228()) return true; } return false; } inline bool jj_3R_range_2669_4_227() { if (jj_done) return true; if (jj_3R_simple_expression_3063_1_85()) return true; if (jj_3R_direction_1115_1_86()) return true; if (jj_3R_simple_expression_3063_1_85()) return true; return false; } inline bool jj_3R_qualified_expression_2662_7_451() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_guarded_signal_specificatio_1131_2_531() { if (jj_done) return true; if (jj_3R_signal_list_3039_2_644()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_qualified_expression_2660_5_450() { if (jj_done) return true; if (jj_3R_aggregate_400_3_141()) return true; return false; } inline bool jj_3R_disconnection_specification_1126_1_425() { if (jj_done) return true; if (jj_scan_token(DISCONNECT_T)) return true; if (jj_3R_guarded_signal_specificatio_1131_2_531()) return true; if (jj_scan_token(AFTER_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_qualified_expression_2659_3_189() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(APOSTROPHE_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_qualified_expression_2660_5_450()) { jj_scanpos = xsp; if (jj_3R_qualified_expression_2662_7_451()) return true; } return false; } inline bool jj_3R_protected_type_header_2634_26_861() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; return false; } inline bool jj_3R_protected_type_declaration_2629_31_821() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_qualified_expression_2657_3_74() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_127()) { jj_scanpos = xsp; if (jj_3R_qualified_expression_2659_3_189()) return true; } return false; } inline bool jj_3_127() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(CHARACTER_LITERAL)) return true; if (jj_scan_token(LETTER_OR_DIGIT)) return true; if (jj_scan_token(APOSTROPHE_T)) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_discrete_incomplete_type_definition_1121_2_785() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_scan_token(BOX_T)) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_protected_type_declarative_part_2650_6_849() { if (jj_done) return true; if (jj_3R_protected_type_declarative_item_2639_5_862()) return true; return false; } inline bool jj_3R_protected_type_declarative_part_2650_5_820() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_protected_type_declarative_part_2650_6_849()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_direction_1116_3_202() { if (jj_done) return true; if (jj_scan_token(DOWNTO_T)) return true; return false; } inline bool jj_3_124() { if (jj_done) return true; if (jj_3R_subprogram_declaration_3108_1_142()) return true; return false; } inline bool jj_3R_protected_type_declarative_item_2644_7_887() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3R_direction_1115_1_86() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_direction_1115_1_201()) { jj_scanpos = xsp; if (jj_3R_direction_1116_3_202()) return true; } return false; } inline bool jj_3R_direction_1115_1_201() { if (jj_done) return true; if (jj_scan_token(TO_T)) return true; return false; } inline bool jj_3R_protected_type_declarative_item_2643_7_886() { if (jj_done) return true; if (jj_3R_private_variable_declaration_2471_3_890()) return true; return false; } inline bool jj_3R_protected_type_declarative_item_2642_7_885() { if (jj_done) return true; if (jj_3R_attribute_specification_580_3_423()) return true; return false; } inline bool jj_3R_designator_1110_4_737() { if (jj_done) return true; if (jj_3R_operator_symbol_2232_1_369()) return true; return false; } inline bool jj_3R_protected_type_declarative_item_2641_7_884() { if (jj_done) return true; if (jj_3R_subprogram_instantiation_declaration_3202_2_170()) return true; return false; } inline bool jj_3_125() { if (jj_done) return true; if (jj_3R_alias_declaration_405_2_143()) return true; return false; } inline bool jj_3R_designator_1109_2_736() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_designator_1109_2_659() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_designator_1109_2_736()) { jj_scanpos = xsp; if (jj_3R_designator_1110_4_737()) return true; } return false; } inline bool jj_3R_protected_type_declarative_item_2639_5_883() { if (jj_done) return true; if (jj_3R_subprogram_declaration_3108_1_142()) return true; return false; } inline bool jj_3R_protected_type_declarative_item_2639_5_862() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_protected_type_declarative_item_2639_5_883()) { jj_scanpos = xsp; if (jj_3_125()) { jj_scanpos = xsp; if (jj_3R_protected_type_declarative_item_2641_7_884()) { jj_scanpos = xsp; if (jj_3R_protected_type_declarative_item_2642_7_885()) { jj_scanpos = xsp; if (jj_3R_protected_type_declarative_item_2643_7_886()) { jj_scanpos = xsp; if (jj_3R_protected_type_declarative_item_2644_7_887()) return true; } } } } } return false; } inline bool jj_3_43() { if (jj_done) return true; if (jj_3R_context_clause_1046_3_104()) return true; return false; } inline bool jj_3R_protected_type_header_2634_7_848() { if (jj_done) return true; if (jj_3R_generic_clause_1610_2_81()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_protected_type_header_2634_26_861()) jj_scanpos = xsp; return false; } inline bool jj_3R_protected_type_header_2634_5_819() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_protected_type_header_2634_7_848()) jj_scanpos = xsp; return false; } inline bool jj_3R_constant_declaration_1026_74_517() { if (jj_done) return true; if (jj_scan_token(VARASSIGN_T)) return true; if (jj_3R_conditional_expression_960_3_137()) return true; return false; } inline bool jj_3R_context_ref_1068_31_509() { if (jj_done) return true; if (jj_scan_token(DOT_T)) return true; return false; } inline bool jj_3R_conditional_or_unaffected_expression_965_133_670() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; return false; } inline bool jj_3R_delay_mechanism_1093_5_615() { if (jj_done) return true; if (jj_scan_token(REJECT_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_delay_mechanism_1093_3_493() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_delay_mechanism_1093_5_615()) jj_scanpos = xsp; if (jj_scan_token(INERTIAL_T)) return true; return false; } inline bool jj_3R_protected_type_declaration_2624_4_803() { if (jj_done) return true; if (jj_scan_token(PROTECTED_T)) return true; if (jj_3R_protected_type_header_2634_5_819()) return true; if (jj_3R_protected_type_declarative_part_2650_5_820()) return true; if (jj_scan_token(END_T)) return true; if (jj_scan_token(PROTECTED_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_protected_type_declaration_2629_31_821()) jj_scanpos = xsp; return false; } inline bool jj_3R_delay_mechanism_1092_1_492() { if (jj_done) return true; if (jj_scan_token(TRANSPORT_T)) return true; return false; } inline bool jj_3R_delay_mechanism_1092_1_381() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_delay_mechanism_1092_1_492()) { jj_scanpos = xsp; if (jj_3R_delay_mechanism_1093_3_493()) return true; } return false; } inline bool jj_3R_protected_type_body_2588_38_818() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_part_2618_7_847() { if (jj_done) return true; if (jj_3R_protected_type_body_declarative_item_2593_5_860()) return true; return false; } inline bool jj_3_122() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_part_2618_5_817() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_protected_type_body_declarative_part_2618_7_847()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_protected_type_body_declarative_item_2612_7_882() { if (jj_done) return true; if (jj_3R_group_declaration_1636_3_426()) return true; return false; } inline bool jj_3_123() { if (jj_done) return true; if (jj_3R_group_template_declaration_1644_2_80()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2609_7_881() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2608_7_880() { if (jj_done) return true; if (jj_3R_attribute_specification_580_3_423()) return true; return false; } inline bool jj_3_121() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2606_7_879() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3R_context_declaration_1076_2_444() { if (jj_done) return true; if (jj_scan_token(CONTEXT_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2604_7_878() { if (jj_done) return true; if (jj_3R_alias_declaration_405_2_143()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2603_7_877() { if (jj_done) return true; if (jj_3R_file_declaration_1443_2_421()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2602_7_876() { if (jj_done) return true; if (jj_3R_variable_declaration_3338_1_420()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2601_7_875() { if (jj_done) return true; if (jj_3R_constant_declaration_1026_4_418()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2600_7_874() { if (jj_done) return true; if (jj_3R_subtype_declaration_3213_1_416()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2599_7_873() { if (jj_done) return true; if (jj_3R_type_declaration_3264_1_415()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2598_7_872() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3R_context_ref_1068_2_401() { if (jj_done) return true; if (jj_scan_token(CONTEXT_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_context_ref_1068_31_509()) { jj_scanpos = xsp; break; } } if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2597_7_871() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3_42() { if (jj_done) return true; if (jj_3R_index_constraint_1735_3_75()) return true; return false; } inline bool jj_3_120() { if (jj_done) return true; if (jj_3R_package_body_2242_1_77()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2594_7_870() { if (jj_done) return true; if (jj_3R_subprogram_body_3085_1_664()) return true; return false; } inline bool jj_3_41() { if (jj_done) return true; if (jj_3R_range_constraint_2678_1_103()) return true; return false; } inline bool jj_3R_context_item_1063_3_226() { if (jj_done) return true; if (jj_3R_context_ref_1068_2_401()) return true; return false; } inline bool jj_3R_context_item_1061_3_225() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2593_5_869() { if (jj_done) return true; if (jj_3R_subprogram_declaration_3108_1_142()) return true; return false; } inline bool jj_3R_protected_type_body_declarative_item_2593_5_860() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_protected_type_body_declarative_item_2593_5_869()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2594_7_870()) { jj_scanpos = xsp; if (jj_3_120()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2597_7_871()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2598_7_872()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2599_7_873()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2600_7_874()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2601_7_875()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2602_7_876()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2603_7_877()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2604_7_878()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2606_7_879()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2608_7_880()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2609_7_881()) { jj_scanpos = xsp; if (jj_3_123()) { jj_scanpos = xsp; if (jj_3R_protected_type_body_declarative_item_2612_7_882()) return true; } } } } } } } } } } } } } } } return false; } inline bool jj_3R_context_item_1060_2_102() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_context_item_1060_2_224()) { jj_scanpos = xsp; if (jj_3R_context_item_1061_3_225()) { jj_scanpos = xsp; if (jj_3R_context_item_1063_3_226()) return true; } } return false; } inline bool jj_3R_context_item_1060_2_224() { if (jj_done) return true; if (jj_3R_library_clause_2027_2_399()) return true; return false; } inline bool jj_3R_constraint_1054_5_355() { if (jj_done) return true; if (jj_3R_index_constraint_1735_3_75()) return true; return false; } inline bool jj_3R_constraint_1051_5_173() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_constraint_1051_5_354()) { jj_scanpos = xsp; if (jj_3R_constraint_1054_5_355()) return true; } return false; } inline bool jj_3R_constraint_1051_5_354() { if (jj_done) return true; if (jj_3R_range_constraint_2678_1_103()) return true; return false; } inline bool jj_3R_protected_type_body_2584_4_177() { if (jj_done) return true; if (jj_scan_token(PROTECTED_T)) return true; if (jj_scan_token(BODY_T)) return true; if (jj_3R_protected_type_body_declarative_part_2618_5_817()) return true; if (jj_scan_token(END_T)) return true; if (jj_scan_token(PROTECTED_T)) return true; if (jj_scan_token(BODY_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_protected_type_body_2588_38_818()) jj_scanpos = xsp; return false; } inline bool jj_3_40() { if (jj_done) return true; if (jj_3R_context_item_1060_2_102()) return true; return false; } inline bool jj_3R_context_clause_1046_3_104() { if (jj_done) return true; Token * xsp; if (jj_3_40()) return true; while (true) { xsp = jj_scanpos; if (jj_3_40()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_process_statement_part_2577_4_414() { if (jj_done) return true; if (jj_3R_sequential_statement_2907_5_148()) return true; return false; } inline bool jj_3R_process_statement_part_2577_3_237() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_process_statement_part_2577_4_414()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_process_statement_2555_24_238() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_constraint_array_definition_1040_1_866() { if (jj_done) return true; if (jj_scan_token(ARRAY_T)) return true; if (jj_3R_index_constraint_1735_3_75()) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_constant_declaration_1026_4_418() { if (jj_done) return true; if (jj_scan_token(CONSTANT_T)) return true; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_constant_declaration_1026_74_517()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_39() { if (jj_done) return true; if (jj_3R_component_configuration_780_5_101()) return true; return false; } inline bool jj_3R_configuration_specification_1021_1_424() { if (jj_done) return true; if (jj_scan_token(FOR_T)) return true; if (jj_3R_component_specification_820_1_221()) return true; if (jj_3R_binding_indication_622_2_397()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_configuration_item_1015_4_689() { if (jj_done) return true; if (jj_3R_block_configuration_640_5_398()) return true; return false; } inline bool jj_3R_configuration_item_1013_2_688() { if (jj_done) return true; if (jj_3R_component_configuration_780_5_101()) return true; return false; } inline bool jj_3R_configuration_item_1013_2_620() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_configuration_item_1013_2_688()) { jj_scanpos = xsp; if (jj_3R_configuration_item_1015_4_689()) return true; } return false; } inline bool jj_3R_process_statement_2545_4_235() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_sensitivity_list_2895_3_412()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3_37() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; if (jj_scan_token(ELSE_T)) return true; return false; } inline bool jj_3R_process_statement_2537_3_234() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_process_statement_2537_1_112() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_process_statement_2537_3_234()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_scan_token(79)) jj_scanpos = xsp; if (jj_scan_token(PROCESS_T)) return true; xsp = jj_scanpos; if (jj_3R_process_statement_2545_4_235()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_scan_token(56)) jj_scanpos = xsp; if (jj_3R_process_declarative_part_2532_2_236()) return true; if (jj_scan_token(BEGIN_T)) return true; if (jj_3R_process_statement_part_2577_3_237()) return true; if (jj_scan_token(END_T)) return true; xsp = jj_scanpos; if (jj_scan_token(79)) jj_scanpos = xsp; if (jj_scan_token(PROCESS_T)) return true; xsp = jj_scanpos; if (jj_3R_process_statement_2555_24_238()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_process_declarative_part_2532_4_413() { if (jj_done) return true; if (jj_3R_process_declarative_item_2507_1_513()) return true; return false; } inline bool jj_3R_process_declarative_part_2532_2_236() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_process_declarative_part_2532_4_413()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_conditional_or_unaffected_expression_965_32_669() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; if (jj_scan_token(ELSE_T)) return true; if (jj_3R_expression_or_unaffected_1387_4_668()) return true; return false; } inline bool jj_3R_process_declarative_item_2527_3_635() { if (jj_done) return true; if (jj_3R_group_declaration_1636_3_426()) return true; return false; } inline bool jj_3_38() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; if (jj_scan_token(ELSE_T)) return true; return false; } inline bool jj_3R_process_declarative_item_2523_3_634() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3_119() { if (jj_done) return true; if (jj_3R_group_template_declaration_1644_2_80()) return true; return false; } inline bool jj_3R_procedure_call_2488_38_394() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_actual_parameter_part_371_4_297()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_process_declarative_item_2522_3_633() { if (jj_done) return true; if (jj_3R_attribute_specification_580_3_423()) return true; return false; } inline bool jj_3_117() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3R_configuration_declaration_986_2_443() { if (jj_done) return true; if (jj_scan_token(CONFIGURATION_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_process_declarative_item_2518_3_632() { if (jj_done) return true; if (jj_3R_alias_declaration_405_2_143()) return true; return false; } inline bool jj_3R_conditional_waveforms_979_7_384() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; return false; } inline bool jj_3_118() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3R_process_declarative_item_2517_3_631() { if (jj_done) return true; if (jj_3R_file_declaration_1443_2_421()) return true; return false; } inline bool jj_3R_process_declarative_item_2516_3_630() { if (jj_done) return true; if (jj_3R_variable_declaration_3338_1_420()) return true; return false; } inline bool jj_3R_conditional_waveforms_977_7_383() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; if (jj_scan_token(ELSE_T)) return true; if (jj_3R_waveform_3377_1_382()) return true; return false; } inline bool jj_3R_process_declarative_item_2515_3_629() { if (jj_done) return true; if (jj_3R_constant_declaration_1026_4_418()) return true; return false; } inline bool jj_3R_else_stat_955_28_617() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_process_declarative_item_2514_3_628() { if (jj_done) return true; if (jj_3R_type_declaration_3264_1_415()) return true; return false; } inline bool jj_3R_process_declarative_item_2513_3_627() { if (jj_done) return true; if (jj_3R_subtype_declaration_3213_1_416()) return true; return false; } inline bool jj_3R_process_declarative_item_2512_3_626() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3R_conditional_expression_960_20_298() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; if (jj_scan_token(ELSE_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_process_declarative_item_2511_3_625() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3_116() { if (jj_done) return true; if (jj_3R_package_body_2242_1_77()) return true; return false; } inline bool jj_3R_conditional_waveforms_976_1_207() { if (jj_done) return true; if (jj_3R_waveform_3377_1_382()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_conditional_waveforms_977_7_383()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_3R_conditional_waveforms_979_7_384()) jj_scanpos = xsp; return false; } inline bool jj_3R_process_declarative_item_2508_3_624() { if (jj_done) return true; if (jj_3R_subprogram_body_3085_1_664()) return true; return false; } inline bool jj_3R_process_declarative_item_2507_1_623() { if (jj_done) return true; if (jj_3R_subprogram_declaration_3108_1_142()) return true; return false; } inline bool jj_3R_process_declarative_item_2507_1_513() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_process_declarative_item_2507_1_623()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2508_3_624()) { jj_scanpos = xsp; if (jj_3_116()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2511_3_625()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2512_3_626()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2513_3_627()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2514_3_628()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2515_3_629()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2516_3_630()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2517_3_631()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2518_3_632()) { jj_scanpos = xsp; if (jj_3_118()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2522_3_633()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2523_3_634()) { jj_scanpos = xsp; if (jj_3_119()) { jj_scanpos = xsp; if (jj_3R_process_declarative_item_2527_3_635()) return true; } } } } } } } } } } } } } } } return false; } inline bool jj_3R_else_wave_list_941_27_750() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_conditional_or_unaffected_expression_965_2_560() { if (jj_done) return true; if (jj_3R_expression_or_unaffected_1387_4_668()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_conditional_or_unaffected_expression_965_32_669()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_3R_conditional_or_unaffected_expression_965_133_670()) jj_scanpos = xsp; return false; } inline bool jj_3R_procedure_call_2488_12_393() { if (jj_done) return true; if (jj_scan_token(PARAMETER_T)) return true; if (jj_scan_token(MAP_T)) return true; return false; } inline bool jj_3R_conditional_force_assignment_948_16_219() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(53)) { jj_scanpos = xsp; if (jj_scan_token(75)) return true; } return false; } inline bool jj_3R_conditional_expression_960_3_137() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_conditional_expression_960_20_298()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_conditional_force_assignment_949_13_220() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_3R_else_stat_955_4_395()) return true; return false; } inline bool jj_3R_conditional_waveform_assignment_935_26_563() { if (jj_done) return true; if (jj_3R_else_wave_list_941_3_672()) return true; return false; } inline bool jj_3R_else_stat_955_5_498() { if (jj_done) return true; if (jj_scan_token(ELSE_T)) return true; if (jj_3R_expression_1380_20_70()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_else_stat_955_28_617()) jj_scanpos = xsp; return false; } inline bool jj_3_115() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_else_stat_955_4_395() { if (jj_done) return true; Token * xsp; if (jj_3R_else_stat_955_5_498()) return true; while (true) { xsp = jj_scanpos; if (jj_3R_else_stat_955_5_498()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_procedure_call_statement_2493_1_155() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_115()) jj_scanpos = xsp; if (jj_3R_procedure_call_2488_3_218()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_procedure_call_2488_3_218() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_procedure_call_2488_12_393()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_procedure_call_2488_38_394()) jj_scanpos = xsp; return false; } inline bool jj_3R_conditional_waveform_assignment_934_17_561() { if (jj_done) return true; if (jj_3R_delay_mechanism_1092_1_381()) return true; return false; } inline bool jj_3R_conditional_force_assignment_946_3_99() { if (jj_done) return true; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; if (jj_scan_token(FORCE_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_conditional_force_assignment_948_16_219()) jj_scanpos = xsp; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(WHEN_T)) return true; xsp = jj_scanpos; if (jj_3R_conditional_force_assignment_949_13_220()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_private_incomplete_type_definition_2476_3_784() { if (jj_done) return true; if (jj_scan_token(PRIVATE_T)) return true; return false; } inline bool jj_3R_else_wave_list_941_3_672() { if (jj_done) return true; if (jj_scan_token(ELSE_T)) return true; if (jj_3R_expression_1380_20_70()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_else_wave_list_941_27_750()) jj_scanpos = xsp; return false; } inline bool jj_3R_concurrent_selected_signal_assignment_861_79_208() { if (jj_done) return true; if (jj_3R_delay_mechanism_1092_1_381()) return true; return false; } inline bool jj_3R_private_variable_declaration_2471_3_890() { if (jj_done) return true; if (jj_scan_token(PRIVATE_T)) return true; if (jj_3R_variable_declaration_3338_1_420()) return true; return false; } inline bool jj_3_36() { if (jj_done) return true; if (jj_3R_conditional_force_assignment_946_3_99()) return true; return false; } inline bool jj_3_114() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3R_conditional_waveform_assignment_933_3_470() { if (jj_done) return true; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_conditional_waveform_assignment_934_17_561()) jj_scanpos = xsp; if (jj_3R_waveform_element_3385_2_562()) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; xsp = jj_scanpos; if (jj_3R_conditional_waveform_assignment_935_26_563()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_primary_unit_2465_4_276() { if (jj_done) return true; if (jj_3R_context_declaration_1076_2_444()) return true; return false; } inline bool jj_3R_primary_unit_2464_3_275() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3R_conditional_signal_assignment_wave_928_3_346() { if (jj_done) return true; if (jj_3R_conditional_waveform_assignment_933_3_470()) return true; return false; } inline bool jj_3R_conditional_signal_assignment_wave_926_3_166() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_conditional_signal_assignment_wave_926_3_345()) { jj_scanpos = xsp; if (jj_3R_conditional_signal_assignment_wave_928_3_346()) return true; } return false; } inline bool jj_3R_conditional_signal_assignment_wave_926_3_345() { if (jj_done) return true; if (jj_3R_conditional_force_assignment_946_3_99()) return true; return false; } inline bool jj_3R_primary_unit_2459_3_273() { if (jj_done) return true; if (jj_3R_configuration_declaration_986_2_443()) return true; return false; } inline bool jj_3R_primary_unit_2461_1_274() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3_113() { if (jj_done) return true; if (jj_3R_aggregate_400_3_141()) return true; return false; } inline bool jj_3R_primary_unit_2458_1_123() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_primary_unit_2458_1_272()) { jj_scanpos = xsp; if (jj_3R_primary_unit_2459_3_273()) { jj_scanpos = xsp; if (jj_3R_primary_unit_2461_1_274()) { jj_scanpos = xsp; if (jj_3R_primary_unit_2464_3_275()) { jj_scanpos = xsp; if (jj_3R_primary_unit_2465_4_276()) return true; } } } } return false; } inline bool jj_3R_primary_unit_2458_1_272() { if (jj_done) return true; if (jj_3R_entity_declaration_1251_5_442()) return true; return false; } inline bool jj_3_112() { if (jj_done) return true; if (jj_3R_allocator_426_3_140()) return true; return false; } inline bool jj_3R_condition_clause_917_3_464() { if (jj_done) return true; if (jj_scan_token(UNTIL_T)) return true; if (jj_3R_condition_906_3_100()) return true; return false; } inline bool jj_3_111() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3_110() { if (jj_done) return true; if (jj_3R_literal_2052_2_139()) return true; return false; } inline bool jj_3R_primary_2450_1_576() { if (jj_done) return true; if (jj_3R_aggregate_400_3_141()) return true; return false; } inline bool jj_3_109() { if (jj_done) return true; if (jj_3R_type_conversion_3259_3_138()) return true; return false; } inline bool jj_3R_primary_2447_1_575() { if (jj_done) return true; if (jj_3R_allocator_426_3_140()) return true; return false; } inline bool jj_3_108() { if (jj_done) return true; if (jj_3R_qualified_expression_2657_3_74()) return true; return false; } inline bool jj_3R_primary_2444_1_574() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_condition_906_3_100() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3_35() { if (jj_done) return true; if (jj_3R_concurrent_procedure_call_statement_836_1_98()) return true; return false; } inline bool jj_3_107() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_conditional_expression_960_3_137()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_primary_2441_1_573() { if (jj_done) return true; if (jj_3R_literal_2052_2_139()) return true; return false; } inline bool jj_3_34() { if (jj_done) return true; if (jj_3R_component_instantiation_statement_803_2_97()) return true; return false; } inline bool jj_3_106() { if (jj_done) return true; if (jj_3R_function_call_1534_1_136()) return true; return false; } inline bool jj_3R_primary_2438_1_572() { if (jj_done) return true; if (jj_3R_type_conversion_3259_3_138()) return true; return false; } inline bool jj_3_33() { if (jj_done) return true; if (jj_3R_concurrent_signal_association_statement_866_2_96()) return true; return false; } inline bool jj_3R_primary_2435_1_571() { if (jj_done) return true; if (jj_3R_qualified_expression_2657_3_74()) return true; return false; } inline bool jj_3_32() { if (jj_done) return true; if (jj_3R_concurrent_signal_assignment_statement_841_1_95()) return true; return false; } inline bool jj_3_104() { if (jj_done) return true; if (jj_3R_pathname_element_2367_3_134()) return true; if (jj_scan_token(DOT_T)) return true; return false; } inline bool jj_3R_physical_type_definition_2401_33_865() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_primary_2432_1_570() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_conditional_expression_960_3_137()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_null_886_12_94() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3_31() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_null_886_12_94()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_scan_token(79)) jj_scanpos = xsp; if (jj_scan_token(ASSERT_T)) return true; return false; } inline bool jj_3R_primary_2429_1_569() { if (jj_done) return true; if (jj_3R_function_call_1534_1_136()) return true; return false; } inline bool jj_3R_concurrent_simple_signal_assignment_856_39_496() { if (jj_done) return true; if (jj_3R_delay_mechanism_1092_1_381()) return true; return false; } inline bool jj_3R_primary_2429_1_473() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_primary_2429_1_569()) { jj_scanpos = xsp; if (jj_3R_primary_2432_1_570()) { jj_scanpos = xsp; if (jj_3R_primary_2435_1_571()) { jj_scanpos = xsp; if (jj_3R_primary_2438_1_572()) { jj_scanpos = xsp; if (jj_3R_primary_2441_1_573()) { jj_scanpos = xsp; if (jj_3R_primary_2444_1_574()) { jj_scanpos = xsp; if (jj_3R_primary_2447_1_575()) { jj_scanpos = xsp; if (jj_3R_primary_2450_1_576()) return true; } } } } } } } return false; } inline bool jj_3R_null_880_12_92() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3_29() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_null_880_12_92()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_scan_token(79)) jj_scanpos = xsp; if (jj_scan_token(PROCESS_T)) return true; return false; } inline bool jj_3R_port_map_aspect_2424_2_392() { if (jj_done) return true; if (jj_scan_token(PORT_T)) return true; if (jj_scan_token(MAP_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_association_list_553_1_205()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_pathname_element_list_2378_47_178() { if (jj_done) return true; if (jj_3R_pathname_element_2367_3_134()) return true; if (jj_scan_token(DOT_T)) return true; return false; } inline bool jj_3R_null_877_12_91() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_concurrent_conditional_signal_assignment_851_38_206() { if (jj_done) return true; if (jj_3R_delay_mechanism_1092_1_381()) return true; return false; } inline bool jj_3_28() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_null_877_12_91()) jj_scanpos = xsp; if (jj_scan_token(BLOCK_T)) return true; return false; } inline bool jj_3R_port_list_2419_3_700() { if (jj_done) return true; if (jj_3R_interface_list_1836_3_377()) return true; return false; } inline bool jj_3_30() { if (jj_done) return true; if (jj_3R_generate_statement_1592_1_93()) return true; return false; } inline bool jj_3R_port_clause_2414_4_641() { if (jj_done) return true; if (jj_scan_token(PORT_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_port_list_2419_3_700()) return true; if (jj_scan_token(RPAREN_T)) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_physical_incomplete_type_definition_2409_5_786() { if (jj_done) return true; if (jj_scan_token(UNITS_T)) return true; if (jj_scan_token(BOX_T)) return true; return false; } inline bool jj_3R_physical_type_definition_2399_14_864() { if (jj_done) return true; if (jj_3R_secondary_unit_declaration_2813_1_888()) return true; return false; } inline bool jj_3R_concurrent_simple_signal_association_871_2_214() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(LGT_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_package_instantiation_declaration_2350_57_307() { if (jj_done) return true; if (jj_3R_gen_assoc_list_1544_4_172()) return true; return false; } inline bool jj_3_27() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_physical_type_definition_2394_9_855() { if (jj_done) return true; if (jj_scan_token(UNITS_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(SEMI_T)) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_physical_type_definition_2399_14_864()) { jj_scanpos = xsp; break; } } if (jj_scan_token(END_T)) return true; if (jj_scan_token(UNITS_T)) return true; xsp = jj_scanpos; if (jj_3R_physical_type_definition_2401_33_865()) jj_scanpos = xsp; return false; } inline bool jj_3R_concurrent_signal_association_statement_866_2_96() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_27()) jj_scanpos = xsp; if (jj_3R_concurrent_simple_signal_association_871_2_214()) return true; return false; } inline bool jj_3R_concurrent_selected_signal_assignment_861_6_90() { if (jj_done) return true; if (jj_scan_token(WITH_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(SELECT_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(158)) jj_scanpos = xsp; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; xsp = jj_scanpos; if (jj_scan_token(50)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_concurrent_selected_signal_assignment_861_79_208()) jj_scanpos = xsp; if (jj_3R_selected_waveforms_2835_2_209()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_105() { if (jj_done) return true; if (jj_3R_abstract_literal_338_4_135()) return true; return false; } inline bool jj_3R_concurrent_simple_signal_assignment_856_7_388() { if (jj_done) return true; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(50)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_concurrent_simple_signal_assignment_856_39_496()) jj_scanpos = xsp; if (jj_3R_waveform_3377_1_382()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_concurrent_conditional_signal_assignment_851_6_89() { if (jj_done) return true; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(LESSTHAN_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(50)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_concurrent_conditional_signal_assignment_851_38_206()) jj_scanpos = xsp; if (jj_3R_conditional_waveforms_976_1_207()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_26() { if (jj_done) return true; if (jj_3R_concurrent_selected_signal_assignment_861_6_90()) return true; return false; } inline bool jj_3R_physical_literal_2389_3_292() { if (jj_done) return true; if (jj_3R_abstract_literal_338_4_135()) return true; return false; } inline bool jj_3R_physical_literal_2389_2_133() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_physical_literal_2389_3_292()) jj_scanpos = xsp; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3_25() { if (jj_done) return true; if (jj_3R_concurrent_conditional_signal_assignment_851_6_89()) return true; return false; } inline bool jj_3R_package_path_name_2384_3_683() { if (jj_done) return true; if (jj_scan_token(AT_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_pathname_element_2367_19_293() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_concurrent_signal_assignment_statement_845_3_213() { if (jj_done) return true; if (jj_3R_concurrent_simple_signal_assignment_856_7_388()) return true; return false; } inline bool jj_3R_concurrent_signal_assignment_statement_844_3_212() { if (jj_done) return true; if (jj_3R_concurrent_selected_signal_assignment_861_6_90()) return true; return false; } inline bool jj_3R_pathname_element_list_2378_3_69() { if (jj_done) return true; if (jj_3R_pathname_element_2367_3_134()) return true; if (jj_scan_token(DOT_T)) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_pathname_element_list_2378_47_178()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3_24() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_concurrent_signal_assignment_statement_843_1_211() { if (jj_done) return true; if (jj_3R_concurrent_conditional_signal_assignment_851_6_89()) return true; return false; } inline bool jj_3R_concurrent_signal_assignment_statement_841_1_95() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_24()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_scan_token(79)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_concurrent_signal_assignment_statement_843_1_211()) { jj_scanpos = xsp; if (jj_3R_concurrent_signal_assignment_statement_844_3_212()) { jj_scanpos = xsp; if (jj_3R_concurrent_signal_assignment_statement_845_3_213()) return true; } } return false; } inline bool jj_3_23() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_concurrent_procedure_call_statement_836_1_98() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_23()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_scan_token(79)) jj_scanpos = xsp; if (jj_3R_procedure_call_2488_3_218()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_21() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; return false; } inline bool jj_3_22() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_pathname_element_2367_3_134() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_pathname_element_2367_19_293()) jj_scanpos = xsp; return false; } inline bool jj_3R_concurrent_assertion_statement_831_1_111() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_22()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_scan_token(79)) jj_scanpos = xsp; if (jj_3R_assertion_528_4_233()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_composite_type_definition_826_3_815() { if (jj_done) return true; if (jj_3R_record_type_definition_2683_8_846()) return true; return false; } inline bool jj_3R_composite_type_definition_825_2_814() { if (jj_done) return true; if (jj_3R_array_type_definition_519_2_845()) return true; return false; } inline bool jj_3R_composite_type_definition_825_2_799() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_composite_type_definition_825_2_814()) { jj_scanpos = xsp; if (jj_3R_composite_type_definition_826_3_815()) return true; } return false; } inline bool jj_3R_component_declaration_796_31_529() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_parameter_specification_2360_1_667() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(IN_T)) return true; if (jj_3R_discrete_range_1136_3_87()) return true; return false; } inline bool jj_3R_component_instantiation_statement_815_11_217() { if (jj_done) return true; if (jj_3R_port_map_aspect_2424_2_392()) return true; return false; } inline bool jj_3R_component_instantiation_statement_814_11_216() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; return false; } inline bool jj_3R_component_specification_820_1_221() { if (jj_done) return true; if (jj_3R_instantiation_list_1761_3_396()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_package_instantiation_declaration_2350_2_110() { if (jj_done) return true; if (jj_scan_token(PACKAGE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(IS_T)) return true; if (jj_scan_token(NEW_T)) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_package_instantiation_declaration_2350_57_307()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_package_declarative_part_2345_3_376() { if (jj_done) return true; if (jj_3R_package_declarative_item_2314_1_487()) return true; return false; } inline bool jj_3R_package_declarative_part_2345_2_193() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_package_declarative_part_2345_3_376()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_package_declarative_item_2339_2_611() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3R_component_instantiation_statement_803_2_97() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_instantiation_unit_1754_1_215()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_component_instantiation_statement_814_11_216()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_component_instantiation_statement_815_11_217()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_103() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3R_package_declarative_item_2335_3_610() { if (jj_done) return true; if (jj_3R_group_declaration_1636_3_426()) return true; return false; } inline bool jj_3R_case_scheme_730_73_83() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3_101() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3R_package_declarative_item_2331_3_609() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3_102() { if (jj_done) return true; if (jj_3R_group_template_declaration_1644_2_80()) return true; return false; } inline bool jj_3R_package_declarative_item_2330_3_608() { if (jj_done) return true; if (jj_3R_disconnection_specification_1126_1_425()) return true; return false; } inline bool jj_3R_package_declarative_item_2329_3_607() { if (jj_done) return true; if (jj_3R_attribute_specification_580_3_423()) return true; return false; } inline bool jj_3R_package_declaration_2305_26_194() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_component_declaration_790_5_528() { if (jj_done) return true; if (jj_3R_port_clause_2414_4_641()) return true; return false; } inline bool jj_3R_component_declaration_789_5_527() { if (jj_done) return true; if (jj_3R_generic_clause_1610_2_81()) return true; return false; } inline bool jj_3R_package_declarative_item_2327_1_606() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3R_package_declarative_item_2325_3_605() { if (jj_done) return true; if (jj_3R_mode_view_declaration_2116_3_417()) return true; return false; } inline bool jj_3R_component_configuration_782_11_223() { if (jj_done) return true; if (jj_3R_block_configuration_640_5_398()) return true; return false; } inline bool jj_3R_package_declarative_item_2324_3_604() { if (jj_done) return true; if (jj_3R_component_declaration_787_2_422()) return true; return false; } inline bool jj_3R_component_configuration_781_11_222() { if (jj_done) return true; if (jj_3R_binding_indication_622_2_397()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_package_declarative_item_2323_3_603() { if (jj_done) return true; if (jj_3R_alias_declaration_405_2_143()) return true; return false; } inline bool jj_3R_package_declarative_item_2322_3_602() { if (jj_done) return true; if (jj_3R_file_declaration_1443_2_421()) return true; return false; } inline bool jj_3R_choices_775_15_230() { if (jj_done) return true; if (jj_scan_token(BAR_T)) return true; if (jj_3R_choice_759_4_229()) return true; return false; } inline bool jj_3R_package_declarative_item_2321_3_601() { if (jj_done) return true; if (jj_3R_variable_declaration_3338_1_420()) return true; return false; } inline bool jj_3R_component_declaration_787_2_422() { if (jj_done) return true; if (jj_scan_token(COMPONENT_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(56)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_component_declaration_789_5_527()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_component_declaration_790_5_528()) jj_scanpos = xsp; if (jj_scan_token(END_T)) return true; xsp = jj_scanpos; if (jj_scan_token(28)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_component_declaration_796_31_529()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_package_declarative_item_2320_3_600() { if (jj_done) return true; if (jj_3R_signal_declaration_3022_1_419()) return true; return false; } inline bool jj_3R_package_declarative_item_2319_3_599() { if (jj_done) return true; if (jj_3R_constant_declaration_1026_4_418()) return true; return false; } inline bool jj_3_100() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3R_component_configuration_780_5_101() { if (jj_done) return true; if (jj_scan_token(FOR_T)) return true; if (jj_3R_component_specification_820_1_221()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_component_configuration_781_11_222()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_component_configuration_782_11_223()) jj_scanpos = xsp; if (jj_scan_token(END_T)) return true; if (jj_scan_token(FOR_T)) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_99() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3R_package_declarative_item_2316_3_598() { if (jj_done) return true; if (jj_3R_subtype_declaration_3213_1_416()) return true; return false; } inline bool jj_3R_package_declarative_item_2315_3_597() { if (jj_done) return true; if (jj_3R_type_declaration_3264_1_415()) return true; return false; } inline bool jj_3_16() { if (jj_done) return true; if (jj_scan_token(END_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_case_scheme_730_73_83()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_package_declarative_item_2314_1_596() { if (jj_done) return true; if (jj_3R_subprogram_declaration_3108_1_142()) return true; return false; } inline bool jj_3R_package_declarative_item_2314_1_487() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_package_declarative_item_2314_1_596()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2315_3_597()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2316_3_598()) { jj_scanpos = xsp; if (jj_3_99()) { jj_scanpos = xsp; if (jj_3_100()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2319_3_599()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2320_3_600()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2321_3_601()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2322_3_602()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2323_3_603()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2324_3_604()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2325_3_605()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2327_1_606()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2329_3_607()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2330_3_608()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2331_3_609()) { jj_scanpos = xsp; if (jj_3_102()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2335_3_610()) { jj_scanpos = xsp; if (jj_3_103()) { jj_scanpos = xsp; if (jj_3R_package_declarative_item_2339_2_611()) return true; } } } } } } } } } } } } } } } } } } } return false; } inline bool jj_3_20() { if (jj_done) return true; if (jj_3R_discrete_range_1136_3_87()) return true; return false; } inline bool jj_3R_choices_775_3_106() { if (jj_done) return true; if (jj_3R_choice_759_4_229()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_choices_775_15_230()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3_19() { if (jj_done) return true; if (jj_3R_simple_expression_3063_1_85()) return true; return false; } inline bool jj_3R_choice_769_5_406() { if (jj_done) return true; if (jj_scan_token(OTHER_T)) return true; return false; } inline bool jj_3_18() { if (jj_done) return true; if (jj_3R_simple_expression_3063_1_85()) return true; if (jj_3R_direction_1115_1_86()) return true; return false; } inline bool jj_3R_package_header_2282_25_486() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_choice_768_4_405() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_choice_765_4_404() { if (jj_done) return true; if (jj_3R_discrete_range_1136_3_87()) return true; return false; } inline bool jj_3R_choice_762_4_403() { if (jj_done) return true; if (jj_3R_simple_expression_3063_1_85()) return true; return false; } inline bool jj_3R_choice_759_4_229() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_choice_759_4_402()) { jj_scanpos = xsp; if (jj_3R_choice_762_4_403()) { jj_scanpos = xsp; if (jj_3R_choice_765_4_404()) { jj_scanpos = xsp; if (jj_3R_choice_768_4_405()) { jj_scanpos = xsp; if (jj_3R_choice_769_5_406()) return true; } } } } return false; } inline bool jj_3R_choice_759_4_402() { if (jj_done) return true; if (jj_3R_range_2669_4_105()) return true; return false; } inline bool jj_3R_case_statement_721_38_760() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_character_literal_754_3_445() { if (jj_done) return true; if (jj_scan_token(CHARACTER_LITERAL)) return true; return false; } inline bool jj_3R_package_declaration_2289_2_78() { if (jj_done) return true; if (jj_scan_token(PACKAGE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(IS_T)) return true; if (jj_3R_package_header_2282_4_192()) return true; if (jj_3R_package_declarative_part_2345_2_193()) return true; if (jj_scan_token(END_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(76)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_package_declaration_2305_26_194()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_package_header_2282_6_375() { if (jj_done) return true; if (jj_3R_generic_clause_1610_2_81()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_package_header_2282_25_486()) jj_scanpos = xsp; return false; } inline bool jj_3R_package_body_2251_36_526() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3_17() { if (jj_done) return true; if (jj_3R_label_2022_2_84()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_package_header_2282_4_192() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_package_header_2282_6_375()) jj_scanpos = xsp; return false; } inline bool jj_3R_case_statement_alternative_743_3_748() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_choices_775_3_106()) return true; if (jj_scan_token(ARROW_T)) return true; if (jj_3R_sequential_statement_body_2969_2_797()) return true; return false; } inline bool jj_3R_package_body_declarative_part_2277_2_640() { if (jj_done) return true; if (jj_3R_package_body_declarative_item_2256_1_699()) return true; return false; } inline bool jj_3R_package_body_declarative_part_2277_1_524() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_package_body_declarative_part_2277_2_640()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_package_body_declarative_item_2272_3_780() { if (jj_done) return true; if (jj_3R_group_declaration_1636_3_426()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2268_3_779() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3_98() { if (jj_done) return true; if (jj_3R_group_template_declaration_1644_2_80()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2267_3_778() { if (jj_done) return true; if (jj_3R_mode_view_declaration_2116_3_417()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2266_3_777() { if (jj_done) return true; if (jj_3R_alias_declaration_405_2_143()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2265_3_776() { if (jj_done) return true; if (jj_3R_file_declaration_1443_2_421()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2264_4_775() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3R_case_statement_720_11_759() { if (jj_done) return true; if (jj_3R_case_statement_alternative_743_3_748()) return true; return false; } inline bool jj_3_97() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3_96() { if (jj_done) return true; if (jj_3R_package_body_2242_1_77()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2261_3_774() { if (jj_done) return true; if (jj_3R_variable_declaration_3338_1_420()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2260_3_773() { if (jj_done) return true; if (jj_3R_constant_declaration_1026_4_418()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2259_3_772() { if (jj_done) return true; if (jj_3R_subtype_declaration_3213_1_416()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2258_3_771() { if (jj_done) return true; if (jj_3R_type_declaration_3264_1_415()) return true; return false; } inline bool jj_3R_package_body_2251_10_525() { if (jj_done) return true; if (jj_scan_token(PACKAGE_T)) return true; if (jj_scan_token(BODY_T)) return true; return false; } inline bool jj_3R_package_body_declarative_item_2256_1_770() { if (jj_done) return true; if (jj_3R_subprogram_declaration_3108_1_142()) return true; return false; } inline bool jj_3R_package_body_declarative_item_2256_1_699() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_package_body_declarative_item_2256_1_770()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2258_3_771()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2259_3_772()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2260_3_773()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2261_3_774()) { jj_scanpos = xsp; if (jj_3_96()) { jj_scanpos = xsp; if (jj_3_97()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2264_4_775()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2265_3_776()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2266_3_777()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2267_3_778()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2268_3_779()) { jj_scanpos = xsp; if (jj_3_98()) { jj_scanpos = xsp; if (jj_3R_package_body_declarative_item_2272_3_780()) return true; } } } } } } } } } } } } } return false; } inline bool jj_3_15() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_case_statement_712_1_157() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_15()) jj_scanpos = xsp; if (jj_scan_token(CASE_T)) return true; xsp = jj_scanpos; if (jj_scan_token(158)) jj_scanpos = xsp; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(IS_T)) return true; if (jj_3R_case_statement_alternative_743_3_748()) return true; while (true) { xsp = jj_scanpos; if (jj_3R_case_statement_720_11_759()) { jj_scanpos = xsp; break; } } if (jj_scan_token(END_T)) return true; if (jj_scan_token(CASE_T)) return true; xsp = jj_scanpos; if (jj_scan_token(158)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_case_statement_721_38_760()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_package_body_2242_1_77() { if (jj_done) return true; if (jj_scan_token(PACKAGE_T)) return true; if (jj_scan_token(BODY_T)) return true; if (jj_3R_name_2142_2_73()) return true; if (jj_scan_token(IS_T)) return true; if (jj_3R_package_body_declarative_part_2277_1_524()) return true; if (jj_scan_token(END_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_package_body_2251_10_525()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_package_body_2251_36_526()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_next_statement_2196_43_336() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_block_specification_688_12_619() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_index_specification_1740_2_687()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_operator_symbol_2232_1_369() { if (jj_done) return true; if (jj_scan_token(STRINGLITERAL)) return true; return false; } inline bool jj_3R_object_class_2227_2_658() { if (jj_done) return true; if (jj_scan_token(TYPE_T)) return true; return false; } inline bool jj_3_14() { if (jj_done) return true; if (jj_3R_generic_clause_1610_2_81()) return true; return false; } inline bool jj_3R_object_class_2226_2_657() { if (jj_done) return true; if (jj_scan_token(FILE_T)) return true; return false; } inline bool jj_3R_mode_view_declaration_2116_112_516() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_object_class_2225_2_656() { if (jj_done) return true; if (jj_scan_token(SHARED_T)) return true; if (jj_scan_token(VARIABLE_T)) return true; return false; } inline bool jj_3_95() { if (jj_done) return true; if (jj_3R_physical_literal_2389_2_133()) return true; return false; } inline bool jj_3R_object_class_2224_2_655() { if (jj_done) return true; if (jj_scan_token(VARIABLE_T)) return true; return false; } inline bool jj_3R_block_specification_688_3_505() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_block_specification_688_12_619()) jj_scanpos = xsp; return false; } inline bool jj_3R_object_class_2223_2_654() { if (jj_done) return true; if (jj_scan_token(SIGNAL_T)) return true; return false; } inline bool jj_3R_object_class_2222_1_653() { if (jj_done) return true; if (jj_scan_token(CONSTANT_T)) return true; return false; } inline bool jj_3R_object_class_2222_1_545() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_object_class_2222_1_653()) { jj_scanpos = xsp; if (jj_3R_object_class_2223_2_654()) { jj_scanpos = xsp; if (jj_3R_object_class_2224_2_655()) { jj_scanpos = xsp; if (jj_3R_object_class_2225_2_656()) { jj_scanpos = xsp; if (jj_3R_object_class_2226_2_657()) { jj_scanpos = xsp; if (jj_3R_object_class_2227_2_658()) return true; } } } } } return false; } inline bool jj_3R_numeric_literal_2217_4_278() { if (jj_done) return true; if (jj_3R_abstract_literal_338_4_135()) return true; return false; } inline bool jj_3R_name_ext_2173_47_446() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_numeric_literal_2215_2_125() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_numeric_literal_2215_2_277()) { jj_scanpos = xsp; if (jj_3R_numeric_literal_2217_4_278()) return true; } return false; } inline bool jj_3R_numeric_literal_2215_2_277() { if (jj_done) return true; if (jj_3R_physical_literal_2389_2_133()) return true; return false; } inline bool jj_3R_null_statement_2209_3_556() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_null_statement_2209_1_462() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_null_statement_2209_3_556()) jj_scanpos = xsp; if (jj_scan_token(NULL_T)) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_block_declarative_item_671_3_256() { if (jj_done) return true; if (jj_3R_group_declaration_1636_3_426()) return true; return false; } inline bool jj_3_12() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3_11() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3_13() { if (jj_done) return true; if (jj_3R_group_template_declaration_1644_2_80()) return true; return false; } inline bool jj_3R_block_declarative_item_667_3_255() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3R_block_declarative_item_666_3_254() { if (jj_done) return true; if (jj_3R_disconnection_specification_1126_1_425()) return true; return false; } inline bool jj_3R_null_2172_32_132() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_block_declarative_item_665_3_253() { if (jj_done) return true; if (jj_3R_configuration_specification_1021_1_424()) return true; return false; } inline bool jj_3R_block_declarative_item_664_3_252() { if (jj_done) return true; if (jj_3R_attribute_specification_580_3_423()) return true; return false; } inline bool jj_3R_next_statement_2197_3_337() { if (jj_done) return true; if (jj_scan_token(WHEN_T)) return true; if (jj_3R_condition_906_3_100()) return true; return false; } inline bool jj_3R_next_statement_2196_3_335() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_block_declarative_item_660_3_250() { if (jj_done) return true; if (jj_3R_component_declaration_787_2_422()) return true; return false; } inline bool jj_3R_block_declarative_item_662_1_251() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3_93() { if (jj_done) return true; if (jj_scan_token(LBRACKET_T)) return true; return false; } inline bool jj_3R_block_declarative_item_659_3_249() { if (jj_done) return true; if (jj_3R_package_instantiation_declaration_2350_2_110()) return true; return false; } inline bool jj_3R_next_statement_2196_1_159() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_next_statement_2196_3_335()) jj_scanpos = xsp; if (jj_scan_token(NEXT_T)) return true; xsp = jj_scanpos; if (jj_3R_next_statement_2196_43_336()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_next_statement_2197_3_337()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_block_declarative_item_658_3_248() { if (jj_done) return true; if (jj_3R_package_declaration_2289_2_78()) return true; return false; } inline bool jj_3_10() { if (jj_done) return true; if (jj_3R_package_body_2242_1_77()) return true; return false; } inline bool jj_3R_block_declarative_item_656_3_247() { if (jj_done) return true; if (jj_3R_alias_declaration_405_2_143()) return true; return false; } inline bool jj_3R_block_declarative_item_655_3_246() { if (jj_done) return true; if (jj_3R_file_declaration_1443_2_421()) return true; return false; } inline bool jj_3R_block_declarative_item_654_3_245() { if (jj_done) return true; if (jj_3R_variable_declaration_3338_1_420()) return true; return false; } inline bool jj_3R_block_declarative_item_653_3_244() { if (jj_done) return true; if (jj_3R_signal_declaration_3022_1_419()) return true; return false; } inline bool jj_3R_block_declarative_item_652_3_243() { if (jj_done) return true; if (jj_3R_constant_declaration_1026_4_418()) return true; return false; } inline bool jj_3R_block_declarative_item_651_3_242() { if (jj_done) return true; if (jj_3R_mode_view_declaration_2116_3_417()) return true; return false; } inline bool jj_3R_test_att_name_2185_4_449() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_block_configuration_642_11_507() { if (jj_done) return true; if (jj_3R_configuration_item_1013_2_620()) return true; return false; } inline bool jj_3R_block_declarative_item_650_3_241() { if (jj_done) return true; if (jj_3R_subtype_declaration_3213_1_416()) return true; return false; } inline bool jj_3R_test_att_name_2183_5_447() { if (jj_done) return true; if (jj_3R_signature_3054_1_472()) return true; return false; } inline bool jj_3R_block_configuration_641_11_506() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3R_block_declarative_item_649_3_240() { if (jj_done) return true; if (jj_3R_type_declaration_3264_1_415()) return true; return false; } inline bool jj_3R_block_declarative_item_648_3_113() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_block_declarative_item_648_3_239()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_649_3_240()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_650_3_241()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_651_3_242()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_652_3_243()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_653_3_244()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_654_3_245()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_655_3_246()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_656_3_247()) { jj_scanpos = xsp; if (jj_3_10()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_658_3_248()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_659_3_249()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_660_3_250()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_662_1_251()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_664_3_252()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_665_3_253()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_666_3_254()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_667_3_255()) { jj_scanpos = xsp; if (jj_3_13()) { jj_scanpos = xsp; if (jj_3R_block_declarative_item_671_3_256()) return true; } } } } } } } } } } } } } } } } } } } return false; } inline bool jj_3R_block_declarative_item_648_3_239() { if (jj_done) return true; if (jj_3R_subprogram_declaration_3108_1_142()) return true; return false; } inline bool jj_3_92() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_null_2172_32_132()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_test_att_name_2183_3_291() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_test_att_name_2183_5_447()) jj_scanpos = xsp; if (jj_scan_token(APOSTROPHE_T)) return true; if (jj_3R_attribute_designator_568_3_448()) return true; xsp = jj_scanpos; if (jj_3R_test_att_name_2185_4_449()) jj_scanpos = xsp; return false; } inline bool jj_3R_test_att_name_2181_4_131() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_94()) { jj_scanpos = xsp; if (jj_3R_test_att_name_2183_3_291()) return true; } return false; } inline bool jj_3_94() { if (jj_done) return true; if (jj_scan_token(CHARACTER_LITERAL)) return true; if (jj_scan_token(INTEGER)) return true; if (jj_scan_token(APOSTROPHE_T)) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3_91() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_discrete_range_1136_3_87()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3_87() { if (jj_done) return true; if (jj_3R_name_ext_2159_3_129()) return true; return false; } inline bool jj_3R_block_configuration_640_5_398() { if (jj_done) return true; if (jj_scan_token(FOR_T)) return true; if (jj_3R_block_specification_688_3_505()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_block_configuration_641_11_506()) { jj_scanpos = xsp; break; } } while (true) { xsp = jj_scanpos; if (jj_3R_block_configuration_642_11_507()) { jj_scanpos = xsp; break; } } if (jj_scan_token(END_T)) return true; if (jj_scan_token(FOR_T)) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_90() { if (jj_done) return true; if (jj_3R_test_att_name_2181_4_131()) return true; return false; } inline bool jj_3R_attribute_name_575_68_313() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3_84() { if (jj_done) return true; if (jj_3R_name_ext1_2153_4_128()) return true; return false; } inline bool jj_3_85() { if (jj_done) return true; if (jj_3R_name_ext1_2153_4_128()) return true; return false; } inline bool jj_3R_mode_view_declaration_2116_61_515() { if (jj_done) return true; if (jj_3R_mode_view_element_definition_2121_3_637()) return true; return false; } inline bool jj_3_86() { if (jj_done) return true; if (jj_3R_name_ext1_2153_4_128()) return true; return false; } inline bool jj_3_89() { if (jj_done) return true; if (jj_scan_token(DOT_T)) return true; if (jj_3R_suffix_3230_1_130()) return true; return false; } inline bool jj_3R_name_ext_2172_3_286() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_name_ext_2173_47_446()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3_88() { if (jj_done) return true; if (jj_scan_token(APOSTROPHE_T)) return true; if (jj_scan_token(SUBTYPE_T)) return true; return false; } inline bool jj_3R_name_ext1_2153_18_281() { if (jj_done) return true; if (jj_3R_name_ext_2159_3_129()) return true; return false; } inline bool jj_3R_name_ext_2169_2_285() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_discrete_range_1136_3_87()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_name_ext_2166_3_284() { if (jj_done) return true; if (jj_3R_test_att_name_2181_4_131()) return true; return false; } inline bool jj_3R_name_2143_25_370() { if (jj_done) return true; if (jj_3R_name_ext1_2153_4_128()) return true; return false; } inline bool jj_3R_name_2144_24_372() { if (jj_done) return true; if (jj_3R_name_ext1_2153_4_128()) return true; return false; } inline bool jj_3R_bit_string_literal_629_3_124() { if (jj_done) return true; if (jj_scan_token(BIT_STRING_LITERAL)) return true; return false; } inline bool jj_3R_name_2145_22_373() { if (jj_done) return true; if (jj_3R_name_ext1_2153_4_128()) return true; return false; } inline bool jj_3R_name_ext_2163_2_283() { if (jj_done) return true; if (jj_scan_token(DOT_T)) return true; if (jj_3R_suffix_3230_1_130()) return true; return false; } inline bool jj_3R_binding_indication_624_4_504() { if (jj_done) return true; if (jj_3R_port_map_aspect_2424_2_392()) return true; return false; } inline bool jj_3R_binding_indication_623_4_503() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; return false; } inline bool jj_3R_name_ext_2159_3_129() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_name_ext_2160_2_282()) { jj_scanpos = xsp; if (jj_3R_name_ext_2163_2_283()) { jj_scanpos = xsp; if (jj_3R_name_ext_2166_3_284()) { jj_scanpos = xsp; if (jj_3R_name_ext_2169_2_285()) { jj_scanpos = xsp; if (jj_3R_name_ext_2172_3_286()) return true; } } } } return false; } inline bool jj_3R_name_ext_2160_2_282() { if (jj_done) return true; if (jj_scan_token(APOSTROPHE_T)) return true; if (jj_scan_token(SUBTYPE_T)) return true; return false; } inline bool jj_3R_binding_indication_622_4_502() { if (jj_done) return true; if (jj_scan_token(USE_T)) return true; if (jj_3R_entity_aspect_1212_1_618()) return true; return false; } inline bool jj_3R_binding_indication_622_2_397() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_binding_indication_622_4_502()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_binding_indication_623_4_503()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_binding_indication_624_4_504()) jj_scanpos = xsp; return false; } inline bool jj_3R_name_ext1_2153_4_128() { if (jj_done) return true; if (jj_3R_name_ext_2159_3_129()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_name_ext1_2153_18_281()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_attribute_name_575_46_312() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_name_2145_6_188() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_name_2145_22_373()) jj_scanpos = xsp; return false; } inline bool jj_3R_name_2144_5_187() { if (jj_done) return true; if (jj_3R_external_name_1400_2_371()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_name_2144_24_372()) jj_scanpos = xsp; return false; } inline bool jj_3R_name_2143_4_186() { if (jj_done) return true; if (jj_3R_operator_symbol_2232_1_369()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_name_2143_25_370()) jj_scanpos = xsp; return false; } inline bool jj_3R_name_2142_2_73() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_name_2143_4_186()) { jj_scanpos = xsp; if (jj_3R_name_2144_5_187()) { jj_scanpos = xsp; if (jj_3R_name_2145_6_188()) return true; } } return false; } inline bool jj_3R_multiplying_operation_2136_3_359() { if (jj_done) return true; if (jj_scan_token(REM_T)) return true; return false; } inline bool jj_3R_multiplying_operation_2135_3_358() { if (jj_done) return true; if (jj_scan_token(MOD_T)) return true; return false; } inline bool jj_3R_multiplying_operation_2134_3_357() { if (jj_done) return true; if (jj_scan_token(SLASH_T)) return true; return false; } inline bool jj_3R_multiplying_operation_2133_1_174() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_multiplying_operation_2133_1_356()) { jj_scanpos = xsp; if (jj_3R_multiplying_operation_2134_3_357()) { jj_scanpos = xsp; if (jj_3R_multiplying_operation_2135_3_358()) { jj_scanpos = xsp; if (jj_3R_multiplying_operation_2136_3_359()) return true; } } } return false; } inline bool jj_3R_multiplying_operation_2133_1_356() { if (jj_done) return true; if (jj_scan_token(MULT_T)) return true; return false; } inline bool jj_3R_mode_view_indication_2127_5_652() { if (jj_done) return true; if (jj_3R_record_mode_view_indication_2717_4_735()) return true; return false; } inline bool jj_3R_mode_view_indication_2126_3_544() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_83()) { jj_scanpos = xsp; if (jj_3R_mode_view_indication_2127_5_652()) return true; } return false; } inline bool jj_3_83() { if (jj_done) return true; if (jj_3R_array_mode_view_indication_512_1_127()) return true; return false; } inline bool jj_3R_assertion_528_63_411() { if (jj_done) return true; if (jj_scan_token(SEVERITY_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_mode_view_element_definition_2121_3_637() { if (jj_done) return true; if (jj_3R_record_element_list_2702_5_692()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_element_mode_indication_1194_3_693()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_mode_view_declaration_2116_3_417() { if (jj_done) return true; if (jj_scan_token(VIEW_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; if (jj_scan_token(IS_T)) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_mode_view_declaration_2116_61_515()) { jj_scanpos = xsp; break; } } if (jj_scan_token(END_T)) return true; if (jj_scan_token(VIEW_T)) return true; xsp = jj_scanpos; if (jj_3R_mode_view_declaration_2116_112_516()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_attribute_specification_580_3_423() { if (jj_done) return true; if (jj_scan_token(ATTRIBUTE_T)) return true; if (jj_3R_attribute_designator_568_3_448()) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_entity_specification_1326_1_530()) return true; if (jj_scan_token(IS_T)) return true; if (jj_3R_conditional_expression_960_3_137()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_association_list_553_26_380() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_association_element_547_2_379()) return true; return false; } inline bool jj_3R_attribute_name_575_3_144() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(APOSTROPHE_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(86)) { jj_scanpos = xsp; if (jj_3R_attribute_name_575_46_312()) return true; } xsp = jj_scanpos; if (jj_3R_attribute_name_575_68_313()) jj_scanpos = xsp; return false; } inline bool jj_3R_attribute_designator_569_5_547() { if (jj_done) return true; if (jj_scan_token(RANGE_T)) return true; return false; } inline bool jj_3R_loop_statement_2080_28_749() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_mode_2105_3_539() { if (jj_done) return true; if (jj_scan_token(LINKAGE_T)) return true; return false; } inline bool jj_3R_mode_2104_3_538() { if (jj_done) return true; if (jj_scan_token(BUFFER_T)) return true; return false; } inline bool jj_3R_attribute_designator_568_3_546() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_mode_2103_3_537() { if (jj_done) return true; if (jj_scan_token(INOUT_T)) return true; return false; } inline bool jj_3R_attribute_designator_568_3_448() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_attribute_designator_568_3_546()) { jj_scanpos = xsp; if (jj_3R_attribute_designator_569_5_547()) return true; } return false; } inline bool jj_3R_mode_2102_3_536() { if (jj_done) return true; if (jj_scan_token(OUT_T)) return true; return false; } inline bool jj_3_78() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(OF_T)) return true; return false; } inline bool jj_3R_mode_2101_1_535() { if (jj_done) return true; if (jj_scan_token(IN_T)) return true; return false; } inline bool jj_3R_mode_2101_1_428() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_mode_2101_1_535()) { jj_scanpos = xsp; if (jj_3R_mode_2102_3_536()) { jj_scanpos = xsp; if (jj_3R_mode_2103_3_537()) { jj_scanpos = xsp; if (jj_3R_mode_2104_3_538()) { jj_scanpos = xsp; if (jj_3R_mode_2105_3_539()) return true; } } } } return false; } inline bool jj_3R_attribute_declaration_558_2_79() { if (jj_done) return true; if (jj_scan_token(ATTRIBUTE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_type_mark_3291_3_195()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_9() { if (jj_done) return true; if (jj_3R_formal_part_1496_1_76()) return true; if (jj_scan_token(ARROW_T)) return true; return false; } inline bool jj_3R_assertion_528_31_410() { if (jj_done) return true; if (jj_scan_token(REPORT_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_association_list_553_1_205() { if (jj_done) return true; if (jj_3R_association_element_547_2_379()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_association_list_553_26_380()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_association_element_547_3_490() { if (jj_done) return true; if (jj_3R_formal_part_1496_1_76()) return true; if (jj_scan_token(ARROW_T)) return true; return false; } inline bool jj_3R_association_element_547_2_379() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_association_element_547_3_490()) jj_scanpos = xsp; if (jj_3R_actual_part_380_2_491()) return true; return false; } inline bool jj_3R_loop_statement_2073_7_333() { if (jj_done) return true; if (jj_3R_iteration_scheme_2004_1_466()) return true; return false; } inline bool jj_3R_assertion_statement_539_5_324() { if (jj_done) return true; if (jj_3R_label_2022_2_84()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_assertion_statement_539_3_151() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_assertion_statement_539_5_324()) jj_scanpos = xsp; if (jj_3R_assertion_528_4_233()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_loop_statement_2072_3_332() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_array_index_incomplete_type_list_505_33_826() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_array_index_incomplete_type_497_2_825()) return true; return false; } inline bool jj_3R_loop_statement_2072_1_158() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_loop_statement_2072_3_332()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_loop_statement_2073_7_333()) jj_scanpos = xsp; if (jj_scan_token(LOOP_T)) return true; if (jj_3R_sequence_of_statements_2902_2_334()) return true; if (jj_scan_token(END_T)) return true; if (jj_scan_token(LOOP_T)) return true; xsp = jj_scanpos; if (jj_3R_loop_statement_2080_28_749()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_82() { if (jj_done) return true; if (jj_3R_enumeration_literal_1354_2_126()) return true; return false; } inline bool jj_3R_assertion_528_4_233() { if (jj_done) return true; if (jj_scan_token(ASSERT_T)) return true; if (jj_3R_condition_906_3_100()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_assertion_528_31_410()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_assertion_528_63_411()) jj_scanpos = xsp; return false; } inline bool jj_3_81() { if (jj_done) return true; if (jj_3R_numeric_literal_2215_2_125()) return true; return false; } inline bool jj_3_8() { if (jj_done) return true; if (jj_scan_token(ARRAY_T)) return true; if (jj_3R_index_constraint_1735_3_75()) return true; if (jj_scan_token(OF_T)) return true; return false; } inline bool jj_3R_literal_2062_3_303() { if (jj_done) return true; if (jj_scan_token(NULL_T)) return true; return false; } inline bool jj_3_80() { if (jj_done) return true; if (jj_3R_bit_string_literal_629_3_124()) return true; return false; } inline bool jj_3R_literal_2061_3_302() { if (jj_done) return true; if (jj_3R_string_literal_3078_1_452()) return true; return false; } inline bool jj_3R_array_type_definition_522_4_857() { if (jj_done) return true; if (jj_3R_unconstraint_array_definition_3296_1_867()) return true; return false; } inline bool jj_3R_literal_2059_1_301() { if (jj_done) return true; if (jj_3R_enumeration_literal_1354_2_126()) return true; return false; } inline bool jj_3R_literal_2055_2_300() { if (jj_done) return true; if (jj_3R_numeric_literal_2215_2_125()) return true; return false; } inline bool jj_3R_array_type_definition_519_2_856() { if (jj_done) return true; if (jj_3R_constraint_array_definition_1040_1_866()) return true; return false; } inline bool jj_3R_array_type_definition_519_2_845() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_array_type_definition_519_2_856()) { jj_scanpos = xsp; if (jj_3R_array_type_definition_522_4_857()) return true; } return false; } inline bool jj_3R_literal_2052_2_139() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_literal_2052_2_299()) { jj_scanpos = xsp; if (jj_3R_literal_2055_2_300()) { jj_scanpos = xsp; if (jj_3R_literal_2059_1_301()) { jj_scanpos = xsp; if (jj_3R_literal_2061_3_302()) { jj_scanpos = xsp; if (jj_3R_literal_2062_3_303()) return true; } } } } return false; } inline bool jj_3R_literal_2052_2_299() { if (jj_done) return true; if (jj_3R_bit_string_literal_629_3_124()) return true; return false; } inline bool jj_3R_array_mode_view_indication_512_1_127() { if (jj_done) return true; if (jj_scan_token(VIEW_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(RPAREN_T)) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3_79() { if (jj_done) return true; if (jj_3R_primary_unit_2458_1_123()) return true; return false; } inline bool jj_3R_array_index_incomplete_type_list_505_2_807() { if (jj_done) return true; if (jj_3R_array_index_incomplete_type_497_2_825()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_array_index_incomplete_type_list_505_33_826()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_array_index_incomplete_type_499_4_853() { if (jj_done) return true; if (jj_3R_anonymous_type_indication_459_2_543()) return true; return false; } inline bool jj_3R_array_index_incomplete_type_498_4_852() { if (jj_done) return true; if (jj_3R_index_subtype_definition_1749_2_863()) return true; return false; } inline bool jj_3R_array_index_incomplete_type_497_2_851() { if (jj_done) return true; if (jj_3R_index_constraint_1735_3_75()) return true; return false; } inline bool jj_3R_array_index_incomplete_type_497_2_825() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_array_index_incomplete_type_497_2_851()) { jj_scanpos = xsp; if (jj_3R_array_index_incomplete_type_498_4_852()) { jj_scanpos = xsp; if (jj_3R_array_index_incomplete_type_499_4_853()) return true; } } return false; } inline bool jj_3R_array_incomplete_type_definition_492_3_788() { if (jj_done) return true; if (jj_scan_token(ARRAY_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_array_index_incomplete_type_list_505_2_807()) return true; if (jj_scan_token(RPAREN_T)) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_incomplete_subtype_indication_1696_3_808()) return true; return false; } inline bool jj_3R_library_clause_2027_2_399() { if (jj_done) return true; if (jj_scan_token(LIBRARY_T)) return true; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_array_element_resolution_487_3_108() { if (jj_done) return true; if (jj_3R_resolution_indication_2769_4_232()) return true; return false; } inline bool jj_3R_label_2022_2_84() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_interface_variable_declaration_1973_49_260() { if (jj_done) return true; if (jj_scan_token(VARASSIGN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_array_constraint_477_5_690() { if (jj_done) return true; if (jj_3R_index_constraint_1735_3_75()) return true; return false; } inline bool jj_3R_array_constraint_476_3_621() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_7()) { jj_scanpos = xsp; if (jj_3R_array_constraint_477_5_690()) return true; } return false; } inline bool jj_3R_iteration_scheme_2011_3_558() { if (jj_done) return true; if (jj_scan_token(FOR_T)) return true; if (jj_3R_parameter_specification_2360_1_667()) return true; return false; } inline bool jj_3_7() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_scan_token(OPEN_T)) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_interface_variable_declaration_1972_37_259() { if (jj_done) return true; if (jj_3R_mode_2101_1_428()) return true; return false; } inline bool jj_3R_iteration_scheme_2004_1_557() { if (jj_done) return true; if (jj_scan_token(WHILE_T)) return true; if (jj_3R_condition_906_3_100()) return true; return false; } inline bool jj_3R_iteration_scheme_2004_1_466() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_iteration_scheme_2004_1_557()) { jj_scanpos = xsp; if (jj_3R_iteration_scheme_2011_3_558()) return true; } return false; } inline bool jj_3R_anonymous_type_indication_459_2_543() { if (jj_done) return true; if (jj_scan_token(TYPE_T)) return true; if (jj_scan_token(IS_T)) return true; if (jj_3R_incomplete_type_definition_1702_2_651()) return true; return false; } inline bool jj_3R_alias_declaration_407_44_523() { if (jj_done) return true; if (jj_3R_signature_3054_1_472()) return true; return false; } inline bool jj_3R_ifunc_1879_98_650() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_aggregate_400_39_306() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_element_association_1151_1_305()) return true; return false; } inline bool jj_3R_interface_variable_declaration_1971_3_257() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(117)) { jj_scanpos = xsp; if (jj_scan_token(101)) { jj_scanpos = xsp; if (jj_scan_token(31)) { jj_scanpos = xsp; if (jj_scan_token(102)) return true; } } } return false; } inline bool jj_3R_interface_type_indication_1965_8_435() { if (jj_done) return true; if (jj_3R_mode_view_indication_2126_3_544()) return true; return false; } inline bool jj_3R_interface_variable_declaration_1971_1_115() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_interface_variable_declaration_1971_3_257()) jj_scanpos = xsp; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; xsp = jj_scanpos; if (jj_3R_interface_variable_declaration_1972_37_259()) jj_scanpos = xsp; if (jj_3R_subtype_indication_3224_3_71()) return true; xsp = jj_scanpos; if (jj_scan_token(27)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_interface_variable_declaration_1973_49_260()) jj_scanpos = xsp; return false; } inline bool jj_3R_interface_type_indication_1964_8_434() { if (jj_done) return true; if (jj_3R_anonymous_type_indication_459_2_543()) return true; return false; } inline bool jj_3R_allocator_428_6_304() { if (jj_done) return true; if (jj_scan_token(NEW_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_interface_type_indication_1963_6_268() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_interface_type_indication_1963_6_433()) { jj_scanpos = xsp; if (jj_3R_interface_type_indication_1964_8_434()) { jj_scanpos = xsp; if (jj_3R_interface_type_indication_1965_8_435()) return true; } } return false; } inline bool jj_3R_interface_type_indication_1963_6_433() { if (jj_done) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_ifunc_1879_87_542() { if (jj_done) return true; if (jj_scan_token(IS_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_ifunc_1879_98_650()) { jj_scanpos = xsp; if (jj_scan_token(148)) return true; } return false; } inline bool jj_3R_allocator_426_3_140() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_6()) { jj_scanpos = xsp; if (jj_3R_allocator_428_6_304()) return true; } return false; } inline bool jj_3_6() { if (jj_done) return true; if (jj_scan_token(NEW_T)) return true; if (jj_3R_qualified_expression_2657_3_74()) return true; return false; } inline bool jj_3R_interface_signal_declaration_1859_104_270() { if (jj_done) return true; if (jj_scan_token(VARASSIGN_T)) return true; if (jj_3R_conditional_expression_960_3_137()) return true; return false; } inline bool jj_3R_interface_type_declaration_1958_3_119() { if (jj_done) return true; if (jj_3R_interface_incomplete_type_declaration_1937_3_267()) return true; return false; } inline bool jj_3R_alias_designator_421_4_458() { if (jj_done) return true; if (jj_3R_operator_symbol_2232_1_369()) return true; return false; } inline bool jj_3R_alias_designator_420_4_457() { if (jj_done) return true; if (jj_scan_token(CHARACTER_LITERAL)) return true; return false; } inline bool jj_3R_alias_designator_419_2_310() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_alias_designator_419_2_456()) { jj_scanpos = xsp; if (jj_3R_alias_designator_420_4_457()) { jj_scanpos = xsp; if (jj_3R_alias_designator_421_4_458()) return true; } } return false; } inline bool jj_3R_alias_designator_419_2_456() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_alias_declaration_406_4_311() { if (jj_done) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_alias_declaration_405_2_143() { if (jj_done) return true; if (jj_scan_token(ALIAS_T)) return true; if (jj_3R_alias_designator_419_2_310()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_alias_declaration_406_4_311()) jj_scanpos = xsp; if (jj_scan_token(IS_T)) return true; if (jj_3R_name_2142_2_73()) return true; xsp = jj_scanpos; if (jj_3R_alias_declaration_407_44_523()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_interface_incomplete_type_declaration_1937_3_267() { if (jj_done) return true; if (jj_scan_token(TYPE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_actual_designator_360_44_368() { if (jj_done) return true; if (jj_scan_token(INERTIAL_T)) return true; return false; } inline bool jj_3R_aggregate_400_3_141() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_element_association_1151_1_305()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_aggregate_400_39_306()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_adding_operator_394_5_350() { if (jj_done) return true; if (jj_scan_token(MINUS_T)) return true; return false; } inline bool jj_3R_adding_operator_395_4_351() { if (jj_done) return true; if (jj_scan_token(AMPERSAND_T)) return true; return false; } inline bool jj_3_5() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; if (jj_scan_token(LPAREN_T)) return true; return false; } inline bool jj_3R_adding_operator_393_3_168() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_adding_operator_393_3_349()) { jj_scanpos = xsp; if (jj_3R_adding_operator_394_5_350()) { jj_scanpos = xsp; if (jj_3R_adding_operator_395_4_351()) return true; } } return false; } inline bool jj_3R_adding_operator_393_3_349() { if (jj_done) return true; if (jj_scan_token(PLUS_T)) return true; return false; } inline bool jj_3R_wait_statement_3368_97_330() { if (jj_done) return true; if (jj_3R_timeout_clause_3251_1_465()) return true; return false; } inline bool jj_3_75() { if (jj_done) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_4() { if (jj_done) return true; if (jj_3R_actual_designator_358_1_72()) return true; return false; } inline bool jj_3R_actual_part_385_2_614() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_actual_designator_358_1_72()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_actual_part_383_4_613() { if (jj_done) return true; if (jj_scan_token(BOX_T)) return true; return false; } inline bool jj_3R_actual_part_380_2_612() { if (jj_done) return true; if (jj_3R_actual_designator_358_1_72()) return true; return false; } inline bool jj_3R_actual_part_380_2_491() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_actual_part_380_2_612()) { jj_scanpos = xsp; if (jj_3R_actual_part_383_4_613()) { jj_scanpos = xsp; if (jj_3R_actual_part_385_2_614()) return true; } } return false; } inline bool jj_3R_param_1907_5_649() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_interface_list_1836_3_377()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_actual_parameter_part_371_4_297() { if (jj_done) return true; if (jj_3R_association_list_553_1_205()) return true; return false; } inline bool jj_3R_param_1906_3_540() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(77)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_param_1907_5_649()) jj_scanpos = xsp; return false; } inline bool jj_3_2() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(54)) jj_scanpos = xsp; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_interface_constant_declaration_1816_89_269() { if (jj_done) return true; if (jj_scan_token(VARASSIGN_T)) return true; if (jj_3R_conditional_expression_960_3_137()) return true; return false; } inline bool jj_3R_wait_statement_3368_71_329() { if (jj_done) return true; if (jj_3R_condition_clause_917_3_464()) return true; return false; } inline bool jj_3R_actual_designator_364_2_185() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3_3() { if (jj_done) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_actual_designator_360_1_184() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_actual_designator_360_44_368()) jj_scanpos = xsp; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_actual_designator_358_1_183() { if (jj_done) return true; if (jj_scan_token(OPEN_T)) return true; return false; } inline bool jj_3R_actual_designator_358_1_72() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_actual_designator_358_1_183()) { jj_scanpos = xsp; if (jj_3R_actual_designator_360_1_184()) { jj_scanpos = xsp; if (jj_3_3()) { jj_scanpos = xsp; if (jj_3R_actual_designator_364_2_185()) return true; } } } return false; } inline bool jj_3R_variable_declaration_3338_90_520() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; return false; } inline bool jj_3R_access_incomplete_type_definition_352_3_789() { if (jj_done) return true; if (jj_scan_token(ACCESS_T)) return true; if (jj_3R_incomplete_subtype_indication_1696_3_808()) return true; return false; } inline bool jj_3R_access_type_definition_346_3_800() { if (jj_done) return true; if (jj_scan_token(ACCESS_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_ifunc_1879_3_541() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(85)) { jj_scanpos = xsp; if (jj_scan_token(52)) return true; } return false; } inline bool jj_3R_ifunc_1879_2_431() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_ifunc_1879_3_541()) jj_scanpos = xsp; if (jj_scan_token(FUNCTION_T)) return true; if (jj_3R_name_2142_2_73()) return true; if (jj_3R_param_1906_3_540()) return true; if (jj_scan_token(RETURN_T)) return true; if (jj_3R_name_2142_2_73()) return true; xsp = jj_scanpos; if (jj_3R_ifunc_1879_87_542()) jj_scanpos = xsp; return false; } inline bool jj_3R_abstract_literal_340_4_296() { if (jj_done) return true; if (jj_scan_token(BASED_LITERAL)) return true; return false; } inline bool jj_3R_abstract_literal_339_4_295() { if (jj_done) return true; if (jj_scan_token(INTEGER)) return true; return false; } inline bool jj_3R_abstract_literal_338_4_135() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_abstract_literal_338_4_294()) { jj_scanpos = xsp; if (jj_3R_abstract_literal_339_4_295()) { jj_scanpos = xsp; if (jj_3R_abstract_literal_340_4_296()) return true; } } return false; } inline bool jj_3R_abstract_literal_338_4_294() { if (jj_done) return true; if (jj_scan_token(DECIMAL_LITERAL)) return true; return false; } inline bool jj_3_1() { if (jj_done) return true; if (jj_scan_token(DOT_T)) return true; if (jj_3R_pathname_element_list_2378_3_69()) return true; return false; } inline bool jj_3R_wait_statement_3368_43_328() { if (jj_done) return true; if (jj_3R_sensitivity_clause_2840_2_463()) return true; return false; } inline bool jj_3R_iproc_1870_3_430() { if (jj_done) return true; if (jj_scan_token(PROCEDURE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_3R_param_1906_3_540()) return true; return false; } inline bool jj_3R_absolute_pathname_331_3_752() { if (jj_done) return true; if (jj_scan_token(DOT_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_waveform_element_3385_19_671() { if (jj_done) return true; if (jj_scan_token(AFTER_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_interface_subprogram_declaration_1865_4_265() { if (jj_done) return true; if (jj_3R_ifunc_1879_2_431()) return true; return false; } inline bool jj_3R_interface_subprogram_declaration_1864_4_117() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_interface_subprogram_declaration_1864_4_264()) { jj_scanpos = xsp; if (jj_3R_interface_subprogram_declaration_1865_4_265()) return true; } return false; } inline bool jj_3R_interface_subprogram_declaration_1864_4_264() { if (jj_done) return true; if (jj_3R_iproc_1870_3_430()) return true; return false; } inline bool jj_3R_absolute_pathname_329_2_751() { if (jj_done) return true; if (jj_scan_token(DOT_T)) return true; if (jj_3R_pathname_element_list_2378_3_69()) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_absolute_pathname_329_2_681() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_absolute_pathname_329_2_751()) { jj_scanpos = xsp; if (jj_3R_absolute_pathname_331_3_752()) return true; } return false; } inline bool jj_3R_waveform_3377_23_616() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_waveform_element_3385_2_562()) return true; return false; } inline bool jj_3_74() { if (jj_done) return true; if (jj_scan_token(SEMI_T)) return true; if (jj_3R_interface_element_1821_3_122()) return true; return false; } inline bool jj_3R_interface_signal_declaration_1859_2_121() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(101)) jj_scanpos = xsp; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_interface_type_indication_1963_6_268()) return true; xsp = jj_scanpos; if (jj_scan_token(27)) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_interface_signal_declaration_1859_104_270()) jj_scanpos = xsp; return false; } inline bool jj_3R_interface_package_generic_map_aspect_1849_5_432() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; return false; } inline bool jj_3_77() { if (jj_done) return true; if (jj_scan_token(GENERIC_T)) return true; if (jj_scan_token(MAP_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_scan_token(DEFAULT_T)) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_waveform_element_3385_2_562() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_waveform_element_3385_19_671()) jj_scanpos = xsp; return false; } inline bool jj_3_76() { if (jj_done) return true; if (jj_scan_token(GENERIC_T)) return true; if (jj_scan_token(MAP_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_scan_token(BOX_T)) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_interface_package_generic_map_aspect_1847_3_266() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_76()) { jj_scanpos = xsp; if (jj_3_77()) { jj_scanpos = xsp; if (jj_3R_interface_package_generic_map_aspect_1849_5_432()) return true; } } return false; } inline bool jj_3R_waveform_3379_1_495() { if (jj_done) return true; if (jj_scan_token(UNAFFECTED_T)) return true; return false; } inline bool jj_3R_interface_package_declaration_1841_3_118() { if (jj_done) return true; if (jj_scan_token(PACKAGE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(IS_T)) return true; if (jj_scan_token(NEW_T)) return true; if (jj_3R_name_2142_2_73()) return true; if (jj_3R_interface_package_generic_map_aspect_1847_3_266()) return true; return false; } inline bool jj_3R_waveform_3377_1_494() { if (jj_done) return true; if (jj_3R_waveform_element_3385_2_562()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_waveform_3377_23_616()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_waveform_3377_1_382() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_waveform_3377_1_494()) { jj_scanpos = xsp; if (jj_3R_waveform_3379_1_495()) return true; } return false; } inline bool jj_3R_instantiation_unit_1755_86_497() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_interface_list_1836_3_377() { if (jj_done) return true; if (jj_3R_interface_element_1821_3_122()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3_74()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_3_75()) jj_scanpos = xsp; return false; } inline bool jj_3R_wait_statement_3368_3_327() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_wait_statement_3368_1_153() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_wait_statement_3368_3_327()) jj_scanpos = xsp; if (jj_scan_token(WAIT_T)) return true; xsp = jj_scanpos; if (jj_3R_wait_statement_3368_43_328()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_wait_statement_3368_71_329()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_wait_statement_3368_97_330()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_interface_file_declaration_1826_3_429() { if (jj_done) return true; if (jj_scan_token(FILE_T)) return true; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3_73() { if (jj_done) return true; if (jj_3R_interface_signal_declaration_1859_2_121()) return true; return false; } inline bool jj_3_72() { if (jj_done) return true; if (jj_3R_interface_constant_declaration_1816_3_120()) return true; return false; } inline bool jj_3R_interface_element_1821_3_122() { if (jj_done) return true; if (jj_3R_interface_declaration_1778_1_271()) return true; return false; } inline bool jj_3R_interface_object_declaration_1811_9_263() { if (jj_done) return true; if (jj_3R_interface_file_declaration_1826_3_429()) return true; return false; } inline bool jj_3R_interface_constant_declaration_1816_3_120() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(31)) jj_scanpos = xsp; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; xsp = jj_scanpos; if (jj_scan_token(53)) jj_scanpos = xsp; if (jj_3R_interface_type_indication_1963_6_268()) return true; xsp = jj_scanpos; if (jj_3R_interface_constant_declaration_1816_89_269()) jj_scanpos = xsp; return false; } inline bool jj_3R_interface_object_declaration_1809_9_262() { if (jj_done) return true; if (jj_3R_interface_signal_declaration_1859_2_121()) return true; return false; } inline bool jj_3R_interface_object_declaration_1808_7_116() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_interface_object_declaration_1808_7_261()) { jj_scanpos = xsp; if (jj_3R_interface_object_declaration_1809_9_262()) { jj_scanpos = xsp; if (jj_3R_interface_object_declaration_1811_9_263()) return true; } } return false; } inline bool jj_3R_interface_object_declaration_1808_7_261() { if (jj_done) return true; if (jj_3R_interface_constant_declaration_1816_3_120()) return true; return false; } inline bool jj_3R_unconstraint_array_definition_3296_53_889() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_index_subtype_definition_1749_2_863()) return true; return false; } inline bool jj_3R_variable_declaration_3340_3_521() { if (jj_done) return true; if (jj_scan_token(VARASSIGN_T)) return true; if (jj_3R_conditional_expression_960_3_137()) return true; return false; } inline bool jj_3_71() { if (jj_done) return true; if (jj_3R_interface_subprogram_declaration_1864_4_117()) return true; return false; } inline bool jj_3R_variable_declaration_3338_1_420() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(102)) jj_scanpos = xsp; if (jj_scan_token(VARIABLE_T)) return true; if (jj_3R_identifier_list_1663_4_258()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; xsp = jj_scanpos; if (jj_3R_variable_declaration_3338_90_520()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_variable_declaration_3340_3_521()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_variable_assignment_statement_3333_2_555() { if (jj_done) return true; if (jj_3R_selected_variable_assignment_2856_3_666()) return true; return false; } inline bool jj_3R_interface_declaration_1797_2_441() { if (jj_done) return true; if (jj_3R_object_class_2222_1_545()) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3_69() { if (jj_done) return true; if (jj_3R_interface_package_declaration_1841_3_118()) return true; return false; } inline bool jj_3_168() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_variable_assignment_statement_3329_1_554() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_168()) jj_scanpos = xsp; if (jj_3R_target_3239_2_150()) return true; if (jj_scan_token(VARASSIGN_T)) return true; if (jj_3R_conditional_or_unaffected_expression_965_2_560()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_use_clause_3302_28_532() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_selected_name_2823_2_508()) return true; return false; } inline bool jj_3_68() { if (jj_done) return true; if (jj_3R_interface_subprogram_declaration_1864_4_117()) return true; return false; } inline bool jj_3R_interface_declaration_1794_1_440() { if (jj_done) return true; if (jj_3R_interface_subprogram_declaration_1864_4_117()) return true; return false; } inline bool jj_3R_variable_assignment_statement_3329_1_461() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_variable_assignment_statement_3329_1_554()) { jj_scanpos = xsp; if (jj_3R_variable_assignment_statement_3333_2_555()) return true; } return false; } inline bool jj_3_67() { if (jj_done) return true; if (jj_3R_interface_object_declaration_1808_7_116()) return true; return false; } inline bool jj_3_70() { if (jj_done) return true; if (jj_3R_interface_type_declaration_1958_3_119()) return true; return false; } inline bool jj_3_66() { if (jj_done) return true; if (jj_3R_interface_variable_declaration_1971_1_115()) return true; return false; } inline bool jj_3R_interface_declaration_1787_1_439() { if (jj_done) return true; if (jj_3R_interface_package_declaration_1841_3_118()) return true; return false; } inline bool jj_3R_interface_declaration_1784_1_438() { if (jj_done) return true; if (jj_3R_interface_subprogram_declaration_1864_4_117()) return true; return false; } inline bool jj_3_163() { if (jj_done) return true; if (jj_3R_constraint_1051_5_173()) return true; return false; } inline bool jj_3R_interface_declaration_1781_2_437() { if (jj_done) return true; if (jj_3R_interface_object_declaration_1808_7_116()) return true; return false; } inline bool jj_3R_interface_declaration_1778_1_271() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_interface_declaration_1778_1_436()) { jj_scanpos = xsp; if (jj_3R_interface_declaration_1781_2_437()) { jj_scanpos = xsp; if (jj_3R_interface_declaration_1784_1_438()) { jj_scanpos = xsp; if (jj_3R_interface_declaration_1787_1_439()) { jj_scanpos = xsp; if (jj_3_70()) { jj_scanpos = xsp; if (jj_3R_interface_declaration_1794_1_440()) { jj_scanpos = xsp; if (jj_3R_interface_declaration_1797_2_441()) return true; } } } } } } return false; } inline bool jj_3R_interface_declaration_1778_1_436() { if (jj_done) return true; if (jj_3R_interface_variable_declaration_1971_1_115()) return true; return false; } inline bool jj_3R_index_constraint_1735_42_190() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_discrete_range_1136_3_87()) return true; return false; } inline bool jj_3_158() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; return false; } inline bool jj_3R_subtype_indication_3224_85_182() { if (jj_done) return true; if (jj_3R_constraint_1051_5_173()) return true; return false; } inline bool jj_3_65() { if (jj_done) return true; if (jj_scan_token(BASIC_IDENTIFIER)) return true; if (jj_scan_token(DOT_T)) return true; return false; } inline bool jj_3R_protected_type_instantiation_definition_3285_20_816() { if (jj_done) return true; if (jj_3R_generic_map_aspect_1620_6_88()) return true; return false; } inline bool jj_3R_use_clause_3302_2_400() { if (jj_done) return true; if (jj_scan_token(USE_T)) return true; if (jj_3R_selected_name_2823_2_508()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_use_clause_3302_28_532()) { jj_scanpos = xsp; break; } } if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_instantiation_list_1763_3_501() { if (jj_done) return true; if (jj_scan_token(ALL_T)) return true; return false; } inline bool jj_3R_instantiation_list_1762_3_500() { if (jj_done) return true; if (jj_scan_token(OTHER_T)) return true; return false; } inline bool jj_3R_instantiation_list_1761_3_499() { if (jj_done) return true; if (jj_3R_identifier_list_1663_4_258()) return true; return false; } inline bool jj_3R_instantiation_list_1761_3_396() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_instantiation_list_1761_3_499()) { jj_scanpos = xsp; if (jj_3R_instantiation_list_1762_3_500()) { jj_scanpos = xsp; if (jj_3R_instantiation_list_1763_3_501()) return true; } } return false; } inline bool jj_3R_unconstraint_array_definition_3296_1_867() { if (jj_done) return true; if (jj_scan_token(ARRAY_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_index_subtype_definition_1749_2_863()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_unconstraint_array_definition_3296_53_889()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RPAREN_T)) return true; if (jj_scan_token(OF_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_instantiation_unit_1756_3_391() { if (jj_done) return true; if (jj_scan_token(CONFIGURATION_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_type_mark_3291_3_195() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_instantiation_unit_1755_3_390() { if (jj_done) return true; if (jj_scan_token(ENTITY_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_65()) jj_scanpos = xsp; if (jj_3R_name_2142_2_73()) return true; xsp = jj_scanpos; if (jj_3R_instantiation_unit_1755_86_497()) jj_scanpos = xsp; return false; } inline bool jj_3R_subprogram_specification_3174_118_662() { if (jj_done) return true; if (jj_3R_subprogram_header_3155_6_738()) return true; return false; } inline bool jj_3R_instantiation_unit_1754_1_215() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_instantiation_unit_1754_1_389()) { jj_scanpos = xsp; if (jj_3R_instantiation_unit_1755_3_390()) { jj_scanpos = xsp; if (jj_3R_instantiation_unit_1756_3_391()) return true; } } return false; } inline bool jj_3R_instantiation_unit_1754_1_389() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(28)) jj_scanpos = xsp; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_protected_type_instantiation_definition_3285_3_802() { if (jj_done) return true; if (jj_scan_token(NEW_T)) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_protected_type_instantiation_definition_3285_20_816()) jj_scanpos = xsp; return false; } inline bool jj_3_64() { if (jj_done) return true; if (jj_3R_discrete_range_1136_3_87()) return true; return false; } inline bool jj_3R_index_subtype_definition_1749_2_863() { if (jj_done) return true; if (jj_3R_type_mark_3291_3_195()) return true; if (jj_scan_token(RANGE_T)) return true; if (jj_scan_token(BOX_T)) return true; return false; } inline bool jj_3_162() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_type_definition_3279_3_766() { if (jj_done) return true; if (jj_3R_protected_type_declaration_2624_4_803()) return true; return false; } inline bool jj_3R_index_specification_1742_3_757() { if (jj_done) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3_167() { if (jj_done) return true; if (jj_3R_protected_type_body_2584_4_177()) return true; return false; } inline bool jj_3R_type_definition_3275_3_765() { if (jj_done) return true; if (jj_3R_protected_type_instantiation_definition_3285_3_802()) return true; return false; } inline bool jj_3R_type_definition_3274_3_764() { if (jj_done) return true; if (jj_3R_file_type_definition_1464_2_801()) return true; return false; } inline bool jj_3R_index_specification_1740_2_756() { if (jj_done) return true; if (jj_3R_discrete_range_1136_3_87()) return true; return false; } inline bool jj_3R_index_specification_1740_2_687() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_index_specification_1740_2_756()) { jj_scanpos = xsp; if (jj_3R_index_specification_1742_3_757()) return true; } return false; } inline bool jj_3R_subprogram_instantiation_declaration_3202_75_353() { if (jj_done) return true; if (jj_3R_gen_assoc_list_1544_4_172()) return true; return false; } inline bool jj_3R_type_definition_3273_3_763() { if (jj_done) return true; if (jj_3R_access_type_definition_346_3_800()) return true; return false; } inline bool jj_3R_type_definition_3272_3_762() { if (jj_done) return true; if (jj_3R_composite_type_definition_825_2_799()) return true; return false; } inline bool jj_3R_index_constraint_1735_3_75() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_discrete_range_1136_3_87()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_index_constraint_1735_42_190()) { jj_scanpos = xsp; break; } } if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_type_definition_3271_1_761() { if (jj_done) return true; if (jj_3R_scalar_type_definition_2794_1_798()) return true; return false; } inline bool jj_3R_type_definition_3271_1_691() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_type_definition_3271_1_761()) { jj_scanpos = xsp; if (jj_3R_type_definition_3272_3_762()) { jj_scanpos = xsp; if (jj_3R_type_definition_3273_3_763()) { jj_scanpos = xsp; if (jj_3R_type_definition_3274_3_764()) { jj_scanpos = xsp; if (jj_3R_type_definition_3275_3_765()) { jj_scanpos = xsp; if (jj_3_167()) { jj_scanpos = xsp; if (jj_3R_type_definition_3279_3_766()) return true; } } } } } } return false; } inline bool jj_3R_if_statement_1687_47_758() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; return false; } inline bool jj_3R_type_declaration_3266_3_514() { if (jj_done) return true; if (jj_3R_incomplete_type_declaration_1727_3_636()) return true; return false; } inline bool jj_3R_incomplete_type_declaration_1727_3_636() { if (jj_done) return true; if (jj_scan_token(TYPE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_166() { if (jj_done) return true; if (jj_3R_full_type_declaration_1501_3_176()) return true; return false; } inline bool jj_3R_type_declaration_3264_1_415() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_166()) { jj_scanpos = xsp; if (jj_3R_type_declaration_3266_3_514()) return true; } return false; } inline bool jj_3_62() { if (jj_done) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_type_conversion_3259_3_138() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3_165() { if (jj_done) return true; if (jj_3R_multiplying_operation_2133_1_174()) return true; if (jj_3R_factor_1433_1_175()) return true; return false; } inline bool jj_3R_integer_incomplete_type_definition_1722_3_787() { if (jj_done) return true; if (jj_scan_token(RANGE_T)) return true; if (jj_scan_token(BOX_T)) return true; return false; } inline bool jj_3R_subprogram_instantiation_declaration_3202_58_352() { if (jj_done) return true; if (jj_3R_signature_3054_1_472()) return true; return false; } inline bool jj_3R_timeout_clause_3251_1_465() { if (jj_done) return true; if (jj_scan_token(FOR_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_incomplete_type_definition_1710_5_734() { if (jj_done) return true; if (jj_3R_file_incomplete_type_definition_1469_2_790()) return true; return false; } inline bool jj_3R_incomplete_type_definition_1709_5_733() { if (jj_done) return true; if (jj_3R_access_incomplete_type_definition_352_3_789()) return true; return false; } inline bool jj_3R_incomplete_type_definition_1708_5_732() { if (jj_done) return true; if (jj_3R_array_incomplete_type_definition_492_3_788()) return true; return false; } inline bool jj_3R_simpleTerm_3246_2_169() { if (jj_done) return true; if (jj_3R_factor_1433_1_175()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3_165()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_incomplete_type_definition_1707_5_731() { if (jj_done) return true; if (jj_3R_integer_incomplete_type_definition_1722_3_787()) return true; return false; } inline bool jj_3_63() { if (jj_done) return true; if (jj_3R_floating_incomplete_type_definition_1474_4_114()) return true; return false; } inline bool jj_3R_incomplete_type_definition_1705_5_730() { if (jj_done) return true; if (jj_3R_physical_incomplete_type_definition_2409_5_786()) return true; return false; } inline bool jj_3R_incomplete_type_definition_1704_5_729() { if (jj_done) return true; if (jj_3R_discrete_incomplete_type_definition_1121_2_785()) return true; return false; } inline bool jj_3R_incomplete_type_definition_1703_5_728() { if (jj_done) return true; if (jj_scan_token(148)) return true; return false; } inline bool jj_3R_target_3240_3_323() { if (jj_done) return true; if (jj_3R_aggregate_400_3_141()) return true; return false; } inline bool jj_3R_target_3239_2_150() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_target_3239_2_322()) { jj_scanpos = xsp; if (jj_3R_target_3240_3_323()) return true; } return false; } inline bool jj_3_164() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_target_3239_2_322() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_incomplete_type_definition_1702_2_727() { if (jj_done) return true; if (jj_3R_private_incomplete_type_definition_2476_3_784()) return true; return false; } inline bool jj_3R_incomplete_type_definition_1702_2_651() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_incomplete_type_definition_1702_2_727()) { jj_scanpos = xsp; if (jj_3R_incomplete_type_definition_1703_5_728()) { jj_scanpos = xsp; if (jj_3R_incomplete_type_definition_1704_5_729()) { jj_scanpos = xsp; if (jj_3R_incomplete_type_definition_1705_5_730()) { jj_scanpos = xsp; if (jj_3_63()) { jj_scanpos = xsp; if (jj_3R_incomplete_type_definition_1707_5_731()) { jj_scanpos = xsp; if (jj_3R_incomplete_type_definition_1708_5_732()) { jj_scanpos = xsp; if (jj_3R_incomplete_type_definition_1709_5_733()) { jj_scanpos = xsp; if (jj_3R_incomplete_type_definition_1710_5_734()) return true; } } } } } } } } return false; } inline bool jj_3R_incomplete_subtype_indication_1697_5_828() { if (jj_done) return true; if (jj_3R_anonymous_type_indication_459_2_543()) return true; return false; } inline bool jj_3R_suffix_3234_3_290() { if (jj_done) return true; if (jj_scan_token(ALL_T)) return true; return false; } inline bool jj_3R_suffix_3233_3_289() { if (jj_done) return true; if (jj_3R_operator_symbol_2232_1_369()) return true; return false; } inline bool jj_3R_suffix_3232_3_288() { if (jj_done) return true; if (jj_3R_character_literal_754_3_445()) return true; return false; } inline bool jj_3R_incomplete_subtype_indication_1696_3_827() { if (jj_done) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; return false; } inline bool jj_3R_incomplete_subtype_indication_1696_3_808() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_incomplete_subtype_indication_1696_3_827()) { jj_scanpos = xsp; if (jj_3R_incomplete_subtype_indication_1697_5_828()) return true; } return false; } inline bool jj_3R_suffix_3230_1_130() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_suffix_3230_1_287()) { jj_scanpos = xsp; if (jj_3R_suffix_3232_3_288()) { jj_scanpos = xsp; if (jj_3R_suffix_3233_3_289()) { jj_scanpos = xsp; if (jj_3R_suffix_3234_3_290()) return true; } } } return false; } inline bool jj_3R_suffix_3230_1_287() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_subtype_indication_3224_4_181() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_subtype_indication_3224_3_71() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subtype_indication_3224_4_181()) jj_scanpos = xsp; if (jj_3_162()) return true; while (true) { xsp = jj_scanpos; if (jj_3_162()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_3R_subtype_indication_3224_85_182()) jj_scanpos = xsp; return false; } inline bool jj_3R_if_statement_1683_6_747() { if (jj_done) return true; if (jj_scan_token(ELSE_T)) return true; if (jj_3R_sequence_of_statements_2902_2_334()) return true; return false; } inline bool jj_3R_if_statement_1676_6_746() { if (jj_done) return true; if (jj_scan_token(ELSIF_T)) return true; if (jj_3R_condition_906_3_100()) return true; if (jj_scan_token(THEN_T)) return true; if (jj_3R_sequence_of_statements_2902_2_334()) return true; return false; } inline bool jj_3R_identifier_list_1663_16_427() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_subtype_declaration_3213_1_416() { if (jj_done) return true; if (jj_scan_token(SUBTYPE_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(IS_T)) return true; if (jj_3R_subtype_indication_3224_3_71()) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_if_statement_1668_4_331() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_if_statement_1668_3_156() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_if_statement_1668_4_331()) jj_scanpos = xsp; if (jj_scan_token(IF_T)) return true; if (jj_3R_condition_906_3_100()) return true; if (jj_scan_token(THEN_T)) return true; if (jj_3R_sequence_of_statements_2902_2_334()) return true; while (true) { xsp = jj_scanpos; if (jj_3R_if_statement_1676_6_746()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_3R_if_statement_1683_6_747()) jj_scanpos = xsp; if (jj_scan_token(END_T)) return true; if (jj_scan_token(IF_T)) return true; xsp = jj_scanpos; if (jj_3R_if_statement_1687_47_758()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_161() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(OF_T)) return true; return false; } inline bool jj_3R_subprogram_instantiation_declaration_3202_2_170() { if (jj_done) return true; if (jj_scan_token(FUNCTION_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(IS_T)) return true; if (jj_scan_token(NEW_T)) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subprogram_instantiation_declaration_3202_58_352()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_subprogram_instantiation_declaration_3202_75_353()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_identifier_list_1663_4_258() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_identifier_list_1663_16_427()) { jj_scanpos = xsp; break; } } xsp = jj_scanpos; if (jj_3_62()) jj_scanpos = xsp; return false; } inline bool jj_3R_subprogram_statement_part_3197_4_793() { if (jj_done) return true; if (jj_3R_sequential_statement_2907_5_148()) return true; return false; } inline bool jj_3R_subprogram_statement_part_3197_3_741() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_subprogram_statement_part_3197_4_793()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_identifier_1658_4_198() { if (jj_done) return true; if (jj_scan_token(BASIC_IDENTIFIER)) return true; return false; } inline bool jj_3R_identifier_1657_3_82() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_identifier_1657_3_197()) { jj_scanpos = xsp; if (jj_3R_identifier_1658_4_198()) return true; } return false; } inline bool jj_3R_identifier_1657_3_197() { if (jj_done) return true; if (jj_scan_token(EXTENDED_CHARACTER)) return true; return false; } inline bool jj_3R_group_constituent_list_1631_28_648() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_group_constituent_1625_2_647()) return true; return false; } inline bool jj_3R_subprogram_specification_3186_3_663() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(77)) jj_scanpos = xsp; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_formal_parameter_list_1491_2_739()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_group_template_declaration_1644_2_80() { if (jj_done) return true; if (jj_scan_token(GROUP_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(IS_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_entity_class_entry_list_1245_2_533()) return true; if (jj_scan_token(RPAREN_T)) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_subprogram_specification_3174_4_661() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(85)) { jj_scanpos = xsp; if (jj_scan_token(52)) return true; } return false; } inline bool jj_3R_subprogram_specification_3174_2_549() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subprogram_specification_3174_4_661()) jj_scanpos = xsp; if (jj_scan_token(FUNCTION_T)) return true; if (jj_3R_designator_1109_2_659()) return true; xsp = jj_scanpos; if (jj_3R_subprogram_specification_3174_118_662()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_subprogram_specification_3186_3_663()) jj_scanpos = xsp; if (jj_scan_token(RETURN_T)) return true; xsp = jj_scanpos; if (jj_3_161()) jj_scanpos = xsp; if (jj_3R_type_mark_3291_3_195()) return true; return false; } inline bool jj_3_160() { if (jj_done) return true; if (jj_3R_gen_assoc_list_1544_4_172()) return true; return false; } inline bool jj_3R_group_declaration_1636_3_426() { if (jj_done) return true; if (jj_scan_token(GROUP_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_group_constituent_list_1631_3_534()) return true; if (jj_scan_token(RPAREN_T)) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3_159() { if (jj_done) return true; if (jj_3R_gen_interface_list_1549_4_171()) return true; return false; } inline bool jj_3R_subprogram_specification_3168_5_660() { if (jj_done) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_interface_list_1836_3_377()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_group_constituent_list_1631_3_534() { if (jj_done) return true; if (jj_3R_group_constituent_1625_2_647()) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_group_constituent_list_1631_28_648()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_group_constituent_1626_4_726() { if (jj_done) return true; if (jj_3R_character_literal_754_3_445()) return true; return false; } inline bool jj_3R_group_constituent_1625_2_725() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_group_constituent_1625_2_647() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_group_constituent_1625_2_725()) { jj_scanpos = xsp; if (jj_3R_group_constituent_1626_4_726()) return true; } return false; } inline bool jj_3R_subprogram_specification_3160_2_548() { if (jj_done) return true; if (jj_scan_token(PROCEDURE_T)) return true; if (jj_3R_designator_1109_2_659()) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subprogram_specification_3168_5_660()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3_159()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3_160()) jj_scanpos = xsp; if (jj_3R_param_1906_3_540()) return true; return false; } inline bool jj_3R_subprogram_specification_3160_2_454() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subprogram_specification_3160_2_548()) { jj_scanpos = xsp; if (jj_3R_subprogram_specification_3174_2_549()) return true; } return false; } inline bool jj_3R_subprogram_header_3155_6_738() { if (jj_done) return true; if (jj_scan_token(GENERIC_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_generic_list_1615_2_196()) return true; if (jj_scan_token(RPAREN_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3_158()) jj_scanpos = xsp; return false; } inline bool jj_3R_generic_map_aspect_1620_6_88() { if (jj_done) return true; if (jj_scan_token(GENERIC_T)) return true; if (jj_scan_token(MAP_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_association_list_553_1_205()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_generic_list_1615_2_196() { if (jj_done) return true; if (jj_3R_interface_list_1836_3_377()) return true; return false; } inline bool jj_3R_subprogram_kind_3149_2_794() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_scan_token(46)) { jj_scanpos = xsp; if (jj_scan_token(81)) return true; } return false; } inline bool jj_3_61() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_subprogram_declarative_part_3144_4_792() { if (jj_done) return true; if (jj_3R_subprogram_declarative_item_3123_1_809()) return true; return false; } inline bool jj_3R_subprogram_declarative_part_3144_3_740() { if (jj_done) return true; Token * xsp; while (true) { xsp = jj_scanpos; if (jj_3R_subprogram_declarative_part_3144_4_792()) { jj_scanpos = xsp; break; } } return false; } inline bool jj_3R_generic_clause_1610_2_81() { if (jj_done) return true; if (jj_scan_token(GENERIC_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_generic_list_1615_2_196()) return true; if (jj_scan_token(RPAREN_T)) return true; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_generate_scheme_1605_3_387() { if (jj_done) return true; if (jj_scan_token(IF_T)) return true; return false; } inline bool jj_3_156() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3139_3_840() { if (jj_done) return true; if (jj_3R_group_declaration_1636_3_426()) return true; return false; } inline bool jj_3R_generate_scheme_1604_1_210() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_generate_scheme_1604_1_386()) { jj_scanpos = xsp; if (jj_3R_generate_scheme_1605_3_387()) return true; } return false; } inline bool jj_3R_generate_scheme_1604_1_386() { if (jj_done) return true; if (jj_scan_token(FOR_T)) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3135_3_839() { if (jj_done) return true; if (jj_3R_use_clause_3302_2_400()) return true; return false; } inline bool jj_3_157() { if (jj_done) return true; if (jj_3R_group_template_declaration_1644_2_80()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3134_3_838() { if (jj_done) return true; if (jj_3R_attribute_specification_580_3_423()) return true; return false; } inline bool jj_3_60() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3132_1_837() { if (jj_done) return true; if (jj_3R_attribute_declaration_558_2_79()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3130_3_836() { if (jj_done) return true; if (jj_3R_alias_declaration_405_2_143()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3129_3_835() { if (jj_done) return true; if (jj_3R_file_declaration_1443_2_421()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3128_3_834() { if (jj_done) return true; if (jj_3R_variable_declaration_3338_1_420()) return true; return false; } inline bool jj_3R_subprogram_body_3098_33_743() { if (jj_done) return true; if (jj_3R_designator_1109_2_659()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3127_3_833() { if (jj_done) return true; if (jj_3R_constant_declaration_1026_4_418()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3126_3_832() { if (jj_done) return true; if (jj_3R_subtype_declaration_3213_1_416()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3125_4_831() { if (jj_done) return true; if (jj_3R_subprogram_body_3085_1_664()) return true; return false; } inline bool jj_3R_generate_statement_1592_1_93() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; if (jj_3R_generate_scheme_1604_1_210()) return true; return false; } inline bool jj_3_59() { if (jj_done) return true; if (jj_3R_identifier_1657_3_82()) return true; if (jj_scan_token(COLON_T)) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3124_2_830() { if (jj_done) return true; if (jj_3R_type_declaration_3264_1_415()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3123_1_829() { if (jj_done) return true; if (jj_3R_subprogram_declaration_3108_1_142()) return true; return false; } inline bool jj_3R_subprogram_declarative_item_3123_1_809() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subprogram_declarative_item_3123_1_829()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3124_2_830()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3125_4_831()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3126_3_832()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3127_3_833()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3128_3_834()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3129_3_835()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3130_3_836()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3132_1_837()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3134_3_838()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3135_3_839()) { jj_scanpos = xsp; if (jj_3_157()) { jj_scanpos = xsp; if (jj_3R_subprogram_declarative_item_3139_3_840()) return true; } } } } } } } } } } } } return false; } inline bool jj_3_58() { if (jj_done) return true; if (jj_3R_block_declarative_item_648_3_113()) return true; return false; } inline bool jj_3R_subprogram_1_3117_2_550() { if (jj_done) return true; if (jj_3R_subprogram_body_3085_1_664()) return true; return false; } inline bool jj_3_155() { if (jj_done) return true; if (jj_3R_subprogram_instantiation_declaration_3202_2_170()) return true; return false; } inline bool jj_3R_subprogram_1_3117_2_455() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subprogram_1_3117_2_550()) { jj_scanpos = xsp; if (jj_scan_token(139)) return true; } return false; } inline bool jj_3_154() { if (jj_done) return true; if (jj_3R_adding_operator_393_3_168()) return true; if (jj_3R_simpleTerm_3246_2_169()) return true; return false; } inline bool jj_3R_sequential_bock_statement_2954_159_795() { if (jj_done) return true; if (jj_3R_label_2022_2_84()) return true; return false; } inline bool jj_3R_subprogram_declaration_3111_1_309() { if (jj_done) return true; if (jj_3R_subprogram_specification_3160_2_454()) return true; if (jj_3R_subprogram_1_3117_2_455()) return true; return false; } inline bool jj_3R_signal_declaration_3022_89_519() { if (jj_done) return true; if (jj_scan_token(VARASSIGN_T)) return true; if (jj_3R_expression_1380_20_70()) return true; return false; } inline bool jj_3R_subprogram_body_3098_11_742() { if (jj_done) return true; if (jj_3R_subprogram_kind_3149_2_794()) return true; return false; } inline bool jj_3R_subprogram_declaration_3108_1_142() { if (jj_done) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subprogram_declaration_3108_1_308()) { jj_scanpos = xsp; if (jj_3R_subprogram_declaration_3111_1_309()) return true; } return false; } inline bool jj_3R_subprogram_declaration_3108_1_308() { if (jj_done) return true; if (jj_3R_subprogram_instantiation_declaration_3202_2_170()) return true; return false; } inline bool jj_3R_simple_expression_3063_41_200() { if (jj_done) return true; if (jj_3R_adding_operator_393_3_168()) return true; if (jj_3R_simpleTerm_3246_2_169()) return true; return false; } inline bool jj_3R_signal_declaration_3022_68_518() { if (jj_done) return true; if (jj_3R_signal_kind_3033_3_638()) return true; return false; } inline bool jj_3R_gen_interface_list_1549_4_171() { if (jj_done) return true; if (jj_scan_token(GENERIC_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_interface_list_1836_3_377()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_subprogram_body_3085_1_664() { if (jj_done) return true; if (jj_scan_token(IS_T)) return true; if (jj_3R_subprogram_declarative_part_3144_3_740()) return true; if (jj_scan_token(BEGIN_T)) return true; if (jj_3R_subprogram_statement_part_3197_3_741()) return true; if (jj_scan_token(END_T)) return true; Token * xsp; xsp = jj_scanpos; if (jj_3R_subprogram_body_3098_11_742()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_subprogram_body_3098_33_743()) jj_scanpos = xsp; if (jj_scan_token(SEMI_T)) return true; return false; } inline bool jj_3R_gen_assoc_list_1544_4_172() { if (jj_done) return true; if (jj_scan_token(GENERIC_T)) return true; if (jj_scan_token(MAP_T)) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_association_list_553_1_205()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } inline bool jj_3R_string_literal_3078_1_452() { if (jj_done) return true; if (jj_scan_token(STRINGLITERAL)) return true; return false; } inline bool jj_3R_sequential_bock_statement_2952_124_165() { if (jj_done) return true; if (jj_3R_label_2022_2_84()) return true; return false; } inline bool jj_3R_signature_3055_15_674() { if (jj_done) return true; if (jj_scan_token(COMMA_T)) return true; if (jj_3R_name_2142_2_73()) return true; return false; } inline bool jj_3R_function_call_1534_1_136() { if (jj_done) return true; if (jj_3R_name_2142_2_73()) return true; if (jj_scan_token(LPAREN_T)) return true; if (jj_3R_actual_parameter_part_371_4_297()) return true; if (jj_scan_token(RPAREN_T)) return true; return false; } public: void setErrorHandler(ErrorHandler *eh) { if (errorHandler) delete errorHandler; errorHandler = eh; } TokenManager *token_source = nullptr; CharStream *jj_input_stream = nullptr; /** Current token. */ Token *token = nullptr; /** Next token. */ Token *jj_nt = nullptr; private: int jj_ntk; JJCalls jj_2_rtns[169]; bool jj_rescan; int jj_gc; Token *jj_scanpos, *jj_lastpos; int jj_la; /** Whether we are looking ahead. */ bool jj_lookingAhead; bool jj_semLA; int jj_gen; int jj_la1[388]; ErrorHandler *errorHandler = nullptr; protected: bool hasError; Token *head; public: VhdlParser(TokenManager *tokenManager); virtual ~VhdlParser(); void ReInit(TokenManager* tokenManager); void clear(); Token * jj_consume_token(int kind); bool jj_scan_token(int kind); Token * getNextToken(); Token * getToken(int index); int jj_ntk_f(); private: int jj_kind; int **jj_expentries; int *jj_expentry; void jj_add_error_token(int kind, int pos); protected: /** Generate ParseException. */ virtual void parseError(); private: int indent; // trace indentation bool trace = false; // trace enabled if true public: bool trace_enabled(); void enable_tracing(); void disable_tracing(); void jj_rescan_token(); void jj_save(int index, int xla); struct SharedState { std::shared_ptr<Entry> current_root; std::shared_ptr<Entry> tempEntry; std::shared_ptr<Entry> lastEntity; std::shared_ptr<Entry> lastCompound; std::shared_ptr<Entry> current; QCString compSpec; QCString currName; int levelCounter = 0; QCString confName; QCString genLabels; QCString lab; VhdlSection param_sec = VhdlSection::UNKNOWN; VhdlSection parse_sec = VhdlSection::UNKNOWN; VhdlSpecifier currP = VhdlSpecifier::UNKNOWN; bool interf_sec; bool generic_sec; }; VHDLOutlineParser *m_outlineParser; SharedState *m_sharedState; void setOutlineParser(VHDLOutlineParser* p) { m_outlineParser=p; } VHDLOutlineParser *outlineParser() const { return m_outlineParser; } void setSharedState(SharedState *s) { m_sharedState=s; } void clearError() { hasError = false; } bool checkListTok() { return (getToken(1)->kind==SEMI_T) && (getToken(2)->kind==RPAREN_T); } bool checkNextTok(int kind) { return getToken(1)->kind==kind; } Token* _getPrevTok() { return getToken(0); } private: bool jj_done; }; } } #endif
278,318
C++
.h
10,051
23.693762
96
0.647333
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,537
VhdlParserConstants.h
doxygen_doxygen/vhdlparser/VhdlParserConstants.h
/* Generated By:JavaCC: Do not edit this line. VhdlParserConstants.java */ /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGenCPP#start() */ #ifndef VHDLPARSERCONSTANTS_H #define VHDLPARSERCONSTANTS_H #include "JavaCC.h" namespace vhdl { namespace parser { /** End of File. */ const int _EOF = 0; /** RegularExpression Id. */ const int DOXYGEN_VHDL_COMMENT = 5; /** RegularExpression Id. */ const int MULT_DOXYGEN_COMMENT = 6; /** RegularExpression Id. */ const int VHDL_FLOWCHART_COMMENT = 7; /** RegularExpression Id. */ const int VHDL_COMMENT = 8; /** RegularExpression Id. */ const int MULT_DOXYGEN_VHDL_COMMENT_2008 = 9; /** RegularExpression Id. */ const int MULT_VHDL_2008_COMMENT = 10; /** RegularExpression Id. */ const int ABS_T = 11; /** RegularExpression Id. */ const int ACCESS_T = 12; /** RegularExpression Id. */ const int AFTER_T = 13; /** RegularExpression Id. */ const int ALIAS_T = 14; /** RegularExpression Id. */ const int ALL_T = 15; /** RegularExpression Id. */ const int AND_T = 16; /** RegularExpression Id. */ const int ARCHITECTURE_T = 17; /** RegularExpression Id. */ const int ARRAY_T = 18; /** RegularExpression Id. */ const int ASSERT_T = 19; /** RegularExpression Id. */ const int ASSUME_T = 20; /** RegularExpression Id. */ const int ASSUME_GUARANTEE_T = 21; /** RegularExpression Id. */ const int ATTRIBUTE_T = 22; /** RegularExpression Id. */ const int BEGIN_T = 23; /** RegularExpression Id. */ const int BLOCK_T = 24; /** RegularExpression Id. */ const int BODY_T = 25; /** RegularExpression Id. */ const int BUFFER_T = 26; /** RegularExpression Id. */ const int BUS_T = 27; /** RegularExpression Id. */ const int COMPONENT_T = 28; /** RegularExpression Id. */ const int CASE_T = 29; /** RegularExpression Id. */ const int CONFIGURATION_T = 30; /** RegularExpression Id. */ const int CONSTANT_T = 31; /** RegularExpression Id. */ const int CONTEXT_T = 32; /** RegularExpression Id. */ const int COVER_T = 33; /** RegularExpression Id. */ const int DEFAULT_T = 34; /** RegularExpression Id. */ const int DISCONNECT_T = 35; /** RegularExpression Id. */ const int DOWNTO_T = 36; /** RegularExpression Id. */ const int ELSE_T = 37; /** RegularExpression Id. */ const int ELSIF_T = 38; /** RegularExpression Id. */ const int END_T = 39; /** RegularExpression Id. */ const int ENTITY_T = 40; /** RegularExpression Id. */ const int EXIT_T = 41; /** RegularExpression Id. */ const int FAIRNESS_T = 42; /** RegularExpression Id. */ const int FILE_T = 43; /** RegularExpression Id. */ const int FOR_T = 44; /** RegularExpression Id. */ const int FORCE_T = 45; /** RegularExpression Id. */ const int FUNCTION_T = 46; /** RegularExpression Id. */ const int GENERATE_T = 47; /** RegularExpression Id. */ const int GENERIC_T = 48; /** RegularExpression Id. */ const int GROUP_T = 49; /** RegularExpression Id. */ const int GUARDED_T = 50; /** RegularExpression Id. */ const int IF_T = 51; /** RegularExpression Id. */ const int IMPURE_T = 52; /** RegularExpression Id. */ const int IN_T = 53; /** RegularExpression Id. */ const int INERTIAL_T = 54; /** RegularExpression Id. */ const int INOUT_T = 55; /** RegularExpression Id. */ const int IS_T = 56; /** RegularExpression Id. */ const int LABEL_T = 57; /** RegularExpression Id. */ const int LIBRARY_T = 58; /** RegularExpression Id. */ const int LINKAGE_T = 59; /** RegularExpression Id. */ const int LITERAL_T = 60; /** RegularExpression Id. */ const int LOOP_T = 61; /** RegularExpression Id. */ const int MAP_T = 62; /** RegularExpression Id. */ const int MOD_T = 63; /** RegularExpression Id. */ const int NAND_T = 64; /** RegularExpression Id. */ const int NEW_T = 65; /** RegularExpression Id. */ const int NEXT_T = 66; /** RegularExpression Id. */ const int NOR_T = 67; /** RegularExpression Id. */ const int NOT_T = 68; /** RegularExpression Id. */ const int NULL_T = 69; /** RegularExpression Id. */ const int OF_T = 70; /** RegularExpression Id. */ const int ON_T = 71; /** RegularExpression Id. */ const int OPEN_T = 72; /** RegularExpression Id. */ const int OR_T = 73; /** RegularExpression Id. */ const int OTHER_T = 74; /** RegularExpression Id. */ const int OUT_T = 75; /** RegularExpression Id. */ const int PACKAGE_T = 76; /** RegularExpression Id. */ const int PARAMETER_T = 77; /** RegularExpression Id. */ const int PORT_T = 78; /** RegularExpression Id. */ const int POSTPONED_T = 79; /** RegularExpression Id. */ const int PRIVATE_T = 80; /** RegularExpression Id. */ const int PROCEDURE_T = 81; /** RegularExpression Id. */ const int PROCESS_T = 82; /** RegularExpression Id. */ const int PROPERTY_T = 83; /** RegularExpression Id. */ const int PROTECTED_T = 84; /** RegularExpression Id. */ const int PURE_T = 85; /** RegularExpression Id. */ const int RANGE_T = 86; /** RegularExpression Id. */ const int RECORD_T = 87; /** RegularExpression Id. */ const int REGISTER_T = 88; /** RegularExpression Id. */ const int REJECT_T = 89; /** RegularExpression Id. */ const int RELEASE_T = 90; /** RegularExpression Id. */ const int RESTRICT_T = 91; /** RegularExpression Id. */ const int RESTRICT_GUARANTEE_T = 92; /** RegularExpression Id. */ const int REM_T = 93; /** RegularExpression Id. */ const int REPORT_T = 94; /** RegularExpression Id. */ const int ROL_T = 95; /** RegularExpression Id. */ const int ROR_T = 96; /** RegularExpression Id. */ const int RETURN_T = 97; /** RegularExpression Id. */ const int SELECT_T = 98; /** RegularExpression Id. */ const int SEQUENCE_T = 99; /** RegularExpression Id. */ const int SEVERITY_T = 100; /** RegularExpression Id. */ const int SIGNAL_T = 101; /** RegularExpression Id. */ const int SHARED_T = 102; /** RegularExpression Id. */ const int SLA_T = 103; /** RegularExpression Id. */ const int SLL_T = 104; /** RegularExpression Id. */ const int SRA_T = 105; /** RegularExpression Id. */ const int SRL_T = 106; /** RegularExpression Id. */ const int STRONG_T = 107; /** RegularExpression Id. */ const int SUBTYPE_T = 108; /** RegularExpression Id. */ const int THEN_T = 109; /** RegularExpression Id. */ const int TO_T = 110; /** RegularExpression Id. */ const int TRANSPORT_T = 111; /** RegularExpression Id. */ const int TYPE_T = 112; /** RegularExpression Id. */ const int UNAFFECTED_T = 113; /** RegularExpression Id. */ const int UNITS_T = 114; /** RegularExpression Id. */ const int UNTIL_T = 115; /** RegularExpression Id. */ const int USE_T = 116; /** RegularExpression Id. */ const int VARIABLE_T = 117; /** RegularExpression Id. */ const int VIEW_T = 118; /** RegularExpression Id. */ const int VMODE_T = 119; /** RegularExpression Id. */ const int VPROP_T = 120; /** RegularExpression Id. */ const int VUNIT_T = 121; /** RegularExpression Id. */ const int WAIT_T = 122; /** RegularExpression Id. */ const int WHEN_T = 123; /** RegularExpression Id. */ const int WHILE_T = 124; /** RegularExpression Id. */ const int WITH_T = 125; /** RegularExpression Id. */ const int XOR_T = 126; /** RegularExpression Id. */ const int XNOR_T = 127; /** RegularExpression Id. */ const int AMPERSAND_T = 128; /** RegularExpression Id. */ const int APOSTROPHE_T = 129; /** RegularExpression Id. */ const int LPAREN_T = 130; /** RegularExpression Id. */ const int RPAREN_T = 131; /** RegularExpression Id. */ const int DOUBLEMULT_T = 132; /** RegularExpression Id. */ const int MULT_T = 133; /** RegularExpression Id. */ const int PLUS_T = 134; /** RegularExpression Id. */ const int MINUS_T = 135; /** RegularExpression Id. */ const int COMMA_T = 136; /** RegularExpression Id. */ const int VARASSIGN_T = 137; /** RegularExpression Id. */ const int COLON_T = 138; /** RegularExpression Id. */ const int SEMI_T = 139; /** RegularExpression Id. */ const int LGT_T = 140; /** RegularExpression Id. */ const int LESSTHAN_T = 141; /** RegularExpression Id. */ const int GREATERTHAN_T = 142; /** RegularExpression Id. */ const int LT_T = 143; /** RegularExpression Id. */ const int GT_T = 144; /** RegularExpression Id. */ const int EQU_T = 145; /** RegularExpression Id. */ const int NOTEQU_T = 146; /** RegularExpression Id. */ const int ARROW_T = 147; /** RegularExpression Id. */ const int BOX_T = 148; /** RegularExpression Id. */ const int SLSL_T = 149; /** RegularExpression Id. */ const int RSRS_T = 150; /** RegularExpression Id. */ const int QQ_T = 151; /** RegularExpression Id. */ const int QGT_T = 152; /** RegularExpression Id. */ const int QLT_T = 153; /** RegularExpression Id. */ const int QG_T = 154; /** RegularExpression Id. */ const int QL_T = 155; /** RegularExpression Id. */ const int QEQU_T = 156; /** RegularExpression Id. */ const int QNEQU_T = 157; /** RegularExpression Id. */ const int Q_T = 158; /** RegularExpression Id. */ const int BAR_T = 159; /** RegularExpression Id. */ const int DOT_T = 160; /** RegularExpression Id. */ const int SLASH_T = 161; /** RegularExpression Id. */ const int AT_T = 162; /** RegularExpression Id. */ const int NEG_T = 163; /** RegularExpression Id. */ const int LBRACKET_T = 164; /** RegularExpression Id. */ const int RBRACKET_T = 165; /** RegularExpression Id. */ const int LBRACE = 166; /** RegularExpression Id. */ const int RBRACE = 167; /** RegularExpression Id. */ const int INTEGER = 168; /** RegularExpression Id. */ const int STRINGLITERAL = 169; /** RegularExpression Id. */ const int BASIC_IDENTIFIER = 170; /** RegularExpression Id. */ const int EXTENDED_CHARACTER = 171; /** RegularExpression Id. */ const int CHARACTER_LITERAL = 172; /** RegularExpression Id. */ const int DECIMAL_LITERAL = 173; /** RegularExpression Id. */ const int BASED_INTEGER = 174; /** RegularExpression Id. */ const int BASED_LITERAL = 175; /** RegularExpression Id. */ const int EXPONENT = 176; /** RegularExpression Id. */ const int BASIC_GRAPHIC_CHARACTER = 177; /** RegularExpression Id. */ const int GRAPHIC_CHARACTER = 178; /** RegularExpression Id. */ const int LETTER_OR_DIGIT = 179; /** RegularExpression Id. */ const int LETTER_OR_DIGIT_OR_STD = 180; /** RegularExpression Id. */ const int LETTER = 181; /** RegularExpression Id. */ const int UPPER_CASE_LETTER = 182; /** RegularExpression Id. */ const int BIT_STRING_LITERAL = 183; /** RegularExpression Id. */ const int BASE_SPECIFIER = 184; /** RegularExpression Id. */ const int STD_LOGIC = 185; /** RegularExpression Id. */ const int DIGIT = 186; /** RegularExpression Id. */ const int SPECIAL_CHARACTER = 187; /** RegularExpression Id. */ const int OTHER_SPECIAL_CHARACTER = 188; /** RegularExpression Id. */ const int SPACE_CHARACTER = 189; /** RegularExpression Id. */ const int LOWER_CASE_LETTER = 190; /** RegularExpression Id. */ const int QUOTE = 191; /** RegularExpression Id. */ const int VHDL2008TOOLDIR = 192; /** Lexical state. */ const int DEFAULT = 0; /** Literal token values. */ static const JJChar tokenImage_arr_0[] = {0x3c, 0x45, 0x4f, 0x46, 0x3e, 0}; static const JJChar tokenImage_arr_1[] = {0x22, 0x20, 0x22, 0}; static const JJChar tokenImage_arr_2[] = {0x22, 0x9, 0x22, 0}; static const JJChar tokenImage_arr_3[] = {0x22, 0xa, 0x22, 0}; static const JJChar tokenImage_arr_4[] = {0x22, 0xd, 0x22, 0}; static const JJChar tokenImage_arr_5[] = {0x22, 0x3c, 0x44, 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e, 0x5f, 0x56, 0x48, 0x44, 0x4c, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_6[] = {0x22, 0x3c, 0x4d, 0x55, 0x4c, 0x54, 0x5f, 0x44, 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_7[] = {0x22, 0x3c, 0x56, 0x48, 0x44, 0x4c, 0x5f, 0x46, 0x4c, 0x4f, 0x57, 0x43, 0x48, 0x41, 0x52, 0x54, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_8[] = {0x22, 0x3c, 0x56, 0x48, 0x44, 0x4c, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_9[] = {0x22, 0x3c, 0x4d, 0x55, 0x4c, 0x54, 0x5f, 0x44, 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e, 0x5f, 0x56, 0x48, 0x44, 0x4c, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x32, 0x30, 0x30, 0x38, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_10[] = {0x22, 0x3c, 0x4d, 0x55, 0x4c, 0x54, 0x5f, 0x56, 0x48, 0x44, 0x4c, 0x5f, 0x32, 0x30, 0x30, 0x38, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x4e, 0x54, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_11[] = {0x22, 0x61, 0x62, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_12[] = {0x22, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_13[] = {0x22, 0x61, 0x66, 0x74, 0x65, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_14[] = {0x22, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_15[] = {0x22, 0x61, 0x6c, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_16[] = {0x22, 0x61, 0x6e, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_17[] = {0x22, 0x61, 0x72, 0x63, 0x68, 0x69, 0x74, 0x65, 0x63, 0x74, 0x75, 0x72, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_18[] = {0x22, 0x61, 0x72, 0x72, 0x61, 0x79, 0x22, 0}; static const JJChar tokenImage_arr_19[] = {0x22, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_20[] = {0x22, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_21[] = {0x22, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x5f, 0x67, 0x75, 0x61, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_22[] = {0x22, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_23[] = {0x22, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_24[] = {0x22, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0}; static const JJChar tokenImage_arr_25[] = {0x22, 0x62, 0x6f, 0x64, 0x79, 0x22, 0}; static const JJChar tokenImage_arr_26[] = {0x22, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_27[] = {0x22, 0x62, 0x75, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_28[] = {0x22, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_29[] = {0x22, 0x63, 0x61, 0x73, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_30[] = {0x22, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_31[] = {0x22, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_32[] = {0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_33[] = {0x22, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_34[] = {0x22, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_35[] = {0x22, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_36[] = {0x22, 0x64, 0x6f, 0x77, 0x6e, 0x74, 0x6f, 0x22, 0}; static const JJChar tokenImage_arr_37[] = {0x22, 0x65, 0x6c, 0x73, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_38[] = {0x22, 0x65, 0x6c, 0x73, 0x69, 0x66, 0x22, 0}; static const JJChar tokenImage_arr_39[] = {0x22, 0x65, 0x6e, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_40[] = {0x22, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0}; static const JJChar tokenImage_arr_41[] = {0x22, 0x65, 0x78, 0x69, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_42[] = {0x22, 0x66, 0x61, 0x69, 0x72, 0x6e, 0x65, 0x73, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_43[] = {0x22, 0x66, 0x69, 0x6c, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_44[] = {0x22, 0x66, 0x6f, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_45[] = {0x22, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_46[] = {0x22, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_47[] = {0x22, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_48[] = {0x22, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x22, 0}; static const JJChar tokenImage_arr_49[] = {0x22, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0}; static const JJChar tokenImage_arr_50[] = {0x22, 0x67, 0x75, 0x61, 0x72, 0x64, 0x65, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_51[] = {0x22, 0x69, 0x66, 0x22, 0}; static const JJChar tokenImage_arr_52[] = {0x22, 0x69, 0x6d, 0x70, 0x75, 0x72, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_53[] = {0x22, 0x69, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_54[] = {0x22, 0x69, 0x6e, 0x65, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_55[] = {0x22, 0x69, 0x6e, 0x6f, 0x75, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_56[] = {0x22, 0x69, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_57[] = {0x22, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_58[] = {0x22, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x22, 0}; static const JJChar tokenImage_arr_59[] = {0x22, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x67, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_60[] = {0x22, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_61[] = {0x22, 0x6c, 0x6f, 0x6f, 0x70, 0x22, 0}; static const JJChar tokenImage_arr_62[] = {0x22, 0x6d, 0x61, 0x70, 0x22, 0}; static const JJChar tokenImage_arr_63[] = {0x22, 0x6d, 0x6f, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_64[] = {0x22, 0x6e, 0x61, 0x6e, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_65[] = {0x22, 0x6e, 0x65, 0x77, 0x22, 0}; static const JJChar tokenImage_arr_66[] = {0x22, 0x6e, 0x65, 0x78, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_67[] = {0x22, 0x6e, 0x6f, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_68[] = {0x22, 0x6e, 0x6f, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_69[] = {0x22, 0x6e, 0x75, 0x6c, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_70[] = {0x22, 0x6f, 0x66, 0x22, 0}; static const JJChar tokenImage_arr_71[] = {0x22, 0x6f, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_72[] = {0x22, 0x6f, 0x70, 0x65, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_73[] = {0x22, 0x6f, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_74[] = {0x22, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_75[] = {0x22, 0x6f, 0x75, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_76[] = {0x22, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_77[] = {0x22, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_78[] = {0x22, 0x70, 0x6f, 0x72, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_79[] = {0x22, 0x70, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x6e, 0x65, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_80[] = {0x22, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_81[] = {0x22, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x75, 0x72, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_82[] = {0x22, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_83[] = {0x22, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x22, 0}; static const JJChar tokenImage_arr_84[] = {0x22, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_85[] = {0x22, 0x70, 0x75, 0x72, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_86[] = {0x22, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_87[] = {0x22, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_88[] = {0x22, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_89[] = {0x22, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_90[] = {0x22, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_91[] = {0x22, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_92[] = {0x22, 0x72, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x5f, 0x67, 0x75, 0x61, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_93[] = {0x22, 0x72, 0x65, 0x6d, 0x22, 0}; static const JJChar tokenImage_arr_94[] = {0x22, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_95[] = {0x22, 0x72, 0x6f, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_96[] = {0x22, 0x72, 0x6f, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_97[] = {0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_98[] = {0x22, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_99[] = {0x22, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_100[] = {0x22, 0x73, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x22, 0}; static const JJChar tokenImage_arr_101[] = {0x22, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_102[] = {0x22, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_103[] = {0x22, 0x73, 0x6c, 0x61, 0x22, 0}; static const JJChar tokenImage_arr_104[] = {0x22, 0x73, 0x6c, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_105[] = {0x22, 0x73, 0x72, 0x61, 0x22, 0}; static const JJChar tokenImage_arr_106[] = {0x22, 0x73, 0x72, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_107[] = {0x22, 0x73, 0x74, 0x72, 0x6f, 0x6e, 0x67, 0x22, 0}; static const JJChar tokenImage_arr_108[] = {0x22, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_109[] = {0x22, 0x74, 0x68, 0x65, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_110[] = {0x22, 0x74, 0x6f, 0x22, 0}; static const JJChar tokenImage_arr_111[] = {0x22, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_112[] = {0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_113[] = {0x22, 0x75, 0x6e, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x22, 0}; static const JJChar tokenImage_arr_114[] = {0x22, 0x75, 0x6e, 0x69, 0x74, 0x73, 0x22, 0}; static const JJChar tokenImage_arr_115[] = {0x22, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x22, 0}; static const JJChar tokenImage_arr_116[] = {0x22, 0x75, 0x73, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_117[] = {0x22, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_118[] = {0x22, 0x76, 0x69, 0x65, 0x77, 0x22, 0}; static const JJChar tokenImage_arr_119[] = {0x22, 0x76, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_120[] = {0x22, 0x76, 0x70, 0x72, 0x6f, 0x70, 0x22, 0}; static const JJChar tokenImage_arr_121[] = {0x22, 0x76, 0x75, 0x6e, 0x69, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_122[] = {0x22, 0x77, 0x61, 0x69, 0x74, 0x22, 0}; static const JJChar tokenImage_arr_123[] = {0x22, 0x77, 0x68, 0x65, 0x6e, 0x22, 0}; static const JJChar tokenImage_arr_124[] = {0x22, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_125[] = {0x22, 0x77, 0x69, 0x74, 0x68, 0x22, 0}; static const JJChar tokenImage_arr_126[] = {0x22, 0x78, 0x6f, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_127[] = {0x22, 0x78, 0x6e, 0x6f, 0x72, 0x22, 0}; static const JJChar tokenImage_arr_128[] = {0x22, 0x26, 0x22, 0}; static const JJChar tokenImage_arr_129[] = {0x22, 0x27, 0x22, 0}; static const JJChar tokenImage_arr_130[] = {0x22, 0x28, 0x22, 0}; static const JJChar tokenImage_arr_131[] = {0x22, 0x29, 0x22, 0}; static const JJChar tokenImage_arr_132[] = {0x22, 0x2a, 0x2a, 0x22, 0}; static const JJChar tokenImage_arr_133[] = {0x22, 0x2a, 0x22, 0}; static const JJChar tokenImage_arr_134[] = {0x22, 0x2b, 0x22, 0}; static const JJChar tokenImage_arr_135[] = {0x22, 0x2d, 0x22, 0}; static const JJChar tokenImage_arr_136[] = {0x22, 0x2c, 0x22, 0}; static const JJChar tokenImage_arr_137[] = {0x22, 0x3a, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_138[] = {0x22, 0x3a, 0x22, 0}; static const JJChar tokenImage_arr_139[] = {0x22, 0x3b, 0x22, 0}; static const JJChar tokenImage_arr_140[] = {0x22, 0x3c, 0x3d, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_141[] = {0x22, 0x3c, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_142[] = {0x22, 0x3e, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_143[] = {0x22, 0x3c, 0x22, 0}; static const JJChar tokenImage_arr_144[] = {0x22, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_145[] = {0x22, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_146[] = {0x22, 0x2f, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_147[] = {0x22, 0x3d, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_148[] = {0x22, 0x3c, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_149[] = {0x22, 0x3c, 0x3c, 0x22, 0}; static const JJChar tokenImage_arr_150[] = {0x22, 0x3e, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_151[] = {0x22, 0x3f, 0x3f, 0x22, 0}; static const JJChar tokenImage_arr_152[] = {0x22, 0x3f, 0x3e, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_153[] = {0x22, 0x3f, 0x3c, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_154[] = {0x22, 0x3f, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_155[] = {0x22, 0x3f, 0x3c, 0x22, 0}; static const JJChar tokenImage_arr_156[] = {0x22, 0x3f, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_157[] = {0x22, 0x3f, 0x2f, 0x3d, 0x22, 0}; static const JJChar tokenImage_arr_158[] = {0x22, 0x3f, 0x22, 0}; static const JJChar tokenImage_arr_159[] = {0x22, 0x7c, 0x22, 0}; static const JJChar tokenImage_arr_160[] = {0x22, 0x2e, 0x22, 0}; static const JJChar tokenImage_arr_161[] = {0x22, 0x2f, 0x22, 0}; static const JJChar tokenImage_arr_162[] = {0x22, 0x40, 0x22, 0}; static const JJChar tokenImage_arr_163[] = {0x22, 0x5e, 0x22, 0}; static const JJChar tokenImage_arr_164[] = {0x22, 0x5b, 0x22, 0}; static const JJChar tokenImage_arr_165[] = {0x22, 0x5d, 0x22, 0}; static const JJChar tokenImage_arr_166[] = {0x22, 0x7b, 0x22, 0}; static const JJChar tokenImage_arr_167[] = {0x22, 0x7d, 0x22, 0}; static const JJChar tokenImage_arr_168[] = {0x22, 0x3c, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_169[] = {0x22, 0x3c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x4c, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_170[] = {0x22, 0x3c, 0x42, 0x41, 0x53, 0x49, 0x43, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_171[] = {0x22, 0x3c, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x44, 0x45, 0x44, 0x5f, 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_172[] = {0x22, 0x3c, 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, 0x5f, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x4c, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_173[] = {0x22, 0x3c, 0x44, 0x45, 0x43, 0x49, 0x4d, 0x41, 0x4c, 0x5f, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x4c, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_174[] = {0x22, 0x3c, 0x42, 0x41, 0x53, 0x45, 0x44, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x47, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_175[] = {0x22, 0x3c, 0x42, 0x41, 0x53, 0x45, 0x44, 0x5f, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x4c, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_176[] = {0x22, 0x3c, 0x45, 0x58, 0x50, 0x4f, 0x4e, 0x45, 0x4e, 0x54, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_177[] = {0x22, 0x3c, 0x42, 0x41, 0x53, 0x49, 0x43, 0x5f, 0x47, 0x52, 0x41, 0x50, 0x48, 0x49, 0x43, 0x5f, 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_178[] = {0x22, 0x3c, 0x47, 0x52, 0x41, 0x50, 0x48, 0x49, 0x43, 0x5f, 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_179[] = {0x22, 0x3c, 0x4c, 0x45, 0x54, 0x54, 0x45, 0x52, 0x5f, 0x4f, 0x52, 0x5f, 0x44, 0x49, 0x47, 0x49, 0x54, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_180[] = {0x22, 0x3c, 0x4c, 0x45, 0x54, 0x54, 0x45, 0x52, 0x5f, 0x4f, 0x52, 0x5f, 0x44, 0x49, 0x47, 0x49, 0x54, 0x5f, 0x4f, 0x52, 0x5f, 0x53, 0x54, 0x44, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_181[] = {0x22, 0x3c, 0x4c, 0x45, 0x54, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_182[] = {0x22, 0x3c, 0x55, 0x50, 0x50, 0x45, 0x52, 0x5f, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x4c, 0x45, 0x54, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_183[] = {0x22, 0x3c, 0x42, 0x49, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x4c, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_184[] = {0x22, 0x3c, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_185[] = {0x22, 0x3c, 0x53, 0x54, 0x44, 0x5f, 0x4c, 0x4f, 0x47, 0x49, 0x43, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_186[] = {0x22, 0x3c, 0x44, 0x49, 0x47, 0x49, 0x54, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_187[] = {0x22, 0x3c, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x5f, 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_188[] = {0x22, 0x3c, 0x4f, 0x54, 0x48, 0x45, 0x52, 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, 0x41, 0x4c, 0x5f, 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_189[] = {0x22, 0x3c, 0x53, 0x50, 0x41, 0x43, 0x45, 0x5f, 0x43, 0x48, 0x41, 0x52, 0x41, 0x43, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_190[] = {0x22, 0x3c, 0x4c, 0x4f, 0x57, 0x45, 0x52, 0x5f, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x4c, 0x45, 0x54, 0x54, 0x45, 0x52, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_191[] = {0x22, 0x3c, 0x51, 0x55, 0x4f, 0x54, 0x45, 0x3e, 0x22, 0}; static const JJChar tokenImage_arr_192[] = {0x22, 0x3c, 0x56, 0x48, 0x44, 0x4c, 0x32, 0x30, 0x30, 0x38, 0x54, 0x4f, 0x4f, 0x4c, 0x44, 0x49, 0x52, 0x3e, 0x22, 0}; static const JJChar* const tokenImage[] = { tokenImage_arr_0, tokenImage_arr_1, tokenImage_arr_2, tokenImage_arr_3, tokenImage_arr_4, tokenImage_arr_5, tokenImage_arr_6, tokenImage_arr_7, tokenImage_arr_8, tokenImage_arr_9, tokenImage_arr_10, tokenImage_arr_11, tokenImage_arr_12, tokenImage_arr_13, tokenImage_arr_14, tokenImage_arr_15, tokenImage_arr_16, tokenImage_arr_17, tokenImage_arr_18, tokenImage_arr_19, tokenImage_arr_20, tokenImage_arr_21, tokenImage_arr_22, tokenImage_arr_23, tokenImage_arr_24, tokenImage_arr_25, tokenImage_arr_26, tokenImage_arr_27, tokenImage_arr_28, tokenImage_arr_29, tokenImage_arr_30, tokenImage_arr_31, tokenImage_arr_32, tokenImage_arr_33, tokenImage_arr_34, tokenImage_arr_35, tokenImage_arr_36, tokenImage_arr_37, tokenImage_arr_38, tokenImage_arr_39, tokenImage_arr_40, tokenImage_arr_41, tokenImage_arr_42, tokenImage_arr_43, tokenImage_arr_44, tokenImage_arr_45, tokenImage_arr_46, tokenImage_arr_47, tokenImage_arr_48, tokenImage_arr_49, tokenImage_arr_50, tokenImage_arr_51, tokenImage_arr_52, tokenImage_arr_53, tokenImage_arr_54, tokenImage_arr_55, tokenImage_arr_56, tokenImage_arr_57, tokenImage_arr_58, tokenImage_arr_59, tokenImage_arr_60, tokenImage_arr_61, tokenImage_arr_62, tokenImage_arr_63, tokenImage_arr_64, tokenImage_arr_65, tokenImage_arr_66, tokenImage_arr_67, tokenImage_arr_68, tokenImage_arr_69, tokenImage_arr_70, tokenImage_arr_71, tokenImage_arr_72, tokenImage_arr_73, tokenImage_arr_74, tokenImage_arr_75, tokenImage_arr_76, tokenImage_arr_77, tokenImage_arr_78, tokenImage_arr_79, tokenImage_arr_80, tokenImage_arr_81, tokenImage_arr_82, tokenImage_arr_83, tokenImage_arr_84, tokenImage_arr_85, tokenImage_arr_86, tokenImage_arr_87, tokenImage_arr_88, tokenImage_arr_89, tokenImage_arr_90, tokenImage_arr_91, tokenImage_arr_92, tokenImage_arr_93, tokenImage_arr_94, tokenImage_arr_95, tokenImage_arr_96, tokenImage_arr_97, tokenImage_arr_98, tokenImage_arr_99, tokenImage_arr_100, tokenImage_arr_101, tokenImage_arr_102, tokenImage_arr_103, tokenImage_arr_104, tokenImage_arr_105, tokenImage_arr_106, tokenImage_arr_107, tokenImage_arr_108, tokenImage_arr_109, tokenImage_arr_110, tokenImage_arr_111, tokenImage_arr_112, tokenImage_arr_113, tokenImage_arr_114, tokenImage_arr_115, tokenImage_arr_116, tokenImage_arr_117, tokenImage_arr_118, tokenImage_arr_119, tokenImage_arr_120, tokenImage_arr_121, tokenImage_arr_122, tokenImage_arr_123, tokenImage_arr_124, tokenImage_arr_125, tokenImage_arr_126, tokenImage_arr_127, tokenImage_arr_128, tokenImage_arr_129, tokenImage_arr_130, tokenImage_arr_131, tokenImage_arr_132, tokenImage_arr_133, tokenImage_arr_134, tokenImage_arr_135, tokenImage_arr_136, tokenImage_arr_137, tokenImage_arr_138, tokenImage_arr_139, tokenImage_arr_140, tokenImage_arr_141, tokenImage_arr_142, tokenImage_arr_143, tokenImage_arr_144, tokenImage_arr_145, tokenImage_arr_146, tokenImage_arr_147, tokenImage_arr_148, tokenImage_arr_149, tokenImage_arr_150, tokenImage_arr_151, tokenImage_arr_152, tokenImage_arr_153, tokenImage_arr_154, tokenImage_arr_155, tokenImage_arr_156, tokenImage_arr_157, tokenImage_arr_158, tokenImage_arr_159, tokenImage_arr_160, tokenImage_arr_161, tokenImage_arr_162, tokenImage_arr_163, tokenImage_arr_164, tokenImage_arr_165, tokenImage_arr_166, tokenImage_arr_167, tokenImage_arr_168, tokenImage_arr_169, tokenImage_arr_170, tokenImage_arr_171, tokenImage_arr_172, tokenImage_arr_173, tokenImage_arr_174, tokenImage_arr_175, tokenImage_arr_176, tokenImage_arr_177, tokenImage_arr_178, tokenImage_arr_179, tokenImage_arr_180, tokenImage_arr_181, tokenImage_arr_182, tokenImage_arr_183, tokenImage_arr_184, tokenImage_arr_185, tokenImage_arr_186, tokenImage_arr_187, tokenImage_arr_188, tokenImage_arr_189, tokenImage_arr_190, tokenImage_arr_191, tokenImage_arr_192, }; } } #endif
35,017
C++
.h
975
33.718974
208
0.686106
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,539
vhdlstring.h
doxygen_doxygen/vhdlparser/vhdlstring.h
#ifndef VHDLSTRING_H #define VHDLSTRING_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include "VhdlParser.h" // super class for VhdlParserTokenManager // is generated in vhdlparser.jj // -option TOKEN_MANAGER_SUPER_CLASS = "TokenParser" // sets the Vhdlparser in vhdljjparser.cpp // tokenManager->setLexParser(vhdlParser); namespace vhdl { namespace parser { class TokenParser { public: VhdlParser* parser = nullptr; void setLexParser(VhdlParser* p) { parser = p; } }; } } /** @brief Minimal string class with std::string like behavior that fulfills the JavaCC * string requirements. */ class VhdlString { public: VhdlString() { init(); } VhdlString(const VhdlString &other) { m_str = (char*)malloc(other.m_len+1); memcpy(m_str,other.m_str,other.m_len); m_len = other.m_len; m_str[m_len]=0; } VhdlString &operator=(const VhdlString &other) { if (this!=&other) { free(m_str); m_str = (char*)malloc(other.m_len+1); memcpy(m_str,other.m_str,other.m_len); m_len = other.m_len; m_str[m_len]=0; } return *this; } VhdlString(const char *s) { m_len = (int)strlen(s); m_str=(char*)malloc(m_len+1); memcpy(m_str,s,m_len+1); } VhdlString(const char *s,int size) { m_str = (char*)malloc(size+1); memcpy(m_str,s,size); m_str[size]=0; m_len=size; } ~VhdlString() { free(m_str); } VhdlString& append(const char *s,int size) { int oldlen = m_len; m_len+=size+1; if (m_len) { m_str = (char*)realloc(m_str,m_len); memcpy(m_str+oldlen,s,m_len-oldlen-1); m_str[m_len-1]=0; } return *this; } VhdlString& append(const char *s) { return append(s,(int)strlen(s)); } VhdlString& append(const VhdlString &other) { return append(other.m_str,other.m_len); } VhdlString substr(int pos=0,int len=-1) { return VhdlString(m_str ? m_str+pos : nullptr, len==-1 ? m_len-pos : m_len); } int copy(char *s,int len,int pos=0) const { if (len==0) return 0; if (pos>=m_len) { s[0]=0; return 0; } int r=m_len<pos+len ? m_len-pos : len; memcpy(s,m_str+pos,r); return r; } const char *c_str() const { return m_str; } const char *data() const { return m_str; } int size() const { return m_len; } int length() const { return m_len; } char & operator[](int i) { return m_str[i]; } const char &operator[](int i) const { return m_str[i]; } void clear() { free(m_str); init(); } VhdlString &operator+=(char c) { char s[2]; s[0]=c; s[1]=0; return append(s); } VhdlString &operator+=(const char *s) { return append(s); } VhdlString &operator+=(VhdlString s) { return append(s); } VhdlString operator+ (const char *s) { return append(s); } private: void init() { m_str=(char*)calloc(1,1); m_len=0; } char *m_str; int m_len; }; inline VhdlString operator+ (const char *s, VhdlString v) { return VhdlString(s).append(v); } #endif
3,300
C++
.h
119
22.521008
95
0.572825
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,544
044_section.h
doxygen_doxygen/testing/044_section.h
// objective: test the \(public|protected|private)section commands // check: struct_s.xml /** A struct */ struct S { /** \publicsection */ /** public field */ int pub1; /** another public field */ int pub2; /** \protectedsection */ /** protected field */ int pro1; /** another protected field */ int pro2; /** \privatesection */ /** private field */ int pri1; /** another private field */ int pri2; };
439
C++
.h
21
18.142857
66
0.63747
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,545
078_xml_namespace_members_in_file_scope.h
doxygen_doxygen/testing/078_xml_namespace_members_in_file_scope.h
// objective: test that namespace members are put to file docs when enabled // check: 078__xml__namespace__members__in__file__scope_8h.xml // config: XML_NS_MEMB_FILE_SCOPE = YES namespace Namespace { /** @brief A function Detailed documentation. */ void foo(); /** @brief An enum */ enum class Enum {}; }
311
C++
.h
12
24.5
75
0.727891
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,547
decl_def.h
doxygen_doxygen/testing/decl_def.h
namespace N { /** @brief variable declaration */ extern int var; /** @brief function declaration */ void foo(int param); }
126
C++
.h
7
16.571429
34
0.732759
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,548
077_no_xml_namespace_members_in_file_scope.h
doxygen_doxygen/testing/077_no_xml_namespace_members_in_file_scope.h
// objective: test that namespace members are not put to file docs by default // check: 077__no__xml__namespace__members__in__file__scope_8h.xml namespace Namespace { /** @brief A function Detailed documentation. */ void foo(); /** @brief An enum */ enum class Enum {}; }
277
C++
.h
11
23.727273
77
0.727969
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,549
102_header.hpp
doxygen_doxygen/testing/102_header.hpp
// objective: test noexcept with expression and nodiscard and constexpr // check: class_a.xml // #ifndef INCLUDE_GUARD #define INCLUDE_GUARD #include <type_traits> /// @brief Some class class A { public: /// @brief Does stuff /// @details Details [[nodiscard]] constexpr int do_stuff() noexcept(std::is_nothrow_move_assignable_v<A>) { } /// @brief Does stuff /// @details Details [[nodiscard]] constexpr auto do_stuff2() noexcept(std::is_nothrow_move_assignable_v<A>) -> int { } }; #endif
535
C++
.h
22
21.227273
98
0.679764
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,550
013_class.h
doxygen_doxygen/testing/013_class.h
// objective: test the \class and \headerfile commands // check: class_t1.xml // check: class_t2.xml // check: class_t3.xml // check: class_t4.xml /** A class * \headerfile 013_class.h "inc/013_class.h" */ class T1 { }; class T2 { }; class T3 { }; class T4 { }; /** \class T2 * \headerfile <> * class T2 */ /** \class T3 013_class.h * class T3 */ /** \class T4 013_class.h "inc/013_class.h" * class T4 */
426
C++
.h
30
12.666667
54
0.640103
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,551
081_brief_lists.h
doxygen_doxygen/testing/081_brief_lists.h
// objective: Test termination of brief description with lists // check: 081__brief__lists_8h.xml /// \file /// @brief Just with minus /// - Item 1 /// - Item 2 void c_subr1(void); /// @brief With minus and hash /// -# Item 3 /// -# Item 4 void c_subr2(void); /// @brief With numbers /// 1. Item 5 /// 2. Item 6 void c_subr3(void); /// @brief With asterisk /// * Item 7 /// * Item 8 void c_subr4(void);
407
C++
.h
19
20.210526
62
0.645833
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,552
dotcallgraph.h
doxygen_doxygen/src/dotcallgraph.h
/****************************************************************************** * * Copyright (C) 1997-2019 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 DOTCALLGRAPH_H #define DOTCALLGRAPH_H #include <memory> #include "dotnode.h" #include "dotgraph.h" #include "memberdef.h" /** Representation of an call graph */ class DotCallGraph : public DotGraph { public: DotCallGraph(const MemberDef *md,bool inverse); ~DotCallGraph() override; NON_COPYABLE(DotCallGraph) bool isTrivial() const; bool isTooBig() const; int numNodes() const; QCString writeGraph(TextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const QCString &path,const QCString &fileName, const QCString &relPath,bool writeImageMap=TRUE, int graphId=-1); static bool isTrivial(const MemberDef *md,bool inverse); protected: QCString getBaseName() const override; QCString getMapLabel() const override; void computeTheGraph() override; private: void buildGraph(DotNode *n,const MemberDef *md,int distance); void determineVisibleNodes(DotNodeDeque &queue, int &maxNodes); void determineTruncatedNodes(DotNodeDeque &queue); DotNode *m_startNode; DotNodeMap m_usedNodes; bool m_inverse; QCString m_diskName; const Definition * m_scope; }; using DotCallGraphPtr = std::shared_ptr<DotCallGraph>; #endif
1,958
C++
.h
51
34.196078
85
0.699157
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,553
code.h
doxygen_doxygen/src/code.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 CODE_H #define CODE_H #include "parserintf.h" #include "construct.h" class FileDef; class MemberDef; class QCString; class Definition; class CCodeParser : public CodeParserInterface { public: CCodeParser(); ~CCodeParser() override; NON_COPYABLE(CCodeParser) void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE ) override; void resetCodeParserState() override; void setInsideCodeLine(bool inp); bool insideCodeLine() const; private: struct Private; std::unique_ptr<Private> p; }; #endif
1,844
C++
.h
54
26.796296
79
0.628571
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,554
membername.h
doxygen_doxygen/src/membername.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 MEMBERNAME_H #define MEMBERNAME_H #include "memberdef.h" #include "linkedmap.h" class MemberName { public: using Ptr = std::unique_ptr<MemberDef>; using Vec = std::vector<Ptr>; using iterator = typename Vec::iterator; using const_iterator = typename Vec::const_iterator; using reverse_iterator = typename Vec::reverse_iterator; using const_reverse_iterator = typename Vec::const_reverse_iterator; MemberName(const QCString &name) : m_name(name) {} QCString memberName() const { return m_name; } iterator begin() { return m_members.begin(); } iterator end() { return m_members.end(); } const_iterator begin() const { return m_members.begin(); } const_iterator end() const { return m_members.end(); } const_iterator cbegin() const { return m_members.cbegin(); } const_iterator cend() const { return m_members.cend(); } reverse_iterator rbegin() { return m_members.rbegin(); } reverse_iterator rend() { return m_members.rend(); } const_reverse_iterator crbegin() const { return m_members.crbegin(); } const_reverse_iterator crend() const { return m_members.crend(); } bool empty() const { return m_members.empty(); } size_t size() const { return m_members.size(); } Ptr &back() { return m_members.back(); } const Ptr &back() const { return m_members.back(); } Ptr &front() { return m_members.front(); } const Ptr &front() const { return m_members.front(); } iterator erase(iterator it) { return m_members.erase(it); } void push_back(Ptr &&p) { m_members.push_back(std::move(p)); } private: QCString m_name; Vec m_members; }; /** Ordered dictionary of MemberName objects. */ class MemberNameLinkedMap : public LinkedMap<MemberName> { public: MemberName::Ptr take(const QCString &key,const MemberDef *value) { MemberName::Ptr result; MemberName *mn = find(key); if (mn) { auto it = std::find_if(mn->begin(),mn->end(),[&value](const auto &el) { return el.get()==value; }); if (it != mn->end()) { it->swap(result); mn->erase(it); } if (mn->empty()) { del(key); } } return result; } }; /** Data associated with a MemberDef in an inheritance relation. */ class MemberInfo { public: MemberInfo(MemberDef *md,Protection p,Specifier v,bool inh,bool vbc) : m_memberDef(md), m_prot(p), m_virt(v), m_inherited(inh), m_virtBaseClass(vbc) {} // getters MemberDef *memberDef() { return m_memberDef; } const MemberDef *memberDef() const { return m_memberDef; } Protection prot() const { return m_prot; } Specifier virt() const { return m_virt; } bool inherited() const { return m_inherited; } QCString scopePath() const { return m_scopePath; } QCString ambiguityResolutionScope() const { return m_ambiguityResolutionScope; } const ClassDef *ambigClass() const { return m_ambigClass; } bool virtualBaseClass() const { return m_virtBaseClass; } // setters void setAmbiguityResolutionScope(const QCString &s) { m_ambiguityResolutionScope = s; } void setScopePath(const QCString &s) { m_scopePath = s; } void setAmbigClass(const ClassDef *cd) { m_ambigClass = cd; } private: MemberDef * m_memberDef; Protection m_prot; Specifier m_virt; bool m_inherited; QCString m_scopePath; QCString m_ambiguityResolutionScope; const ClassDef *m_ambigClass = nullptr; bool m_virtBaseClass; }; class MemberNameInfo { public: using Ptr = std::unique_ptr<MemberInfo>; using Vec = std::vector<Ptr>; using iterator = typename Vec::iterator; using const_iterator = typename Vec::const_iterator; MemberNameInfo(const QCString &name) : m_name(name) {} QCString memberName() const { return m_name; } iterator begin() { return m_members.begin(); } iterator end() { return m_members.end(); } const_iterator begin() const { return m_members.begin(); } const_iterator end() const { return m_members.end(); } bool empty() const { return m_members.empty(); } size_t size() const { return m_members.size(); } Ptr &back() { return m_members.back(); } const Ptr &back() const { return m_members.back(); } Ptr &front() { return m_members.front(); } const Ptr &front() const { return m_members.front(); } void push_back(Ptr &&p) { m_members.push_back(std::move(p)); } private: QCString m_name; Vec m_members; }; class MemberNameInfoLinkedMap : public LinkedMap<MemberNameInfo> { }; #endif
6,006
C++
.h
135
39.962963
107
0.581312
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,555
stringutil.h
doxygen_doxygen/src/stringutil.h
/****************************************************************************** * * Copyright (C) 1997-2024 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 STRINGUTIL_H #define STRINGUTIL_H #include <string> #include <string_view> /** @file * @brief Some helper functions for std::string */ /** Replaces occurrences of substring \a toReplace in string \a s with string \a replaceWith. * Modifies \a s in place. */ inline void substituteInplace(std::string &s, std::string_view toReplace,std::string_view replaceWith) { std::string buf; size_t pos = 0; size_t prevPos = 0; buf.reserve(s.length()); while ((pos=s.find(toReplace, prevPos))!=std::string::npos) { buf.append(s, prevPos, pos - prevPos); buf += replaceWith; prevPos = pos + toReplace.length(); } buf.append(s, prevPos, s.size() - prevPos); s.swap(buf); } /** Returns a new string where occurrences of substring \a toReplace in string \a s are replaced by * string \a replaceWith. */ inline std::string substituteStringView(std::string_view s, std::string_view toReplace,std::string_view replaceWith) { std::string buf; size_t pos = 0; size_t prevPos = 0; buf.reserve(s.length()); while ((pos=s.find(toReplace, prevPos))!=std::string::npos) { buf.append(s, prevPos, pos - prevPos); buf += replaceWith; prevPos = pos + toReplace.length(); } buf.append(s, prevPos, s.size() - prevPos); return buf; } /** Given a string view \a s, returns a new, narrower view on that string, skipping over any * leading or trailing whitespace characters. */ inline std::string_view stripWhiteSpace(std::string_view s) { static auto isspace = [](char c){ return c==' ' || c=='\t' || c=='\n' || c=='\r'; }; size_t sl = s.length(); if (sl==0 || (!isspace(s[0]) && !isspace(s[sl-1]))) return s; size_t start=0, end=sl-1; while (start<sl && isspace(s[start])) start++; if (start==sl) return s.substr(0,0); // only whitespace while (end>start && isspace(s[end])) end--; return s.substr(start,end+1-start); } inline void addTerminalCharIfMissing(std::string &s,char c) { if (s.empty()) { s+=c; } else { if (s[s.length()-1]!=c) s+=c; } } #endif // STRINGUTIL_H
2,780
C++
.h
85
29.494118
99
0.65611
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,556
sqlcode.h
doxygen_doxygen/src/sqlcode.h
/****************************************************************************** * * Copyright (C) 1997-2020 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 SQLCODE_H #define SQLCODE_H #include "parserintf.h" class FileDef; class MemberDef; class QCString; class Definition; /** SQL scanner. Only support syntax highlighting of code at the moment. */ class SQLCodeParser : public CodeParserInterface { public: SQLCodeParser(); ~SQLCodeParser() override; NON_COPYABLE(SQLCodeParser) void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt, bool stripCodeComments, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE ) override; void resetCodeParserState() override; private: struct Private; std::unique_ptr<Private> p; }; #endif
1,833
C++
.h
51
28.333333
79
0.631342
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,557
symbolmap.h
doxygen_doxygen/src/symbolmap.h
/****************************************************************************** * * Copyright (C) 1997-2020 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 SYMBOLMAP_H #define SYMBOLMAP_H #include <algorithm> #include <unordered_map> #include <vector> #include <string> #include <utility> #include <cassert> //! Class implementing a symbol map that maps symbol names to objects. //! Symbol names do not have to be unique. //! Supports adding symbols with add(), removing symbols with remove(), and //! finding symbols with find(). template<class T> class SymbolMap { public: using Ptr = T *; using VectorPtr = std::vector<Ptr>; using Map = std::unordered_map<std::string,VectorPtr>; using iterator = typename Map::iterator; using const_iterator = typename Map::const_iterator; //! Add a symbol \a def into the map under key \a name void add(const QCString &name,Ptr def) { auto it = m_map.find(name.str()); if (it!=m_map.end()) { it->second.push_back(def); } else { m_map.emplace(name.str(),VectorPtr({def})); } } //! Remove a symbol \a def from the map that was stored under key \a name void remove(const QCString &name,Ptr def) { auto it1 = m_map.find(name.str()); if (it1!=m_map.end()) { VectorPtr &v = it1->second; auto it2 = std::find(v.begin(),v.end(),def); if (it2!=v.end()) { v.erase(it2); if (v.empty()) { m_map.erase(it1); } } } } //! Find the list of symbols stored under key \a name //! Returns a pair of iterators pointing to the start and end of the range of matching symbols const VectorPtr &find(const QCString &name) { assert(m_noMatch.empty()); auto it = m_map.find(name.str()); return it==m_map.end() ? m_noMatch : it->second; } iterator begin() { return m_map.begin(); } iterator end() { return m_map.end(); } const_iterator begin() const { return m_map.cbegin(); } const_iterator end() const { return m_map.cend(); } bool empty() const { return m_map.empty(); } private: Map m_map; VectorPtr m_noMatch; }; #endif
2,792
C++
.h
84
28.452381
98
0.618748
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,558
constexp.h
doxygen_doxygen/src/constexp.h
/****************************************************************************** * * Copyright (C) 1997-2021 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 CONSTEXP_H #define CONSTEXP_H #include <string> #include <memory> #include "construct.h" /** @brief constant expression parser used for the C preprocessor */ class ConstExpressionParser { public: ConstExpressionParser(); ~ConstExpressionParser(); NON_COPYABLE(ConstExpressionParser) bool parse(const char *fileName,int line,const std::string &expression,const std::string &orgExpression); private: struct Private; std::unique_ptr<Private> p; }; #endif
1,148
C++
.h
32
33.46875
109
0.716472
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,559
classlist.h
doxygen_doxygen/src/classlist.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 CLASSLIST_H #define CLASSLIST_H #include "linkedmap.h" #include "classdef.h" class Definition; class ClassLinkedMap : public LinkedMap<ClassDef> { }; class ClassLinkedRefMap : public LinkedRefMap<ClassDef> { public: bool declVisible(const ClassDef::CompoundType *filter=nullptr) const; void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter,const QCString &header,bool localNames) const; void writeDocumentation(OutputList &ol,const Definition * container=nullptr) const; }; #endif
1,191
C++
.h
32
35.125
124
0.733738
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,560
constexp_p.h
doxygen_doxygen/src/constexp_p.h
/****************************************************************************** * * Copyright (C) 1997-2021 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 CONSTEXP_P_H #define CONSTEXP_P_H #include <string> //! @file //! @brief Private interface between Parser (constexp.y) and Lexer (constexp.l) #include "cppvalue.h" #ifdef YYSTYPE #undef YYSTYPE #endif #define YYSTYPE CPPValue #define YY_TYPEDEF_YY_SCANNER_T struct yyguts_t; typedef yyguts_t* yyscan_t; struct constexpYY_state { std::string strToken; CPPValue resultValue; int constExpLineNr; std::string constExpFileName; std::string orgString; std::string inputString; int inputPosition; }; constexpYY_state* constexpYYget_extra(yyscan_t yyscanner ); int constexpYYlex(YYSTYPE *lvalp, yyscan_t); int constexpYYparse(yyscan_t); #endif
1,346
C++
.h
41
30.95122
79
0.722994
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,561
translator_bg.h
doxygen_doxygen/src/translator_bg.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 TRANSLATOR_BG_H #define TRANSLATOR_BG_H /*! When defining a translator class for the new language, follow the description in the documentation. One of the steps says that you should copy the translator_en.h (this) file to your translator_xx.h new file. Your new language should use the Translator class as the base class. This means that you need to implement exactly the same (pure virtual) override methods as the TranslatorEnglish does. Because of this, it is a good idea to start with the copy of TranslatorEnglish and replace the strings one by one. It is not necessary to include "translator.h" or "translator_adapter.h" here. The files are included in the language.cpp correctly. Not including any of the mentioned files frees the maintainer from thinking about whether the first, the second, or both files should be included or not, and why. This holds namely for localized translators because their base class is changed occasionally to adapter classes when the Translator class changes the interface, or back to the Translator class (by the local maintainer) when the localized translator is made up-to-date again. */ /* * Kiril Kirilov released released Feb 28, 2022 * */ class TranslatorBulgarian : public TranslatorAdapter_1_9_4 { public: // --- Language control methods ------------------- /*! Used for identification of the language. The identification * should not be translated. It should be replaced by the name * of the language in English using lower-case characters only * (e.g. "czech", "japanese", "russian", etc.). It should be equal to * the identification used in language.cpp. */ QCString idLanguage() override { return "bulgarian"; } /*! 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. */ QCString latexLanguageSupportCommand() override { { return "\\usepackage[T2A]{fontenc}\n\\usepackage[bulgarian]{babel}\n"; } } QCString trISOLang() override { return "bg"; } QCString getLanguageString() override { return "0x402 bulgarian"; } // --- Language translation methods ------------------- /*! used in the compound documentation before a list of related functions. */ QCString trRelatedFunctions() override { return "Функции, свързани с класа"; } /*! subscript for the related functions. */ QCString trRelatedSubscript() override { return "(Имайте предвид, че тези функции не са членове на класа.)"; } /*! header that is put before the detailed description of files, classes and namespaces. */ QCString trDetailedDescription() override { return "Подробно описание"; } /*! header that is used when the summary tag is missing inside the details tag */ QCString trDetails() override { return "Подробности"; } /*! header that is put before the list of typedefs. */ QCString trMemberTypedefDocumentation() override { return "Членове Дефинирани типове Документация"; } /*! header that is put before the list of enumerations. */ QCString trMemberEnumerationDocumentation() override { return "Членове Изброявания Документация"; } /*! header that is put before the list of member functions. */ QCString trMemberFunctionDocumentation() override { return "Членове Функции(методи) Документация"; } /*! header that is put before the list of member attributes. */ QCString trMemberDataDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Полета Документация"; } else { return "Член данни Документация"; } } /*! this is the text of a link put after brief descriptions. */ QCString trMore() override { return "Допълнително..."; } /*! put in the class documentation */ QCString trListOfAllMembers() override { return "Списък на всички членове"; } /*! used as the title of the "list of all members" page of a class */ QCString trMemberList() override { return "Членове Списък"; } /*! this is the first part of a sentence that is followed by a class name */ QCString trThisIsTheListOfAllMembers() override { return "Това е пълен списък с членове за"; } /*! this is the remainder of the sentence after the class name */ QCString trIncludingInheritedMembers() override { return ", включително всички наследени членове."; } /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ QCString trGeneratedAutomatically(const QCString &s) override { QCString result="Генерирано автоматично от Doxygen"; if (!s.isEmpty()) result+=(QCString)" за "+s; result+=" от изходния код."; return result; } /*! put after an enum name in the list of all members */ QCString trEnumName() override { return "изброяване"; } /*! put after an enum value in the list of all members */ QCString trEnumValue() override { return "елементи на изброяване"; } /*! put after an undocumented member in the list of all members */ QCString trDefinedIn() override { return "дефинирани в"; } // quick reference sections /*! This is put above each page as a link to the list of all groups of * compounds or files (see the \\group command). */ QCString trModules() override { return "Групи"; } /*! This is put above each page as a link to the class hierarchy */ QCString trClassHierarchy() override { return "Класове Йерархия"; } /*! This is put above each page as a link to the list of annotated classes */ QCString trCompoundList() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структури от данни"; } else { return "Класове Списък"; } } /*! This is put above each page as a link to the list of documented files */ QCString trFileList() override { return "Файлове Списък"; } /*! This is put above each page as a link to all members of compounds. */ QCString trCompoundMembers() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Член Полета с данни"; } else { return "Членове на класа"; } } /*! This is put above each page as a link to all members of files. */ QCString trFileMembers() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Глобални"; } else { return "Файлове Членове"; } } /*! This is put above each page as a link to all related pages. */ QCString trRelatedPages() override { return "Свързани страници"; } /*! This is put above each page as a link to all examples. */ QCString trExamples() override { return "Примери"; } /*! This is put above each page as a link to the search engine. */ QCString trSearch() override { return "Търсене"; } /*! This is an introduction to the class hierarchy. */ QCString trClassHierarchyDescription() override { if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) { return "Йерархичен списък на всички обекти:"; } else { return "Този списък с наследявания е сортиран, " "но не изцяло по азбучен ред:"; } } /*! This is an introduction to the list with all files. */ QCString trFileListDescription(bool extractAll) override { QCString result="Пълен списък с "; if (!extractAll) result+="документирани "; result+="файлове с кратко описание:"; return result; } /*! This is an introduction to the annotated compound list. */ QCString trCompoundListDescription() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структури от данни с кратко описание:"; } else if (Config_getBool(OPTIMIZE_OUTPUT_SLICE)) { return "Класове с кратко описание:"; } else { return "Класове, структури, " "обединения и интерфейси с кратко описание:"; } } /*! This is an introduction to the page with all class members. */ QCString trCompoundMembersDescription(bool extractAll) override { QCString result="Списък на всички "; if (!extractAll) { result+="документирани "; } if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="членове поле, структура и обединение"; } else { result+="членове на класа"; } result+=" с връзки към "; if (!extractAll) { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="документацията за структура/обединение за всяко поле:"; } else { result+="документацията на класа за всеки член:"; } } else { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="структурите/обединенията, към които принадлежат:"; } else { result+="класовете, към които принадлежат:"; } } return result; } /*! This is an introduction to the page with all file members. */ QCString trFileMembersDescription(bool extractAll) override { QCString result="Списък на всички "; if (!extractAll) result+="документирани "; if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="функции, променливи, макроопределения, изброявания и дефиниции на типове"; } else { result+="членове на файлове"; } result+=" с връзки към "; if (extractAll) result+="файловете,към които принадлежат:"; else result+="документацията:"; return result; } /*! This is an introduction to the page with the list of all examples */ QCString trExamplesDescription() override { return "Списък на всички примери:"; } /*! This is an introduction to the page with the list of related pages */ QCString trRelatedPagesDescription() override { return "Списък на всички свързани страници с документация:"; } /*! This is an introduction to the page with the list of class/file groups */ QCString trModulesDescription() override { return "Списък на всички групи:"; } // index titles (the project name is prepended for these) /*! This is used in HTML as the title of index.html. */ QCString trDocumentation(const QCString &projName) override { return (!projName.isEmpty()?projName + " " : "") + "Документация"; } /*! This is used in LaTeX as the title of the chapter with the * index of all groups. */ QCString trModuleIndex() override { return "Групи Указател"; } /*! This is used in LaTeX as the title of the chapter with the * class hierarchy. */ QCString trHierarchicalIndex() override { return "Класове Йерархичен указател"; } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index. */ QCString trCompoundIndex() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структури от данни Указател"; } else { return "Класове Указател"; } } /*! This is used in LaTeX as the title of the chapter with the * list of all files. */ QCString trFileIndex() override { return "Файлове Списък"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all groups. */ QCString trModuleDocumentation() override { return "Групи Документация"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all classes, structs and unions. */ QCString trClassDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структури от данни Документация"; } else if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) { return trDesignUnitDocumentation(); } else { return "Класове Документация"; } } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all files. */ QCString trFileDocumentation() override { return "Файлове Документация"; } /*! This is used in LaTeX as the title of the document */ QCString trReferenceManual() override { return "Помощно ръководство"; } /*! This is used in the documentation of a file as a header before the * list of defines */ QCString trDefines() override { return "Макроси"; } /*! This is used in the documentation of a file as a header before the * list of typedefs */ QCString trTypedefs() override { return "Дефиниции на типове"; } /*! This is used in the documentation of a file as a header before the * list of enumerations */ QCString trEnumerations() override { return "Изброявания"; } /*! This is used in the documentation of a file as a header before the * list of (global) functions */ QCString trFunctions() override { return "Функции"; } /*! This is used in the documentation of a file as a header before the * list of (global) variables */ QCString trVariables() override { return "Променливи"; } /*! This is used in the documentation of a file as a header before the * list of (global) variables */ QCString trEnumerationValues() override { return "Елементи на изброяване"; } /*! This is used in the documentation of a file before the list of * documentation blocks for defines */ QCString trDefineDocumentation() override { return "Макро дефиниции Документация"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for typedefs */ QCString trTypedefDocumentation() override { return "Дефинирани типове Документация"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration types */ QCString trEnumerationTypeDocumentation() override { return "Изброени типове Документация"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for functions */ QCString trFunctionDocumentation() override { return "Функции Документация"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for variables */ QCString trVariableDocumentation() override { return "Променливи Документация"; } /*! This is used in the documentation of a file/namespace/group before * the list of links to documented compounds */ QCString trCompounds() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структури от данни"; } else { return "Класове"; } } /*! This is used in the standard footer of each page and indicates when * the page was generated */ QCString trGeneratedAt(const QCString &date,const QCString &projName) override { QCString result=(QCString)"Генерирано на "+date; if (!projName.isEmpty()) result+=(QCString)" за "+projName; result+=(QCString)" от"; return result; } /*! this text is put before a class diagram */ QCString trClassDiagram(const QCString &clName) override { return (QCString)"Диаграма на наследяване за "+clName+":"; } /*! this text is generated when the \\warning command is used. */ QCString trWarning() override { return "Предупреждение"; } /*! this text is generated when the \\version command is used. */ QCString trVersion() override { return "Версия"; } /*! this text is generated when the \\date command is used. */ QCString trDate() override { return "Дата"; } /*! this text is generated when the \\return command is used. */ QCString trReturns() override { return "Връща"; } /*! this text is generated when the \\sa command is used. */ QCString trSeeAlso() override { return "Виж също"; } /*! this text is generated when the \\param command is used. */ QCString trParameters() override { return "Аргументи"; } /*! this text is generated when the \\exception command is used. */ QCString trExceptions() override { return "Изключения"; } /*! this text is used in the title page of a LaTeX document. */ QCString trGeneratedBy() override { return "Генериран от"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990307 ////////////////////////////////////////////////////////////////////////// /*! used as the title of page containing all the index of all namespaces. */ QCString trNamespaceList() override { return "Именни пространства Списък "; } /*! used as an introduction to the namespace list */ QCString trNamespaceListDescription(bool extractAll) override { QCString result="пълен списък с "; if (!extractAll) result+="документирани "; result+="именни пространства с кратко описание:"; return result; } /*! used in the class documentation as a header before the list of all * friends of a class */ QCString trFriends() override { return "Приятели"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990405 ////////////////////////////////////////////////////////////////////////// /*! used in the class documentation as a header before the list of all * related classes */ QCString trRelatedFunctionDocumentation() override { return "Приятели и Свързани функции Документация"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) override { QCString result=(QCString)clName; switch(compType) { case ClassDef::Class: result+=" Клас"; break; case ClassDef::Struct: result+=" Структура"; break; case ClassDef::Union: result+=" Обединение"; break; case ClassDef::Interface: result+=" Интерфейс"; break; case ClassDef::Protocol: result+=" Протокол"; break; case ClassDef::Category: result+=" Категория"; break; case ClassDef::Exception: result+=" Изключение"; break; default: break; } if (isTemplate) result+=" Шаблон"; result+=" Препратка"; return result; } /*! used as the title of the HTML page of a file */ QCString trFileReference(const QCString &fileName) override { QCString result=fileName; result+=" Файл Справка"; return result; } /*! used as the title of the HTML page of a namespace */ QCString trNamespaceReference(const QCString &namespaceName) override { QCString result=namespaceName; result+=" Именно пространството Справка"; return result; } QCString trPublicMembers() override { return "Общодостъпни членове функции"; } QCString trPublicSlots() override { return "Общодостъпни слотове"; } QCString trSignals() override { return "Сигнали"; } QCString trStaticPublicMembers() override { return "Статични общодостъпни членове функции"; } QCString trProtectedMembers() override { return "Защитени членове функции"; } QCString trProtectedSlots() override { return "Защитени слотове"; } QCString trStaticProtectedMembers() override { return "Статични защитени членове функции"; } QCString trPrivateMembers() override { return "Частни членове функции"; } QCString trPrivateSlots() override { return "Частни слотове"; } QCString trStaticPrivateMembers() override { return "Статични частни членове функции"; } /*! this function is used to produce a comma-separated list of items. * use generateMarker(i) to indicate where item i should be put. */ QCString trWriteList(int numEntries) override { QCString result; // the inherits list contain `numEntries' classes for (int i=0;i<numEntries;i++) { // use generateMarker to generate placeholders for the class links! result+=generateMarker(i); // generate marker for entry i in the list // (order is left to right) if (i!=numEntries-1) // not the last entry, so we need a separator { if (i<numEntries-2) // not the fore last entry result+=", "; else // the fore last entry result+=", и "; } } return result; } /*! used in class documentation to produce a list of base classes, * if class diagrams are disabled. */ QCString trInheritsList(int numEntries) override { return "Базови класове "+trWriteList(numEntries)+"."; } /*! used in class documentation to produce a list of super classes, * if class diagrams are disabled. */ QCString trInheritedByList(int numEntries) override { return "Производни класове "+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * members that are hidden by this one. */ QCString trReimplementedFromList(int numEntries) override { return "Заменя наследеният метод "+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * all member that overwrite the implementation of this member. */ QCString trReimplementedInList(int numEntries) override { return "Заменя в "+trWriteList(numEntries)+"."; } /*! This is put above each page as a link to all members of namespaces. */ QCString trNamespaceMembers() override { return "Членове Именни пространства"; } /*! This is an introduction to the page with all namespace members */ QCString trNamespaceMemberDescription(bool extractAll) override { QCString result="Пълен списък с "; if (!extractAll) result+="документирани "; result+="членове именни пространства с връзки към "; if (extractAll) result+="документация за именно пространство за всеки член:"; else result+="именните пространства към които принадлежат:"; return result; } /*! This is used in LaTeX as the title of the chapter with the * index of all namespaces. */ QCString trNamespaceIndex() override { return "Именни пространства Указател"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all namespaces. */ QCString trNamespaceDocumentation() override { return "Именни пространства Документация"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990522 ////////////////////////////////////////////////////////////////////////// /*! This is used in the documentation before the list of all * namespaces in a file. */ QCString trNamespaces() override { return "Именни пространства"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990728 ////////////////////////////////////////////////////////////////////////// /*! This is put at the bottom of a class documentation page and is * followed by a list of files that were used to generate the page. */ QCString trGeneratedFromFiles(ClassDef::CompoundType compType, bool single) override { // single is true implies a single file bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); QCString result=(QCString)"Документация за "; switch(compType) { case ClassDef::Class: result+=vhdlOpt?"проектна единица":"клас"; break; case ClassDef::Struct: result+="структура"; break; case ClassDef::Union: result+="обединение"; break; case ClassDef::Interface: result+="интерфейс"; break; case ClassDef::Protocol: result+="протокол"; break; case ClassDef::Category: result+="категория"; break; case ClassDef::Exception: result+="изключение"; break; default: break; } result+=" генериран от "; if (single) result+="следният файл:"; else result+="следните файлове:"; return result; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990901 ////////////////////////////////////////////////////////////////////////// /*! This is used as the heading text for the retval command. */ QCString trReturnValues() override { return "Връщана стойност"; } /*! This is in the (quick) index as a link to the main page (index.html) */ QCString trMainPage() override { return "Главна страница"; } /*! This is used in references to page that are put in the LaTeX * documentation. It should be an abbreviation of the word page. */ QCString trPageAbbreviation() override { return "стр."; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-991003 ////////////////////////////////////////////////////////////////////////// QCString trDefinedAtLineInSourceFile() override { return "Виж дефиницията във файла @1 ред @0."; } QCString trDefinedInSourceFile() override { return "Виж дефиницията във файла @0."; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-991205 ////////////////////////////////////////////////////////////////////////// QCString trDeprecated() override { return "Остарело"; } ////////////////////////////////////////////////////////////////////////// // new since 1.0.0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ QCString trCollaborationDiagram(const QCString &clName) override { return (QCString)"Граф на зависимости за класа "+clName+":"; } /*! this text is put before an include dependency graph */ QCString trInclDepGraph(const QCString &fName) override { return (QCString)"Граф на включените заглавни файлове за "+fName+":"; } /*! header that is put before the list of constructor/destructors. */ QCString trConstructorDocumentation() override { return "Конструктор & Деструктор Документация"; } /*! Used in the file documentation to point to the corresponding sources. */ QCString trGotoSourceCode() override { return "Вижте изходният код на този файл."; } /*! Used in the file sources to point to the corresponding documentation. */ QCString trGotoDocumentation() override { return "Вижте документацията за този файл."; } /*! Text for the \\pre command */ QCString trPrecondition() override { return "Предпоставка"; } /*! Text for the \\post command */ QCString trPostcondition() override { return "Следусловие"; } /*! Text for the \\invariant command */ QCString trInvariant() override { return "Инвариант"; } /*! Text shown before a multi-line variable/enum initialization */ QCString trInitialValue() override { return "Първоначална стойност:"; } /*! Text used the source code in the file index */ QCString trCode() override { return "изходен код"; } QCString trGraphicalHierarchy() override { return "Йерархия на класовете Графичен вид"; } QCString trGotoGraphicalHierarchy() override { return "Виж графичен вид на йерархията на класовете"; } QCString trGotoTextualHierarchy() override { return "Виж текстови вид на йерархията на класовете"; } QCString trPageIndex() override { return "Тематични описания Указател"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.0 ////////////////////////////////////////////////////////////////////////// QCString trNote() override { return "Пояснение"; } QCString trPublicTypes() override { return "Общодостъпни типове"; } QCString trPublicAttribs() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Полета данни"; } else { return "Общодостъпни атрибути"; } } QCString trStaticPublicAttribs() override { return "Статични общодостъпни атрибути"; } QCString trProtectedTypes() override { return "Защитени типове"; } QCString trProtectedAttribs() override { return "Защитени атрибути"; } QCString trStaticProtectedAttribs() override { return "Статични защитени атрибути"; } QCString trPrivateTypes() override { return "Частни типове"; } QCString trPrivateAttribs() override { return "Частни атрибути"; } QCString trStaticPrivateAttribs() override { return "Статични частни атрибути"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.3 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a \\todo item */ QCString trTodo() override { return "Елементи на списъка със задачи"; } /*! Used as the header of the todo list */ QCString trTodoList() override { return "Списък със задачи за обсъждане свързани с подобренията"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.4 ////////////////////////////////////////////////////////////////////////// QCString trReferencedBy() override { return "Използва се"; } QCString trRemarks() override { return "Забележки"; } QCString trAttention() override { return "Внимание"; } QCString trInclByDepGraph() override { return "Граф на файлове показващ, кой файлове включват " "явно или косвено този файл:"; } QCString trSince() override { return "От"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.5 ////////////////////////////////////////////////////////////////////////// /*! title of the graph legend page */ QCString trLegendTitle() override { return "Графична легенда"; } /*! page explaining how the dot graph's should be interpreted * The %A in the text below are to prevent link to classes called "A". */ QCString trLegendDocs() override { return "Тази страница обяснява как да интерпретирате графиките, генерирани " "от doxygen.<p>\n" "Разгледайте следният пример:\n" "\\code\n" "/*! Невидим клас поради съкращаване */\n" "class Invisible { };\n\n" "/*! Съкратен клас, наследствена връзка е скрита */\n" "class Truncated : public Invisible { };\n\n" "/* Класът не е документиран с doxygen коментари */\n" "class Undocumented { };\n\n" "/*! Клас, който се наследява чрез публично наследяване */\n" "class PublicBase : public Truncated { };\n\n" "/*! Шаблонен клас */\n" "template<class T> class Templ { };\n\n" "/*! Клас, който се наследява чрез защитено наследяване */\n" "class ProtectedBase { };\n\n" "/*! Клас, който се наследява чрез частно наследяване */\n" "class PrivateBase { };\n\n" "/*! Клас, използващ наследеният клас */\n" "class Used { };\n\n" "/*! Супер клас, който наследява редица други класове */\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" "Правоъгълниците в този граф имат следното значение:" "<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center></p>\n" "<p>\n" "Правоъгълниците в този граф имат следното значение:\n" "</p>\n" "<ul>\n" "<li>%Запълненият сиво правоъгълник представлява структурата или клас, " "за който е създаден графа.</li>\n" "<li>%Правоъгълника с черна рамка обозначава документирана структура или клас.</li>\n" "<li>%Правоъгълника със сива рамка обозначава недокументирана структура или клас.</li>\n" "<li>%Правоъгълника с червена рамка обозначава документирана структура или клас за" "който не са показани всички отношения наследяване/съдържание. %A Графa e" "съкратен, ако не се вписва в определените граници.</li>\n" "</ul>\n" "<p>\n" "Стрелките имат следното значение:\n" "</p>\n" "<ul>\n" "<li>%Тъмносиня стрелка се използва за визуализиране на публично наследство " "между два класа.</li>\n" "<li>%Тъмнозелена стрелка се използва за защитено наследяване.</li>\n" "<li>%Тъмночервена стрелка се използва за частно наследяване.</li>\n" "<li>%Лилава пунктирана стрелка се използва, ако клас се съдържа или използва " "от друг клас. Стрелката указва променлива(и) " "чрез който е достъпен посоченият клас или структура.</li>\n" "<li>%Жълта пунктирана стрелка обозначава връзка между екземпляр на шаблон и " "класът шаблон, от който е създаден. Стрелката указва " "параметрите на шаблона на екземпляра.</li>\n" "</ul>\n"; } /*! text for the link to the legend page */ QCString trLegend() override { return "легенда"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.0 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a test item */ QCString trTest() override { return "Тест"; } /*! Used as the header of the test list */ QCString trTestList() override { return "Тестове Списък"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.2 ////////////////////////////////////////////////////////////////////////// /*! Used as a section header for IDL properties */ QCString trProperties() override { return "Свойства"; } /*! Used as a section header for IDL property documentation */ QCString trPropertyDocumentation() override { return "Свойство Документация"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.4 ////////////////////////////////////////////////////////////////////////// /*! Used for Java classes in the summary section of Java packages */ QCString trClasses() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структури от данни"; } else { return "Класове"; } } /*! Used as the title of a Java package */ QCString trPackage(const QCString &name) override { return (QCString)"Пакет "+name; } /*! The description of the package index page */ QCString trPackageListDescription() override { return "Списък на пакетите с кратки описания(ако има такива):"; } /*! The link name in the Quick links header for each page */ QCString trPackages() override { return "Пакети"; } /*! Text shown before a multi-line define */ QCString trDefineValue() override { return "Макроопределение:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.5 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a \\bug item */ QCString trBug() override { return "Бъг"; } /*! Used as the header of the bug list */ QCString trBugList() override { return "Бъгове Списък"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.6 ////////////////////////////////////////////////////////////////////////// /*! Used as ansicpg for RTF file * * The following table shows the correlation of Charset name, Charset Value and * Codepage number: * <pre> * Charset Name Charset Value(hex) Codepage number * ------------------------------------------------------ * DEFAULT_CHARSET 1 (x01) * SYMBOL_CHARSET 2 (x02) * OEM_CHARSET 255 (xFF) * ANSI_CHARSET 0 (x00) 1252 * RUSSIAN_CHARSET 204 (xCC) 1251 * EE_CHARSET 238 (xEE) 1250 * GREEK_CHARSET 161 (xA1) 1253 * TURKISH_CHARSET 162 (xA2) 1254 * BALTIC_CHARSET 186 (xBA) 1257 * HEBREW_CHARSET 177 (xB1) 1255 * ARABIC _CHARSET 178 (xB2) 1256 * SHIFTJIS_CHARSET 128 (x80) 932 * HANGEUL_CHARSET 129 (x81) 949 * GB2313_CHARSET 134 (x86) 936 * CHINESEBIG5_CHARSET 136 (x88) 950 * </pre> * */ QCString trRTFansicp() override { return "1251"; } /*! Used as ansicpg for RTF fcharset * \see trRTFansicp() for a table of possible values. */ QCString trRTFCharSet() override { return "204"; } /*! Used as header RTF general index */ QCString trRTFGeneralIndex() override { return "Азбучен указател"; } /*! 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. */ QCString trClass(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "клас", "ове"); } /*! 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. */ QCString trFile(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "файл", "ове"); } /*! 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. */ QCString trNamespace(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "именн", "и пространства", "о пространство"); } /*! 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. */ QCString trGroup(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "груп", "и", "а"); } /*! 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. */ QCString trPage(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "страниц", "и", "а"); } /*! 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. */ QCString trMember(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "член", "ове"); } /*! 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. */ QCString trGlobal(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "глобалн", "и", "а"); } ////////////////////////////////////////////////////////////////////////// // new since 1.2.7 ////////////////////////////////////////////////////////////////////////// /*! This text is generated when the \\author command is used and * for the author section in man pages. */ QCString trAuthor(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "автор", "и"); } ////////////////////////////////////////////////////////////////////////// // new since 1.2.11 ////////////////////////////////////////////////////////////////////////// /*! This text is put before the list of members referenced by a member */ QCString trReferences() override { return "Кръстосани препратки"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.13 ////////////////////////////////////////////////////////////////////////// /*! used in member documentation blocks to produce a list of * members that are implemented by this one. */ QCString trImplementedFromList(int numEntries) override { return "Заменя "+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * all members that implement this abstract member. */ QCString trImplementedInList(int numEntries) override { return "Заменя в "+trWriteList(numEntries)+"."; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.16 ////////////////////////////////////////////////////////////////////////// /*! used in RTF documentation as a heading for the Table * of Contents. */ QCString trRTFTableOfContents() override { return "Съдържание"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.17 ////////////////////////////////////////////////////////////////////////// /*! Used as the header of the list of item that have been * flagged deprecated */ QCString trDeprecatedList() override { return "Остарели дефиниции и декларации Списък"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.18 ////////////////////////////////////////////////////////////////////////// /*! Used as a header for declaration section of the events found in * a C# program */ QCString trEvents() override { return "Събития"; } /*! Header used for the documentation section of a class' events. */ QCString trEventDocumentation() override { return "Събития Документация"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3 ////////////////////////////////////////////////////////////////////////// /*! Used as a heading for a list of Java class types with package scope. */ QCString trPackageTypes() override { return "Типове с област на видимост пакет"; } /*! Used as a heading for a list of Java class functions with package * scope. */ QCString trPackageFunctions() override { return "Функции с област на видимост пакет"; } QCString trPackageMembers() override { return "Членове с област на видимост пакет"; } /*! Used as a heading for a list of static Java class functions with * package scope. */ QCString trStaticPackageFunctions() override { return "Статични функции с област на видимост пакет"; } /*! Used as a heading for a list of Java class variables with package * scope. */ QCString trPackageAttribs() override { return "Променливи с област на видимост пакет"; } /*! Used as a heading for a list of static Java class variables with * package scope. */ QCString trStaticPackageAttribs() override { 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. */ QCString trAll() override { return "Указател към не филтриран списък на всички членове"; } /*! Put in front of the call graph for a function. */ QCString trCallGraph() override { return "Граф с извикванията за тази функция:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.3 ////////////////////////////////////////////////////////////////////////// /*! This string is used as the title for the page listing the search * results. */ QCString trSearchResultsTitle() override { return "Резултати от търсенето"; } /*! 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. */ QCString trSearchResults(int numDocuments) override { if (numDocuments==0) { return "За съжаление няма документи, отговарящи на вашата заявка."; } else if (numDocuments==1) { return "Намерен е <b>1</b> документ, съответстващ на вашата заявка."; } else { return "Намерени са <b>$num</b> документи, съответстващи на вашата заявка. " "Първо се показват най-добрите съвпадения."; } } /*! 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. */ QCString trSearchMatches() override { return "Намерено:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.8 ////////////////////////////////////////////////////////////////////////// /*! This is used in HTML as the title of page with source code for file filename */ QCString trSourceFile(const QCString& filename) override { return filename + " Изходен файл"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.9 ////////////////////////////////////////////////////////////////////////// /*! This is used as the name of the chapter containing the directory * hierarchy. */ QCString trDirIndex() override { return "Директории Йерархия"; } /*! This is used as the name of the chapter containing the documentation * of the directories. */ QCString trDirDocumentation() override { return "Директории Документация"; } /*! This is used as the title of the directory index and also in the * Quick links of an HTML page, to link to the directory hierarchy. */ QCString trDirectories() override { return "Директории"; } /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ QCString trDirReference(const QCString &dirName) override { QCString result=dirName; result+=" Директория Съдържание"; return result; } /*! This returns the word directory with or without starting capital * (\a first_capital) and in singular or plural form (\a singular). */ QCString trDir(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "директори", "и", "я"); } ////////////////////////////////////////////////////////////////////////// // new since 1.4.1 ////////////////////////////////////////////////////////////////////////// /*! This text is added to the documentation when the \\overload command * is used for a overloaded function. */ QCString trOverloadText() override { return "Това е преопределена член функция, " "предоставена за удобство. Различава се от спомената по горе " "функция само по броя на фактическите аргументи."; } ////////////////////////////////////////////////////////////////////////// // new since 1.4.6 ////////////////////////////////////////////////////////////////////////// /*! This is used to introduce a caller (or called-by) graph */ QCString trCallerGraph() override { return "Граф на извикванията за тази функция:"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration values */ QCString trEnumerationValueDocumentation() override { return "Изброяване Документация"; } ////////////////////////////////////////////////////////////////////////// // new since 1.5.4 (mainly for Fortran) ////////////////////////////////////////////////////////////////////////// /*! header that is put before the list of member subprograms (Fortran). */ QCString trMemberFunctionDocumentationFortran() override { return "Функции/подпрограми Документация"; } /*! This is put above each page as a link to the list of annotated data types (Fortran). */ QCString trCompoundListFortran() override { return "Типове данни Списък"; } /*! This is put above each page as a link to all members of compounds (Fortran). */ QCString trCompoundMembersFortran() override { return "Полета данни"; } /*! This is an introduction to the annotated compound list (Fortran). */ QCString trCompoundListDescriptionFortran() override { return "Анотиран списък от типовете данни с кратки описания:"; } /*! This is an introduction to the page with all data types (Fortran). */ QCString trCompoundMembersDescriptionFortran(bool extractAll) override { QCString result="Списък на всички "; if (!extractAll) { result+="документирани "; } result+="членове типове данни"; result+=" с препратки към "; if (!extractAll) { result+="документацията за структура от данни за всеки член"; } else { result+="типовете данни, към които принадлежат:"; } return result; } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index (Fortran). */ QCString trCompoundIndexFortran() override { return "Типове данни Указател"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all data types (Fortran). */ QCString trTypeDocumentation() override { return "Типове данни Документация"; } /*! This is used in the documentation of a file as a header before the * list of (global) subprograms (Fortran). */ QCString trSubprograms() override { return "Функции/Подпрограми"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for subprograms (Fortran) */ QCString trSubprogramDocumentation() override { return "Функции/Подпрограми Документация"; } /*! This is used in the documentation of a file/namespace/group before * the list of links to documented compounds (Fortran) */ QCString trDataTypes() override { return "Типове данни"; } /*! used as the title of page containing all the index of all modules (Fortran). */ QCString trModulesList() override { return "Модули Списък"; } /*! used as an introduction to the modules list (Fortran) */ QCString trModulesListDescription(bool extractAll) override { QCString result="Списък на всички "; if (!extractAll) result+="документирани "; result+="модули с кратко описание:"; return result; } /*! used as the title of the HTML page of a module/type (Fortran) */ QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) override { QCString result=(QCString)clName; switch(compType) { case ClassDef::Class: result+=" Модул"; break; case ClassDef::Struct: result+=" Тип"; break; case ClassDef::Union: result+=" Обединение"; break; case ClassDef::Interface: result+=" Интерфейс"; break; case ClassDef::Protocol: result+=" Протокол"; break; case ClassDef::Category: result+=" Категория"; break; case ClassDef::Exception: result+=" Изключение"; break; default: break; } if (isTemplate) result+=" Шаблон"; result+=" Отнася се"; return result; } /*! used as the title of the HTML page of a module (Fortran) */ QCString trModuleReference(const QCString &namespaceName) override { QCString result=namespaceName; result+=" Модул Справка"; return result; } /*! This is put above each page as a link to all members of modules. (Fortran) */ QCString trModulesMembers() override { return "Модул Членове"; } /*! This is an introduction to the page with all modules members (Fortran) */ QCString trModulesMemberDescription(bool extractAll) override { QCString result="Списък на всички "; if (!extractAll) result+="документирани "; result+="членове на модула с връзки към "; if (extractAll) { result+="документацията на модула за всеки член:"; } else { result+="модулите, към които принадлежат:"; } return result; } /*! This is used in LaTeX as the title of the chapter with the * index of all modules (Fortran). */ QCString trModulesIndex() override { return "Модули Указател"; } /*! 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. */ QCString trModule(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "модул", "и"); } /*! This is put at the bottom of a module documentation page and is * followed by a list of files that were used to generate the page. */ QCString trGeneratedFromFilesFortran(ClassDef::CompoundType compType, bool single) override { // single is true implies a single file QCString result=(QCString)"Документацията за "; switch(compType) { case ClassDef::Class: result+="модул"; break; case ClassDef::Struct: result+="тип"; break; case ClassDef::Union: result+="обединение"; break; case ClassDef::Interface: result+="интерфейс"; break; case ClassDef::Protocol: result+="протокол"; break; case ClassDef::Category: result+="категория"; break; case ClassDef::Exception: result+="изключение"; break; default: break; } result+=" беше генериран "; if (single) result+="от следният файл:"; else result+="от следните файлове:"; 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. */ QCString trType(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "тип", "ове"); } /*! 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. */ QCString trSubprogram(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "подпрограм", "и:", "а:"); } /*! C# Type Constraint list */ QCString trTypeConstraints() override { return "Съвместими типове"; } ////////////////////////////////////////////////////////////////////////// // new since 1.6.0 (mainly for the new search engine) ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ QCString trDirRelation(const QCString &name) override { return QCString(name)+" Връзка"; } /*! Loading message shown when loading search results */ QCString trLoading() override { return "Зареждане..."; } /*! Label used for search results in the global namespace */ QCString trGlobalNamespace() override { return "Глобални именни пространства"; } /*! Message shown while searching */ QCString trSearching() override { return "Търсене..."; } /*! Text shown when no search results are found */ QCString trNoMatches() override { return "Не намерено"; } ////////////////////////////////////////////////////////////////////////// // new since 1.6.3 (missing items for the directory pages) ////////////////////////////////////////////////////////////////////////// /*! when clicking a directory dependency label, a page with a * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ QCString trFileIn(const QCString &name) override { return (QCString)"Файл в "+name; } /*! when clicking a directory dependency label, a page with a * table is shown. The heading for the second column mentions the * destination file that is included. */ QCString trIncludesFileIn(const QCString &name) override { return (QCString)"Включва файла в "+name; } /** Compiles a date string. * @param year Year in 4 digits * @param month Month of the year: 1=January * @param day Day of the Month: 1..31 * @param dayOfWeek Day of the week: 1=Monday..7=Sunday * @param hour Hour of the day: 0..23 * @param minutes Minutes in the hour: 0..59 * @param seconds Seconds within the minute: 0..59 * @param includeTime Include time in the result string? */ QCString trDateTime(int year,int month,int day,int dayOfWeek, int hour,int minutes,int seconds, DateTimeType includeTime) override { static const char *days[] = { "Пн","Вт","Ср","Чт","Пт","Сб","Нд" }; static const char *months[] = { "Яну","Фев","Мар","Апр","Май","Юни","Юли","Авг","Сеп","Окт","Ное","Дек" }; QCString sdate; if (includeTime == DateTimeType::DateTime || includeTime == DateTimeType::Date) { sdate.sprintf("%s %s %d %d",days[dayOfWeek-1],months[month-1],day,year); } if (includeTime == DateTimeType::DateTime) sdate += " "; if (includeTime == DateTimeType::DateTime || includeTime == DateTimeType::Time) { QCString stime; stime.sprintf("%.2d:%.2d:%.2d",hour,minutes,seconds); sdate+=stime; } return sdate; } QCString trDayOfWeek(int dayOfWeek, bool, bool full) override { static const char *days_short[] = { "пон", "вт", "ср", "четв", "пет", "съб", "нед" }; static const char *days_full[] = { "понеделник", "вторник", "сряда", "четвъртък", "петък", "събота", "неделя" }; return full? days_full[dayOfWeek-1] : days_short[dayOfWeek-1]; } QCString trMonth(int month, bool, bool full) override { static const char *months_short[] = { "яну", "фев", "мар", "апр", "май", "юни", "юли", "авг", "сеп", "окт", "ное", "дек" }; static const char *months_full[] = { "януари", "февруари", "март", "април", "май", "юни", "юли", "август", "септември", "октомври", "ноември", "декември" }; return full? months_full[month-1] : months_short[month-1]; } QCString trDayPeriod(bool period) override { static const char *dayPeriod[] = { "пр.об.", "сл.об." }; return dayPeriod[period?1:0]; } ////////////////////////////////////////////////////////////////////////// // new since 1.7.5 ////////////////////////////////////////////////////////////////////////// /*! Header for the page with bibliographic citations */ QCString trCiteReferences() override { return "Библиография"; } /*! Text for copyright paragraph */ QCString trCopyright() override { return "Авторско право"; } /*! Header for the graph showing the directory dependencies */ QCString trDirDepGraph(const QCString &name) override { return QCString("Граф на зависимостта на директория за ")+name+":"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.0 ////////////////////////////////////////////////////////////////////////// /*! Detail level selector shown for hierarchical indices */ QCString trDetailLevel() override { return "ниво на детайлност"; } /*! Section header for list of template parameters */ QCString trTemplateParameters() override { return "Шаблона Параметри"; } /*! Used in dot graph when UML_LOOK is enabled and there are many fields */ QCString trAndMore(const QCString &number) override { return "и "+number+" повече..."; } /*! Used file list for a Java enum */ QCString trEnumGeneratedFromFiles(bool single) override { QCString result = "Документацията за това изброяване е генерирана от "; if (single) result+="следният файл:"; else result+="следните файлове:"; result+=":"; return result; } /*! Header of a Java enum page (Java enums are represented as classes). */ QCString trEnumReference(const QCString &name) override { return QCString(name)+" Изброяване Справка"; } /*! Used for a section containing inherited members */ QCString trInheritedFrom(const QCString &members,const QCString &what) override { return QCString(members)+" наследен от "+what; } /*! Header of the sections with inherited members specific for the * base class(es) */ QCString trAdditionalInheritedMembers() override { return "Допълнителни наследени членове"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.2 ////////////////////////////////////////////////////////////////////////// /*! Used as a tooltip for the toggle button that appears in the * navigation tree in the HTML output when GENERATE_TREEVIEW is * enabled. This tooltip explains the meaning of the button. */ QCString trPanelSynchronisationTooltip(bool enable) override { QCString opt = enable ? "включване" : "изключване"; return "натиснете на "+opt+" за синхронизация на панела"; } /*! Used in a method of an Objective-C class that is declared in a * a category. Note that the @1 marker is required and is replaced * by a link. */ QCString trProvidedByCategory() override { return "По групи @0."; } /*! Used in a method of an Objective-C category that extends a class. * Note that the @1 marker is required and is replaced by a link to * the class method. */ QCString trExtendsClass() override { return "Разширява класа @0."; } /*! Used as the header of a list of class methods in Objective-C. * These are similar to static public member functions in C++. */ QCString trClassMethods() override { return "Клас Методи"; } /*! Used as the header of a list of instance methods in Objective-C. * These are similar to public member functions in C++. */ QCString trInstanceMethods() override { return "Общодостъпни Методи"; } /*! Used as the header of the member functions of an Objective-C class. */ QCString trMethodDocumentation() override { return "Метод Документация"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.4 ////////////////////////////////////////////////////////////////////////// /** old style UNO IDL services: implemented interfaces */ QCString trInterfaces() override { return "Експортирани интерфейси"; } /** old style UNO IDL services: inherited services */ QCString trServices() override { return "Включени услуги"; } /** UNO IDL constant groups */ QCString trConstantGroups() override { return "Постоянни групи"; } /** UNO IDL constant groups */ QCString trConstantGroupReference(const QCString &namespaceName) override { QCString result=namespaceName; result+=" Постоянни групи Справка"; return result; } /** UNO IDL service page title */ QCString trServiceReference(const QCString &sName) override { QCString result=(QCString)sName; result+=" Сървис Справка"; return result; } /** UNO IDL singleton page title */ QCString trSingletonReference(const QCString &sName) override { QCString result=(QCString)sName; result+=" Конкретика Справка"; return result; } /** UNO IDL service page */ QCString trServiceGeneratedFromFiles(bool single) override { // single is true implies a single file QCString result=(QCString)"Документацията за този сървис " "беше генерирано от "; if (single) result+="следният файл:"; else result+="следните файлове:"; return result; } /** UNO IDL singleton page */ QCString trSingletonGeneratedFromFiles(bool single) override { // single is true implies a single file QCString result=(QCString)"Документацията за тази конкретика " "беше генерирано от "; if (single) result+="следният файл:"; else result+="следните файлове:"; return result; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.15 ////////////////////////////////////////////////////////////////////////// /** VHDL design unit hierarchy */ QCString trDesignUnitHierarchy() override { return "Проектни единици Йерархия"; } /** VHDL design unit list */ QCString trDesignUnitList() override { return "Проектни единици Списък"; } /** VHDL design unit members */ QCString trDesignUnitMembers() override { return "Проектна единица Членове"; } /** VHDL design unit list description */ QCString trDesignUnitListDescription() override { return "Here is a list of all design unit members with links to " "the Entities they belong to:"; } /** VHDL design unit index */ QCString trDesignUnitIndex() override { return "Проектна единица Указател"; } /** VHDL design units */ QCString trDesignUnits() override { return "Проектни единици"; } /** VHDL functions/procedures/processes */ QCString trFunctionAndProc() override { return "Функции/Процедури/Процеси"; } /** VHDL type */ QCString trVhdlType(VhdlSpecifier type,bool single) override { switch(type) { case VhdlSpecifier::LIBRARY: if (single) return "Библиотека"; else return "Библиотеки"; case VhdlSpecifier::PACKAGE: if (single) return "Пакет"; else return "Пакети"; case VhdlSpecifier::SIGNAL: if (single) return "Сигнал"; else return "Сигнали"; case VhdlSpecifier::COMPONENT: if (single) return "Компонент"; else return "Компоненти"; case VhdlSpecifier::CONSTANT: if (single) return "Константа"; else return "Константи"; case VhdlSpecifier::ENTITY: if (single) return "Същност"; else return "Същности"; case VhdlSpecifier::TYPE: if (single) return "Тип"; else return "Типове"; case VhdlSpecifier::SUBTYPE: if (single) return "Подтип"; else return "Подтипове"; case VhdlSpecifier::FUNCTION: if (single) return "Функция"; else return "Функции"; case VhdlSpecifier::RECORD: if (single) return "Запис"; else return "Записи"; case VhdlSpecifier::PROCEDURE: if (single) return "Процедура"; else return "Процедури"; case VhdlSpecifier::ARCHITECTURE: if (single) return "Архитектура"; else return "Архитектури"; case VhdlSpecifier::ATTRIBUTE: if (single) return "Атрибут"; else return "Атрибути"; case VhdlSpecifier::PROCESS: if (single) return "Процес"; else return "Процеси"; case VhdlSpecifier::PORT: if (single) return "Порт"; else return "Портове"; case VhdlSpecifier::USE: if (single) return "use клауза"; else return "Use клаузи"; case VhdlSpecifier::GENERIC: if (single) return "Роден"; else return "Родни"; case VhdlSpecifier::PACKAGE_BODY: return "Тяло на пакета"; case VhdlSpecifier::UNITS: return "Единици"; case VhdlSpecifier::SHAREDVARIABLE: if (single) return "Споделена променлива"; else return "Споделени променливи"; case VhdlSpecifier::VFILE: if (single) return "Файл"; else return "Файлове"; case VhdlSpecifier::GROUP: if (single) return "Група"; else return "Групи"; case VhdlSpecifier::INSTANTIATION: if (single) return "Инстанция"; else return "Инстанции"; case VhdlSpecifier::ALIAS: if (single) return "Псевдоним"; else return "Псевдоними"; case VhdlSpecifier::CONFIG: if (single) return "Конфигурация"; else return "Конфигурации"; case VhdlSpecifier::MISCELLANEOUS: return "Други"; case VhdlSpecifier::UCF_CONST: return "Ограничения"; default: return "Клас"; } } QCString trCustomReference(const QCString &name) override { return QCString(name)+" Отнася се"; } /* Slice */ QCString trConstants() override { return "Константи"; } QCString trConstantDocumentation() override { return "Константи Документация"; } QCString trSequences() override { return "Последователности"; } QCString trSequenceDocumentation() override { return "Последователности Документация"; } QCString trDictionaries() override { return "Речници"; } QCString trDictionaryDocumentation() override { return "Речници Документация"; } QCString trSliceInterfaces() override { return "Интерфейси"; } QCString trInterfaceIndex() override { return "Интерфейси Указател"; } QCString trInterfaceList() override { return "Интерфейси списък"; } QCString trInterfaceListDescription() override { return "Интерфейсите с кратки описания:"; } QCString trInterfaceHierarchy() override { return "Интерфейси Йерархия"; } QCString trInterfaceHierarchyDescription() override { return "Този списък на наследяване е сортиран, но не напълно, по азбучен ред:"; } QCString trInterfaceDocumentation() override { return "Интерфейси Документация"; } QCString trStructs() override { return "Структури"; } QCString trStructIndex() override { return "Структури Указател"; } QCString trStructList() override { return "Структури Списък"; } QCString trStructListDescription() override { return "Структури с кратки описания:"; } QCString trStructDocumentation() override { return "Структури Документация"; } QCString trExceptionIndex() override { return "Изключения Указател"; } QCString trExceptionList() override { return "Изключения Списък"; } QCString trExceptionListDescription() override { return "Изключения с кратки описания:"; } QCString trExceptionHierarchy() override { return "Изключения Йерархия"; } QCString trExceptionHierarchyDescription() override { return "Този списък на наследяване е сортиран, но не напълно, по азбучен ред:"; } QCString trExceptionDocumentation() override { return "Изключения Документация"; } QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) override { QCString result=(QCString)clName; if (isLocal) result+=" Локален"; switch(compType) { case ClassDef::Class: result+=" Клас"; break; case ClassDef::Struct: result+=" Структура"; break; case ClassDef::Union: result+=" Обединение"; break; case ClassDef::Interface: result+=" Интерфейс"; break; case ClassDef::Protocol: result+=" Протокол"; break; case ClassDef::Category: result+=" Категория"; break; case ClassDef::Exception: result+=" Изключение"; break; default: break; } result+=" Отнася се"; return result; } QCString trOperations() override { return "Операции"; } QCString trOperationDocumentation() override { return "Операции Документация"; } QCString trDataMembers() override { return "Членове Данни"; } QCString trDataMemberDocumentation() override { return "Членове Данни Документация"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.19 ////////////////////////////////////////////////////////////////////////// /** VHDL design unit documentation */ QCString trDesignUnitDocumentation() override { return "Проектни единици Документация"; } ////////////////////////////////////////////////////////////////////////// // new since 1.9.2 ////////////////////////////////////////////////////////////////////////// /** C++20 concept */ QCString trConcept(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "концепци", "и", "я"); } /*! used as the title of the HTML page of a C++20 concept page */ QCString trConceptReference(const QCString &conceptName) override { QCString result=conceptName; result+=" Концепции Справка"; return result; } /*! used as the title of page containing all the index of all concepts. */ QCString trConceptList() override { return "Концепции Списък"; } /*! used as the title of chapter containing the index listing all concepts. */ QCString trConceptIndex() override { return "Концепции Указател"; } /*! used as the title of chapter containing all information about concepts. */ QCString trConceptDocumentation() override { return "Концепции Документация"; } /*! used as an introduction to the concept list */ QCString trConceptListDescription(bool extractAll) override { QCString result="Списък на всички "; if (!extractAll) result+="документирани "; result+="концепции с кратко описание:"; return result; } /*! used to introduce the definition of the C++20 concept */ QCString trConceptDefinition() override { return "Дефиниция на концепция"; } }; #endif
86,438
C++
.h
2,055
31.690024
163
0.595787
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,562
translator_je.h
doxygen_doxygen/src/translator_je.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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. * */ /* * translator_jp.h * * 1.2.5) * First Translation * by Kenji Nagamatsu * 1.2.12) * Update and Shift-Jis(_WIN32) * by Ryunosuke Sato (30-Dec-2001) */ #ifndef TRANSLATOR_JE_H #define TRANSLATOR_JE_H class TranslatorJapaneseEn : public TranslatorEnglish { public: QCString idLanguage() override { return "japanese-en"; } QCString latexLanguageSupportCommand() override { return "\\usepackage{CJKutf8}\n"; } QCString latexFontenc() override { return ""; } QCString latexDocumentPre() override { return "\\begin{CJK}{UTF8}{min}\n"; } QCString latexDocumentPost() override { return "\\end{CJK}\n"; } QCString trRTFansicp() override { return "932"; } /*! Used as ansicpg for RTF fcharset * \see trRTFansicp() for a table of possible values. */ QCString trRTFCharSet() override { return "128"; } QCString trISOLang() override { return "ja"; } QCString getLanguageString() override { return "0x411 Japanese"; } }; #endif
1,770
C++
.h
70
21.457143
79
0.64817
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,563
utf8.h
doxygen_doxygen/src/utf8.h
/****************************************************************************** * * Copyright (C) 1997-2021 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 UTF8_H #define UTF8_H #include <cstdint> #include <string> class TextStream; /** @file * @brief Various UTF8 related helper functions. * * See https://en.wikipedia.org/wiki/UTF-8 for details on UTF8 encoding. */ /** Converts the input string into a lower case version, also taking into account * non-ASCII characters that has a lower case variant. */ std::string convertUTF8ToLower(const std::string &input); /** Converts the input string into a upper case version, also taking into account * non-ASCII characters that has a upper case variant. */ std::string convertUTF8ToUpper(const std::string &input); /** Returns the UTF8 character found at byte position pos in the input string. * The resulting string can be a multi byte sequence. */ std::string getUTF8CharAt(const std::string &input,size_t pos); /** Returns the 32bit Unicode value matching character at byte position pos in * the UTF8 encoded input. */ uint32_t getUnicodeForUTF8CharAt(const std::string &input,size_t pos); /** Returns the number of bytes making up a single UTF8 character given the first byte * in the sequence. */ uint8_t getUTF8CharNumBytes(char firstByte); /** Writes the UTF8 character pointed to by s to stream t and returns a pointer * to the next character. */ const char *writeUTF8Char(TextStream &t,const char *s); /** Returns true iff the last character in input is a multibyte character. */ bool lastUTF8CharIsMultibyte(const std::string &input); /** Returns true iff the input string at byte position pos holds an upper case character. */ bool isUTF8CharUpperCase(const std::string &input,size_t pos); /** Check if the first character pointed at by input is a non-breakable whitespace character. * Returns the byte size of the character if there is match or 0 if not. */ int isUTF8NonBreakableSpace(const char *input); /** Check if the given Unicode character represents a punctuation character */ bool isUTF8PunctuationCharacter(uint32_t unicode); #endif
2,653
C++
.h
59
43.169492
93
0.750194
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,564
translator_ru.h
doxygen_doxygen/src/translator_ru.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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. */ /* * * Nickolay Semyonov * Andrey V. Stolyarov released Feb 14, 2001 * Alexandr V. Chelpanov <cav@cryptopro.ru> released Sep 25, 2004 * Благодарности: Vitaly A. Repin <vitaly@radio.hop.stu.neva.ru>, * Михаил Глушенков <bbman@mail.ru> */ #ifndef TRANSLATOR_RU_H #define TRANSLATOR_RU_H class TranslatorRussian : public Translator { public: /*! Used for identification of the language. */ QCString idLanguage() override { return "russian"; } /* Used to get the command(s) for the language support. */ QCString latexLanguageSupportCommand() override { return "\\usepackage[T2A]{fontenc}\n\\usepackage[russian]{babel}\n"; } QCString trISOLang() override { return "ru"; } QCString getLanguageString() override { return "0x419 Russian"; } // --- Language translation methods ------------------- /*! used in the compound documentation before a list of related functions. */ QCString trRelatedFunctions() override { return "Относящиеся к классу функции"; } /*! subscript for the related functions. */ QCString trRelatedSubscript() override { return "(не члены класса)"; } /*! header that is put before the detailed description of files, classes and namespaces. */ QCString trDetailedDescription() override { return "Подробное описание"; } /*! header that is used when the summary tag is missing inside the details tag */ QCString trDetails() override { return "Подробности"; } /*! header that is put before the list of typedefs. */ QCString trMemberTypedefDocumentation() override { return "Определения типов"; } /*! header that is put before the list of enumerations. */ QCString trMemberEnumerationDocumentation() override { return "Перечисления"; } /*! header that is put before the list of member functions. */ QCString trMemberFunctionDocumentation() override { return "Методы"; } /*! header that is put before the list of member attributes. */ QCString trMemberDataDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Поля"; } else { return "Данные класса"; } } /*! this is the text of a link put after brief descriptions. */ QCString trMore() override { return "Подробнее..."; } /*! put in the class documentation */ /* Isn't used when optimization for C is on. */ QCString trListOfAllMembers() override { return "Полный список членов класса"; } /*! used as the title of the "list of all members" page of a class */ /* Isn't used when optimization for C is on. */ QCString trMemberList() override { return "Cписок членов класса"; } /*! this is the first part of a sentence that is followed by a class name */ /* Isn't used when optimization for C is on. */ QCString trThisIsTheListOfAllMembers() override { return "Полный список членов класса"; } /*! this is the remainder of the sentence after the class name */ /* Isn't used when optimization for C is on. */ QCString trIncludingInheritedMembers() override { return ", включая наследуемые из базового класса"; } /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ QCString trGeneratedAutomatically(const QCString &s) override { QCString result="Автоматически создано Doxygen"; if (!s.isEmpty()) result+=QCString(" для ")+s; result+=" из исходного текста."; return result; } /*! put after an enum name in the list of all members */ QCString trEnumName() override { return "перечисление"; } /*! put after an enum value in the list of all members */ QCString trEnumValue() override { return "элементы перечисления"; } /*! put after an undocumented member in the list of all members */ QCString trDefinedIn() override { return "определено в"; } // quick reference sections /*! This is put above each page as a link to the list of all groups of * compounds or files (see the \\group command). */ QCString trModules() override { return "Группы"; } /*! This is put above each page as a link to the class hierarchy */ QCString trClassHierarchy() override { return "Иерархия классов"; } /*! This is put above each page as a link to the list of annotated classes */ QCString trCompoundList() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структуры данных"; } else { return "Классы"; } } /*! This is put above each page as a link to the list of documented files */ QCString trFileList() override { return "Файлы"; } /*! This is put above each page as a link to all members of compounds. */ QCString trCompoundMembers() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Поля структур"; } else { return "Члены классов"; } } /*! This is put above each page as a link to all members of files. */ /*??*/ QCString trFileMembers() override { return "Список членов всех файлов"; } /*! This is put above each page as a link to all related pages. */ QCString trRelatedPages() override /* ?? Вариант перевода "См. также: " более удачный, но не в заголовке, как в данном случае. */ { return "Описания"; } /*! This is put above each page as a link to all examples. */ QCString trExamples() override { return "Примеры"; } /*! This is put above each page as a link to the search engine. */ QCString trSearch() override { return "Поиск"; } /*! This is an introduction to the class hierarchy. */ QCString trClassHierarchyDescription() override { return "Иерархия классов."; } /*! This is an introduction to the list with all files. */ QCString trFileListDescription(bool extractAll) override { QCString result="Полный список "; if (!extractAll) result+="документированных "; result+="файлов."; return result; } /*! This is an introduction to the annotated compound list. */ QCString trCompoundListDescription() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структуры данных с их кратким описанием."; } else if (Config_getBool(OPTIMIZE_OUTPUT_SLICE)) { return "Классы с их кратким описанием."; } else { return "Классы с их кратким описанием."; } } /*! This is an introduction to the page with all class members. */ QCString trCompoundMembersDescription(bool extractAll) override { QCString result="Список всех "; if(!extractAll) result+="документированных "; if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) result+="членов структур данных со ссылками на "; else result+="членов классов со ссылками на "; if(!extractAll) { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) result+="документацию по структуре для каждого члена."; else result+="документацию по классу для каждого члена."; } else { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) result += "структуры"; else result += "классы"; result+=", к которым они принадлежат."; } return result; } /*! This is an introduction to the page with all file members. */ QCString trFileMembersDescription(bool extractAll) override { QCString result="Список всех "; if (!extractAll) result+="документированных "; if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="функций, переменных, макроопределений, " "перечислений и определений типов"; } else { result+="членов файлов "; } result+=" со ссылками на "; if (extractAll) result+="файлы, к которым они принадлежат."; else result+="документацию."; return result; } /*! This is an introduction to the page with the list of all examples */ QCString trExamplesDescription() override { return "Полный список примеров."; } /*! This is an introduction to the page with the list of related pages */ QCString trRelatedPagesDescription() override { return "Полный список дополнительных описаний."; } /*! This is an introduction to the page with the list of class/file groups */ QCString trModulesDescription() override { return "Полный список групп."; } // index titles (the project name is prepended for these) /*! This is used in HTML as the title of index.html. */ QCString trDocumentation(const QCString &projName) override { return (!projName.isEmpty()?projName + " " : "") + "Документация"; } /*! This is used in LaTeX as the title of the chapter with the * index of all groups. */ QCString trModuleIndex() override { return "Алфавитный указатель групп"; } /*! This is used in LaTeX as the title of the chapter with the * class hierarchy. */ QCString trHierarchicalIndex() override { return "Иерархический список классов"; } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index. */ QCString trCompoundIndex() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Алфавитный указатель структур данных"; } else { return "Алфавитный указатель классов"; } } /*! This is used in LaTeX as the title of the chapter with the * list of all files. */ QCString trFileIndex() override { return "Список файлов"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all groups. */ QCString trModuleDocumentation() override { return "Группы"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all classes, structs and unions. */ QCString trClassDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структуры данных"; } else if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) { return trDesignUnitDocumentation(); } else { return "Классы"; } } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all files. */ QCString trFileDocumentation() override { return "Файлы"; } /*! This is used in LaTeX as the title of the document */ QCString trReferenceManual() override { return "Оглавление"; } /*! This is used in the documentation of a file as a header before the * list of defines */ QCString trDefines() override { return "Макросы"; } /*! This is used in the documentation of a file as a header before the * list of typedefs */ QCString trTypedefs() override { return "Определения типов"; } /*! This is used in the documentation of a file as a header before the * list of enumerations */ QCString trEnumerations() override { return "Перечисления"; } /*! This is used in the documentation of a file as a header before the * list of (global) functions */ QCString trFunctions() override { return "Функции"; } /*! This is used in the documentation of a file as a header before the * list of (global) variables */ QCString trVariables() override { return "Переменные"; } /*! This is used in the documentation of a file as a header before the * list of (global) variables */ QCString trEnumerationValues() override { return "Элементы перечислений"; } /*! This is used in the documentation of a file before the list of * documentation blocks for defines */ QCString trDefineDocumentation() override { return "Макросы"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for typedefs */ QCString trTypedefDocumentation() override { return "Типы"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration types */ QCString trEnumerationTypeDocumentation() override { return "Перечисления"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for functions */ QCString trFunctionDocumentation() override { return "Функции"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for variables */ QCString trVariableDocumentation() override { return "Переменные"; } /*! This is used in the documentation of a file/namespace/group before * the list of links to documented compounds */ QCString trCompounds() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структуры данных"; } else { return "Классы"; } } /*! This is used in the documentation of a group before the list of * links to documented files */ /*! This is used in the standard footer of each page and indicates when * the page was generated */ QCString trGeneratedAt(const QCString &date,const QCString &projName) override { QCString result="Документация "; if (!projName.isEmpty()) result+=QCString("по ")+projName; result+=QCString(". Последние изменения: ")+date; result+=". Создано системой"; return result; } /*! this text is put before a class diagram */ QCString trClassDiagram(const QCString &clName) override { return QCString("Граф наследования:")+clName+":"; } /*! this text is generated when the \\warning command is used. */ QCString trWarning() override { return "Предупреждения"; } /*! this text is generated when the \\version command is used. */ QCString trVersion() override { return "Версия"; } /*! this text is generated when the \\date command is used. */ QCString trDate() override { return "Дата"; } /*! this text is generated when the \\return command is used. */ QCString trReturns() override { return "Возвращает"; } /*! this text is generated when the \\sa command is used. */ QCString trSeeAlso() override { return "См. также"; } /*! this text is generated when the \\param command is used. */ QCString trParameters() override { return "Аргументы"; } /*! this text is generated when the \\exception command is used. */ QCString trExceptions() override { return "Исключения"; } /*! this text is used in the title page of a LaTeX document. */ QCString trGeneratedBy() override { return "Создано системой"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990307 ////////////////////////////////////////////////////////////////////////// /*! used as the title of page containing all the index of all namespaces. */ QCString trNamespaceList() override { return "Пространства имен"; } /*! used as an introduction to the namespace list */ QCString trNamespaceListDescription(bool extractAll) override { QCString result="Полный список "; if (!extractAll) result+="документированных "; result+="пространств имен."; return result; } /*! used in the class documentation as a header before the list of all * friends of a class */ QCString trFriends() override { return "Друзья"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990405 ////////////////////////////////////////////////////////////////////////// /*! used in the class documentation as a header before the list of all * related classes */ QCString trRelatedFunctionDocumentation() override { return "Документация по друзьям класса и функциям, относящимся" " к классу"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) override { QCString result; if (isTemplate) { result="Шаблон "; switch(compType) { case ClassDef::Class: result+="класса"; break; case ClassDef::Struct: result+="структуры"; break; case ClassDef::Union: result+="объединения"; break; case ClassDef::Interface: result+="интерфейса"; break; case ClassDef::Protocol: result+="протокола"; break; case ClassDef::Category: result+="категории"; break; case ClassDef::Exception: result+="исключения"; break; default: break; } } else { switch(compType) { case ClassDef::Class: result+="Класс"; break; case ClassDef::Struct: result+="Структура"; break; case ClassDef::Union: result+="Объединение"; break; case ClassDef::Interface: result+="Интерфейс"; break; case ClassDef::Protocol: result+="Протокол"; break; case ClassDef::Category: result+="Категория"; break; case ClassDef::Exception: result+="Исключение"; break; default: break; } } result+=" "; return result+clName; } /*! used as the title of the HTML page of a file */ QCString trFileReference(const QCString &fileName) override { return QCString("Файл ")+fileName; } /*! used as the title of the HTML page of a namespace */ QCString trNamespaceReference(const QCString &namespaceName) override { return QCString("Пространство имен ")+namespaceName; } QCString trPublicMembers() override { return "Открытые члены"; } QCString trPublicSlots() override { return "Открытые слоты"; } QCString trSignals() override { return "Сигналы"; } QCString trStaticPublicMembers() override { return "Открытые статические члены"; } QCString trProtectedMembers() override { return "Защищенные члены"; } QCString trProtectedSlots() override { return "Защищенные слоты"; } QCString trStaticProtectedMembers() override { return "Защищенные статические члены"; } QCString trPrivateMembers() override { return "Закрытые члены"; } QCString trPrivateSlots() override { return "Закрытые слоты"; } QCString trStaticPrivateMembers() override { return "Закрытые статические члены"; } /*! this function is used to produce a comma-separated list of items. * use generateMarker(i) to indicate where item i should be put. */ QCString trWriteList(int numEntries) override { QCString result; // the inherits list contain `numEntries' classes for (int i=0;i<numEntries;i++) { // use generateMarker to generate placeholders for the class links! result+=generateMarker(i); // generate marker for entry i in the list // (order is left to right) if (i!=numEntries-1) // not the last entry, so we need a separator { if (i<numEntries-2) // not the fore last entry result+=", "; else // the fore last entry result+=" и "; } } return result; } /*! used in class documentation to produce a list of base classes, * if class diagrams are disabled. */ QCString trInheritsList(int numEntries) override { return "Базовые классы:"+trWriteList(numEntries)+"."; } /*! used in class documentation to produce a list of super classes, * if class diagrams are disabled. */ QCString trInheritedByList(int numEntries) override { return "Производные классы:"+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * members that are hidden by this one. */ QCString trReimplementedFromList(int numEntries) override { QCString result="Переопределяет метод"; if(numEntries>1) result+="ы предков"; else result+=" предка"; return result+" "+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * all member that overwrite the implementation of this member. */ QCString trReimplementedInList(int numEntries) override { return "Переопределяется в "+trWriteList(numEntries)+"."; } /*! This is put above each page as a link to all members of namespaces. */ QCString trNamespaceMembers() override { return "Члены пространств имен"; } /*! This is an introduction to the page with all namespace members */ QCString trNamespaceMemberDescription(bool extractAll) override { QCString result="Полный список "; if (!extractAll) result+="документированных "; result+="членов простанств имен."; return result; } /*! This is used in LaTeX as the title of the chapter with the * index of all namespaces. */ QCString trNamespaceIndex() override { return "Алфавитный указатель пространств имен"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all namespaces. */ QCString trNamespaceDocumentation() override { return "Пространства имен"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990522 ////////////////////////////////////////////////////////////////////////// /*! This is used in the documentation before the list of all * namespaces in a file. */ QCString trNamespaces() override { return "Пространства имен"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990728 ////////////////////////////////////////////////////////////////////////// /*! This is put at the bottom of a class documentation page and is * followed by a list of files that were used to generate the page. */ QCString trGeneratedFromFiles(ClassDef::CompoundType compType, bool single) override { // here s is one of " Class", " Struct" or " Union" // single is true implies a single file QCString result=QCString("Объявления и описания членов "); switch(compType) { case ClassDef::Class: result+="класс"; if (single) result+="а"; else result+="ов"; break; case ClassDef::Struct: result+="структур"; if (single) result+="ы"; break; case ClassDef::Union: result+="объединени"; if (single) result+="я"; else result+="й"; break; case ClassDef::Interface: result+="интерфейс"; if (single) result+="а"; else result+="ов"; break; case ClassDef::Protocol: result+="протокол"; if (single) result+="а"; else result+="ов"; break; case ClassDef::Category: result+="категори"; if (single) result+="и"; else result+="й"; break; case ClassDef::Exception: result+="исключени"; if (single) result+="я"; else result+="й"; break; default: break; } result+=" находятся в файл"; if (single) result+="е:"; else result+="ах:"; return result; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990901 ////////////////////////////////////////////////////////////////////////// /*! This is used as the heading text for the retval command. */ QCString trReturnValues() override { return "Возвращаемые значения"; } /*! This is in the (quick) index as a link to the main page (index.html) */ QCString trMainPage() override { return "Титульная страница"; } /*! This is used in references to page that are put in the LaTeX * documentation. It should be an abbreviation of the word page. */ QCString trPageAbbreviation() override { return "стр."; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-991106 ////////////////////////////////////////////////////////////////////////// QCString trDefinedAtLineInSourceFile() override { return "См. определение в файле @1 строка @0"; } QCString trDefinedInSourceFile() override { return "См. определение в файле @0"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-991205 ////////////////////////////////////////////////////////////////////////// QCString trDeprecated() override { return "Уст."; } ////////////////////////////////////////////////////////////////////////// // new since 1.0.0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ QCString trCollaborationDiagram(const QCString &clName) override { return "Граф связей класса "+clName+":"; } /*! this text is put before an include dependency graph */ QCString trInclDepGraph(const QCString &fName) override { return "Граф включаемых заголовочных файлов для "+fName+":"; } /*! header that is put before the list of constructor/destructors. */ QCString trConstructorDocumentation() override { return "Конструктор(ы)"; } /*! Used in the file documentation to point to the corresponding sources. */ QCString trGotoSourceCode() override { return "См. исходные тексты."; } /*! Used in the file sources to point to the corresponding documentation. */ QCString trGotoDocumentation() override { return "См. документацию."; } /*! Text for the \\pre command */ QCString trPrecondition() override { return "Предусловие"; } /*! Text for the \\post command */ QCString trPostcondition() override { return "Постусловие"; } /*! Text for the \\invariant command */ QCString trInvariant() override { return "Инвариант"; } /*! Text shown before a multi-line variable/enum initialization */ QCString trInitialValue() override { return "Инициализатор"; } /*! Text used the source code in the file index */ QCString trCode() override { return "Исходные тексты"; } QCString trGraphicalHierarchy() override { return "Иерархия классов. Графический вид."; } QCString trGotoGraphicalHierarchy() override { return "см. графический вид."; } QCString trGotoTextualHierarchy() override { return "см. текстовый вид."; } QCString trPageIndex() override { return "Алфавитный указатель тематических описаний"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.0 ////////////////////////////////////////////////////////////////////////// QCString trNote() override { return "Заметки"; } QCString trPublicTypes() override { return "Открытые типы"; } QCString trPublicAttribs() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Поля данных"; } else { return "Открытые атрибуты"; } } QCString trStaticPublicAttribs() override { return "Статические открытые данные"; } QCString trProtectedTypes() override { return "Защищенные типы"; } QCString trProtectedAttribs() override { return "Защищенные данные"; } QCString trStaticProtectedAttribs() override { return "Статические защищенные данные"; } QCString trPrivateTypes() override { return "Закрытые типы"; } QCString trPrivateAttribs() override { return "Закрытые данные"; } QCString trStaticPrivateAttribs() override { return "Закрытые статические данные"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.3 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a todo item */ QCString trTodo() override /*??*/ { return "Необходимо сделать"; } /*! Used as the header of the todo list */ QCString trTodoList() override /*??*/ { return "Список задач"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.4 ////////////////////////////////////////////////////////////////////////// QCString trReferencedBy() override { return "Используется в"; } QCString trRemarks() override { return "Прим."; } QCString trAttention() override { return "Внимание"; } QCString trInclByDepGraph() override { return "Граф файлов, в которые включается этот файл:"; } QCString trSince() override /*??*/ { return "Начиная с"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.5 ////////////////////////////////////////////////////////////////////////// /*! title of the graph legend page */ QCString trLegendTitle() override { return "Легенда"; } /*! page explaining how the dot graph's should be interpreted */ QCString trLegendDocs() override { return "Обозначения, используемые в графах.<p>\n" "Рассмотрим следующий пример:\n" "\\code\n" "/*! Невидимый класс из-за усечения */\n" "class Invisible { };\n\n" "/*! Усеченный класс, отношение наследования скрыто */\n" "class Truncated : public Invisible { };\n\n" "/* Недокументированный класс */\n" "class Undocumented { };\n\n" "/*! Открытое наследование */\n" "class PublicBase : public Truncated { };\n\n" "/*! Шаблон класса */\n" "template<class T> class Templ {};\n\n" "/*! Защищенное наследование */\n" "class ProtectedBase { };\n\n" "/*! Закрытое наследование */\n" "class PrivateBase { };\n\n" "/*! Класс, используемый классом Inherited */\n" "class Used { };\n\n" "/*! Класс, порожденный от других классов */\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" "Получится следующий граф:" "<p><center><img src=\"graph_legend."+getDotImageExtension()+"\"></center>\n" "<p>\n" "Прямоугольники в этом графе имеют следующее значение:\n" "<ul>\n" "<li>Заполненный черный прямоугольник представляет структуру или класс, " "для которого создан граф.\n" "<li>Прямоугольник с черной границей обозначает документированную структуру или класс.\n" "<li>Прямоугольник с серой границей обозначает недокументированную структуру или класс.\n" "<li>Прямоугольник с красной границей обозначает документированную структуру или класс, для которого\n" " не все отношения наследования/содержания показаны. Граф усечен, " "если он не поместился в указанных границах.\n" "</ul>\n" "Стрелки имеют следующее значение:\n" "<ul>\n" "<li>Темно-синяя стрелка используется для изображения отношения открытого наследования " "между двумя классами.\n" "<li>Темно-зеленая стрелка используется при защищенном наследовании.\n" "<li>Темно-красная стрелка используется при закрытом наследовании.\n" "<li>Фиолетовая стрелка используется, если класс содержится в" "другом класе или используется другим классом." "Со стрелкой указывается переменная, " "через которую доступен указываемый класс или структура. \n" "<li>Желтая стрелка используется для связи подстановки шаблона и " "шаблона, на основе которого эта подстановка выполнена. С шаблоном" "указывается параметр подстановки.\n" "</ul>\n"; } /*! text for the link to the legend page */ QCString trLegend() override { return "см. легенду"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.0 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a test item */ QCString trTest() override { return "Тест"; } /*! Used as the header of the test list */ QCString trTestList() override { return "Список тестов"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.2 ////////////////////////////////////////////////////////////////////////// /*! Used as a section header for IDL properties */ QCString trProperties() override { return "Свойства"; } /*! Used as a section header for IDL property documentation */ QCString trPropertyDocumentation() override { return "Полный список свойств"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.4 ////////////////////////////////////////////////////////////////////////// /*! Used for Java classes in the summary section of Java packages */ QCString trClasses() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Структуры данных"; } else { return "Классы"; } } /*! Used as the title of a Java package */ QCString trPackage(const QCString &name) override { return QCString("Пакет ")+name; } /*! The description of the package index page */ QCString trPackageListDescription() override { return "Полный список документированных пакетов."; } /*! The link name in the Quick links header for each page */ QCString trPackages() override { return "Пакеты"; } /*! Text shown before a multi-line define */ QCString trDefineValue() override { return "Макроопределение:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.5 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a \\bug item */ QCString trBug() override { return "Ошибка"; } /*! Used as the header of the bug list */ QCString trBugList() override { return "Ошибки"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.6 ////////////////////////////////////////////////////////////////////////// /*! Used as ansicpg for RTF file */ QCString trRTFansicp() override { return "1251"; } /*! Used as ansicpg for RTF fcharset */ QCString trRTFCharSet() override { return "204"; } /*! Used as header RTF general index */ QCString trRTFGeneralIndex() override { return "Алфавитный указатель"; } /*! 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. */ QCString trClass(bool first_capital, bool singular) override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { QCString result((first_capital ? "Структуры данных" : "структуры данных")); return result; } else { return createNoun(first_capital, singular, "класс", "ы"); } } /*! 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. */ QCString trFile(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "файл", "ы"); } /*! 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. */ QCString trNamespace(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "пространств", "а имен", "о имен"); } /*! 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. */ QCString trGroup(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "групп", "ы", "а"); } /*! 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. */ QCString trPage(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "страниц", "ы", "а"); } /*! 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. */ QCString trMember(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "член", "ы"); } /*! 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. */ QCString trGlobal(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "глобальны", "е", "й"); } ////////////////////////////////////////////////////////////////////////// // new since 1.2.7 ////////////////////////////////////////////////////////////////////////// /*! This text is generated when the \\author command is used and * for the author section in man pages. */ QCString trAuthor(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "автор", "ы"); } ////////////////////////////////////////////////////////////////////////// // new since 1.2.11 ////////////////////////////////////////////////////////////////////////// /*! This text is put before the list of members referenced by a member */ QCString trReferences() override { return "Перекрестные ссылки"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.13 ////////////////////////////////////////////////////////////////////////// /*! used in member documentation blocks to produce a list of * members that are implemented by this one. */ QCString trImplementedFromList(int numEntries) override { return "Замещает "+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * all members that implementation this member. */ QCString trImplementedInList(int numEntries) override { return "Замещается в "+trWriteList(numEntries)+"."; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.16 ////////////////////////////////////////////////////////////////////////// /*! used in RTF documentation as a heading for the Table * of Contents. */ QCString trRTFTableOfContents() override { return "Оглавление"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.17 ////////////////////////////////////////////////////////////////////////// /*! Used as the header of the list of item that have been * flagged deprecated */ QCString trDeprecatedList() override { return "Список устаревших определений и описаний"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.18 ////////////////////////////////////////////////////////////////////////// /*! Used as a header for declaration section of the events found in * a C# program */ QCString trEvents() override { return "События"; } /*! Header used for the documentation section of a class' events. */ QCString trEventDocumentation() override { return "Cобытия"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3 ////////////////////////////////////////////////////////////////////////// /*! Used as a heading for a list of Java class types with package scope. */ QCString trPackageTypes() override { return "Типы с областью видимости пакета"; } /*! Used as a heading for a list of Java class functions with package * scope. */ QCString trPackageFunctions() override { return "Функции с областью видимости пакета"; } QCString trPackageMembers() override { return "Члены с областью видимости пакета"; } /*! Used as a heading for a list of static Java class functions with * package scope. */ QCString trStaticPackageFunctions() override { return "Статические функции с областью видимости пакета"; } /*! Used as a heading for a list of Java class variables with package * scope. */ QCString trPackageAttribs() override { return "Переменные с областью видимости пакета"; } /*! Used as a heading for a list of static Java class variables with * package scope. */ QCString trStaticPackageAttribs() override { 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. */ QCString trAll() override { return "Указатель"; } /*! Put in front of the call graph for a function. */ QCString trCallGraph() override { return "Граф вызовов:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.3 ////////////////////////////////////////////////////////////////////////// /*! This string is used as the title for the page listing the search * results. */ QCString trSearchResultsTitle() override { return "Результаты поиска"; } /*! 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. */ QCString trSearchResults(int numDocuments) override { if (numDocuments==0) { return "К сожалению, по Вашему запросу ничего не найдено."; } else if( numDocuments == 1 ) { return "Найден 1 документ."; } else { return "Найден(о) <b>$num</b> документ(ов). " "Документы отсортированы по релевантности."; } } /*! 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. */ QCString trSearchMatches() override { return "Найдено:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.8 ////////////////////////////////////////////////////////////////////////// /*! This is used in HTML as the title of page with source code for file filename */ QCString trSourceFile(const QCString& filename) override { return "Исходный файл " + filename; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.9 ////////////////////////////////////////////////////////////////////////// /*! This is used as the name of the chapter containing the directory * hierarchy. */ QCString trDirIndex() override { return "Дерево директорий"; } /*! This is used as the name of the chapter containing the documentation * of the directories. */ QCString trDirDocumentation() override { return "Директории"; } /*! 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. */ QCString trDirectories() override { return "Алфавитный указатель директорий"; } /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ QCString trDirReference(const QCString &dirName) override { QCString result=QCString("Содержание директории ")+ dirName; return result; } /*! This returns the word directory with or without starting capital * (\a first_capital) and in sigular or plural form (\a singular). */ QCString trDir(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "директори", "и", "я"); } ////////////////////////////////////////////////////////////////////////// // new since 1.4.1 ////////////////////////////////////////////////////////////////////////// /*! This text is added to the documentation when the \\overload command * is used for a overloaded function. */ QCString trOverloadText() override { return "Эта функция перегружена и предоставляется исключительно " "для удобства использования. Она отличается от вышеупомянутой " "только фактическими аргументами."; } ////////////////////////////////////////////////////////////////////////// // new since 1.4.6 ////////////////////////////////////////////////////////////////////////// /*! This is used to introduce a caller (or called-by) graph */ QCString trCallerGraph() override { return "Граф вызова функции:"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration values */ QCString trEnumerationValueDocumentation() override { return "Элементы перечислений"; } ////////////////////////////////////////////////////////////////////////// // new since 1.5.4 (mainly for Fortran) ////////////////////////////////////////////////////////////////////////// // Простите переводчика, уже лет 20 не писал на фортране... // Любые замечания приму с благодарностью. /*! header that is put before the list of member subprograms (Fortran). */ QCString trMemberFunctionDocumentationFortran() override { return "Функции/подпрограммы"; } /*! This is put above each page as a link to the list of annotated data types (Fortran). */ QCString trCompoundListFortran() override { return "Типы данных"; } /*! This is put above each page as a link to all members of compounds (Fortran). */ QCString trCompoundMembersFortran() override { return "Поля данных"; } /*! This is an introduction to the annotated compound list (Fortran). */ QCString trCompoundListDescriptionFortran() override { return "Аннотированный список типов данных:"; } /*! This is an introduction to the page with all data types (Fortran). */ QCString trCompoundMembersDescriptionFortran(bool extractAll) override { QCString result="Список всех "; if (!extractAll) { result+="документированных "; } result+="членов типа со ссылками "; if (!extractAll) { result+="на документацию для каждого члена:"; } else { result+="на содержащую структуру:"; } return result; } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index (Fortran). */ QCString trCompoundIndexFortran() override { return "Типы данных"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all data types (Fortran). */ QCString trTypeDocumentation() override { return "Оглавление типов данных"; } /*! This is used in the documentation of a file as a header before the * list of (global) subprograms (Fortran). */ QCString trSubprograms() override { return "Функции/подпрограммы"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for subprograms (Fortran) */ QCString trSubprogramDocumentation() override { return "Функции/подпрограммы"; } /*! This is used in the documentation of a file/namespace/group before * the list of links to documented compounds (Fortran) */ QCString trDataTypes() override { return "Типы данных"; } /*! used as the title of page containing all the index of all modules (Fortran). */ QCString trModulesList() override { return "Указатель модулей"; } /*! used as an introduction to the modules list (Fortran) */ QCString trModulesListDescription(bool extractAll) override { QCString result="Аннотированный список"; if (!extractAll) result+="документированных "; result+="модулей:"; return result; } /*! used as the title of the HTML page of a module/type (Fortran) */ QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) override { QCString result=clName; if (isTemplate) { switch(compType) { case ClassDef::Class: result+=" Модуль"; break; case ClassDef::Struct: result+=" Тип"; break; case ClassDef::Union: result+=" Объединение"; break; case ClassDef::Interface: result+=" Интерфейс"; break; case ClassDef::Protocol: result+=" Протокол"; break; case ClassDef::Category: result+=" Категория"; break; case ClassDef::Exception: result+=" Исключение"; break; default: break; } } else { result+=" Шаблон "; switch(compType) { case ClassDef::Class: result+="модуля"; break; case ClassDef::Struct: result+="типа"; break; case ClassDef::Union: result+="объединения"; break; case ClassDef::Interface: result+="интерфейса"; break; case ClassDef::Protocol: result+="протокола"; break; case ClassDef::Category: result+="категории"; break; case ClassDef::Exception: result+="исключения"; break; default: break; } } return result; } /*! used as the title of the HTML page of a module (Fortran) */ QCString trModuleReference(const QCString &namespaceName) override { return QCString("Модуль ") + namespaceName; } /*! This is put above each page as a link to all members of modules. (Fortran) */ QCString trModulesMembers() override { return "Члены модуля"; } /*! This is an introduction to the page with all modules members (Fortran) */ QCString trModulesMemberDescription(bool extractAll) override { QCString result="Список всех "; if (!extractAll) result+="документированных "; result+="модулей со ссылками "; if (extractAll) { result+="на документацию для каждого члена:"; } else { result+="на модули, их содержащие:"; } return result; } /*! This is used in LaTeX as the title of the chapter with the * index of all modules (Fortran). */ QCString trModulesIndex() override { return "Указатель модулей"; } /*! 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. */ QCString trModule(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "модул", "и", "ь"); } /*! This is put at the bottom of a module documentation page and is * followed by a list of files that were used to generate the page. */ QCString trGeneratedFromFilesFortran(ClassDef::CompoundType compType, bool single) override { // here s is one of " Module", " Struct" or " Union" // single is true implies a single file QCString result="Документация по "; switch(compType) { case ClassDef::Class: result+="модулю"; break; case ClassDef::Struct: result+="типу"; break; case ClassDef::Union: result+="объединению"; break; case ClassDef::Interface: result+="интерфейсу"; break; case ClassDef::Protocol: result+="протоколу"; break; case ClassDef::Category: result+="категории"; break; case ClassDef::Exception: result+="исключению"; break; default: break; } result+=" сгенерирована на основе следующ"; if (single) result+="его файла:"; else result+="их файлов:"; 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. */ QCString trType(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "тип", "ы"); } /*! 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. */ QCString trSubprogram(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "подпрограмм", "ы", "а"); } /*! C# Type Constraint list */ QCString trTypeConstraints() override { return "Согласование типов"; } ////////////////////////////////////////////////////////////////////////// // new since 1.6.0 (mainly for the new search engine) ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ QCString trDirRelation(const QCString &name) override { return QCString(name)+" Связь"; } /*! Loading message shown when loading search results */ QCString trLoading() override { return "Загрузка..."; } /*! Label used for search results in the global namespace */ QCString trGlobalNamespace() override { return "Глобальное пространство имён"; } /*! Message shown while searching */ QCString trSearching() override { return "Поиск..."; } /*! Text shown when no search results are found */ QCString trNoMatches() override { return "Не найдено"; } ////////////////////////////////////////////////////////////////////////// // new since 1.6.3 (missing items for the directory pages) ////////////////////////////////////////////////////////////////////////// /*! when clicking a directory dependency label, a page with a * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ QCString trFileIn(const QCString &name) override { return "Файл в "+name; } /*! when clicking a directory dependency label, a page with a * table is shown. The heading for the second column mentions the * destination file that is included. */ QCString trIncludesFileIn(const QCString &name) override { return "Включает файл в "+name; } /** Compiles a date string. * @param year Year in 4 digits * @param month Month of the year: 1=January * @param day Day of the Month: 1..31 * @param dayOfWeek Day of the week: 1=Monday..7=Sunday * @param hour Hour of the day: 0..23 * @param minutes Minutes in the hour: 0..59 * @param seconds Seconds within the minute: 0..59 * @param includeTime Include time in the result string? */ QCString trDateTime(int year,int month,int day,int dayOfWeek, int hour,int minutes,int seconds, DateTimeType includeTime) override { static const char *days[] = { "Пн","Вт","Ср","Чт","Пт","Сб","Вс" }; static const char *months[] = { "Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек" }; QCString sdate; if (includeTime == DateTimeType::DateTime || includeTime == DateTimeType::Date) { sdate.sprintf("%s %d %s %d",days[dayOfWeek-1],day,months[month-1],year); } if (includeTime == DateTimeType::DateTime) sdate += " "; if (includeTime == DateTimeType::DateTime || includeTime == DateTimeType::Time) { QCString stime; stime.sprintf("%.2d:%.2d:%.2d",hour,minutes,seconds); sdate+=stime; } return sdate; } QCString trDayOfWeek(int dayOfWeek, bool, bool full) override { static const char *days_short[] = { "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс" }; static const char *days_full[] = { "понедельник", "вторник", "среда", "четверг", "пятница", "суббота", "воскресенье" }; QCString text = full? days_full[dayOfWeek-1] : days_short[dayOfWeek-1]; return text; } QCString trMonth(int month, bool, bool full) override { static const char *months_short[] = { "янв", "фев", "мар", "апр", "май", "июн", "июл", "авг", "сен", "окт", "ноя", "дек" }; static const char *months_full[] = { "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" }; QCString text = full? months_full[month-1] : months_short[month-1]; return text; } QCString trDayPeriod(bool period) override { static const char *dayPeriod[] = { "AM", "PM" }; return dayPeriod[period?1:0]; } /////////////////////////////////////////////////////////////////////// // new since 1.7.5 /////////////////////////////////////////////////////////////////////// /*! Header for the page with bibliographic citations */ QCString trCiteReferences() override { return "Библиографические ссылки"; } /*! Text for copyright paragraph */ QCString trCopyright() override { return "Авторство"; } /*! Header for the graph showing the directory dependencies */ QCString trDirDepGraph(const QCString &name) override { return QCString("Директория графа зависимостей ")+name+":"; } /////////////////////////////////////////////////////////////////////// // new since 1.8.0 /////////////////////////////////////////////////////////////////////// /*! Detail level selector shown for hierarchical indices */ QCString trDetailLevel() override { return "уровень детализации"; } /*! Section header for list of template parameters */ QCString trTemplateParameters() override { return "Параметры шаблона"; } /*! Used in dot graph when UML_LOOK is enabled and there are many fields */ QCString trAndMore(const QCString &number) override { return "и "+number+" больше..."; } /*! Used file list for a Java enum */ QCString trEnumGeneratedFromFiles(bool single) override { QCString result = "Документация для этого перечисления сгенерерирована из файл"; if (!single) result += "ов"; result+="а:"; return result; } /*! Header of a Java enum page (Java enums are represented as classes). */ QCString trEnumReference(const QCString &name) override { return QCString(name)+" Ссылки на перечисление"; } /*! Used for a section containing inherited members */ QCString trInheritedFrom(const QCString &members,const QCString &what) override { return QCString(members)+" унаследованные от "+what; } /*! Header of the sections with inherited members specific for the * base class(es) */ QCString trAdditionalInheritedMembers() override { return "Дополнительные унаследованные члены"; } /////////////////////////////////////////////////////////////////////// // new since 1.8.2 /////////////////////////////////////////////////////////////////////// /*! Used as a tooltip for the toggle button that appears in the * navigation tree in the HTML output when GENERATE_TREEVIEW is * enabled. This tooltip explains the meaning of the button. */ QCString trPanelSynchronisationTooltip(bool enable) override { QCString opt = enable ? "включить" : "выключить"; return "нажмите на "+opt+" для синхронизации панелей"; } /*! Used in a method of an Objective-C class that is declared in a * a category. Note that the @1 marker is required and is replaced * by a link. */ QCString trProvidedByCategory() override { return "По группам @0."; } /*! Used in a method of an Objective-C category that extends a class. * Note that the @1 marker is required and is replaced by a link to * the class method. */ QCString trExtendsClass() override { return "Расширяет класс @0."; } /*! Used as the header of a list of class methods in Objective-C. * These are similar to static public member functions in C++. */ QCString trClassMethods() override { return "Методы класса"; } /*! Used as the header of a list of instance methods in Objective-C. * These are similar to public member functions in C++. */ QCString trInstanceMethods() override { return "Методы экземпляра"; } /*! Used as the header of the member functions of an Objective-C class. */ QCString trMethodDocumentation() override { return "Документация метода"; } /////////////////////////////////////////////////////////////////////// // new since 1.8.4 /////////////////////////////////////////////////////////////////////// /** old style UNO IDL services: implemented interfaces */ QCString trInterfaces() override { return "Экспортируемые интерфейсы"; } /** old style UNO IDL services: inherited services */ QCString trServices() override { return "Включённые сервисы"; } /** UNO IDL constant groups */ QCString trConstantGroups() override { return "Постоянные группы"; } /** UNO IDL constant groups */ QCString trConstantGroupReference(const QCString &namespaceName) override { QCString result=namespaceName; result+=" Ссылка на постоянную группу"; return result; } /** UNO IDL service page title */ QCString trServiceReference(const QCString &sName) override { QCString result=sName; result+=" Ссылка на сервис"; return result; } /** UNO IDL singleton page title */ QCString trSingletonReference(const QCString &sName) override { QCString result=sName; result+=" Ссылка на одиночку"; return result; } /** UNO IDL service page */ QCString trServiceGeneratedFromFiles(bool single) override { // single is true implies a single file QCString result="Документация для этого сервиса " "сгенерирована из следующего файл"; if (single) result+="а:"; else result+="ов:"; return result; } /** UNO IDL singleton page */ QCString trSingletonGeneratedFromFiles(bool single) override { // single is true implies a single file QCString result="Документация по этому одиночке " "сгенерирована из следующего файл"; if (single) result+="а:"; else result+="ов:"; return result; } /* * Russian translations for updates since version 1.8.15 * * Aleksei Leshchenko, 2024 * Github: FrostMonsterSP */ ////////////////////////////////////////////////////////////////////////// // new since 1.8.15 ////////////////////////////////////////////////////////////////////////// /** VHDL design unit hierarchy */ QCString trDesignUnitHierarchy() override { return "Иерархия проектных единиц"; } /** VHDL design unit list */ QCString trDesignUnitList() override { return "Список проектных единиц"; } /** VHDL design unit members */ QCString trDesignUnitMembers() override { return "Компоненты проектной единицы"; } /** VHDL design unit list description */ QCString trDesignUnitListDescription() override { return "Список всех компонентов проектных единиц со ссылками на " "проектные единицы, в которые входят:"; } /** VHDL design unit index */ QCString trDesignUnitIndex() override { return "Указатель проектных единиц"; } /** VHDL design units */ QCString trDesignUnits() override { return "Проектные единицы"; } /** VHDL functions/procedures/processes */ QCString trFunctionAndProc() override { return "Функции/Процедуры/Процессы"; } /** VHDL type */ QCString trVhdlType(VhdlSpecifier type, bool single) override { switch (type) { case VhdlSpecifier::LIBRARY: if (single) return "Библиотека"; else return "Библиотеки"; case VhdlSpecifier::PACKAGE: if (single) return "Пакет"; else return "Пакеты"; case VhdlSpecifier::SIGNAL: if (single) return "Сигнал"; else return "Сигналы"; case VhdlSpecifier::COMPONENT: if (single) return "Компонент"; else return "Компоненты"; case VhdlSpecifier::CONSTANT: if (single) return "Конатанта"; else return "Константы"; case VhdlSpecifier::ENTITY: if (single) return "Единица"; else return "Единицы"; case VhdlSpecifier::TYPE: if (single) return "Тип"; else return "Типы"; case VhdlSpecifier::SUBTYPE: if (single) return "Подтип"; else return "Подтипы"; case VhdlSpecifier::FUNCTION: if (single) return "Функция"; else return "Функции"; case VhdlSpecifier::RECORD: if (single) return "Запись"; else return "Записи"; case VhdlSpecifier::PROCEDURE: if (single) return "Процедура"; else return "Процедуры"; case VhdlSpecifier::ARCHITECTURE: if (single) return "Архитектура"; else return "Архитектуры"; case VhdlSpecifier::ATTRIBUTE: if (single) return "Аттрибут"; else return "Аттрибуты"; case VhdlSpecifier::PROCESS: if (single) return "Процесс"; else return "Процессы"; case VhdlSpecifier::PORT: if (single) return "Порт"; else return "Порты"; case VhdlSpecifier::USE: if (single) return "Условие использования"; else return "Условия использования"; case VhdlSpecifier::GENERIC: if (single) return "Дженерик"; else return "Дженерики"; case VhdlSpecifier::PACKAGE_BODY: return "Тело пакета"; case VhdlSpecifier::UNITS: return "Единицы"; case VhdlSpecifier::SHAREDVARIABLE: if (single) return "Общая переменная"; else return "Общие переменные"; case VhdlSpecifier::VFILE: if (single) return "Файл"; else return "Файлы"; case VhdlSpecifier::GROUP: if (single) return "Группа"; else return "Группы"; case VhdlSpecifier::INSTANTIATION: if (single) return "Созданный экземпляр"; else return "Созданные экземпляры"; case VhdlSpecifier::ALIAS: if (single) return "Псевдоним"; else return "Псевдонимы"; case VhdlSpecifier::CONFIG: if (single) return "Конфигурация"; else return "Конфигурации"; case VhdlSpecifier::MISCELLANEOUS: return "Разное"; case VhdlSpecifier::UCF_CONST: return "Ограничения"; default: return "Класс"; } } QCString trCustomReference(const QCString &name) override { return "Документация " + name; } /* Slice */ QCString trConstants() override { return "Константы"; } QCString trConstantDocumentation() override { return "Документация константы"; } QCString trSequences() override { return "Последовательности"; } QCString trSequenceDocumentation() override { return "Документация последовательности"; } QCString trDictionaries() override { return "Словари"; } QCString trDictionaryDocumentation() override { return "Документация словаря"; } QCString trSliceInterfaces() override { return "Интерфейсы"; } QCString trInterfaceIndex() override { return "Документация интерфейса"; } QCString trInterfaceList() override { return "Список интерфейсов"; } QCString trInterfaceListDescription() override { return "Здесь представлен список интерфейсов с их кратким описанием:"; } QCString trInterfaceHierarchy() override { return "Иерархия интерфейса"; } QCString trInterfaceHierarchyDescription() override { return "Данный список наследований по большей части, но не " "полностью, отсортирован в алфавитном порядке:"; } QCString trInterfaceDocumentation() override { return "Документация интерфейса"; } QCString trStructs() override { return "Структуры"; } QCString trStructIndex() override { return "Указатель Структур"; } QCString trStructList() override { return "Список Структур"; } QCString trStructListDescription() override { return "Здесь представлен список структур с их краткими описаниями:"; } QCString trStructDocumentation() override { return "Документация структур"; } QCString trExceptionIndex() override { return "Указатель исключений"; } QCString trExceptionList() override { return "Список исключений"; } QCString trExceptionListDescription() override { return "Здесь представлен список исключений с их краткими описаниями:"; } QCString trExceptionHierarchy() override { return "Иерархия Исключения"; } QCString trExceptionHierarchyDescription() override { return "Данный список наследований частично, но не полностью, отсортирован " "в алфавитном порядке:"; } QCString trExceptionDocumentation() override { return "Документация исключения"; } QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) override { QCString result = "Ссылка на"; switch (compType) { case ClassDef::Class: if (isLocal) result += " локальный"; result += " класс "; break; case ClassDef::Struct: if (isLocal) result += " локальную"; result += " структуру "; break; case ClassDef::Union: if (isLocal) result += " локальное"; result += " объединение "; break; case ClassDef::Interface: if (isLocal) result += " локальный"; result += " интерфейс "; break; case ClassDef::Protocol: if (isLocal) result += " локальный"; result += " протокол "; break; case ClassDef::Category: if (isLocal) result += " локальную"; result += " категорию "; break; case ClassDef::Exception: if (isLocal) result += " локальное"; result += " исключение "; break; default: break; } return result + clName; } QCString trOperations() override { return "Операции"; } QCString trOperationDocumentation() override { return "Документация операции"; } QCString trDataMembers() override { return "Поля класса"; } QCString trDataMemberDocumentation() override { return "Документация для полей класса"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.19 ////////////////////////////////////////////////////////////////////////// /** VHDL design unit documentation */ QCString trDesignUnitDocumentation() override { return "Проектная единица"; } ////////////////////////////////////////////////////////////////////////// // new since 1.9.2 ////////////////////////////////////////////////////////////////////////// /** C++20 concept */ QCString trConcept(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "концепт", "ы"); } /*! used as the title of the HTML page of a C++20 concept page */ QCString trConceptReference(const QCString &conceptName) override { return "Ссылка на концепт " + conceptName; } /*! used as the title of page containing all the index of all concepts. */ QCString trConceptList() override { return "Список концептов"; } /*! used as the title of chapter containing the index listing all concepts. */ QCString trConceptIndex() override { return "Указатель концептов"; } /*! used as the title of chapter containing all information about concepts. */ QCString trConceptDocumentation() override { return "Документация концептов"; } /*! used as an introduction to the concept list */ QCString trConceptListDescription(bool extractAll) override { QCString result = "Список всех "; if (!extractAll) result += "задокументированных "; result += "концептов с их краткими описаниями:"; return result; } /*! used to introduce the definition of the C++20 concept */ QCString trConceptDefinition() override { return "Определение концепта"; } ////////////////////////////////////////////////////////////////////////// // new since 1.9.4 ////////////////////////////////////////////////////////////////////////// QCString trPackageList() override { return "Список пакетов"; } ////////////////////////////////////////////////////////////////////////// // new since 1.9.6 ////////////////////////////////////////////////////////////////////////// /*! This is used for translation of the word that will be * followed by a single name of the VHDL process flowchart. */ QCString trFlowchart() override { return "Блок-схема:"; } /*! Please translate also updated body of the method * trMemberFunctionDocumentation(), now better adapted for * VHDL sources documentation. */ ////////////////////////////////////////////////////////////////////////// // new since 1.9.7 ////////////////////////////////////////////////////////////////////////// /*! used in the compound documentation before a list of related symbols. * * Supersedes trRelatedFunctions */ QCString trRelatedSymbols() override { return "Относящиеся к классу:"; } /*! subscript for the related symbols * * Supersedes trRelatedSubscript */ QCString trRelatedSymbolsSubscript() override { return "(не члены класса)"; } /*! used in the class documentation as a header before the list of all * related classes. * * Supersedes trRelatedFunctionDocumentation */ QCString trRelatedSymbolDocumentation() override { return "Друзья класса и относящимся к классу обозначения"; } /*! the compound type as used for the xrefitems */ QCString trCompoundType(ClassDef::CompoundType compType, SrcLangExt lang) override { QCString result; switch (compType) { case ClassDef::Class: if (lang == SrcLangExt::Fortran) trType(true, true); else result = trClass(true, true); break; case ClassDef::Struct: result = "Структура"; break; case ClassDef::Union: result = "Объединение"; break; case ClassDef::Interface: result = "Интерфейс"; break; case ClassDef::Protocol: result = "Протокол"; break; case ClassDef::Category: result = "Категория"; break; case ClassDef::Exception: result = "Исключение"; break; case ClassDef::Service: result = "Служба"; break; case ClassDef::Singleton: result = "Синглтон"; break; default: break; } return result; } QCString trFileMembersDescriptionTotal(FileMemberHighlight::Enum hl) override { bool extractAll = Config_getBool(EXTRACT_ALL); QCString result = "Список всех "; if (!extractAll) result += "задокументированных "; switch (hl) { case FileMemberHighlight::All: if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result += "функций, переменных, макроопределений, перечислителей и " "определений типов"; } else { result += "прикреплённых файлов"; } break; case FileMemberHighlight::Functions: result += "функций"; break; case FileMemberHighlight::Variables: result += "переменных"; break; case FileMemberHighlight::Typedefs: result += "определений типов"; break; case FileMemberHighlight::Sequences: result += "последовательностей"; break; case FileMemberHighlight::Dictionaries: result += "словарей"; break; case FileMemberHighlight::Enums: result += "перечислителей"; break; case FileMemberHighlight::EnumValues: result += "значений перечислителей"; break; case FileMemberHighlight::Defines: result += "макроопределений"; break; case FileMemberHighlight::Total: // for completeness break; } result += " соссылками на "; if (extractAll) result += "файлы, к которым они относятся:"; else result += "документацию:"; return result; } QCString trCompoundMembersDescriptionTotal(ClassMemberHighlight::Enum hl) override { bool extractAll = Config_getBool(EXTRACT_ALL); QCString result = "Список всех "; if (!extractAll) { result += "задокументированных "; } switch (hl) { case ClassMemberHighlight::All: if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result += "полей структур и объединений"; } else { result += "членов класса"; } break; case ClassMemberHighlight::Functions: result += "функций"; break; case ClassMemberHighlight::Variables: result += "переменных"; break; case ClassMemberHighlight::Typedefs: result += "определений типов"; break; case ClassMemberHighlight::Enums: result += "перечислителей"; break; case ClassMemberHighlight::EnumValues: result += "значений перечислителей"; break; case ClassMemberHighlight::Properties: result += "свойств"; break; case ClassMemberHighlight::Events: result += "событий"; break; case ClassMemberHighlight::Related: result += "связанных символов"; break; case ClassMemberHighlight::Total: // for completeness break; } result += " со ссылками на "; if (!extractAll) { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result += "документацию каждого поля структуры/объединения:"; } else { result += "документацию класса каждого члена:"; } } else { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result += "структуры/объединения, к которым они относятся:"; } else { result += "классы, к которым они относятся:"; } } return result; } QCString trNamespaceMembersDescriptionTotal( NamespaceMemberHighlight::Enum hl) override { bool extractAll = Config_getBool(EXTRACT_ALL); QCString result = "Список всех "; if (!extractAll) result += "задокументированных "; QCString singularResult = ""; QCString pluralResult = ""; switch (hl) { case NamespaceMemberHighlight::All: singularResult = "члена"; pluralResult = "членов"; break; case NamespaceMemberHighlight::Functions: singularResult = "функции"; pluralResult = "функций"; break; case NamespaceMemberHighlight::Variables: singularResult = "переменной"; pluralResult = "переменных"; break; case NamespaceMemberHighlight::Typedefs: singularResult = "определения"; pluralResult = "определений типов"; break; case NamespaceMemberHighlight::Sequences: singularResult = "последовательности"; pluralResult = "последовательностей"; break; case NamespaceMemberHighlight::Dictionaries: singularResult = "словаря"; pluralResult = "словарей"; break; case NamespaceMemberHighlight::Enums: singularResult = "перечислителя"; pluralResult = "перечислителей"; break; case NamespaceMemberHighlight::EnumValues: singularResult = "значения"; pluralResult = "значений перечислителей"; break; case NamespaceMemberHighlight::Total: // for completeness break; } result += pluralResult + " со ссылками на "; if (extractAll) result += "документацию пространства имён для каждого " + singularResult + ":"; else result += "пространство имён, к которому они принадлежат:"; return result; } QCString trDefinition() override { return "Определения"; } QCString trDeclaration() override { return "Объявления"; } ////////////////////////////////////////////////////////////////////////// // new since 1.9.8 ////////////////////////////////////////////////////////////////////////// QCString trTopics() override { return "Разделы"; } QCString trTopicDocumentation() override { return "Документация разделов"; } QCString trTopicList() override { return "Список разделов"; } QCString trTopicIndex() override { return "Указатель разделов"; } QCString trTopicListDescription() override { return "Список всех разделов c краткими описаниями:"; } QCString trModuleMembersDescriptionTotal(ModuleMemberHighlight::Enum hl) override { bool extractAll = Config_getBool(EXTRACT_ALL); QCString result = "Список всех "; if (!extractAll) result += "задокументированных "; QCString singularResult = ""; QCString pluralResult = ""; switch (hl) { case ModuleMemberHighlight::All: singularResult = "члена"; pluralResult = "членов"; break; case ModuleMemberHighlight::Functions: singularResult = "функции"; pluralResult = "функций"; break; case ModuleMemberHighlight::Variables: singularResult = "переменной"; pluralResult = "переменных"; break; case ModuleMemberHighlight::Typedefs: singularResult = "определения"; pluralResult = "определений типов"; break; case ModuleMemberHighlight::Enums: singularResult = "перечислителя"; pluralResult = "перечислителей"; break; case ModuleMemberHighlight::EnumValues: singularResult = "значения"; pluralResult = "значений перечислителей"; break; case ModuleMemberHighlight::Total: // for completeness break; }; result += pluralResult + " со ссылками на "; if (extractAll) result += "на документацию модуля для каждого " + singularResult + ":"; else result += "на модуль к которому они принадлежат:"; return result; } QCString trExportedModules() override { return "Экспортируемые модули"; } ////////////////////////////////////////////////////////////////////////// // new since 1.10.0 ////////////////////////////////////////////////////////////////////////// QCString trCopyToClipboard() override { return "Скопировать в буфер обмена"; } ////////////////////////////////////////////////////////////////////////// // new since 1.11.0 ////////////////////////////////////////////////////////////////////////// QCString trImportant() override { return "Важно!"; } }; #endif
94,959
C++
.h
2,329
30.606269
161
0.598823
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,565
docnode.h
doxygen_doxygen/src/docnode.h
/****************************************************************************** * * Copyright (C) 1997-2022 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 DOCNODE_H #define DOCNODE_H #include <cstdio> #include <cstdint> #include <vector> #include <memory> #include <variant> #include <type_traits> #include "qcstring.h" #include "docvisitor.h" #include "docparser.h" #include "htmlattrib.h" #include "htmlentity.h" #include "growvector.h" #include "section.h" #include "construct.h" #include "doctokenizer.h" class MemberDef; class Definition; class DocParser; //--------------------------------------------------------------------------- #define DOC_NODES \ /* 0 */ DN(DocWord) DN_SEP DN(DocLinkedWord) DN_SEP DN(DocURL) DN_SEP DN(DocLineBreak) DN_SEP DN(DocHorRuler) DN_SEP \ /* 5 */ DN(DocAnchor) DN_SEP DN(DocCite) DN_SEP DN(DocStyleChange) DN_SEP DN(DocSymbol) DN_SEP DN(DocEmoji) DN_SEP \ /* 10 */ DN(DocWhiteSpace) DN_SEP DN(DocSeparator) DN_SEP DN(DocVerbatim) DN_SEP DN(DocInclude) DN_SEP DN(DocIncOperator) DN_SEP \ /* 15 */ DN(DocFormula) DN_SEP DN(DocIndexEntry) DN_SEP DN(DocAutoList) DN_SEP DN(DocAutoListItem) DN_SEP DN(DocTitle) DN_SEP \ /* 20 */ DN(DocXRefItem) DN_SEP DN(DocImage) DN_SEP DN(DocDotFile) DN_SEP DN(DocMscFile) DN_SEP DN(DocDiaFile) DN_SEP \ /* 25 */ DN(DocVhdlFlow) DN_SEP DN(DocLink) DN_SEP DN(DocRef) DN_SEP DN(DocInternalRef) DN_SEP DN(DocHRef) DN_SEP \ /* 30 */ DN(DocHtmlHeader) DN_SEP DN(DocHtmlDescTitle) DN_SEP DN(DocHtmlDescList) DN_SEP DN(DocSection) DN_SEP DN(DocSecRefItem) DN_SEP \ /* 35 */ DN(DocSecRefList) DN_SEP DN(DocInternal) DN_SEP DN(DocParBlock) DN_SEP DN(DocSimpleList) DN_SEP DN(DocHtmlList) DN_SEP \ /* 40 */ DN(DocSimpleSect) DN_SEP DN(DocSimpleSectSep) DN_SEP DN(DocParamSect) DN_SEP DN(DocPara) DN_SEP DN(DocParamList) DN_SEP \ /* 45 */ DN(DocSimpleListItem) DN_SEP DN(DocHtmlListItem) DN_SEP DN(DocHtmlDescData) DN_SEP DN(DocHtmlCell) DN_SEP DN(DocHtmlCaption) DN_SEP \ /* 50 */ DN(DocHtmlRow) DN_SEP DN(DocHtmlTable) DN_SEP DN(DocHtmlBlockQuote) DN_SEP DN(DocText) DN_SEP DN(DocRoot) DN_SEP \ /* 55 */ DN(DocHtmlDetails) DN_SEP DN(DocHtmlSummary) DN_SEP DN(DocPlantUmlFile) \ // forward declarations #define DN(x) class x; #define DN_SEP DOC_NODES #undef DN #undef DN_SEP // define a variant type #define DN(x) x #define DN_SEP , using DocNodeVariant = std::variant< DOC_NODES >; #undef DN #undef DN_SEP // getter functions to return the name of a doc node type #define DN(x) constexpr const char *docNodeName(const x &/* n */) { return #x; } #define DN_SEP DOC_NODES #undef DN #undef DN_SEP /** Abstract node interface with type information. */ class DocNode { public: /*! Creates a new node */ DocNode(DocParser *parser,DocNodeVariant *parent) : m_parser(parser), m_parent(parent) {} ~DocNode() = default; ONLY_DEFAULT_MOVABLE(DocNode) /*! Returns the parent of this node or nullptr for the root node. */ DocNodeVariant *parent() { return m_parent; } const DocNodeVariant *parent() const { return m_parent; } DocNodeVariant *thisVariant() { return m_thisVariant; } const DocNodeVariant *thisVariant() const { return m_thisVariant; } void setThisVariant(DocNodeVariant *thisVariant) { m_thisVariant=thisVariant; } DocParser *parser() { return m_parser; } const DocParser *parser() const { return m_parser; } /*! Sets a new parent for this node. */ void setParent(DocNodeVariant *parent) { m_parent = parent; } /*! Returns TRUE iff this node is inside a preformatted section */ bool isPreformatted() const { return m_insidePre; } protected: /*! Sets whether or not this item is inside a preformatted section */ void setInsidePreformatted(bool p) { m_insidePre = p; } enum RefType { Unknown, Anchor, Section, Table }; private: bool m_insidePre = false; DocParser *m_parser; DocNodeVariant *m_parent; DocNodeVariant *m_thisVariant = nullptr; }; struct DocNodeList : public GrowVector<DocNodeVariant> { /** Append a new DocNodeVariant to the list by constructing it with type T and * parameters Args. */ template<class T,class...Args> void append(Args&&... args); /** moves the element of list \a l at the end of this list. * List \a l will become empty. */ void move_append(DocNodeList &l); /** Returns a pointer to the last element in the list if that element exists and * holds a T, otherwise nullptr is returned. */ template<class T> T *get_last(); }; /** Base class for nodes with children */ class DocCompoundNode : public DocNode { public: DocCompoundNode(DocParser *parser,DocNodeVariant *parent) : DocNode(parser,parent) {} DocNodeList &children() { return m_children; } const DocNodeList &children() const { return m_children; } private: DocNodeList m_children; }; /** Node representing a word */ class DocWord : public DocNode { public: DocWord(DocParser *parser,DocNodeVariant *parent,const QCString &word); QCString word() const { return m_word; } private: QCString m_word; }; /** Node representing a word that can be linked to something */ class DocLinkedWord : public DocNode { public: DocLinkedWord(DocParser *parser,DocNodeVariant *parent,const QCString &word, const QCString &ref,const QCString &file, const QCString &anchor,const QCString &tooltip); QCString word() const { return m_word; } QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } QCString anchor() const { return m_anchor; } QCString tooltip() const { return m_tooltip; } private: QCString m_word; QCString m_ref; QCString m_file; QCString m_relPath; QCString m_anchor; QCString m_tooltip; }; /** Node representing a URL (or email address) */ class DocURL : public DocNode { public: DocURL(DocParser *parser,DocNodeVariant *parent,const QCString &url,bool isEmail) : DocNode(parser,parent), m_url(url), m_isEmail(isEmail) {} QCString url() const { return m_url; } bool isEmail() const { return m_isEmail; } private: QCString m_url; bool m_isEmail = false; }; /** Node representing a line break */ class DocLineBreak : public DocNode { public: DocLineBreak(DocParser *parser,DocNodeVariant *parent) : DocNode(parser,parent) {} DocLineBreak(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocNode(parser,parent), m_attribs(attribs) {} const HtmlAttribList &attribs() const { return m_attribs; } private: HtmlAttribList m_attribs; }; /** Node representing a horizontal ruler */ class DocHorRuler : public DocNode { public: DocHorRuler(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocNode(parser,parent), m_attribs(attribs) {} const HtmlAttribList &attribs() const { return m_attribs; } private: HtmlAttribList m_attribs; }; /** Node representing an anchor */ class DocAnchor : public DocNode { public: DocAnchor(DocParser *parser,DocNodeVariant *parent,const QCString &id,bool newAnchor); QCString anchor() const { return m_anchor; } QCString file() const { return m_file; } const HtmlAttribList &attribs() const { return m_attribs; } private: QCString m_anchor; QCString m_file; HtmlAttribList m_attribs; }; /** Node representing a citation of some bibliographic reference */ class DocCite : public DocNode { public: DocCite(DocParser *parser,DocNodeVariant *parent,const QCString &target,const QCString &context); QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } QCString anchor() const { return m_anchor; } QCString text() const { return m_text; } private: QCString m_file; QCString m_relPath; QCString m_ref; QCString m_anchor; QCString m_text; }; /** Node representing a style change */ class DocStyleChange : public DocNode { public: enum Style { Bold = (1<<0), Italic = (1<<1), Code = (1<<2), Center = (1<<3), Small = (1<<4), Subscript = (1<<5), Superscript = (1<<6), Preformatted = (1<<7), Span = (1<<8), Div = (1<<9), Strike = (1<<10), Underline = (1<<11), Del = (1<<12), Ins = (1<<13), S = (1<<14), Cite = (1<<15), Kbd = (1<<16) }; DocStyleChange(DocParser *parser,DocNodeVariant *parent,size_t position,Style s, const QCString &tagName,bool enable, const HtmlAttribList *attribs=nullptr) : DocNode(parser,parent), m_position(position), m_style(s), m_enable(enable) { if (attribs) m_attribs=*attribs; m_tagName = tagName.lower(); } Style style() const { return m_style; } const char *styleString() const; bool enable() const { return m_enable; } size_t position() const { return m_position; } const HtmlAttribList &attribs() const { return m_attribs; } QCString tagName() const { return m_tagName; } private: size_t m_position = 0; Style m_style = Bold; bool m_enable = false; HtmlAttribList m_attribs; QCString m_tagName; }; /** Node representing a special symbol */ class DocSymbol : public DocNode { public: DocSymbol(DocParser *parser,DocNodeVariant *parent,HtmlEntityMapper::SymType s) : DocNode(parser,parent), m_symbol(s) {} HtmlEntityMapper::SymType symbol() const { return m_symbol; } static HtmlEntityMapper::SymType decodeSymbol(const QCString &symName); private: HtmlEntityMapper::SymType m_symbol = HtmlEntityMapper::Sym_Unknown; }; /** Node representing an emoji */ class DocEmoji : public DocNode { public: DocEmoji(DocParser *parser,DocNodeVariant *parent,const QCString &symName); QCString name() const { return m_symName; } int index() const { return m_index; } private: QCString m_symName; int m_index = 0; }; /** Node representing some amount of white space */ class DocWhiteSpace : public DocNode { public: DocWhiteSpace(DocParser *parser,DocNodeVariant *parent,const QCString &chars) : DocNode(parser,parent), m_chars(chars) {} QCString chars() const { return m_chars; } private: QCString m_chars; }; /** Node representing a separator */ class DocSeparator : public DocNode { public: DocSeparator(DocParser *parser,DocNodeVariant *parent,const QCString &chars) : DocNode(parser,parent), m_chars(chars) {} QCString chars() const { return m_chars; } private: QCString m_chars; }; /** Node representing a verbatim, unparsed text fragment */ class DocVerbatim : public DocNode { public: enum Type { Code, HtmlOnly, ManOnly, LatexOnly, RtfOnly, XmlOnly, Verbatim, Dot, Msc, DocbookOnly, PlantUML, JavaDocCode, JavaDocLiteral }; DocVerbatim(DocParser *parser,DocNodeVariant *parent,const QCString &context, const QCString &text, Type t,bool isExample, const QCString &exampleFile,bool isBlock=FALSE,const QCString &lang=QCString()); Type type() const { return p->type; } QCString text() const { return p->text; } QCString context() const { return p->context; } bool isExample() const { return p->isExample; } QCString exampleFile() const { return p->exampleFile; } QCString relPath() const { return p->relPath; } QCString language() const { return p->lang; } bool isBlock() const { return p->isBlock; } bool hasCaption() const { return !p->children.empty(); } QCString width() const { return p->width; } QCString height() const { return p->height; } QCString engine() const { return p->engine; } bool useBitmap() const { return p->useBitmap; } const DocNodeList &children() const { return p->children; } DocNodeList &children() { return p->children; } QCString srcFile() const { return p->srcFile; } int srcLine() const { return p->srcLine; } void setText(const QCString &t) { p->text=t; } void setWidth(const QCString &w) { p->width=w; } void setHeight(const QCString &h) { p->height=h; } void setEngine(const QCString &e) { p->engine=e; } void setUseBitmap(const bool &u) { p->useBitmap=u; } void setLocation(const QCString &file,int line) { p->srcFile=file; p->srcLine=line; } private: struct Private { Private(const QCString &context_,const QCString &text_, Type type_, bool isExample_, const QCString &exampleFile_, const QCString &relPath_,const QCString &lang_, bool isBlock_) : context(context_), text(text_), type(type_), isExample(isExample_), exampleFile(exampleFile_), relPath(relPath_), lang(lang_), isBlock(isBlock_) {} QCString context; QCString text; Type type = Code; bool isExample; QCString exampleFile; QCString relPath; QCString lang; bool isBlock; QCString width; QCString height; QCString engine; bool useBitmap=false; // some PlantUML engines cannot output data in EPS format so bitmap format is required DocNodeList children; QCString srcFile; int srcLine = -1; }; std::unique_ptr<Private> p; }; /** Node representing an included text block from file */ class DocInclude : public DocNode { public: enum Type { Include, DontInclude, VerbInclude, HtmlInclude, LatexInclude, IncWithLines, Snippet , SnippetWithLines, DontIncWithLines, RtfInclude, ManInclude, DocbookInclude, XmlInclude }; DocInclude(DocParser *parser,DocNodeVariant *parent,const QCString &file, const QCString &context, Type t, bool stripCodeComments, bool isExample,const QCString &exampleFile, const QCString &blockId, bool isBlock, bool trimLeft) : DocNode(parser,parent), m_file(file), m_context(context), m_type(t), m_stripCodeComments(stripCodeComments), m_isExample(isExample), m_isBlock(isBlock), m_trimLeft(trimLeft), m_exampleFile(exampleFile), m_blockId(blockId) {} QCString file() const { return m_file; } QCString extension() const { int i=m_file.findRev('.'); return i!=-1 ? m_file.mid(i) : QCString(); } Type type() const { return m_type; } QCString text() const { return m_text; } QCString context() const { return m_context; } QCString blockId() const { return m_blockId; } bool stripCodeComments() const { return m_stripCodeComments; } bool isExample() const { return m_isExample; } QCString exampleFile() const { return m_exampleFile; } bool isBlock() const { return m_isBlock; } bool trimLeft() const { return m_trimLeft; } void parse(); private: QCString m_file; QCString m_context; QCString m_text; Type m_type; bool m_stripCodeComments; bool m_isExample; bool m_isBlock; bool m_trimLeft; QCString m_exampleFile; QCString m_blockId; }; /** Node representing a include/dontinclude operator block */ class DocIncOperator : public DocNode { public: enum Type { Line, SkipLine, Skip, Until }; DocIncOperator(DocParser *parser,DocNodeVariant *parent,Type t,const QCString &pat, const QCString &context,bool stripCodeComments,bool isExample,const QCString &exampleFile) : DocNode(parser,parent), m_type(t), m_pattern(pat), m_context(context), m_isFirst(FALSE), m_isLast(FALSE), m_stripCodeComments(stripCodeComments), m_isExample(isExample), m_exampleFile(exampleFile) {} Type type() const { return m_type; } const char *typeAsString() const { switch(m_type) { case Line: return "line"; case SkipLine: return "skipline"; case Skip: return "skip"; case Until: return "until"; } return ""; } int line() const { return m_line; } bool showLineNo() const { return m_showLineNo; } QCString text() const { return m_text; } QCString pattern() const { return m_pattern; } QCString context() const { return m_context; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } void markFirst(bool v=TRUE) { m_isFirst = v; } void markLast(bool v=TRUE) { m_isLast = v; } bool stripCodeComments() const { return m_stripCodeComments; } bool isExample() const { return m_isExample; } QCString exampleFile() const { return m_exampleFile; } QCString includeFileName() const { return m_includeFileName; } void parse(); private: Type m_type = Line; int m_line = 0; bool m_showLineNo = false; QCString m_text; QCString m_pattern; QCString m_context; bool m_isFirst = false; bool m_isLast = false; bool m_stripCodeComments = true; bool m_isExample = false; QCString m_exampleFile; QCString m_includeFileName; }; /** Node representing an item of a cross-referenced list */ class DocFormula : public DocNode { public: DocFormula(DocParser *parser,DocNodeVariant *parent,int id); QCString name() const { return m_name; } QCString text() const { return m_text; } QCString relPath() const { return m_relPath; } int id() const { return m_id; } bool isInline() const { if (m_text.length()>1 && m_text.at(0)=='\\' && m_text.at(1)=='[') return false; if (m_text.startsWith("\\begin{")) return false; return true; } private: QCString m_name; QCString m_text; QCString m_relPath; int m_id = 0; }; /** Node representing an entry in the index. */ class DocIndexEntry : public DocNode { public: DocIndexEntry(DocParser *parser,DocNodeVariant *parent,const Definition *scope,const MemberDef *md) : DocNode(parser,parent), m_scope(scope), m_member(md) {} Token parse(); const Definition *scope() const { return m_scope; } const MemberDef *member() const { return m_member; } QCString entry() const { return m_entry; } private: QCString m_entry; const Definition *m_scope = nullptr; const MemberDef *m_member = nullptr; }; //----------------------------------------------------------------------- /** Node representing an auto List */ class DocAutoList : public DocCompoundNode { public: enum ListType { Unnumbered=1, Unchecked=-2, Checked_x=-3, Checked_X=-4 // positive numbers give the label }; DocAutoList(DocParser *parser,DocNodeVariant *parent,int indent,bool isEnumList, int depth, bool isCheckedList); bool isEnumList() const { return m_isEnumList; } int indent() const { return m_indent; } bool isCheckedList() const { return m_isCheckedList; } int depth() const { return m_depth; } Token parse(); private: int m_indent = 0; bool m_isEnumList = false; bool m_isCheckedList = false; int m_depth = 0; }; /** Node representing an item of a auto list */ class DocAutoListItem : public DocCompoundNode { public: DocAutoListItem(DocParser *parser,DocNodeVariant *parent,int indent,int num); int itemNumber() const { return m_itemNum; } Token parse(); private: int m_indent = 0; int m_itemNum = 0; }; /** Node representing a simple section title */ class DocTitle : public DocCompoundNode { public: DocTitle(DocParser *parser,DocNodeVariant *parent) : DocCompoundNode(parser,parent) {} void parse(); void parseFromString(DocNodeVariant *,const QCString &title); bool hasTitle() const { return !children().empty(); } private: }; /** Node representing an item of a cross-referenced list */ class DocXRefItem : public DocCompoundNode { public: DocXRefItem(DocParser *parser,DocNodeVariant *parent,int id,const QCString &key); QCString file() const { return m_file; } QCString anchor() const { return m_anchor; } QCString title() const { return m_title; } QCString relPath() const { return m_relPath; } QCString key() const { return m_key; } bool parse(); private: int m_id = 0; QCString m_key; QCString m_file; QCString m_anchor; QCString m_title; QCString m_relPath; }; /** Node representing an image */ class DocImage : public DocCompoundNode { public: enum Type { Html, Latex, Rtf, DocBook, Xml }; DocImage(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs, const QCString &name,Type t,const QCString &url=QCString(), bool inlineImage = TRUE); Type type() const { return p->type; } QCString name() const { return p->name; } bool hasCaption() const { return !children().empty(); } QCString width() const { return p->width; } QCString height() const { return p->height; } QCString relPath() const { return p->relPath; } QCString url() const { return p->url; } bool isInlineImage() const { return p->inlineImage; } bool isSVG() const; const HtmlAttribList &attribs() const { return p->attribs; } void parse(); private: struct Private { Private(const HtmlAttribList &attribs_,const QCString &name_,Type type_, const QCString &relPath_, const QCString &url_,bool inlineImage_) : attribs(attribs_), name(name_), type(type_), relPath(relPath_), url(url_), inlineImage(inlineImage_) {} HtmlAttribList attribs; QCString name; Type type = Html; QCString width; QCString height; QCString relPath; QCString url; bool inlineImage; }; std::unique_ptr<Private> p; }; class DocDiagramFileBase : public DocCompoundNode { public: DocDiagramFileBase(DocParser *parser, DocNodeVariant *parent,const QCString &name, const QCString &context, const QCString &srcFile,int srcLine) : DocCompoundNode(parser,parent), p(std::make_unique<Private>(name, context, srcFile, srcLine)) {} QCString name() const { return p->name; } QCString file() const { return p->file; } QCString relPath() const { return p->relPath; } bool hasCaption() const { return !children().empty(); } QCString width() const { return p->width; } QCString height() const { return p->height; } QCString context() const { return p->context; } QCString srcFile() const { return p->srcFile; } int srcLine() const { return p->srcLine; } protected: struct Private { Private(const QCString &name_,const QCString &context_,const QCString &srcFile_,int srcLine_) : name(name_), context(context_), srcFile(srcFile_), srcLine(srcLine_) {} QCString name; QCString file; QCString relPath; QCString width; QCString height; QCString context; QCString srcFile; int srcLine; }; std::unique_ptr<Private> p; }; /** Node representing a dot file */ class DocDotFile : public DocDiagramFileBase { public: DocDotFile(DocParser *parser,DocNodeVariant *parent,const QCString &name,const QCString &context, const QCString &srcFile,int srcLine); bool parse(); }; /** Node representing a msc file */ class DocMscFile : public DocDiagramFileBase { public: DocMscFile(DocParser *parser,DocNodeVariant *parent,const QCString &name,const QCString &context, const QCString &srcFile,int srcLine); bool parse(); }; /** Node representing a dia file */ class DocDiaFile : public DocDiagramFileBase { public: DocDiaFile(DocParser *parser,DocNodeVariant *parent,const QCString &name,const QCString &context, const QCString &srcFile,int srcLine); bool parse(); }; /** Node representing a uml file */ class DocPlantUmlFile : public DocDiagramFileBase { public: DocPlantUmlFile(DocParser *parser,DocNodeVariant *parent,const QCString &name,const QCString &context, const QCString &srcFile,int srcLine); bool parse(); }; /** Node representing a VHDL flow chart */ class DocVhdlFlow : public DocCompoundNode { public: DocVhdlFlow(DocParser *parser,DocNodeVariant *parent); void parse(); bool hasCaption() const { return !children().empty(); } private: }; /** Node representing a link to some item */ class DocLink : public DocCompoundNode { public: DocLink(DocParser *parser,DocNodeVariant *parent,const QCString &target); QCString parse(bool,bool isXmlLink=FALSE); QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } QCString anchor() const { return m_anchor; } private: QCString m_file; QCString m_relPath; QCString m_ref; QCString m_anchor; QCString m_refText; }; /** Node representing a reference to some item */ class DocRef : public DocCompoundNode { public: DocRef(DocParser *parser,DocNodeVariant *parent,const QCString &target,const QCString &context); void parse(); QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } QCString anchor() const { return m_anchor; } QCString targetTitle() const { return m_text; } SectionType sectionType() const { return m_sectionType; } bool hasLinkText() const { return !children().empty(); } bool refToAnchor() const { return m_refType==Anchor; } bool refToSection() const { return m_refType==Section; } bool refToTable() const { return m_refType==Table; } bool isSubPage() const { return m_isSubPage; } private: RefType m_refType = Unknown; SectionType m_sectionType = SectionType::Anchor; bool m_isSubPage = false; QCString m_file; QCString m_relPath; QCString m_ref; QCString m_anchor; QCString m_text; }; /** Node representing an internal reference to some item */ class DocInternalRef : public DocCompoundNode { public: DocInternalRef(DocParser *parser,DocNodeVariant *parent,const QCString &target); void parse(); QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } QCString anchor() const { return m_anchor; } private: QCString m_file; QCString m_relPath; QCString m_anchor; }; /** Node representing a Hypertext reference */ class DocHRef : public DocCompoundNode { public: DocHRef(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs,const QCString &url, const QCString &relPath, const QCString &file) : DocCompoundNode(parser,parent), m_attribs(attribs), m_url(url), m_relPath(relPath), m_file(file) {} Token parse(); QCString url() const { return m_url; } QCString file() const { return m_file; } QCString relPath() const { return m_relPath; } const HtmlAttribList &attribs() const { return m_attribs; } private: HtmlAttribList m_attribs; QCString m_url; QCString m_relPath; QCString m_file; }; /** Node Html summary */ class DocHtmlSummary : public DocCompoundNode { public: DocHtmlSummary(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocCompoundNode(parser,parent), m_attribs(attribs) {} const HtmlAttribList &attribs() const { return m_attribs; } void parse(); private: HtmlAttribList m_attribs; }; /** Node Html details */ class DocHtmlDetails : public DocCompoundNode { public: DocHtmlDetails(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocCompoundNode(parser,parent), m_attribs(attribs) {} const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); void parseSummary(DocNodeVariant *,HtmlAttribList &attribs); const DocNodeVariant *summary() const { return m_summary.get(); } private: HtmlAttribList m_attribs; std::unique_ptr<DocNodeVariant> m_summary; }; /** Node Html heading */ class DocHtmlHeader : public DocCompoundNode { public: DocHtmlHeader(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs,int level) : DocCompoundNode(parser,parent), m_level(level), m_attribs(attribs) {} int level() const { return m_level; } const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); private: int m_level = 0; HtmlAttribList m_attribs; }; /** Node representing a Html description item */ class DocHtmlDescTitle : public DocCompoundNode { public: DocHtmlDescTitle(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocCompoundNode(parser,parent), m_attribs(attribs) {} const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); private: HtmlAttribList m_attribs; }; /** Node representing a Html description list */ class DocHtmlDescList : public DocCompoundNode { public: DocHtmlDescList(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocCompoundNode(parser,parent), m_attribs(attribs) {} const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); private: HtmlAttribList m_attribs; }; /** Node representing a normal section */ class DocSection : public DocCompoundNode { public: DocSection(DocParser *parser,DocNodeVariant *parent,int level,const QCString &id) : DocCompoundNode(parser,parent), m_level(level), m_id(id) {} int level() const { return m_level; } const DocNodeVariant *title() const { return m_title.get(); } QCString anchor() const { return m_anchor; } QCString id() const { return m_id; } QCString file() const { return m_file; } Token parse(); private: int m_level = 0; QCString m_id; std::unique_ptr<DocNodeVariant> m_title; QCString m_anchor; QCString m_file; }; /** Node representing a reference to a section */ class DocSecRefItem : public DocCompoundNode { public: DocSecRefItem(DocParser *parser,DocNodeVariant *parent,const QCString &target); QCString target() const { return m_target; } QCString file() const { return m_file; } QCString anchor() const { return m_anchor; } QCString relPath() const { return m_relPath; } QCString ref() const { return m_ref; } bool refToTable() const { return m_refType==Table; } bool isSubPage() const { return m_isSubPage; } void parse(); private: QCString m_target; RefType m_refType = Unknown; bool m_isSubPage = false; QCString m_file; QCString m_relPath; QCString m_ref; QCString m_anchor; }; /** Node representing a list of section references */ class DocSecRefList : public DocCompoundNode { public: DocSecRefList(DocParser *parser,DocNodeVariant *parent) : DocCompoundNode(parser,parent) {} void parse(); private: }; /** Node representing an internal section of documentation */ class DocInternal : public DocCompoundNode { public: DocInternal(DocParser *parser,DocNodeVariant *parent) : DocCompoundNode(parser,parent) {} Token parse(int); private: }; /** Node representing an block of paragraphs */ class DocParBlock : public DocCompoundNode { public: DocParBlock(DocParser *parser,DocNodeVariant *parent) : DocCompoundNode(parser,parent) {} Token parse(); private: }; /** Node representing a simple list */ class DocSimpleList : public DocCompoundNode { public: DocSimpleList(DocParser *parser,DocNodeVariant *parent) : DocCompoundNode(parser,parent) {} Token parse(); private: }; /** Node representing a Html list */ class DocHtmlList : public DocCompoundNode { public: enum Type { Unordered, Ordered }; DocHtmlList(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs,Type t) : DocCompoundNode(parser,parent), m_type(t), m_attribs(attribs) {} Type type() const { return m_type; } const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); Token parseXml(); private: Type m_type = Unordered; HtmlAttribList m_attribs; }; /** Node representing a simple section */ class DocSimpleSect : public DocCompoundNode { public: enum Type { Unknown, See, Return, Author, Authors, Version, Since, Date, Note, Warning, Copyright, Pre, Post, Invar, Remark, Attention, Important, User, Rcs }; DocSimpleSect(DocParser *parser,DocNodeVariant *parent,Type t); Type type() const { return m_type; } QCString typeString() const; Token parse(bool userTitle,bool needsSeparator); Token parseRcs(); Token parseXml(); void appendLinkWord(const QCString &word); bool hasTitle() const; const DocNodeVariant *title() const { return m_title.get(); } private: Type m_type = Unknown; std::unique_ptr<DocNodeVariant> m_title; }; /** Node representing a separator between two simple sections of the * same type. */ class DocSimpleSectSep : public DocNode { public: DocSimpleSectSep(DocParser *parser,DocNodeVariant *parent) : DocNode(parser,parent) {} private: }; /** Node representing a parameter section */ class DocParamSect : public DocCompoundNode { friend class DocParamList; public: enum Type { Unknown, Param, RetVal, Exception, TemplateParam }; enum Direction { In=1, Out=2, InOut=3, Unspecified=0 }; DocParamSect(DocParser *parser,DocNodeVariant *parent,Type t) : DocCompoundNode(parser,parent), m_type(t), m_hasInOutSpecifier(FALSE), m_hasTypeSpecifier(FALSE) {} Token parse(const QCString &cmdName,bool xmlContext,Direction d); Type type() const { return m_type; } bool hasInOutSpecifier() const { return m_hasInOutSpecifier; } bool hasTypeSpecifier() const { return m_hasTypeSpecifier; } private: Type m_type = Unknown; bool m_hasInOutSpecifier = false; bool m_hasTypeSpecifier = false; }; /** Node representing a paragraph in the documentation tree */ class DocPara : public DocCompoundNode { public: DocPara(DocParser *parser,DocNodeVariant *parent); Token parse(); bool isEmpty() const { return children().empty(); } void markFirst(bool v=TRUE) { m_isFirst=v; } void markLast(bool v=TRUE) { m_isLast=v; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } Token handleCommand(char cmdChar,const QCString &cmdName); Token handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &tagHtmlAttribs); Token handleHtmlEndTag(const QCString &tagName); Token handleSimpleSection(DocSimpleSect::Type t,bool xmlContext=FALSE); Token handleXRefItem(); Token handleParamSection(const QCString &cmdName,DocParamSect::Type t, bool xmlContext, int direction); void handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type t); template<class T> void handleFile(const QCString &cmdName); void handleInclude(const QCString &cmdName,DocInclude::Type t); void handleLink(const QCString &cmdName,bool isJavaLink); void handleCite(char cmdChar,const QCString &cmdName); void handleDoxyConfig(char cmdChar,const QCString &cmdName); void handleEmoji(char cmdChar,const QCString &cmdName); void handleRef(char cmdChar,const QCString &cmdName); void handleSection(char cmdChar,const QCString &cmdName); void handleInheritDoc(); void handleVhdlFlow(); void handleILine(char cmdChar,const QCString &cmdName); void handleIFile(char cmdChar,const QCString &cmdName); void handleShowDate(char cmdChar,const QCString &cmdName); Token handleStartCode(); Token handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level); bool injectToken(Token tok,const QCString &tokText); const HtmlAttribList &attribs() const { return m_attribs; } void setAttribs(const HtmlAttribList &attribs) { m_attribs = attribs; } private: bool m_isFirst = false; bool m_isLast = false; HtmlAttribList m_attribs; }; /** Node representing a parameter list. */ class DocParamList : public DocNode { public: DocParamList(DocParser *parser,DocNodeVariant *parent,DocParamSect::Type t,DocParamSect::Direction d) : DocNode(parser,parent), m_type(t), m_dir(d) {} const DocNodeList &parameters() const { return m_params; } const DocNodeList &paramTypes() const { return m_paramTypes; } const DocNodeList &paragraphs() const { return m_paragraphs; } DocParamSect::Type type() const { return m_type; } DocParamSect::Direction direction() const { return m_dir; } void markFirst(bool b=TRUE) { m_isFirst=b; } void markLast(bool b=TRUE) { m_isLast=b; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } Token parse(const QCString &cmdName); Token parseXml(const QCString &paramName); private: DocNodeList m_paragraphs; DocNodeList m_params; DocNodeList m_paramTypes; DocParamSect::Type m_type = DocParamSect::Unknown; DocParamSect::Direction m_dir = DocParamSect::Unspecified; bool m_isFirst = false; bool m_isLast = false; }; /** Node representing a simple list item */ class DocSimpleListItem : public DocNode { public: DocSimpleListItem(DocParser *parser,DocNodeVariant *parent); Token parse(); const DocNodeVariant *paragraph() const { return m_paragraph.get(); } private: std::unique_ptr<DocNodeVariant> m_paragraph; }; /** Node representing a HTML list item */ class DocHtmlListItem : public DocCompoundNode { public: DocHtmlListItem(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs,int num) : DocCompoundNode(parser,parent), m_attribs(attribs), m_itemNum(num) {} int itemNumber() const { return m_itemNum; } const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); Token parseXml(); private: HtmlAttribList m_attribs; int m_itemNum = 0; }; /** Node representing a HTML description data */ class DocHtmlDescData : public DocCompoundNode { public: DocHtmlDescData(DocParser *parser,DocNodeVariant *parent) : DocCompoundNode(parser,parent) {} const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); private: HtmlAttribList m_attribs; }; /** Node representing a HTML table cell */ class DocHtmlCell : public DocCompoundNode { friend class DocHtmlTable; public: enum Alignment { Left, Right, Center }; enum Valignment {Top, Middle, Bottom}; DocHtmlCell(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs,bool isHeading) : DocCompoundNode(parser,parent), m_isHeading(isHeading), m_attribs(attribs) {} bool isHeading() const { return m_isHeading; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } void markFirst(bool v=TRUE) { m_isFirst=v; } void markLast(bool v=TRUE) { m_isLast=v; } const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); Token parseXml(); uint32_t rowIndex() const { return m_rowIdx; } uint32_t columnIndex() const { return m_colIdx; } uint32_t rowSpan() const; uint32_t colSpan() const; Alignment alignment() const; Valignment valignment() const; private: void setRowIndex(uint32_t idx) { m_rowIdx = idx; } void setColumnIndex(uint32_t idx) { m_colIdx = idx; } bool m_isHeading = false; bool m_isFirst = false; bool m_isLast = false; HtmlAttribList m_attribs; uint32_t m_rowIdx = static_cast<uint32_t>(-1); uint32_t m_colIdx = static_cast<uint32_t>(-1); }; /** Node representing a HTML table caption */ class DocHtmlCaption : public DocCompoundNode { public: DocHtmlCaption(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs); const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); bool hasCaptionId() const { return m_hasCaptionId; } QCString file() const { return m_file; } QCString anchor() const { return m_anchor; } private: HtmlAttribList m_attribs; bool m_hasCaptionId = false; QCString m_file; QCString m_anchor; }; /** Node representing a HTML table row */ class DocHtmlRow : public DocCompoundNode { friend class DocHtmlTable; public: DocHtmlRow(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocCompoundNode(parser,parent), m_attribs(attribs) {} size_t numCells() const { return children().size(); } const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); Token parseXml(bool header); bool isHeading() const; void setVisibleCells(uint32_t n) { m_visibleCells = n; } uint32_t visibleCells() const { return m_visibleCells; } uint32_t rowIndex() const { return m_rowIdx; } private: void setRowIndex(uint32_t idx) { m_rowIdx = idx; } HtmlAttribList m_attribs; uint32_t m_visibleCells = 0; uint32_t m_rowIdx = static_cast<uint32_t>(-1); }; /** Node representing a HTML table */ class DocHtmlTable : public DocCompoundNode { public: DocHtmlTable(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocCompoundNode(parser,parent), m_attribs(attribs) {} size_t numRows() const { return children().size(); } bool hasCaption() const; const HtmlAttribList &attribs() const { return m_attribs; } Token parse(); Token parseXml(); size_t numColumns() const { return m_numCols; } const DocNodeVariant *caption() const; const DocNodeVariant *firstRow() const; private: void computeTableGrid(); std::unique_ptr<DocNodeVariant> m_caption; HtmlAttribList m_attribs; size_t m_numCols = 0; }; /** Node representing an HTML blockquote */ class DocHtmlBlockQuote : public DocCompoundNode { public: DocHtmlBlockQuote(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) : DocCompoundNode(parser,parent), m_attribs(attribs) {} Token parse(); const HtmlAttribList &attribs() const { return m_attribs; } private: HtmlAttribList m_attribs; }; /** Root node of a text fragment */ class DocText : public DocCompoundNode { public: DocText(DocParser *parser) : DocCompoundNode(parser,nullptr) {} void parse(); bool isEmpty() const { return children().empty(); } }; /** Root node of documentation tree */ class DocRoot : public DocCompoundNode { public: DocRoot(DocParser *parser,bool indent,bool sl) : DocCompoundNode(parser,nullptr), m_indent(indent), m_singleLine(sl) {} void parse(); bool indent() const { return m_indent; } bool singleLine() const { return m_singleLine; } bool isEmpty() const { return children().empty(); } private: bool m_indent = false; bool m_singleLine = false; }; //-------------------------------------------------------------------------------------- /// returns the parent node of a given node \a n or nullptr if the node has no parent. constexpr DocNodeVariant *parent(DocNodeVariant *n) { return n ? std::visit([](auto &&x)->decltype(auto) { return x.parent(); }, *n) : nullptr; } /// returns the parent node of a given node \a n or nullptr if the node has no parent. constexpr const DocNodeVariant *parent(const DocNodeVariant *n) { return n ? std::visit([](auto &&x)->decltype(auto) { return x.parent(); }, *n) : nullptr; } namespace details { template<class T,class... Ts> struct Impl { static constexpr bool holds_one_of_alternatives(const DocNodeVariant &v) { return std::holds_alternative<T>(v) || Impl<Ts...>::holds_one_of_alternatives(v); } }; template<class T> struct Impl<T> { static constexpr bool holds_one_of_alternatives(const DocNodeVariant &v) { return std::holds_alternative<T>(v); } }; } // namespace details /// returns true iff \a v holds one of types passed as template parameters template<class... Ts> constexpr bool holds_one_of_alternatives(const DocNodeVariant &v) { return details::Impl<Ts...>::holds_one_of_alternatives(v); } namespace details { // Helper type trait to check if a type has member function children(). Default case is false. template <typename T, typename = void> struct has_method_children : std::false_type {}; // Use SFINAE to have a partial template specialization derived from std::true_type in case T has method children() template <typename T> struct has_method_children<T, std::void_t<decltype(std::declval<T>().children())>> : std::true_type {}; } // namespace details // Call children() on variant v if the contained type has this method, otherwise return nullptr inline DocNodeList* call_method_children(DocNodeVariant *v) { return std::visit([](auto&& value) -> DocNodeList* { if constexpr (details::has_method_children<decltype(value)>::value) { return &value.children(); } else { return nullptr; } }, *v); } //----------------- DocNodeList --------------------------------------- template<class T,class...Args> inline void DocNodeList::append(Args&&... args) { // add a DocNodeVariant to the list containing an node T as its active member. emplace_back(T(std::forward<Args>(args)...)); // store a pointer to the variant holding node T inside the node itself. // Since DocNodeList is a GrowVector this reference will remain valid even if new // elements are added (which would not be the case if a std::vector was used) std::get_if<T>(&back())->setThisVariant(&back()); } template<class T> inline T *DocNodeList::get_last() { return std::get_if<T>(&back()); } // ---------------- Debug helpers ------------------------------- #define DN(x) #x #define DN_SEP , inline const char *docNodeName(const DocNodeVariant &v) { static const char *table[] = { DOC_NODES }; return table[v.index()]; } #undef DN #undef DN_SEP inline void dumpDocNodeSizes() { #define DN(x) #x #define DN_SEP , static const char *tableWithNames[] = { DOC_NODES }; #undef DN #undef DN_SEP #define DN(x) sizeof(x) #define DN_SEP , static size_t tableWithSizes[] = { DOC_NODES }; #undef DN #undef DN_SEP size_t maxSize=0; printf("DocNodeVariant(\n"); for (size_t i=0;i<sizeof(tableWithNames)/sizeof(tableWithNames[0]);i++) { printf(" /* %2zu */ sizeof(%s)=%zu\n",i,tableWithNames[i],tableWithSizes[i]); if (tableWithSizes[i]>maxSize) maxSize = tableWithSizes[i]; } printf(")=%zu\n",maxSize); } inline void dumpDocNodeList(const DocNodeList &children) { printf("children=[\n"); for (const auto &child : children) { const DocWord *w = std::get_if<DocWord>(&child); printf(" %s (%p) %s\n",docNodeName(child),(void*)&child,qPrint(w?w->word():"")); } printf("]\n"); } //---------------------------------------------------------------------------------- /** Class representing the abstract syntax tree of a documentation block */ class DocNodeAST : public IDocNodeAST { public: // Note that r can only be a rvalue, not a general forwarding reference. // The compiler will error on lvalues because DotNodeVariant doesn't have a copy constructor template<class DocNode> DocNodeAST(DocNode &&r) : root(std::move(r)) { std::get_if<DocNode>(&root)->setThisVariant(&root); } bool isEmpty() const override { if (std::holds_alternative<DocRoot>(root)) { return std::get<DocRoot>(root).isEmpty(); } else if (std::holds_alternative<DocText>(root)) { return std::get<DocText>(root).isEmpty(); } return false; } DocNodeVariant root; }; template<class T,class... Args> std::unique_ptr<DocNodeVariant> createDocNode(Args&&...args) { auto node = std::make_unique<DocNodeVariant>(T(std::forward<Args>(args)...)); std::get_if<T>(node.get())->setThisVariant(node.get()); return node; } #endif
50,327
C++
.h
1,309
34.239878
157
0.663903
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,566
dotfilepatcher.h
doxygen_doxygen/src/dotfilepatcher.h
/****************************************************************************** * * Copyright (C) 1997-2019 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 DOTFILEPATCHER_H #define DOTFILEPATCHER_H #include <vector> #include "qcstring.h" class TextStream; /** Helper class to insert a set of map file into an output file */ class DotFilePatcher { public: DotFilePatcher(const QCString &patchFile); int addMap(const QCString &mapFile,const QCString &relPath, bool urlOnly,const QCString &context,const QCString &label); int addFigure(const QCString &baseName, const QCString &figureName,bool heightCheck); int addSVGConversion(const QCString &relPath,bool urlOnly, const QCString &context,bool zoomable,int graphId); int addSVGObject(const QCString &baseName, const QCString &figureName, const QCString &relPath); bool run() const; bool isSVGFile() const; static bool convertMapFile(TextStream &t,const QCString &mapName, const QCString &relPath, bool urlOnly=FALSE, const QCString &context=QCString()); static bool writeSVGFigureLink(TextStream &out,const QCString &relPath, const QCString &baseName,const QCString &absImgName); static bool writeVecGfxFigure(TextStream& out, const QCString& baseName, const QCString& figureName); private: struct Map { Map(const QCString &mf,const QCString &rp,bool uo,const QCString &ctx, const QCString &lab,bool zoom=false,int gId=-1) : mapFile(mf), relPath(rp), urlOnly(uo), context(ctx), label(lab), zoomable(zoom), graphId(gId) {} QCString mapFile; QCString relPath; bool urlOnly; QCString context; QCString label; bool zoomable; int graphId; }; std::vector<Map> m_maps; QCString m_patchFile; }; #endif
2,513
C++
.h
60
34.85
88
0.661747
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,567
translator_eo.h
doxygen_doxygen/src/translator_eo.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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. * */ /* Tradukita kaj ĝisdatigata de Ander Martinez. */ #ifndef TRANSLATOR_EO_H #define TRANSLATOR_EO_H /*! When defining a translator class for the new language, follow the description in the documentation. One of the steps says that you should copy the translator_en.h (this) file to your translator_xx.h new file. Your new language should use the Translator class as the base class. This means that you need to implement exactly the same (pure virtual) override methods as the TranslatorEnglish does. Because of this, it is a good idea to start with the copy of TranslatorEnglish and replace the strings one by one. It is not necessary to include "translator.h" or "translator_adapter.h" here. The files are included in the language.cpp correctly. Not including any of the mentioned files frees the maintainer from thinking about whether the first, the second, or both files should be included or not, and why. This holds namely for localized translators because their base class is changed occasionally to adapter classes when the Translator class changes the interface, or back to the Translator class (by the local maintainer) when the localized translator is made up-to-date again. */ class TranslatorEsperanto : public TranslatorAdapter_1_8_4 { public: // --- Language control methods ------------------- /*! Used for identification of the language. The identification * should not be translated. It should be replaced by the name * of the language in English using lower-case characters only * (e.g. "czech", "japanese", "russian", etc.). It should be equal to * the identification used in language.cpp. */ QCString idLanguage() override { return "esperanto"; } /*! 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. */ QCString latexLanguageSupportCommand() override { return "\\usepackage[esperanto]{babel}\n"; } QCString trISOLang() override { return "eo"; } // using fallback see translator.h QCString getLanguageString() override { return "0x409 English (United States)"; } // --- Language translation methods ------------------- /*! used in the compound documentation before a list of related functions. */ QCString trRelatedFunctions() override { return "Rilataj Funkcioj"; } /*! subscript for the related functions. */ QCString trRelatedSubscript() override { return "(Atentu ke tiuj ĉi ne estas membraj funkcioj.)"; } /*! header that is put before the detailed description of files, classes and namespaces. */ QCString trDetailedDescription() override { return "Detala Priskribo"; } /*! header that is used when the summary tag is missing inside the details tag */ QCString trDetails() override { return "Detaloj"; } /*! header that is put before the list of typedefs. */ QCString trMemberTypedefDocumentation() override { return "Dokumentado de la Membraj Tipodifinoj"; } /*! header that is put before the list of enumerations. */ QCString trMemberEnumerationDocumentation() override { return "Dokumentado de la Membraj Enumeracioj"; } /*! header that is put before the list of member functions. */ QCString trMemberFunctionDocumentation() override { return "Dokumentado de la Membraj Funkcioj"; } /*! header that is put before the list of member attributes. */ QCString trMemberDataDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Kampa Dokumentado"; } else { return "Dokumentado de la Membraj Datumoj"; } } /*! this is the text of a link put after brief descriptions. */ QCString trMore() override { return "Pli..."; } /*! put in the class documentation */ QCString trListOfAllMembers() override { return "Listo de ĉiuj membroj"; } /*! used as the title of the "list of all members" page of a class */ QCString trMemberList() override { return "Membra Listo"; } /*! this is the first part of a sentence that is followed by a class name */ QCString trThisIsTheListOfAllMembers() override { return "Tiu ĉi estas la kompleta membraro de"; } /*! this is the remainder of the sentence after the class name */ QCString trIncludingInheritedMembers() override { return ", inkluzive ĉiujn hereditajn membrojn."; } /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ QCString trGeneratedAutomatically(const QCString &s) override { QCString result="Generita aŭtomate de Doxygen"; if (!s.isEmpty()) result+=" por "+s; result+=" el la fontkodo."; return result; } /*! put after an enum name in the list of all members */ QCString trEnumName() override { return "enum nomo"; } /*! put after an enum value in the list of all members */ QCString trEnumValue() override { return "enum valoro"; } /*! put after an undocumented member in the list of all members */ QCString trDefinedIn() override { return "difinita en"; } // quick reference sections /*! This is put above each page as a link to the list of all groups of * compounds or files (see the \\group command). */ QCString trModules() override { return "Moduloj"; } /*! This is put above each page as a link to the class hierarchy */ QCString trClassHierarchy() override { return "Klasa Hierarkio"; } /*! This is put above each page as a link to the list of annotated classes */ QCString trCompoundList() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Datumstruktoroj"; } else { return "Klasaro"; } } /*! This is put above each page as a link to the list of documented files */ QCString trFileList() override { return "Dosieraro"; } /*! This is put above each page as a link to all members of compounds. */ QCString trCompoundMembers() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Datumkampoj"; } else { return "Klasaj membroj"; } } /*! This is put above each page as a link to all members of files. */ QCString trFileMembers() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Mallokalaĵoj"; } else { return "Dosieraj Membroj"; } } /*! This is put above each page as a link to all related pages. */ QCString trRelatedPages() override { return "Rilataj Paĝoj"; } /*! This is put above each page as a link to all examples. */ QCString trExamples() override { return "Ekzemploj"; } /*! This is put above each page as a link to the search engine. */ QCString trSearch() override { return "Serĉi"; } /*! This is an introduction to the class hierarchy. */ QCString trClassHierarchyDescription() override { return "Tiu ĉi heredada listo estas plimalpli, " "sed ne tute, ordigita alfabete:"; } /*! This is an introduction to the list with all files. */ QCString trFileListDescription(bool extractAll) override { QCString result="Jen listo de ĉiuj "; if (!extractAll) result+="dokumentitaj "; result+="dosieroj kun mallongaj priskriboj:"; return result; } /*! This is an introduction to the annotated compound list. */ QCString trCompoundListDescription() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Jen datumstrukturoj kun mallongaj priskriboj:"; } else if (Config_getBool(OPTIMIZE_OUTPUT_SLICE)) { return "Jen la klasoj kun mallongaj priskriboj:"; } else { return "Jen la klasoj, strukturoj, kunigoj kaj interfacoj " "kun mallongaj priskriboj:"; } } /*! This is an introduction to the page with all class members. */ QCString trCompoundMembersDescription(bool extractAll) override { QCString result="Jen listo de ĉiuj "; if (!extractAll) { result+="dokumentitaj "; } if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="strukturaj kaj kunigaj kampoj"; } else { result+="klasaj membroj"; } result+=" kun ligiloj al "; if (!extractAll) { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="la struktura/kuniga dokumentado por ĉiu kampo:"; } else { result+="la klasa dokumentado por ĉiu membro:"; } } else { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="la strukturoj/kunigoj al kiuj ili apartenas:"; } else { result+="la klasoj al kiuj ili apartenas:"; } } return result; } /*! This is an introduction to the page with all file members. */ QCString trFileMembersDescription(bool extractAll) override { QCString result="Jen listo de ĉiuj "; if (!extractAll) result+="dokumentitaj "; if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="funkcioj, variabloj, difinoj, enumeracioj kaj tipodifinoj"; } else { result+="dosieraj membroj"; } result+=" kun ligiloj al "; if (extractAll) result+="la dosieroj al kiuj ili apartenas:"; else result+="la dokumentado:"; return result; } /*! This is an introduction to the page with the list of all examples */ QCString trExamplesDescription() override { return "Jen listo de ĉiuj la ekzemploj:"; } /*! This is an introduction to the page with the list of related pages */ QCString trRelatedPagesDescription() override { return "Jen listo de ĉiuj rilataj dokumentadaj paĝoj:"; } /*! This is an introduction to the page with the list of class/file groups */ QCString trModulesDescription() override { return "Jen listo de ĉiuj la moduloj:"; } // index titles (the project name is prepended for these) /*! This is used in HTML as the title of index.html. */ QCString trDocumentation(const QCString &projName) override { return (!projName.isEmpty()?projName + " " : "") + "Dokumentado"; } /*! This is used in LaTeX as the title of the chapter with the * index of all groups. */ QCString trModuleIndex() override { return "Modula Indekso"; } /*! This is used in LaTeX as the title of the chapter with the * class hierarchy. */ QCString trHierarchicalIndex() override { return "Hierarkia Indekso"; } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index. */ QCString trCompoundIndex() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Datumstruktura Indekso"; } else { return "Klasa Indekso"; } } /*! This is used in LaTeX as the title of the chapter with the * list of all files. */ QCString trFileIndex() override { return "Dosiera Indekso"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all groups. */ QCString trModuleDocumentation() override { return "Modula Dokumentado"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all classes, structs and unions. */ QCString trClassDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Datumstruktura Dokumentado"; } else if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) { return trDesignUnitDocumentation(); } else { return "Klasa Dokumentado"; } } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all files. */ QCString trFileDocumentation() override { return "Dosiera Dokumentado"; } /*! This is used in LaTeX as the title of the document */ QCString trReferenceManual() override { return "Referenca Manlibro"; } /*! This is used in the documentation of a file as a header before the * list of defines */ QCString trDefines() override { return "Difinoj"; } /*! This is used in the documentation of a file as a header before the * list of typedefs */ QCString trTypedefs() override { return "Tipdifinoj"; } /*! This is used in the documentation of a file as a header before the * list of enumerations */ QCString trEnumerations() override { return "Enumeracioj"; } /*! This is used in the documentation of a file as a header before the * list of (global) functions */ QCString trFunctions() override { return "Funkcioj"; } /*! This is used in the documentation of a file as a header before the * list of (global) variables */ QCString trVariables() override { return "Variabloj"; } /*! This is used in the documentation of a file as a header before the * list of (global) variables */ QCString trEnumerationValues() override { return "Enumeraciilo"; } /*! This is used in the documentation of a file before the list of * documentation blocks for defines */ QCString trDefineDocumentation() override { return "Difina Dokumentado"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for typedefs */ QCString trTypedefDocumentation() override { return "Tipdifina Dokumentado"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration types */ QCString trEnumerationTypeDocumentation() override { return "Enumeracitipa Dokumentado"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for functions */ QCString trFunctionDocumentation() override { return "Funkcia Dokumentado"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for variables */ QCString trVariableDocumentation() override { return "Variabla Dokumentado"; } /*! This is used in the documentation of a file/namespace/group before * the list of links to documented compounds */ QCString trCompounds() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Datumstrukturoj"; } else { return "Klasoj"; } } /*! This is used in the standard footer of each page and indicates when * the page was generated */ QCString trGeneratedAt(const QCString &date,const QCString &projName) override { QCString result="Generita la "+date; if (!projName.isEmpty()) result+=" por "+projName; result+=" de"; return result; } /*! this text is put before a class diagram */ QCString trClassDiagram(const QCString &clName) override { return "Heredada diagramo por "+clName+":"; } /*! this text is generated when the \\warning command is used. */ QCString trWarning() override { return "Averto"; } /*! this text is generated when the \\version command is used. */ QCString trVersion() override { return "Versio"; } /*! this text is generated when the \\date command is used. */ QCString trDate() override { return "Dato"; } /*! this text is generated when the \\return command is used. */ QCString trReturns() override { return "Liveras"; } /*! this text is generated when the \\sa command is used. */ QCString trSeeAlso() override { return "Vido ankaŭ"; } /*! this text is generated when the \\param command is used. */ QCString trParameters() override { return "Parametroj"; } /*! this text is generated when the \\exception command is used. */ QCString trExceptions() override { return "Esceptoj"; } /*! this text is used in the title page of a LaTeX document. */ QCString trGeneratedBy() override { return "Generita de"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990307 ////////////////////////////////////////////////////////////////////////// /*! used as the title of page containing all the index of all namespaces. */ QCString trNamespaceList() override { return "Nomspacaro"; } /*! used as an introduction to the namespace list */ QCString trNamespaceListDescription(bool extractAll) override { QCString result="Jen listo de ĉiuj "; if (!extractAll) result+="dokumentitaj "; result+="nomspacoj kun mallongaj priskriboj:"; return result; } /*! used in the class documentation as a header before the list of all * friends of a class */ QCString trFriends() override { return "Amikoj"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990405 ////////////////////////////////////////////////////////////////////////// /*! used in the class documentation as a header before the list of all * related classes */ QCString trRelatedFunctionDocumentation() override { return "Dokumentado pri amikoj kaj rilatitaj funkcioj"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) override { QCString result="Referenco de la "; if (isTemplate) result+=" ŝablono de la "; switch(compType) { case ClassDef::Class: result+="klaso "; break; case ClassDef::Struct: result+="strukturo "; break; case ClassDef::Union: result+="kunigo "; break; case ClassDef::Interface: result+="interfaco "; break; case ClassDef::Protocol: result+="protokolo "; break; case ClassDef::Category: result+="kategorio "; break; case ClassDef::Exception: result+="escepto "; break; default: break; } result+=clName; return result; } /*! used as the title of the HTML page of a file */ QCString trFileReference(const QCString &fileName) override { QCString result=fileName; result+=" Dosiera referenco"; return result; } /*! used as the title of the HTML page of a namespace */ QCString trNamespaceReference(const QCString &namespaceName) override { QCString result=namespaceName; result+=" Nomspaca referenco"; return result; } QCString trPublicMembers() override { return "Publikaj Membraj Funkcioj"; } QCString trPublicSlots() override { return "Pubikaj Ingoj"; } QCString trSignals() override { return "Signaloj"; } QCString trStaticPublicMembers() override { return "Statikaj Publikaj Membraj Funkcioj"; } QCString trProtectedMembers() override { return "Protektitaj Membraj Funkcioj"; } QCString trProtectedSlots() override { return "Protektitaj Ingoj"; } QCString trStaticProtectedMembers() override { return "Statikaj Protektitaj Membraj Funkcioj"; } QCString trPrivateMembers() override { return "Privataj Membraj Funkcioj"; } QCString trPrivateSlots() override { return "Privataj Ingoj"; } QCString trStaticPrivateMembers() override { return "Statikaj Privataj Membraj Funkcioj"; } /*! this function is used to produce a comma-separated list of items. * use generateMarker(i) to indicate where item i should be put. */ QCString trWriteList(int numEntries) override { QCString result; // the inherits list contain `numEntries' classes for (int i=0;i<numEntries;i++) { // use generateMarker to generate placeholders for the class links! result+=generateMarker(i); // generate marker for entry i in the list // (order is left to right) if (i!=numEntries-1) // not the last entry, so we need a separator { if (i<numEntries-2) // not the fore last entry result+=", "; else // the fore last entry result+=", kaj "; } } return result; } /*! used in class documentation to produce a list of base classes, * if class diagrams are disabled. */ QCString trInheritsList(int numEntries) override { return "Heredas de "+trWriteList(numEntries)+"."; } /*! used in class documentation to produce a list of super classes, * if class diagrams are disabled. */ QCString trInheritedByList(int numEntries) override { return "Heredita de "+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * members that are hidden by this one. */ QCString trReimplementedFromList(int numEntries) override { return "Rerealigita el "+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * all member that overwrite the implementation of this member. */ QCString trReimplementedInList(int numEntries) override { return "Rerealigita en "+trWriteList(numEntries)+"."; } /*! This is put above each page as a link to all members of namespaces. */ QCString trNamespaceMembers() override { return "Nomspacaj Membroj"; } /*! This is an introduction to the page with all namespace members */ QCString trNamespaceMemberDescription(bool extractAll) override { QCString result="Jen listo de ĉiuj "; if (!extractAll) result+="dokumentitaj "; result+="nomspacaj membroj kun ligiloj al "; if (extractAll) result+="la nomspaca dokumentado de ĉiu membro:"; else result+="la nomspacoj al kiuj ili apartenas:"; return result; } /*! This is used in LaTeX as the title of the chapter with the * index of all namespaces. */ QCString trNamespaceIndex() override { return "Nomspaca Indekso"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all namespaces. */ QCString trNamespaceDocumentation() override { return "Nomspaca Dokumentado"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990522 ////////////////////////////////////////////////////////////////////////// /*! This is used in the documentation before the list of all * namespaces in a file. */ QCString trNamespaces() override { return "Nomspacoj"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990728 ////////////////////////////////////////////////////////////////////////// /*! This is put at the bottom of a class documentation page and is * followed by a list of files that were used to generate the page. */ QCString trGeneratedFromFiles(ClassDef::CompoundType compType, bool single) override { // single is true implies a single file QCString result="La dokumentado por tiu ĉi "; switch(compType) { case ClassDef::Class: result+="klaso"; break; case ClassDef::Struct: result+="strukturo"; break; case ClassDef::Union: result+="kunigo"; break; case ClassDef::Interface: result+="interfaco"; break; case ClassDef::Protocol: result+="protokolo"; break; case ClassDef::Category: result+="kategorio"; break; case ClassDef::Exception: result+="escepto"; break; default: break; } result+=" generitas el la "; if (single) result+="sekva dosiero:"; else result+="sekvaj dosieroj:"; return result; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990901 ////////////////////////////////////////////////////////////////////////// /*! This is used as the heading text for the retval command. */ QCString trReturnValues() override { return "Liveraĵoj"; } /*! This is in the (quick) index as a link to the main page (index.html) */ QCString trMainPage() override { return "Ĉefa Paĝo"; } /*! This is used in references to page that are put in the LaTeX * documentation. It should be an abbreviation of the word page. */ QCString trPageAbbreviation() override { return "p."; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-991003 ////////////////////////////////////////////////////////////////////////// QCString trDefinedAtLineInSourceFile() override { return "Difinita sur la lineo @0 de la dosiero @1."; } QCString trDefinedInSourceFile() override { return "Difinita en la dosiero @0."; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-991205 ////////////////////////////////////////////////////////////////////////// QCString trDeprecated() override { return "Evitinda"; } ////////////////////////////////////////////////////////////////////////// // new since 1.0.0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ QCString trCollaborationDiagram(const QCString &clName) override { return "Kunlaborada diagramo por "+clName+":"; } /*! this text is put before an include dependency graph */ QCString trInclDepGraph(const QCString &fName) override { return "Inkluzivaĵa dependeca diagramo por "+fName+":"; } /*! header that is put before the list of constructor/destructors. */ QCString trConstructorDocumentation() override { return "Konstruila kaj Detruila Dokumentado"; } /*! Used in the file documentation to point to the corresponding sources. */ QCString trGotoSourceCode() override { return "Iri al la fontkodo de tiu ĉi dosiero."; } /*! Used in the file sources to point to the corresponding documentation. */ QCString trGotoDocumentation() override { return "Iri al la dokumentado de tiu ĉi dosiero."; } /*! Text for the \\pre command */ QCString trPrecondition() override { return "Antaŭkondiĉo"; } /*! Text for the \\post command */ QCString trPostcondition() override { return "Postkondiĉo"; } /*! Text for the \\invariant command */ QCString trInvariant() override { return "Malvariaĵo"; } /*! Text shown before a multi-line variable/enum initialization */ QCString trInitialValue() override { return "Komenca valoro:"; } /*! Text used the source code in the file index */ QCString trCode() override { return "kodo"; } QCString trGraphicalHierarchy() override { return "Grafika Klasa Hierarkio"; } QCString trGotoGraphicalHierarchy() override { return "Iri al la grafika klasa hierarkio"; } QCString trGotoTextualHierarchy() override { return "Iri al la teksta klasa hierarkio"; } QCString trPageIndex() override { return "Paĝa Indekso"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.0 ////////////////////////////////////////////////////////////////////////// QCString trNote() override { return "Noto"; } QCString trPublicTypes() override { return "Publikaj Tipoj"; } QCString trPublicAttribs() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Datumkampoj"; } else { return "Publikaj Atributoj"; } } QCString trStaticPublicAttribs() override { return "Statikaj Publikaj Atributoj"; } QCString trProtectedTypes() override { return "Protektitaj Tipoj"; } QCString trProtectedAttribs() override { return "Protektitaj Atributoj"; } QCString trStaticProtectedAttribs() override { return "Statikaj Protektitaj Atributoj"; } QCString trPrivateTypes() override { return "Privataj Tipoj"; } QCString trPrivateAttribs() override { return "Privataj Atributoj"; } QCString trStaticPrivateAttribs() override { return "Statikaj Privataj Atributoj"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.3 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a \\todo item */ QCString trTodo() override { return "Farendaĵo"; } /*! Used as the header of the todo list */ QCString trTodoList() override { return "Farendaĵaro"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.4 ////////////////////////////////////////////////////////////////////////// QCString trReferencedBy() override { return "Referencita de"; } QCString trRemarks() override { return "Rimarkoj"; } QCString trAttention() override { return "Atentu"; } QCString trInclByDepGraph() override { return "Tiu ĉi diagramo montras kiuj dosieroj rekte aŭ malrekte " "inkluzivas tiun ĉi dosieron:"; } QCString trSince() override { return "De"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.5 ////////////////////////////////////////////////////////////////////////// /*! title of the graph legend page */ QCString trLegendTitle() override { return "Diagrama Klarigeto"; } /*! page explaining how the dot graph's should be interpreted * The %A in the text below are to prevent link to classes called "A". */ QCString trLegendDocs() override { return "Tiu ĉi paĝo klarigas kiel interpreti la diagramojn generitajn " "de doxygen.<p>\n" "Konsideru la sekvan ekzemplon:\n" "\\code\n" "/*! Nevidebla klaso pro trunkado */\n" "class Invisible { };\n\n" "/*! Trunkita klaso, hereda rilato kaŝiĝas */\n" "class Truncated : public Invisible { };\n\n" "/* Klaso ne dokumentita per komentoj de doxygen */\n" "class Undocumented { };\n\n" "/*! Klaso de kiu herediĝas per publika heredado */\n" "class PublicBase : public Truncated { };\n\n" "/*! Ŝablona klaso */\n" "template<class T> class Templ { };\n\n" "/*! Klaso de kiu herediĝas per protektita heredado */\n" "class ProtectedBase { };\n\n" "/*! Klaso de kiu herediĝas per privata heredado */\n" "class PrivateBase { };\n\n" "/*! Klaso uzata de la klaso Inherited */\n" "class Used { };\n\n" "/*! Supra klaso kiu heredas de kelkaj aliaj klasoj */\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" "Tio ĉi liveros la sekvan diagramon:" "<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center>\n" "<p>\n" "La skatoloj de la supra diagramo havas la sekvajn signifojn:\n" "<ul>\n" "<li>%Plene griza skatolo reprezentas la strukturon aŭ klason " "kies diagramo generiĝis.\n" "<li>%Skatolo kun nigra bordero montras dokumentitan strukturon aŭ klason.\n" "<li>%Skatolo kun griza bordero montras nedokumentitan strukturon aŭ klason.\n" "<li>%Skatolo kun ruĝa bordero montras dokumentitan strukturon aŭ klason por " "kiu ne ĉiuj heredadoj/enhavoj montriĝas. %Diagramo estas trunkota " "se ĝi ne adaptiĝas en la donitajn limojn.\n" "</ul>\n" "La sagoj havas la sekvajn signifojn:\n" "<ul>\n" "<li>%Malhelblua sago uzatas por montri publika heredado " "inter du klasoj.\n" "<li>%Malhelverda sago uzatas por protektita heredado.\n" "<li>%Malhelruĝa sago uzatas por privata heredado.\n" "<li>%Purpura streka sago uzatas se klaso enhavatas aŭ uzatas " "de alia klaso. La sago estas etikedatas kun la variablo(j) " "tra kiu la montrita klaso aŭ strukturo estas alirebla.\n" "<li>%Flava streka sago montras rilato inter ŝablona apero kaj " "la ŝablona klaso el kiu ĝi realigitas. La sago etikeditas kun " "la parametroj de la ŝablona apero.\n" "</ul>\n"; } /*! text for the link to the legend page */ QCString trLegend() override { return "klarigeto"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.0 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a test item */ QCString trTest() override { return "Testo"; } /*! Used as the header of the test list */ QCString trTestList() override { return "Testa Listo"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.2 ////////////////////////////////////////////////////////////////////////// /*! Used as a section header for IDL properties */ QCString trProperties() override { return "Atributoj"; } /*! Used as a section header for IDL property documentation */ QCString trPropertyDocumentation() override { return "Atributa Dokumentado"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.4 ////////////////////////////////////////////////////////////////////////// /*! Used for Java classes in the summary section of Java packages */ QCString trClasses() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "Datumstrukturoj"; } else { return "Klasoj"; } } /*! Used as the title of a Java package */ QCString trPackage(const QCString &name) override { return "Pakaĵo "+name; } /*! The description of the package index page */ QCString trPackageListDescription() override { return "Jen listo de pakaĵoj kun mallongaj priskriboj (se ekzistas):"; } /*! The link name in the Quick links header for each page */ QCString trPackages() override { return "Pakaĵoj"; } /*! Text shown before a multi-line define */ QCString trDefineValue() override { return "Valoro:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.5 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a \\bug item */ QCString trBug() override { return "Cimo"; } /*! Used as the header of the bug list */ QCString trBugList() override { return "Cima Listo"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.6 ////////////////////////////////////////////////////////////////////////// /*! Used as ansicpg for RTF file * * The following table shows the correlation of Charset name, Charset Value and * <pre> * Codepage number: * Charset Name Charset Value(hex) Codepage number * ------------------------------------------------------ * DEFAULT_CHARSET 1 (x01) * SYMBOL_CHARSET 2 (x02) * OEM_CHARSET 255 (xFF) * ANSI_CHARSET 0 (x00) 1252 * RUSSIAN_CHARSET 204 (xCC) 1251 * EE_CHARSET 238 (xEE) 1250 * GREEK_CHARSET 161 (xA1) 1253 * TURKISH_CHARSET 162 (xA2) 1254 * BALTIC_CHARSET 186 (xBA) 1257 * HEBREW_CHARSET 177 (xB1) 1255 * ARABIC _CHARSET 178 (xB2) 1256 * SHIFTJIS_CHARSET 128 (x80) 932 * HANGEUL_CHARSET 129 (x81) 949 * GB2313_CHARSET 134 (x86) 936 * CHINESEBIG5_CHARSET 136 (x88) 950 * </pre> * */ QCString trRTFansicp() override { return ""; } /*! Used as ansicpg for RTF fcharset * \see trRTFansicp() for a table of possible values. */ QCString trRTFCharSet() override { return "1"; } /*! Used as header RTF general index */ QCString trRTFGeneralIndex() override { return "Indekso"; } /*! 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. */ QCString trClass(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "klaso", "j"); } /*! 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. */ QCString trFile(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "dosiero", "j"); } /*! 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. */ QCString trNamespace(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "nomspaco", "j"); } /*! 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. */ QCString trGroup(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "grupo", "j"); } /*! 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. */ QCString trPage(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "paĝo", "j"); } /*! 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. */ QCString trMember(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "membro", "j"); } /*! 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. */ QCString trGlobal(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "mallokalaĵo", "j"); } ////////////////////////////////////////////////////////////////////////// // new since 1.2.7 ////////////////////////////////////////////////////////////////////////// /*! This text is generated when the \\author command is used and * for the author section in man pages. */ QCString trAuthor(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "aŭtoro", "j"); } ////////////////////////////////////////////////////////////////////////// // new since 1.2.11 ////////////////////////////////////////////////////////////////////////// /*! This text is put before the list of members referenced by a member */ QCString trReferences() override { return "Referencoj"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.13 ////////////////////////////////////////////////////////////////////////// /*! used in member documentation blocks to produce a list of * members that are implemented by this one. */ QCString trImplementedFromList(int numEntries) override { return "Realigas "+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * all members that implement this abstract member. */ QCString trImplementedInList(int numEntries) override { return "Realigita en "+trWriteList(numEntries)+"."; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.16 ////////////////////////////////////////////////////////////////////////// /*! used in RTF documentation as a heading for the Table * of Contents. */ QCString trRTFTableOfContents() override { return "Enhava Tabelo"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.17 ////////////////////////////////////////////////////////////////////////// /*! Used as the header of the list of item that have been * flagged deprecated */ QCString trDeprecatedList() override { return "Evitindaĵa Listo"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.18 ////////////////////////////////////////////////////////////////////////// /*! Used as a header for declaration section of the events found in * a C# program */ QCString trEvents() override { return "Eventoj"; } /*! Header used for the documentation section of a class' events. */ QCString trEventDocumentation() override { return "Eventa Dokumentado"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3 ////////////////////////////////////////////////////////////////////////// /*! Used as a heading for a list of Java class types with package scope. */ QCString trPackageTypes() override { return "Pakaĵaj Tipoj"; } /*! Used as a heading for a list of Java class functions with package * scope. */ QCString trPackageFunctions() override { return "Pakaĵaj Funkcioj"; } QCString trPackageMembers() override { return "Pakaĵaj Membroj"; } /*! Used as a heading for a list of static Java class functions with * package scope. */ QCString trStaticPackageFunctions() override { return "Statikaj Pakaĵaj Funkcioj"; } /*! Used as a heading for a list of Java class variables with package * scope. */ QCString trPackageAttribs() override { return "Pakaĵaj Atributoj"; } /*! Used as a heading for a list of static Java class variables with * package scope. */ QCString trStaticPackageAttribs() override { return "Statikaj Pakaĵaj Atributoj"; } ////////////////////////////////////////////////////////////////////////// // 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. */ QCString trAll() override { return "Ĉiuj"; } /*! Put in front of the call graph for a function. */ QCString trCallGraph() override { return "Jen la vokdiagramo por tiu ĉi funkcio:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.3 ////////////////////////////////////////////////////////////////////////// /*! This string is used as the title for the page listing the search * results. */ QCString trSearchResultsTitle() override { return "Serĉaj Rezultoj"; } /*! 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. */ QCString trSearchResults(int numDocuments) override { if (numDocuments==0) { return "Pardonu, nenio dokumento kongruas vian peton."; } else if (numDocuments==1) { return "Trafita <b>unu</b> dokumenton kongruantan vian peton."; } else { return "Trafitaj <b>$num</b> dokumentojn kongruantajn vian peton. " "Montriĝos plej bonaj kongruoj unue."; } } /*! 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. */ QCString trSearchMatches() override { return "Kongruoj:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.8 ////////////////////////////////////////////////////////////////////////// /*! This is used in HTML as the title of page with source code for file filename */ QCString trSourceFile(const QCString& filename) override { return filename + " Fonta Dosiero"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.9 ////////////////////////////////////////////////////////////////////////// /*! This is used as the name of the chapter containing the directory * hierarchy. */ QCString trDirIndex() override { return "Dosieruja Hierarkio"; } /*! This is used as the name of the chapter containing the documentation * of the directories. */ QCString trDirDocumentation() override { return "Dosieruja Dokumentado"; } /*! This is used as the title of the directory index and also in the * Quick links of an HTML page, to link to the directory hierarchy. */ QCString trDirectories() override { return "Dosierujoj"; } /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ QCString trDirReference(const QCString &dirName) override { QCString result=dirName; result+=" Dosieruja Referenco"; return result; } /*! This returns the word directory with or without starting capital * (\a first_capital) and in sigular or plural form (\a singular). */ QCString trDir(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "dosierujo", "j"); } ////////////////////////////////////////////////////////////////////////// // new since 1.4.1 ////////////////////////////////////////////////////////////////////////// /*! This text is added to the documentation when the \\overload command * is used for a overloaded function. */ QCString trOverloadText() override { return "Tiu ĉi estas superŝarĝita membra funkcio, " "donita por faciligo. Ĝi nur malsamas de la supra " "funkcio nur pro la argumento(j) kiujn ili akceptas."; } ////////////////////////////////////////////////////////////////////////// // new since 1.4.6 ////////////////////////////////////////////////////////////////////////// /*! This is used to introduce a caller (or called-by) graph */ QCString trCallerGraph() override { return "Jen la vokdiagramo por tiu ĉi funkcio:"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration values */ QCString trEnumerationValueDocumentation() override { return "Enumeraciila Dokumentado"; } ////////////////////////////////////////////////////////////////////////// // new since 1.5.4 (mainly for Fortran) ////////////////////////////////////////////////////////////////////////// /*! header that is put before the list of member subprograms (Fortran). */ QCString trMemberFunctionDocumentationFortran() override { return "Dokumentado de Membraj Funkcioj/Subrutinoj"; } /*! This is put above each page as a link to the list of annotated data types (Fortran). */ QCString trCompoundListFortran() override { return "Datumtipa Listo"; } /*! This is put above each page as a link to all members of compounds (Fortran). */ QCString trCompoundMembersFortran() override { return "Datumkampoj"; } /*! This is an introduction to the annotated compound list (Fortran). */ QCString trCompoundListDescriptionFortran() override { return "Jen la datumtipoj kun mallongaj priskriboj:"; } /*! This is an introduction to the page with all data types (Fortran). */ QCString trCompoundMembersDescriptionFortran(bool extractAll) override { QCString result="Jen listo de ĉiuj "; if (!extractAll) { result+="dokumentitaj "; } result+="datumtipaj membroj"; result+=" kun ligiloj al "; if (!extractAll) { result+="la datumstruktura dokumentado de ĉiu membro"; } else { result+="la datumtipoj al kiuj ili apartenas:"; } return result; } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index (Fortran). */ QCString trCompoundIndexFortran() override { return "Datumtipa Indekso"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all data types (Fortran). */ QCString trTypeDocumentation() override { return "Datumtipa Dokumentado"; } /*! This is used in the documentation of a file as a header before the * list of (global) subprograms (Fortran). */ QCString trSubprograms() override { return "Funkcioj/Subrutinoj"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for subprograms (Fortran) */ QCString trSubprogramDocumentation() override { return "Funkcia/Subrutina Dokumentado"; } /*! This is used in the documentation of a file/namespace/group before * the list of links to documented compounds (Fortran) */ QCString trDataTypes() override { return "Datumtipoj"; } /*! used as the title of page containing all the index of all modules (Fortran). */ QCString trModulesList() override { return "Modula Listo"; } /*! used as an introduction to the modules list (Fortran) */ QCString trModulesListDescription(bool extractAll) override { QCString result="Jen listo de ĉiuj "; if (!extractAll) result+="dokumentitaj "; result+="moduloj kun mallongaj priskriboj:"; return result; } /*! used as the title of the HTML page of a module/type (Fortran) */ QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) override { QCString result="Referenco de la "; if (isTemplate) result+=" ŝablono de la "; switch(compType) { case ClassDef::Class: result+="modulo "; break; case ClassDef::Struct: result+="tipo "; break; case ClassDef::Union: result+="kunigo "; break; case ClassDef::Interface: result+="interfaco "; break; case ClassDef::Protocol: result+="protokolo "; break; case ClassDef::Category: result+="kategorio "; break; case ClassDef::Exception: result+="escepto "; break; default: break; } result+=clName; return result; } /*! used as the title of the HTML page of a module (Fortran) */ QCString trModuleReference(const QCString &namespaceName) override { QCString result=namespaceName; result+=" Modula Referenco"; return result; } /*! This is put above each page as a link to all members of modules. (Fortran) */ QCString trModulesMembers() override { return "Modulaj Membroj"; } /*! This is an introduction to the page with all modules members (Fortran) */ QCString trModulesMemberDescription(bool extractAll) override { QCString result="Jen listo de ĉiuj "; if (!extractAll) result+="dokumentitaj "; result+="modulaj membroj kun ligiloj al la "; if (extractAll) { result+="modula dokumentado de ĉiu membro:"; } else { result+="moduloj al kiuj ili apartenas:"; } return result; } /*! This is used in LaTeX as the title of the chapter with the * index of all modules (Fortran). */ QCString trModulesIndex() override { return "Indekso de Moduloj"; } /*! 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. */ QCString trModule(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "modulo", "j"); } /*! This is put at the bottom of a module documentation page and is * followed by a list of files that were used to generate the page. */ QCString trGeneratedFromFilesFortran(ClassDef::CompoundType compType, bool single) override { // single is true implies a single file QCString result="La dokumentado por tiu ĉi "; switch(compType) { case ClassDef::Class: result+="modulo"; break; case ClassDef::Struct: result+="tipo"; break; case ClassDef::Union: result+="kunigo"; break; case ClassDef::Interface: result+="interfaco"; break; case ClassDef::Protocol: result+="protokolo"; break; case ClassDef::Category: result+="kategorio"; break; case ClassDef::Exception: result+="escepto"; break; default: break; } result+=" kreiĝis el la "; if (single) result+="sekva dosiero:"; else result+="sekvaj dosieroj:"; 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. */ QCString trType(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "tipo", "j"); } /*! 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. */ QCString trSubprogram(bool first_capital, bool singular) override { return createNoun(first_capital, singular, "subprogramo", "j"); } /*! C# Type Constraint list */ QCString trTypeConstraints() override { return "Tipaj Limigoj"; } ////////////////////////////////////////////////////////////////////////// // new since 1.6.0 (mainly for the new search engine) ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ QCString trDirRelation(const QCString &name) override { return QCString(name)+" Rilato"; } /*! Loading message shown when loading search results */ QCString trLoading() override { return "Ŝarĝante..."; } /*! Label used for search results in the global namespace */ QCString trGlobalNamespace() override { return "Malloka Nomspaco"; } /*! Message shown while searching */ QCString trSearching() override { return "Serĉante..."; } /*! Text shown when no search results are found */ QCString trNoMatches() override { return "Nenia kongruo"; } ////////////////////////////////////////////////////////////////////////// // new since 1.6.3 (missing items for the directory pages) ////////////////////////////////////////////////////////////////////////// /*! when clicking a directory dependency label, a page with a * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ QCString trFileIn(const QCString &name) override { return "Dosiero en "+name; } /*! when clicking a directory dependency label, a page with a * table is shown. The heading for the second column mentions the * destination file that is included. */ QCString trIncludesFileIn(const QCString &name) override { return "Inkluzivas dosieron en "+name; } /** Compiles a date string. * @param year Year in 4 digits * @param month Month of the year: 1=January * @param day Day of the Month: 1..31 * @param dayOfWeek Day of the week: 1=Monday..7=Sunday * @param hour Hour of the day: 0..23 * @param minutes Minutes in the hour: 0..59 * @param seconds Seconds within the minute: 0..59 * @param includeTime Include time in the result string? */ QCString trDateTime(int year,int month,int day,int dayOfWeek, int hour,int minutes,int seconds, DateTimeType includeTime) override { static const char *days[] = { "lundo","mardo","merkredo", "ĵaŭdo","vendredo","sabato", "dimanĉo" }; static const char *months[] = { "Januaro", "Februaro", "Marto", "Aprilo", "Majo", "Junio", "Julio", "Aŭgusto", "Septembro", "Oktobro", "Novembro", "Decembro" }; QCString sdate; if (includeTime == DateTimeType::DateTime || includeTime == DateTimeType::Date) { sdate.sprintf("%s, %d-a de %s %d",days[dayOfWeek-1],day,months[month-1],year); } if (includeTime == DateTimeType::DateTime) sdate += " "; if (includeTime == DateTimeType::DateTime || includeTime == DateTimeType::Time) { QCString stime; stime.sprintf("%.2d:%.2d:%.2d",hour,minutes,seconds); sdate+=stime; } return sdate; } QCString trDayOfWeek(int dayOfWeek, bool first_capital, bool full) override { static const char *days_short[] = { "lu", "ma", "me", "ĵa", "ve", "sa", "di" }; static const char *days_full[] = { "lundo", "mardo", "merkredo", "ĵaŭdo", "vendredo", "sabato", "dimanĉo" }; QCString text = full? days_full[dayOfWeek-1] : days_short[dayOfWeek-1]; if (first_capital) return text.mid(0,1).upper()+text.mid(1); else return text; } QCString trMonth(int month, bool first_capital, bool full) override { static const char *months_short[] = { "jan", "feb", "mar", "apr", "maj", "jun", "jul", "aŭg", "sep", "okt", "nov", "dec" }; static const char *months_full[] = { "januaro", "februaro", "marto", "aprilo", "majo", "junio", "julio", "aŭgusto", "septembro", "oktobro", "novembro", "decembro" }; QCString text = full? months_full[month-1] : months_short[month-1]; if (first_capital) return text.mid(0,1).upper()+text.mid(1); else return text; } QCString trDayPeriod(bool period) override { static const char *dayPeriod[] = { "atm", "ptm" }; return dayPeriod[period?1:0]; } ////////////////////////////////////////////////////////////////////////// // new since 1.7.5 ////////////////////////////////////////////////////////////////////////// /*! Header for the page with bibliographic citations */ QCString trCiteReferences() override { return "Bibliografiaj Referencoj"; } /*! Text for copyright paragraph */ QCString trCopyright() override { return "Kopirajto"; } /*! Header for the graph showing the directory dependencies */ QCString trDirDepGraph(const QCString &name) override { return QCString("Dosieruja dependa diagramo por ")+name+":"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.0 ////////////////////////////////////////////////////////////////////////// /*! Detail level selector shown for hierarchical indices */ QCString trDetailLevel() override { return "detala nivelo"; } /*! Section header for list of template parameters */ QCString trTemplateParameters() override { return "Parametroj de ŝablonoj"; } /*! Used in dot graph when UML_LOOK is enabled and there are many fields */ QCString trAndMore(const QCString &number) override { return "kaj "+number+" pli..."; } /*! Used file list for a Java enum */ QCString trEnumGeneratedFromFiles(bool single) override { QCString result = "La dokumentaro por tiu ĉi enum estis generita el la sekva dosiero"; if (!single) result += "s"; result+=":"; return result; } /*! Header of a Java enum page (Java enums are represented as classes). */ QCString trEnumReference(const QCString &name) override { return QCString(name)+" Enum Referenco"; } /*! Used for a section containing inherited members */ QCString trInheritedFrom(const QCString &members,const QCString &what) override { return QCString(members)+" heredita el "+what; } /*! Header of the sections with inherited members specific for the * base class(es) */ QCString trAdditionalInheritedMembers() override { return "Kromaj Hereditaj Membroj"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.2 ////////////////////////////////////////////////////////////////////////// /*! Used as a tooltip for the toggle button that appears in the * navigation tree in the HTML output when GENERATE_TREEVIEW is * enabled. This tooltip explains the meaning of the button. */ QCString trPanelSynchronisationTooltip(bool enable) override { QCString opt = enable ? "aktivigi" : "malaktivigi"; return "klaku por "+opt+" panelan sinkronigon"; } /*! Used in a method of an Objective-C class that is declared in a * a category. Note that the @1 marker is required and is replaced * by a link. */ QCString trProvidedByCategory() override { return "Provizita de kategorio @0."; } /*! Used in a method of an Objective-C category that extends a class. * Note that the @1 marker is required and is replaced by a link to * the class method. */ QCString trExtendsClass() override { return "Etendi klason @0."; } /*! Used as the header of a list of class methods in Objective-C. * These are similar to static public member functions in C++. */ QCString trClassMethods() override { return "Klasaj Metodoj"; } /*! Used as the header of a list of instance methods in Objective-C. * These are similar to public member functions in C++. */ QCString trInstanceMethods() override { return "Aperaj Metodoj"; } /*! Used as the header of the member functions of an Objective-C class. */ QCString trMethodDocumentation() override { return "Dokumentaro de la Metodo"; } }; #endif
65,234
C++
.h
1,712
32.036799
172
0.589432
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,568
diagram.h
doxygen_doxygen/src/diagram.h
/****************************************************************************** * * * * * Copyright (C) 1997-2015 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 DIAGRAM_H #define DIAGRAM_H #include <memory> #include "qcstring.h" #include "construct.h" class ClassDef; class TextStream; /** Class representing a built-in class diagram. */ class ClassDiagram { public: ClassDiagram(const ClassDef *root); ~ClassDiagram(); NON_COPYABLE(ClassDiagram) void writeFigure(TextStream &t,const QCString &path, const QCString &file) const; void writeImage(TextStream &t,const QCString &path,const QCString &relPath, const QCString &file,bool generateMap=true) const; private: struct Private; std::unique_ptr<Private> p; }; #endif
1,310
C++
.h
40
29.375
79
0.692247
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,569
ftvhelp.h
doxygen_doxygen/src/ftvhelp.h
/****************************************************************************** * * Copyright (C) 1997-2021 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. * */ /****************************************************************************** * ftvhelp.h,v 1.0 2000/09/06 16:09:00 * * Kenney Wong <kwong@ea.com> * * Folder Tree View for offline help on browsers that do not support HTML Help. */ #ifndef FTVHELP_H #define FTVHELP_H #include <memory> #include <vector> #include "qcstring.h" #include "construct.h" #include "indexlist.h" class Definition; class MemberDef; class TextStream; /** A class that generates a dynamic tree view side panel. */ class FTVHelp : public IndexIntf { public: FTVHelp(bool LTI); ~FTVHelp(); NON_COPYABLE(FTVHelp) void initialize(); void finalize(); void incContentsDepth(); void decContentsDepth(); void addContentsItem(bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def); void addIndexItem(const Definition *,const MemberDef *,const QCString &,const QCString &) {} void addIndexFile(const QCString &) {} void addImageFile(const QCString &) {} void addStyleSheetFile(const QCString &) {} void generateTreeView(); void generateTreeViewInline(TextStream &t); static void generateTreeViewImages(); void generateTreeViewScripts(); private: struct Private; std::unique_ptr<Private> p; }; constexpr auto JAVASCRIPT_LICENSE_TEXT = R"LIC(/* @licstart The following is the entire license notice for the JavaScript code in this file. The MIT License (MIT) Copyright (C) 1997-2020 by Dimitri van Heesch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @licend The above is the entire license notice for the JavaScript code in this file */ )LIC"; #endif /* FTVHELP_H */
3,561
C++
.h
83
38.253012
98
0.697574
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,570
configoptions.h
doxygen_doxygen/src/configoptions.h
/****************************************************************************** * * Copyright (C) 1997-2015 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 CONFIGOPTIONS #define CONFIGOPTIONS class ConfigImpl; void addConfigOptions(ConfigImpl *cfg); #endif
771
C++
.h
19
38.578947
79
0.704545
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,571
translator_ke.h
doxygen_doxygen/src/translator_ke.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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. * */ // // Update: // // 2004.12.22 (SooYoung Jung: jung5000@gmail.com) // - LaTex and RTF were not generated correctly. // Corrected trRTFansicp and trRTFCharSet. // It was wrong. // // #ifndef TRANSLATOR_KE_H #define TRANSLATOR_KE_H class TranslatorKoreanEn : public TranslatorEnglish { public: QCString idLanguage() override { return "korean-en"; } QCString latexLanguageSupportCommand() override { return "\\usepackage{kotex}\n"; } QCString trRTFansicp() override { return "949"; } QCString latexCommandName() override { return p_latexCommandName("xelatex"); } /*! Used as ansicpg for RTF fcharset * \see trRTFansicp() for a table of possible values. */ QCString trRTFCharSet() override { return "129"; } QCString trISOLang() override { return "ko"; } QCString getLanguageString() override { return "0x412 Korean"; } }; #endif
1,633
C++
.h
61
23.262295
79
0.666028
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,572
qcstring.h
doxygen_doxygen/src/qcstring.h
/**************************************************************************** ** ** Copyright (C) 1997-2015 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. ** ** Note: this is a reimplementation of the qcstring.h that came with ** an Qt version 2.2.3. For short strings it stores the string data inside ** the object. For long strings it uses a separate array with reference counting. ** **********************************************************************/ #ifndef QCSTRING_H #define QCSTRING_H #include <string> #include <string_view> #include <algorithm> #include <cctype> #include <cstring> #include <cstdio> #include <cstdlib> #include <cstdint> #include <ostream> #include "utf8.h" #ifndef FALSE #define FALSE false #endif #ifndef TRUE #define TRUE true #endif #define ASSERT(x) if ( !(x) )\ fprintf(stderr,"ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__) /***************************************************************************** Safe and portable C string functions; extensions to standard string.h *****************************************************************************/ void *qmemmove( void *dst, const void *src, size_t len ); #define qsnprintf snprintf //! Returns a copy of a string \a s. //! Note that memory is passed to the caller, use qstrfree() to release. char *qstrdup( const char *s ); //! Frees the memory allocated using qstrdup(). void qstrfree( const char *s ); //! Returns the length of string \a str, or 0 if a null pointer is passed. inline uint32_t qstrlen( const char *str ) { return str ? static_cast<uint32_t>(strlen(str)) : 0; } inline char *qstrcpy( char *dst, const char *src ) { return src ? strcpy(dst, src) : nullptr; } char *qstrncpy(char *dst,const char *src, size_t len); inline bool qisempty( const char *s) { return s==nullptr || *s=='\0'; } inline int qstrcmp( const char *str1, const char *str2 ) { return (str1 && str2) ? strcmp(str1,str2) : // both non-empty (qisempty(str1) && qisempty(str2)) ? 0 : // both empty qisempty(str1) ? -1 : 1; // one empty, other non-empty } inline int qstrncmp( const char *str1, const char *str2, size_t len ) { return (str1 && str2) ? strncmp(str1,str2,len) : // both non-empty (qisempty(str1) && qisempty(str2)) ? 0 : // both empty qisempty(str1) ? -1 : 1; // one empty other non-empty } inline bool qisspace(char c) { return c==' ' || c=='\t' || c=='\n' || c=='\r'; } int qstricmp( const char *str1, const char *str2 ); inline int qstricmp_sort( const char *str1, const char *str2 ) { int result = qstricmp(str1,str2); return result==0 ? qstrcmp(str1,str2) : result; } int qstrnicmp( const char *str1, const char *str2, size_t len ); using JavaCCString = std::basic_string<JAVACC_CHAR_TYPE>; /** This is an alternative implementation of QCString. It provides basically * the same functions but uses std::string as the underlying string type */ class QCString { public: QCString() = default; explicit QCString( const std::string &s ) : m_rep(s) {} QCString( std::string &&s) : m_rep(std::move(s)) {} QCString( std::string_view sv) : m_rep(sv) {} QCString &operator=(std::string_view sv) { m_rep=sv; return *this; } QCString( int ) = delete; /** For converting a JavaCC string */ QCString( const JavaCCString &s) { m_rep.resize(s.size()); memcpy(m_rep.data(),s.data(),s.size()); } QCString &operator=( const JavaCCString &s) { m_rep.resize(s.size()); memcpy(m_rep.data(),s.data(),s.size()); return *this; } /** creates a string with room for size characters * @param[in] size the number of character to allocate (also counting the 0-terminator!) */ enum SizeTag { ExplicitSize }; explicit QCString( size_t size, SizeTag t) { m_rep.resize(size); } /** creates a string from a plain C string. * @param[in] str A zero terminated C string. When 0 an empty string is created. */ QCString( const char *str ) : m_rep(str?str:"") {} /** creates a string from \a str and copies over the first \a maxlen characters. */ QCString( const char *str, size_t maxlen ) : m_rep(str?str:"") { m_rep.resize(maxlen); } /** replaces the contents by that of C string \a str. */ QCString &operator=( const char *str) { m_rep = str?str:""; return *this; } QCString &operator=( const std::string &s) { m_rep = s; return *this; } /** Returns TRUE iff the string is empty */ bool isEmpty() const { return m_rep.empty(); } /** Returns the length of the string, not counting the 0-terminator. Equivalent to size(). */ size_t length() const { return m_rep.size(); } /** Returns the length of the string, not counting the 0-terminator. */ size_t size() const { return m_rep.size(); } /** Returns a pointer to the contents of the string in the form of a 0-terminated C string */ const char *data() const { return m_rep.c_str(); } std::string_view view() const { return m_rep; } /** Returns a writable pointer to the data. */ char *rawData() { return &m_rep[0]; } void resize( size_t newlen) { m_rep.resize(newlen); } void clear() { m_rep.clear(); } /** Reserve space for \a size bytes without changing the string contents */ void reserve( size_t size ) { m_rep.reserve(size); } /** Fills a string with a predefined character * @param[in] c the character used to fill the string with. * @param[in] len the number of character to fill. Use -1 to fill the whole string. * @note the string will be resized to contain \a len characters. The contents of the * string will be lost. */ void fill( char c, int len = -1 ) { int l = len==-1 ? static_cast<int>(m_rep.size()) : len; m_rep = std::string(l,c); } QCString &sprintf( const char *format, ... ); int find( char c, int index=0, bool cs=TRUE ) const; int find( const char *str, int index=0, bool cs=TRUE ) const; int find( const QCString &str, int index=0, bool cs=TRUE ) const; int findRev( char c, int index=-1, bool cs=TRUE) const; int findRev( const char *str, int index=-1, bool cs=TRUE) const; int contains( char c, bool cs=TRUE ) const; int contains( const char *str, bool cs=TRUE ) const; bool stripPrefix(const QCString &prefix) { if (prefix.isEmpty() || m_rep.empty()) return FALSE; if (m_rep.rfind(prefix.data(),0)==0) // string starts with prefix { m_rep.erase(0,prefix.length()); return TRUE; } return FALSE; } bool stripPrefix(const char *prefix) { return stripPrefix(QCString(prefix)); } QCString left( size_t len ) const { return m_rep.empty() ? QCString() : QCString(m_rep.substr(0,len)); } QCString right( size_t len ) const { return m_rep.empty() ? QCString() : len<m_rep.size() ? QCString(m_rep.substr(m_rep.size()-len,len)) : *this; } QCString mid( size_t index, size_t len=static_cast<size_t>(-1) ) const { size_t slen = m_rep.size(); if (len==static_cast<uint32_t>(-1)) len = slen-index; return m_rep.empty() || index>slen || len==0 ? QCString() : QCString(m_rep.substr(index,len)); } QCString lower() const { return QCString(convertUTF8ToLower(m_rep)); } QCString upper() const { return QCString(convertUTF8ToUpper(m_rep)); } /// returns a copy of this string with leading and trailing whitespace removed QCString stripWhiteSpace() const { size_t sl = m_rep.size(); if (sl==0 || (!qisspace(m_rep[0]) && !qisspace(m_rep[sl-1]))) return *this; size_t start=0,end=sl-1; while (start<sl && qisspace(m_rep[start])) start++; if (start==sl) return QCString(); // only whitespace while (end>start && qisspace(m_rep[end])) end--; return QCString(m_rep.substr(start,1+end-start)); } QCString stripLeadingAndTrailingEmptyLines() const; // Returns a quoted copy of this string, unless it is already quoted. // Note that trailing and leading whitespace is removed. QCString quoted() const { size_t start=0, sl=m_rep.size(), end=sl-1; while (start<sl && qisspace(m_rep[start])) start++; // skip over leading whitespace if (start==sl) return QCString(); // only whitespace while (end>start && qisspace(m_rep[end])) end--; // skip over trailing whitespace bool needsQuotes=false; size_t i=start; if (i<end && m_rep[i]!='"') // stripped string has at least non-whitespace unquoted character { while (i<end && !needsQuotes) // check if the to be quoted part has at least one whitespace character { needsQuotes = m_rep[i] =='-'; needsQuotes |= qisspace(m_rep[i++]); } } QCString result(m_rep.substr(start,1+end-start)); if (needsQuotes) { result.prepend("\""); result.append("\""); } return result; } /// returns a copy of this string with all whitespace removed QCString removeWhiteSpace() const { size_t sl = m_rep.size(); if (sl==0) return *this; std::string result = m_rep; size_t src=0,dst=0; while (src<sl) { if (!qisspace(m_rep[src])) result[dst++]=m_rep[src]; src++; } if (dst<m_rep.size()) result.resize(dst); return QCString(result); } /// return a copy of this string with leading and trailing whitespace removed and multiple /// whitespace characters replaced by a single space QCString simplifyWhiteSpace() const; // Returns a copy of this string repeated n times QCString repeat(unsigned int n) const { QCString result(n * size(), ExplicitSize); size_t offset = 0; for (offset = 0; offset < n * size(); offset += size()) { memcpy(result.rawData() + offset, data(), size()); } return result; } QCString &insert( size_t index, const QCString &s ) { if (s.length()>0) { size_t ol = m_rep.size(); if (index>ol) // insert beyond end of string and fill gap with spaces { m_rep.resize(index+s.length()); std::memset(&m_rep[ol],' ',index-ol); std::memcpy(&m_rep[index],s.data(),s.length()+1); } else // insert inside the string { m_rep.insert(index,s.str()); } } return *this; } QCString &insert( size_t index, std::string_view s) { if (s.length()>0) { size_t ol = m_rep.size(); if (index>ol) // insert beyond end of string and fill gap with spaces { m_rep.resize(index+s.length()); std::memset(&m_rep[ol],' ',index-ol); std::memcpy(&m_rep[index],s.data(),s.length()+1); } else // insert inside the string { m_rep.insert(index,s); } } return *this; } QCString &insert( size_t index, const char *s ) { size_t len = s ? qstrlen(s) : 0; if (len>0) { size_t ol = m_rep.size(); if (index>ol) // insert beyond end of string and fill gap with spaces { m_rep.resize(index+len); std::memset(&m_rep[ol],' ',index-ol); std::memcpy(&m_rep[index],s,len+1); } else // insert inside the string { m_rep.insert(index,s); } } return *this; } QCString &insert( size_t index, char c) { char s[2] = { c, '\0' }; return insert(index,s); } QCString &append( char c) { m_rep+=c; return *this; } QCString &append( const char *s ) { return operator+=(s); } QCString &append( const QCString &s ) { return operator+=(s); } QCString &append( const std::string &s ) { return operator+=(s); } QCString &append( std::string_view s) { return operator+=(s); } QCString &prepend( const char *s ) { return insert(0,s); } QCString &prepend( const QCString &s ) { return insert(0,s.data()); } QCString &prepend( const std::string &s ) { return insert(0,s.c_str()); } QCString &prepend( std::string_view s) { return insert(0,s); } QCString &remove( size_t index, size_t len ) { size_t ol = m_rep.size(); if (index<ol && len>0) m_rep.erase(index,index+len>=ol ? std::string::npos : len); return *this; } QCString &replace( size_t index, size_t len, const char *s); short toShort( bool *ok=nullptr, int base=10 ) const; uint16_t toUShort( bool *ok=nullptr, int base=10 ) const; int toInt( bool *ok=nullptr, int base=10 ) const; uint32_t toUInt( bool *ok=nullptr, int base=10 ) const; long toLong( bool *ok=nullptr, int base=10 ) const; unsigned long toULong( bool *ok=nullptr, int base=10 ) const; uint64_t toUInt64( bool *ok=nullptr, int base=10 ) const; QCString &setNum(short n) { m_rep = std::to_string(n); return *this; } QCString &setNum(uint16_t n) { m_rep = std::to_string(n); return *this; } QCString &setNum(int n) { m_rep = std::to_string(n); return *this; } QCString &setNum(uint32_t n) { m_rep = std::to_string(n); return *this; } QCString &setNum(long n) { m_rep = std::to_string(n); return *this; } QCString &setNum(long long n) { m_rep = std::to_string(n); return *this; } QCString &setNum(unsigned long long n) { m_rep = std::to_string(n); return *this; } QCString &setNum(unsigned long n) { m_rep = std::to_string(n); return *this; } bool startsWith( const char *s ) const { if (m_rep.empty() || s==nullptr) return s==nullptr; return m_rep.rfind(s,0)==0; // looking "backward" starting and ending at index 0 } bool startsWith( const std::string &s) const { return m_rep.rfind(s,0)==0; // looking "backward" starting and ending at index 0 } bool startsWith( const QCString &s ) const { if (m_rep.empty() || s.isEmpty()) return s.isEmpty(); return m_rep.rfind(s.str(),0)==0; // looking "backward" starting and ending at index 0 } bool endsWith(const char *s) const { if (m_rep.empty() || s==nullptr) return s==nullptr; size_t l = strlen(s); return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s, l)==0; } bool endsWith(const std::string &s) const { size_t l = s.length(); return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s)==0; } bool endsWith(const QCString &s) const { size_t l = s.length(); return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s.str())==0; } #define HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING 0 #if HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING /** Converts the string to a plain C string */ operator const char *() const { return data(); } #endif const std::string &str() const { return m_rep; } QCString &operator+=( const QCString &s) { m_rep+=s.str(); return *this; } QCString &operator+=( const std::string &s) { m_rep+=s; return *this; } QCString &operator+=(std::string_view s) { m_rep+=s; return *this; } /** Appends string \a str to this string and returns a reference to the result. */ QCString &operator+=( const char *s ) { if (s) m_rep+=s; return *this; } #define HAS_CHARACTER_APPEND_OPERATOR 1 #if HAS_CHARACTER_APPEND_OPERATOR /** Appends character \a c to this string and returns a reference to the result. */ QCString &operator+=( char c ) { m_rep+=c; return *this; } #endif /** Returns a reference to the character at index \a i. */ char &at( size_t i) { return m_rep[i]; } const char &at( size_t i) const { return m_rep[i]; } /** Indexing operator. Equivalent to at(). */ char &operator[]( size_t i ) { return m_rep[i]; } const char &operator[]( size_t i ) const { return m_rep[i]; } private: std::string m_rep; }; /***************************************************************************** QCString non-member operators *****************************************************************************/ inline bool operator==( const QCString &s1, const QCString &s2 ) { return s1.str() == s2.str(); } inline bool operator==( const QCString &s1, const char *s2 ) { return qstrcmp(s1.data(),s2) == 0; } inline bool operator==( const char *s1, const QCString &s2 ) { return qstrcmp(s1,s2.data()) == 0; } inline bool operator!=( const QCString &s1, const QCString &s2 ) { return s1.str() != s2.str(); } inline bool operator!=( const QCString &s1, const char *s2 ) { return qstrcmp(s1.data(),s2) != 0; } inline bool operator!=( const char *s1, const QCString &s2 ) { return qstrcmp(s1,s2.data()) != 0; } inline bool operator<( const QCString &s1, const QCString& s2 ) { return qstrcmp(s1.data(),s2.data()) < 0; } inline bool operator<( const QCString &s1, const char *s2 ) { return qstrcmp(s1.data(),s2) < 0; } inline bool operator<( const char *s1, const QCString &s2 ) { return qstrcmp(s1,s2.data()) < 0; } inline bool operator<=( const QCString &s1, const char *s2 ) { return qstrcmp(s1.data(),s2) <= 0; } inline bool operator<=( const char *s1, const QCString &s2 ) { return qstrcmp(s1,s2.data()) <= 0; } inline bool operator>( const QCString &s1, const char *s2 ) { return qstrcmp(s1.data(),s2) > 0; } inline bool operator>( const char *s1, const QCString &s2 ) { return qstrcmp(s1,s2.data()) > 0; } inline bool operator>=( const QCString &s1, const char *s2 ) { return qstrcmp(s1.data(),s2) >= 0; } inline bool operator>=( const char *s1, const QCString &s2 ) { return qstrcmp(s1,s2.data()) >= 0; } inline QCString operator+( const QCString &s1, const QCString &s2 ) { return QCString(s1.str()+s2.str()); } inline QCString operator+( const QCString &s1, const char *s2 ) { QCString tmp(s1); tmp.append(s2); return tmp; } inline QCString operator+( const char *s1, const QCString &s2 ) { QCString tmp(s1); tmp.append(s2); return tmp; } inline const char *qPrint(const char *s) { if (s) return s; else return ""; } inline const char *qPrint(const QCString &s) { if (!s.isEmpty()) return s.data(); else return ""; } inline const char *qPrint(const std::string &s) { return s.c_str(); } inline std::string toStdString(const QCString &s) { return s.str(); } //---- overloads inline int qstrcmp( const QCString &str1, const char *str2 ) { return qstrcmp(str1.data(),str2); } inline int qstrcmp( const char *str1, const QCString &str2 ) { return qstrcmp(str1,str2.data()); } inline int qstrcmp( const QCString &str1, const QCString &str2 ) { return qstrcmp(str1.data(),str2.data()); } inline int qstricmp( const QCString &str1, const char *str2 ) { return qstricmp(str1.data(),str2); } inline int qstricmp( const char *str1, const QCString &str2 ) { return qstricmp(str1,str2.data()); } inline int qstricmp( const QCString &str1, const QCString &str2 ) { return qstricmp(str1.data(),str2.data()); } inline int qstricmp_sort( const QCString &str1, const char *str2 ) { return qstricmp_sort(str1.data(),str2); } inline int qstricmp_sort( const char *str1, const QCString &str2 ) { return qstricmp_sort(str1,str2.data()); } inline int qstricmp_sort( const QCString &str1, const QCString &str2 ) { return qstricmp_sort(str1.data(),str2.data()); } inline int qstrnicmp( const QCString &str1, const char *str2, size_t len ) { return qstrnicmp(str1.data(),str2,len); } inline int qstrnicmp( const char *str1, const QCString &str2, size_t len ) { return qstrnicmp(str1,str2.data(),len); } inline int qstrnicmp( const QCString &str1, const QCString &str2, size_t len ) { return qstrnicmp(str1.data(),str2.data(),len); } // helper functions QCString substitute(const QCString &str,const QCString &find,const QCString &replace); inline QCString substitute(const QCString &str,const char *find,const char *replace) { return substitute(str,QCString(find),QCString(replace)); } QCString substitute(const QCString &s,const QCString &src,const QCString &dst,int skip_seq); inline QCString substitute(const QCString &s,char srcChar,char dstChar) { std::string ss = s.str(); std::replace(ss.begin(),ss.end(),srcChar,dstChar); return QCString(ss); } inline std::ostream& operator<<(std::ostream& os, const QCString& s) { os << s.str(); return os; } #endif // QCSTRING_H
21,371
C++
.h
632
28.97943
109
0.611945
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,573
vhdlcode.h
doxygen_doxygen/src/vhdlcode.h
/****************************************************************************** * * Copyright (C) 1997-2020 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 VHDLCODE_H #define VHDLCODE_H #include "parserintf.h" class FileDef; class MemberDef; void codeFreeVhdlScanner(); class VHDLCodeParser : public CodeParserInterface { public: VHDLCodeParser(); ~VHDLCodeParser() override; NON_COPYABLE(VHDLCodeParser) void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt lang, bool stripCodeComments, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE ) override; void resetCodeParserState() override; private: struct Private; std::unique_ptr<Private> p; }; #endif
1,759
C++
.h
48
28.6875
79
0.626979
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,574
reflist.h
doxygen_doxygen/src/reflist.h
/****************************************************************************** * * Copyright (C) 1997-2020 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 REFLIST_H #define REFLIST_H #include <vector> #include <unordered_map> #include <memory> #include "qcstring.h" #include "linkedmap.h" #include "construct.h" class Definition; class RefList; /** This struct represents an item in the list of references. */ class RefItem { public: RefItem(int id,RefList *list) : m_id(id), m_list(list) {} void setText (const QCString &text) { m_text = text; } void setAnchor(const QCString &anchor) { m_anchor = anchor; } void setPrefix(const QCString &prefix) { m_prefix = prefix; } void setName (const QCString &name) { m_name = name; } void setTitle (const QCString &title) { m_title = title; } void setArgs (const QCString &args) { m_args = args; } void setGroup (const QCString &group) { m_group = group; } void setScope (const Definition *scope) { m_scope = scope; } QCString text() const { return m_text; } QCString anchor() const { return m_anchor; } QCString prefix() const { return m_prefix; } QCString name() const { return m_name; } QCString title() const { return m_title; } QCString args() const { return m_args; } QCString group() const { return m_group; } int id() const { return m_id; } RefList *list() const { return m_list; } const Definition *scope() const { return m_scope; } private: int m_id = 0; //!< unique identifier for this item within its list RefList *m_list; //!< list owning this item QCString m_text; //!< text of the item. QCString m_anchor; //!< anchor in the list QCString m_prefix; //!< type prefix for the name QCString m_name; //!< name of the entity containing the reference QCString m_title; //!< display name of the entity QCString m_args; //!< optional arguments for the entity (if function) QCString m_group; //!< group id used to combine item under a single header const Definition *m_scope = nullptr; //!< scope to use for references. }; /** List of cross-referenced items * * This class represents a list of items that are put * at a certain point in the documentation by some special command * and are collected in a list. The items cross-reference the * documentation and the list. * * Examples are the todo list, the test list and the bug list, * introduced by the \\todo, \\test, and \\bug commands respectively. */ class RefList { public: /*! Create a list of items that are cross referenced with documentation blocks * @param listName String representing the name of the list. * @param pageTitle String representing the title of the list page. * @param secTitle String representing the title of the section. */ RefList(const QCString &listName, const QCString &pageTitle, const QCString &secTitle); bool isEnabled() const; /*! Adds a new item to the list. * @returns A unique id for this item. */ RefItem *add(); /*! Returns an item given it's id that is obtained with addRefItem() * @param itemId item's identifier. * @returns A pointer to the todo item's structure. */ RefItem *find(int itemId); QCString listName() const { return m_listName; } QCString fileName() const { return m_fileName; } QCString pageTitle() const { return m_pageTitle; } QCString sectionTitle() const { return m_secTitle; } void generatePage(); private: int m_id = 0; QCString m_listName; QCString m_fileName; QCString m_pageTitle; QCString m_secTitle; std::vector< std::unique_ptr< RefItem > > m_entries; std::unordered_map< int, RefItem* > m_lookup; }; class RefListManager : public LinkedMap<RefList> { public: static RefListManager &instance() { static RefListManager rlm; return rlm; } private: RefListManager() = default; ~RefListManager() = default; NON_COPYABLE(RefListManager) }; using RefItemVector = std::vector<RefItem*>; #endif
4,777
C++
.h
117
37.059829
91
0.659414
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,575
translator_cn.h
doxygen_doxygen/src/translator_cn.h
/****************************************************************************** * * * * Copyright (C) 1997-2015 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 TRANSLATOR_CN_H #define TRANSLATOR_CN_H /*! If you want insert a space whenever Chinese meets English characters, set CN_SPC to " ", else null. */ #define CN_SPC " " class TranslatorChinese : public Translator { public: /*! Used for identification of the language. The identification * should not be translated. It should be replaced by the name * of the language in English using lower-case characters only * (e.g. "czech", "japanese", "russian", etc.). It should be equal to * the identification used in the language.cpp. */ QCString idLanguage() override { return "chinese"; } /*! 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. */ QCString latexLanguageSupportCommand() override { return "\\usepackage{CJKutf8}\n"; } QCString trISOLang() override { return "zh"; } QCString getLanguageString() override { return "0x804 Chinese (PRC)"; } QCString latexFontenc() override { return ""; } QCString latexDocumentPre() override { return "\\begin{CJK}{UTF8}{gbsn}\n"; } QCString latexDocumentPost() override { return "\\end{CJK}\n"; } bool needsPunctuation() override { return false; } // --- Language translation methods ------------------- /*! used in the compound documentation before a list of related functions. */ QCString trRelatedFunctions() override { return "相关函数"; } /*! subscript for the related functions. */ QCString trRelatedSubscript() override { return "(请注意: 这些不是成员函数.)"; } /*! header that is put before the detailed description of files, * classes and namespaces. */ QCString trDetailedDescription() override { return "详细描述"; } /*! header that is used when the summary tag is missing inside the details tag */ QCString trDetails() override { return "详细信息"; } /*! header that is put before the list of typedefs. */ QCString trMemberTypedefDocumentation() override { return "成员类型定义说明"; } /*! header that is put before the list of enumerations. */ QCString trMemberEnumerationDocumentation() override { return "成员枚举类型说明"; } /*! header that is put before the list of member function. */ QCString trMemberFunctionDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) { return "成员函数/过程/进程说明"; } else { return "成员函数说明"; } } /*! header that is put before the list of member attributes. */ QCString trMemberDataDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "结构体成员变量说明"; } else { return "类成员变量说明"; } } /*! this is the text of a link put after brief descriptions. */ QCString trMore() override { return "更多..."; } /*! put in the class documentation */ QCString trListOfAllMembers() override { return "所有成员列表"; } /*! used as the title of the "list of all members" page of a class */ QCString trMemberList() override { return "成员列表"; } /*! this is the first part of a sentence that is followed by a class name */ QCString trThisIsTheListOfAllMembers() override { return "成员的完整列表,这些成员属于"; } /*! this is the remainder of the sentence after the class name */ QCString trIncludingInheritedMembers() override { return ",包括所有继承而来的类成员"; } /*! this is put at the author sections at the bottom of man pages. * parameter s is name of the project name. */ QCString trGeneratedAutomatically(const QCString &s) override { QCString result; result = "由" CN_SPC "Doyxgen" CN_SPC "通过分析" CN_SPC; if (!s.isEmpty()) result += (s+CN_SPC "的" CN_SPC); result+= "源代码自动生成."; return result; } /*! put after an enum name in the list of all members */ QCString trEnumName() override { return "枚举名称"; } /*! put after an enum value in the list of all members */ QCString trEnumValue() override { return "枚举值"; } /*! put after an undocumented member in the list of all members */ QCString trDefinedIn() override { return "定义于" CN_SPC; } // quick reference sections /*! This is put above each page as a link to the list of all groups of * compounds or files (see the \\group command). */ QCString trModules() override { return "模块"; } /*! This is put above each page as a link to the class hierarchy */ QCString trClassHierarchy() override { return "类继承关系"; } /*! This is put above each page as a link to the list of annotated class */ QCString trCompoundList() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "结构体"; } else { return "类列表"; } } /*! This is put above each page as a link to the list of documented files */ QCString trFileList() override { return "文件列表"; } /*! This is put above each page as a link to all members of compounds. */ QCString trCompoundMembers() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "成员变量"; } else { return "类成员"; } } /*! This is put above each page as a link to all member of files. */ QCString trFileMembers() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "全局定义"; } else { return "文件成员"; } } /*! This is put above each page as a link to all related pages. */ QCString trRelatedPages() override { return "相关页面"; } /*! This is put above each page as a link to all examples. */ QCString trExamples() override { return "示例"; } /*! This is put above each page as a link to the search engine. */ QCString trSearch() override { return "搜索"; } /*! This is an introduction to the class hierarchy. */ QCString trClassHierarchyDescription() override { if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) { return "这里给出了所有实体的层次化列表:"; } else { return "此继承关系列表按字典顺序粗略的排序:" CN_SPC; } } /*! This is an introduction to the list with all files. */ QCString trFileListDescription(bool extractAll) override { QCString result="这里列出了所有"; if (!extractAll) result+="文档化的"; result+="文件,并附带简要说明:"; return result; } /*! This is an introduction to the annotated compound list. */ QCString trCompoundListDescription() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "这里列出了所有结构体,并附带简要说明:"; } else if (Config_getBool(OPTIMIZE_OUTPUT_SLICE)) { return "这里列出了所有类并附带简要说明:"; } else { return "这里列出了所有类、结构、联合以及接口定义等,并附带简要说明:"; } } /*! This is an introduction to the page with all class members. */ QCString trCompoundMembersDescription(bool extractAll) override { QCString result="这里列出了所有"; if (!extractAll) { result+="文档化的"; } if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="结构体和联合体的成员变量"; } else { result+="类成员"; } result+=",并附带"; if (extractAll) { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="结构体或联合的详细说明:"; } else { result+="类的详细说明:"; } } else { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="结构或联合所属的文件:"; } else { result+="类所属的文件:"; } } return result; } /*! This is an introduction to the page with all file members. */ QCString trFileMembersDescription(bool extractAll) override { QCString result="这里列出了所有"; if (!extractAll) result +="文档化的"; if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result +="函数、变量、宏、枚举和类型定义等"; } else { result +="文件成员"; } result+=",并附带"; if (extractAll) result+="其所属的文件:"; else result+="其详细说明:"; return result; } /*! This is an introduction to the page with the list of all examples */ QCString trExamplesDescription() override { return "这里列出了所有示例:"; } /*! This is an introduction to the page with the list of related pages */ QCString trRelatedPagesDescription() override { return "这里列出了所有相关页面:"; } /*! This is an introduction to the page with the list of class/file groups */ QCString trModulesDescription() override { return "这里列出了所有模块:"; } // index titles (the project name is prepended for these) /*! This is used in HTML as the title of index.html. */ QCString trDocumentation(const QCString &projName) override { return (!projName.isEmpty()?projName + " " : "") + "文档"; } /*! This is used in LaTeX as the title of the chapter with the * index of all groups. */ QCString trModuleIndex() override { return "模块索引"; } /*! This is used in LaTeX as the title of the chapter with the * class hierarchy. */ QCString trHierarchicalIndex() override { return "继承关系索引"; } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index. */ QCString trCompoundIndex() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "结构体索引"; } else { return "类索引"; } } /*! This is used in LaTeX as the title of the chapter with the * list of all files. */ QCString trFileIndex() override { return "文件索引"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all groups. */ QCString trModuleDocumentation() override { return "模块说明"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all classes, structs and unions. */ QCString trClassDocumentation() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "结构体说明"; } else if (Config_getBool(OPTIMIZE_OUTPUT_VHDL)) { return trDesignUnitDocumentation(); } else { return "类说明"; } } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all classes, structs and unions. */ QCString trFileDocumentation() override { return "文件说明"; } /*! This is used in LaTeX as the title of the document */ QCString trReferenceManual() override { return "参考手册"; } /*! This is used in the documentation of a file as a header before the * list of defines */ QCString trDefines() override { return "宏定义"; } /*! This is used in the documentation of a file as a header before the * list of typedefs */ QCString trTypedefs() override { return "类型定义"; } /*! This is used in the documentation of a file as a header before the * list of enumerations */ QCString trEnumerations() override { return "枚举"; } /*! This is used in the documentation of a file as a header before the * list of (global) functions */ QCString trFunctions() override { return "函数"; } /*! This is used in the documentation of a file as a header before the * list of (global) variables */ QCString trVariables() override { return "变量"; } /*! This is used in the documentation of a file as a header before the * list of (global) variables */ QCString trEnumerationValues() override { return "枚举值"; } /*! This is used in the documentation of a file before the list of * documentation blocks for defines */ QCString trDefineDocumentation() override { return "宏定义说明"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for typedefs */ QCString trTypedefDocumentation() override { return "类型定义说明"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration types */ QCString trEnumerationTypeDocumentation() override { return "枚举类型说明"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for functions */ QCString trFunctionDocumentation() override { return "函数说明"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for variables */ QCString trVariableDocumentation() override { return "变量说明"; } /*! This is used in the documentation of a file/namespace/group before * the list of links to documented compounds */ QCString trCompounds() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "结构体"; } else { return "类"; } } /*! This is used in the standard footer of each page and indicates when * the page was generated */ QCString trGeneratedAt(const QCString &date,const QCString &projName) override { QCString result="生成于" CN_SPC+date; if (!projName.isEmpty()) result+=CN_SPC ", 为" CN_SPC+projName; result+="使用" CN_SPC; return result; } /*! this text is put before a class diagram */ QCString trClassDiagram(const QCString &clName) override { return "类" CN_SPC+clName+CN_SPC "继承关系图:"; } /*! this text is generated when the \\warning command is used. */ QCString trWarning() override { return "警告"; } /*! this text is generated when the \\version command is used. */ QCString trVersion() override { return "版本"; } /*! this text is generated when the \\date command is used. */ QCString trDate() override { return "日期"; } /*! this text is generated when the \\return command is used. */ QCString trReturns() override { return "返回"; } /*! this text is generated when the \\sa command is used. */ QCString trSeeAlso() override { return "参见"; } /*! this text is generated when the \\param command is used. */ QCString trParameters() override { return "参数"; } /*! this text is generated when the \\exception command is used. */ QCString trExceptions() override { return "异常"; } /*! this text is used in the title page of a LaTeX document. */ QCString trGeneratedBy() override { return "制作者"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990307 ////////////////////////////////////////////////////////////////////////// /*! used as the title of page containing all the index of all namespaces. */ QCString trNamespaceList() override { return "命名空间列表"; } /*! used as an introduction to the namespace list */ QCString trNamespaceListDescription(bool extractAll) override { QCString result="这里列出了所有"; if (!extractAll) result+="文档化的"; result+="命名空间定义,附带简要说明:"; return result; } /*! used in the class documentation as a header before the list of all * friends of a class */ QCString trFriends() override { return "友元"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990405 ////////////////////////////////////////////////////////////////////////// /*! used in the class documentation as a header before the list of all * related classes */ QCString trRelatedFunctionDocumentation() override { return "友元及相关函数文档"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990425 ////////////////////////////////////////////////////////////////////////// /*! used as the title of the HTML page of a class/struct/union */ QCString trCompoundReference(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) override { QCString result=clName; if (isTemplate) result+=CN_SPC "模板"; switch(compType) { case ClassDef::Class: result+="类"; break; case ClassDef::Struct: result+="结构体"; break; case ClassDef::Union: result+="联合体"; break; case ClassDef::Interface: result+="接口"; break; case ClassDef::Protocol: result+="协议"; break; case ClassDef::Category: result+="分类"; break; case ClassDef::Exception: result+="异常"; break; default: break; } result+=CN_SPC "参考"; return result; } /*! used as the title of the HTML page of a file */ QCString trFileReference(const QCString &fileName) override { QCString result=fileName; result+=CN_SPC "文件参考"; return result; } /*! used as the title of the HTML page of a namespace */ QCString trNamespaceReference(const QCString &namespaceName) override { QCString result=namespaceName; result+=CN_SPC "命名空间参考"; return result; } // these are for the member sections of a class, struct or union QCString trPublicMembers() override { return "Public 成员函数"; } QCString trPublicSlots() override { return "Public 槽"; } QCString trSignals() override { return "信号"; } QCString trStaticPublicMembers() override { return "静态 Public 成员函数"; } QCString trProtectedMembers() override { return "Protected 成员函数"; } QCString trProtectedSlots() override { return "Protected 槽"; } QCString trStaticProtectedMembers() override { return "静态 Protected 成员函数"; } QCString trPrivateMembers() override { return "Private 成员函数"; } QCString trPrivateSlots() override { return "Private 槽"; } QCString trStaticPrivateMembers() override { return "静态 Private 成员函数"; } // end of member sections /*! this function is used to produce a comma-separated list of items. * use generateMarker(i) to indicate where item i should be put. */ QCString trWriteList(int numEntries) override { QCString result; // the inherits list contain `numEntries' classes for (int i=0;i<numEntries;i++) { // use generateMarker to generate placeholders for the class links! result+=generateMarker(i); // generate marker for entry i in the list // (order is left to right) if (i!=numEntries-1) // not the last entry, so we need a separator { if (i<numEntries-2) // not the fore last entry result+="," CN_SPC; else // the fore last entry result+=CN_SPC ", 以及" CN_SPC; } } return result; } /*! used in class documentation to produce a list of base classes, * if class diagrams are disabled. */ QCString trInheritsList(int numEntries) override { return "继承自" CN_SPC+trWriteList(numEntries)+CN_SPC "."; } /*! used in class documentation to produce a list of super classes, * if class diagrams are disabled. */ QCString trInheritedByList(int numEntries) override { return "被" CN_SPC+trWriteList(numEntries)+CN_SPC "继承."; } /*! used in member documentation blocks to produce a list of * members that are hidden by this one. */ QCString trReimplementedFromList(int numEntries) override { return "重载" CN_SPC+trWriteList(numEntries)+CN_SPC "."; } /*! used in member documentation blocks to produce a list of * all member that overwrite the implementation of this member. */ QCString trReimplementedInList(int numEntries) override { return "被" CN_SPC+trWriteList(numEntries)+CN_SPC "重载."; } /*! This is put above each page as a link to all members of namespaces. */ QCString trNamespaceMembers() override { return "命名空间成员"; } /*! This is an introduction to the page with all namespace members */ QCString trNamespaceMemberDescription(bool extractAll) override { QCString result="这里列出了所有"; if (!extractAll) result+="文档化的"; result+="命名空间成员,并附带"; if (extractAll) result+="其对应命名空间的说明文档:"; else result+="其所属的命名空间:"; return result; } /*! This is used in LaTeX as the title of the chapter with the * index of all namespaces. */ QCString trNamespaceIndex() override { return "命名空间索引"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all namespaces. */ QCString trNamespaceDocumentation() override { return "命名空间文档"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990522 ////////////////////////////////////////////////////////////////////////// /*! This is used in the documentation before the list of all * namespaces in a file. */ QCString trNamespaces() override { return "命名空间"; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990728 ////////////////////////////////////////////////////////////////////////// /*! This is put at the bottom of a class documentation page and is * followed by a list of files that were used to generate the page. */ QCString trGeneratedFromFiles(ClassDef::CompoundType compType, bool) override { // single is true implies a single file bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); QCString result="该"; switch(compType) { case ClassDef::Class: result+=vhdlOpt?"设计单元":"类"; break; case ClassDef::Struct: result+="结构体"; break; case ClassDef::Union: result+="联合体"; break; case ClassDef::Interface: result+="接口"; break; case ClassDef::Protocol: result+="协议"; break; case ClassDef::Category: result+="分类"; break; case ClassDef::Exception: result+="异常"; break; default: break; } result+="的文档由以下文件生成:"; return result; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-990901 ////////////////////////////////////////////////////////////////////////// /*! This is used as the heading text for the retval command. */ QCString trReturnValues() override { return "返回值"; } /*! This is in the (quick) index as a link to the main page (index.html) */ QCString trMainPage() override { return "首页"; } /*! This is used in references to page that are put in the LaTeX * documentation. It should be an abbreviation of the word page. */ QCString trPageAbbreviation() override { return "p."; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-991106 ////////////////////////////////////////////////////////////////////////// QCString trDefinedAtLineInSourceFile() override { return "在文件" CN_SPC "@1" CN_SPC "第" CN_SPC "@0" CN_SPC "行定义."; } QCString trDefinedInSourceFile() override { return "在文件" CN_SPC "@0" CN_SPC "中定义."; } ////////////////////////////////////////////////////////////////////////// // new since 0.49-991205 ////////////////////////////////////////////////////////////////////////// QCString trDeprecated() override { return "弃用"; } ////////////////////////////////////////////////////////////////////////// // new since 1.0.0 ////////////////////////////////////////////////////////////////////////// /*! this text is put before a collaboration diagram */ QCString trCollaborationDiagram(const QCString &clName) override { return clName+CN_SPC "的协作图:"; } /*! this text is put before an include dependency graph */ QCString trInclDepGraph(const QCString &fName) override { return fName+CN_SPC "的引用(Include)关系图:"; } /*! header that is put before the list of constructor/destructors. */ QCString trConstructorDocumentation() override { return "构造及析构函数说明"; } /*! Used in the file documentation to point to the corresponding sources. */ QCString trGotoSourceCode() override { return "浏览该文件的源代码."; } /*! Used in the file sources to point to the corresponding documentation. */ QCString trGotoDocumentation() override { return "浏览该文件的文档."; } /*! Text for the \\pre command */ QCString trPrecondition() override { return "前置条件"; } /*! Text for the \\post command */ QCString trPostcondition() override { return "后置条件"; } /*! Text for the \\invariant command */ QCString trInvariant() override { return "不变性"; } /*! Text shown before a multi-line variable/enum initialization */ QCString trInitialValue() override { return "初始值:"; } /*! Text used the source code in the file index */ QCString trCode() override { return "代码"; } QCString trGraphicalHierarchy() override { return "类继承关系图"; } QCString trGotoGraphicalHierarchy() override { return "浏览类继承关系图"; } QCString trGotoTextualHierarchy() override { return "浏览类继承关系表"; } QCString trPageIndex() override { return "页面索引"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.0 ////////////////////////////////////////////////////////////////////////// QCString trNote() override { return "注解"; } QCString trPublicTypes() override { return "Public 类型"; } QCString trPublicAttribs() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "成员变量"; } else { return "Public 属性"; } } QCString trStaticPublicAttribs() override { return "静态 Public 属性"; } QCString trProtectedTypes() override { return "Protected 类型"; } QCString trProtectedAttribs() override { return "Protected 属性"; } QCString trStaticProtectedAttribs() override { return "静态 Protected 属性"; } QCString trPrivateTypes() override { return "Private 类型"; } QCString trPrivateAttribs() override { return "Private 属性"; } QCString trStaticPrivateAttribs() override { return "静态 Private 属性"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.3 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a todo item */ QCString trTodo() override { return "待办事项"; } /*! Used as the header of the todo list */ QCString trTodoList() override { return "待办事项列表"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.4 ////////////////////////////////////////////////////////////////////////// QCString trReferencedBy() override { return "被这些函数引用"; } QCString trRemarks() override { return "备注"; } QCString trAttention() override { return "注意"; } QCString trInclByDepGraph() override { return "此图展示该文件被哪些文件直接或间接地引用了:"; } QCString trSince() override { return "自从"; } ////////////////////////////////////////////////////////////////////////// // new since 1.1.5 ////////////////////////////////////////////////////////////////////////// /*! title of the graph legend page */ QCString trLegendTitle() override { return "图例"; } /*! page explaining how the dot graph's should be interpreted * The %A in the text below are to prevent link to classes called "A". */ QCString trLegendDocs() override { return "本页将向您解释如何理解由" CN_SPC "doxygen" CN_SPC "生成的图.<p>\n" "考虑如下例子:\n" "\\code\n" "/*! 由于截断而使" CN_SPC "Invisible" CN_SPC "不可见 */\n" "class Invisible { };\n\n" "/*! Truncated" CN_SPC "的继承关系将被隐藏 */\n" "class Truncated : public Invisible { };\n\n" "/* 没有被" CN_SPC "doxygen" CN_SPC "文档化的类 */\n" "class Undocumented { };\n\n" "/*! public" CN_SPC "继承关系的基类 */\n" "class PublicBase : public Truncated { };\n\n" "/*! 一个模板类 */\n" "template<class T> class Templ { };\n\n" "/*! protected" CN_SPC "继承关系的基类 */\n" "class ProtectedBase { };\n\n" "/*! private" CN_SPC "继承关系的基类 */\n" "class PrivateBase { };\n\n" "/*! 被" CN_SPC "Inherited" CN_SPC "使用的类 */\n" "class Used { };\n\n" "/*! 继承自其它若干类的超级类 */\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" "结果将会生成以下图:" "<p><center><img alt=\"\" src=\"graph_legend."+getDotImageExtension()+"\"></center></p>\n" "<p>\n" "上图中的矩形含义为:\n" "</p>\n" "<ul>\n" "<li>%灰色填充的矩形 表示生成上图的结构体或类.</li>\n" "<li>%黑色边框的矩形 表示已经被文档化的结构体或类.</li>\n" "<li>%灰色边框的矩形 表示未被文档化的结构体或类.</li>\n" "<li>%红色边框的矩形 表示该结构体或类的关系没有被完全显示." "%如果生成的图超出了指定的尺寸范围,有一些关系就会被截断而无法显示.</li>\n" "</ul>\n" "<p>\n" "箭头的含义为:\n" "</p>\n" "<ul>\n" "<li>%蓝色的箭头 表示" CN_SPC "public" CN_SPC "继承关系.</li>\n" "<li>%深绿色的箭头 表示" CN_SPC "protected" CN_SPC "继承关系.</li>\n" "<li>%深红色的箭头 表示" CN_SPC "private" CN_SPC "继承关系.</li>\n" "<li>%紫色虚线箭头 表示两个类之间的聚合关系. 可以通过箭头旁标明的变量访问箭头指向的类或结构体实例.</li>\n" "<li>%黄色虚线箭头 表示模板类实例和模板类之间的关系. 箭头旁边标明了模板类实例化时所用的模板参数.</li>\n" "</ul>\n"; } /*! text for the link to the legend page */ QCString trLegend() override { return "图例"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.0 ////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a test item */ QCString trTest() override { return "测试"; } /*! Used as the header of the test list */ QCString trTestList() override { return "测试列表"; } ////////////////////////////////////////////////////////////////////////// //// new since 1.2.2 //////////////////////////////////////////////////////////////////////////// /*! Used as a section header for IDL properties */ QCString trProperties() override { return "属性"; } /*! Used as a section header for IDL property documentation */ QCString trPropertyDocumentation() override { return "属性说明"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.4 ////////////////////////////////////////////////////////////////////////// /*! Used for Java classes in the summary section of Java packages */ QCString trClasses() override { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { return "结构体"; } else { return "类"; } } /*! Used as the title of a Java package */ QCString trPackage(const QCString &name) override { return "包" CN_SPC+name; } /*! The description of the package index page */ QCString trPackageListDescription() override { return "这里列出所有的包,附带简要说明(如果有的话):"; } /*! The link name in the Quick links header for each page */ QCString trPackages() override { return "包"; } /*! Text shown before a multi-line define */ QCString trDefineValue() override { return "值:"; } //////////////////////////////////////////////////////////////////////////// //// new since 1.2.6 //////////////////////////////////////////////////////////////////////////// /*! Used as a marker that is put before a \\bug item */ QCString trBug () override { return "Bug"; } /*! Used as the header of the bug list */ QCString trBugList () override { return "Bug" CN_SPC "列表"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.6 ////////////////////////////////////////////////////////////////////////// /*! Used as ansicpg for RTF file * * The following table shows the correlation of Charset name, Charset Value and * <pre> * Codepage number: * Charset Name Charset Value(hex) Codepage number * ------------------------------------------------------ * DEFAULT_CHARSET 1 (x01) * SYMBOL_CHARSET 2 (x02) * OEM_CHARSET 255 (xFF) * ANSI_CHARSET 0 (x00) 1252 * RUSSIAN_CHARSET 204 (xCC) 1251 * EE_CHARSET 238 (xEE) 1250 * GREEK_CHARSET 161 (xA1) 1253 * TURKISH_CHARSET 162 (xA2) 1254 * BALTIC_CHARSET 186 (xBA) 1257 * HEBREW_CHARSET 177 (xB1) 1255 * ARABIC _CHARSET 178 (xB2) 1256 * SHIFTJIS_CHARSET 128 (x80) 932 * HANGEUL_CHARSET 129 (x81) 949 * GB2313_CHARSET 134 (x86) 936 * CHINESEBIG5_CHARSET 136 (x88) 950 * </pre> * */ QCString trRTFansicp() override { return "936"; } /*! Used as ansicpg for RTF fcharset * \see trRTFansicp() for a table of possible values. */ QCString trRTFCharSet() override { return "134"; } /*! Used as header RTF general index */ QCString trRTFGeneralIndex() override { return "索引"; } // Following translations (from trClass to trAuthor) are used for languages // having plural / singular form for nouns, but Chinese does not distinguish // plural form from singular form, so the returned value is constant. /*! 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. */ QCString trClass(bool /*first_capital*/, bool /*singular*/) override { return "类"; } /*! 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. */ QCString trFile(bool /*first_capital*/, bool /*singular*/) override { return "文件"; } /*! 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. */ QCString trNamespace(bool /*first_capital*/, bool /*singular*/) override { return "命名空间"; } /*! 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. */ QCString trGroup(bool /*first_capital*/, bool /*singular*/) override { return "组"; } /*! 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. */ QCString trPage(bool /*first_capital*/, bool /*singular*/) override { return "页"; } /*! 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. */ QCString trMember(bool /*first_capital*/, bool /*singular*/) override { return "成员"; } /*! 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. */ QCString trGlobal(bool /*first_capital*/, bool /*singular*/) override { return "全局"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.7 ////////////////////////////////////////////////////////////////////////// /*! This text is generated when the \\author command is used and * for the author section in man pages. */ QCString trAuthor(bool /*first_capital*/, bool /*singular*/) override { return "作者"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.11 ////////////////////////////////////////////////////////////////////////// /*! This text is put before the list of members referenced by a member */ QCString trReferences() override { return "引用了"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.13 ////////////////////////////////////////////////////////////////////////// /*! used in member documentation blocks to produce a list of * members that are implemented by this one. */ QCString trImplementedFromList(int numEntries) override { return "实现了" CN_SPC+trWriteList(numEntries)+"."; } /*! used in member documentation blocks to produce a list of * all members that implement this abstract member. */ QCString trImplementedInList(int numEntries) override { return "在" CN_SPC+trWriteList(numEntries)+CN_SPC "内被实现."; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.16 ////////////////////////////////////////////////////////////////////////// /*! used in RTF documentation as a heading for the Table * of Contents. */ QCString trRTFTableOfContents() override { return "目录"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.17 ////////////////////////////////////////////////////////////////////////// /*! Used as the header of the list of item that have been * flagged deprecated */ QCString trDeprecatedList() override { return "弃用列表"; } ////////////////////////////////////////////////////////////////////////// // new since 1.2.18 ////////////////////////////////////////////////////////////////////////// /*! Used as a header for declaration section of the events found in * a C# program */ QCString trEvents() override { return "事件"; } /*! Header used for the documentation section of a class' events. */ QCString trEventDocumentation() override { return "事件说明"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3 ////////////////////////////////////////////////////////////////////////// /*! Used as a heading for a list of Java class types with package scope. */ QCString trPackageTypes() override { return "包类型"; } /*! Used as a heading for a list of Java class functions with package * scope. */ QCString trPackageFunctions() override { return "包函数"; } QCString trPackageMembers() override { return "包成员"; } /*! Used as a heading for a list of static Java class functions with * package scope. */ QCString trStaticPackageFunctions() override { return "静态包函数"; } /*! Used as a heading for a list of Java class variables with package * scope. */ QCString trPackageAttribs() override { return "包属性"; } /*! Used as a heading for a list of static Java class variables with * package scope. */ QCString trStaticPackageAttribs() override { 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. */ QCString trAll() override { return "全部"; } /*! Put in front of the call graph for a function. */ QCString trCallGraph() override { return "函数调用图:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.3 ////////////////////////////////////////////////////////////////////////// /*! This string is used as the title for the page listing the search * results. */ QCString trSearchResultsTitle() override { return "搜索结果"; } /*! 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. */ QCString trSearchResults(int numDocuments) override { if (numDocuments==0) { return "抱歉,未找到与您查询相符的文档."; } else if (numDocuments==1) { return "找到<b>1</b>篇与您查询相符的文档."; } else { return "找到<b>$num</b>篇与您查询相符的文档." "优先显示最符合的文档."; } } /*! 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. */ QCString trSearchMatches() override { return "符合的结果:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.8 ////////////////////////////////////////////////////////////////////////// /*! This is used in HTML as the title of page with source code for file filename */ QCString trSourceFile(const QCString& filename) override { return filename + CN_SPC "源文件"; } ////////////////////////////////////////////////////////////////////////// // new since 1.3.9 ////////////////////////////////////////////////////////////////////////// /*! This is used as the name of the chapter containing the directory * hierarchy. */ QCString trDirIndex() override { return "目录结构"; } /*! This is used as the name of the chapter containing the documentation * of the directories. */ QCString trDirDocumentation() override { return "目录说明"; } /*! This is used as the title of the directory index and also in the * Quick links of an HTML page, to link to the directory hierarchy. */ QCString trDirectories() override { return "目录"; } /*! This returns the title of a directory page. The name of the * directory is passed via \a dirName. */ QCString trDirReference(const QCString &dirName) override { QCString result=dirName; result+=CN_SPC "目录参考"; return result; } /*! This returns the word directory with or without starting capital * (\a first_capital) and in sigular or plural form (\a singular). */ QCString trDir(bool /*first_capital*/, bool /*singular*/) override { return "目录"; } ////////////////////////////////////////////////////////////////////////// // new since 1.4.1 ////////////////////////////////////////////////////////////////////////// /*! This text is added to the documentation when the \\overload command * is used for a overloaded function. */ QCString trOverloadText() override { return "这是为便于使用而提供的一个重载成员函数." "与上面的函数相比,它接受不同类型的参数."; } ////////////////////////////////////////////////////////////////////////// // new since 1.4.6 ////////////////////////////////////////////////////////////////////////// /*! This is used to introduce a caller (or called-by) graph */ QCString trCallerGraph() override { return "这是这个函数的调用关系图:"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for enumeration values */ QCString trEnumerationValueDocumentation() override { return "枚举变量说明"; } ////////////////////////////////////////////////////////////////////////// // new since 1.5.4 (mainly for Fortran) ////////////////////////////////////////////////////////////////////////// /*! header that is put before the list of member subprograms (Fortran). */ QCString trMemberFunctionDocumentationFortran() override { return "成员函数/子程序说明"; } /*! This is put above each page as a link to the list of annotated data types (Fortran). */ QCString trCompoundListFortran() override { return "数据类型列表"; } /*! This is put above each page as a link to all members of compounds (Fortran). */ QCString trCompoundMembersFortran() override { return "数据项"; } /*! This is an introduction to the annotated compound list (Fortran). */ QCString trCompoundListDescriptionFortran() override { return "带简要描述的数据类型列表:"; } /*! This is an introduction to the page with all data types (Fortran). */ QCString trCompoundMembersDescriptionFortran(bool extractAll) override { QCString result="这里列出了所有"; if (!extractAll) { result+="文档化的"; } result+="数据类型成员,并附带"; if (!extractAll) { result+="其数据结构说明文档:"; } else { result+="其所属的数据类型:"; } return result; } /*! This is used in LaTeX as the title of the chapter with the * annotated compound index (Fortran). */ QCString trCompoundIndexFortran() override { return "数据类型索引"; } /*! This is used in LaTeX as the title of the chapter containing * the documentation of all data types (Fortran). */ QCString trTypeDocumentation() override { return "数据类型文档"; } /*! This is used in the documentation of a file as a header before the * list of (global) subprograms (Fortran). */ QCString trSubprograms() override { return "函数/子程序"; } /*! This is used in the documentation of a file/namespace before the list * of documentation blocks for subprograms (Fortran) */ QCString trSubprogramDocumentation() override { return "函数/子程序说明"; } /*! This is used in the documentation of a file/namespace/group before * the list of links to documented compounds (Fortran) */ QCString trDataTypes() override { return "数据类型"; } /*! used as the title of page containing all the index of all modules (Fortran). */ QCString trModulesList() override { return "模块列表"; } /*! used as an introduction to the modules list (Fortran) */ QCString trModulesListDescription(bool extractAll) override { QCString result="这里列出了所有"; if (!extractAll) result+="文档化的"; result+="模块,并附带简要说明:"; return result; } /*! used as the title of the HTML page of a module/type (Fortran) */ QCString trCompoundReferenceFortran(const QCString &clName, ClassDef::CompoundType compType, bool isTemplate) override { QCString result=clName; switch(compType) { case ClassDef::Class: result+=CN_SPC "模块"; break; case ClassDef::Struct: result+=CN_SPC "类型"; break; case ClassDef::Union: result+=CN_SPC "联合体"; break; case ClassDef::Interface: result+=CN_SPC "接口"; break; case ClassDef::Protocol: result+=CN_SPC "协议"; break; case ClassDef::Category: result+=CN_SPC "目录"; break; case ClassDef::Exception: result+=CN_SPC "异常"; break; default: break; } if (isTemplate) result+="模板" CN_SPC; result+="参考手册"; return result; } /*! used as the title of the HTML page of a module (Fortran) */ QCString trModuleReference(const QCString &namespaceName) override { QCString result=namespaceName; result += CN_SPC "模块参考手册"; return result; } /*! This is put above each page as a link to all members of modules. (Fortran) */ QCString trModulesMembers() override { return "模块成员"; } /*! This is an introduction to the page with all modules members (Fortran) */ QCString trModulesMemberDescription(bool extractAll) override { if(!extractAll) { return "这里是所有文档化的模块成员列表,含有到每个成员所在模块的文档的链接:"; } else { return "这里是模块成员列表,含有到成员所属的模块的链接:"; } } /*! This is used in LaTeX as the title of the chapter with the * index of all modules (Fortran). */ QCString trModulesIndex() override { return "模块索引"; } /*! 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. */ QCString trModule(bool /*first_capital*/, bool /*singular*/) override { return "模块"; } /*! This is put at the bottom of a module documentation page and is * followed by a list of files that were used to generate the page. */ QCString trGeneratedFromFilesFortran(ClassDef::CompoundType compType, bool) override { QCString result="该"; switch(compType) { case ClassDef::Class: result+=CN_SPC "模块"; break; case ClassDef::Struct: result+=CN_SPC "结构体"; break; case ClassDef::Union: result+=CN_SPC "联合体"; break; case ClassDef::Interface: result+=CN_SPC "接口"; break; case ClassDef::Protocol: result+=CN_SPC "协议"; break; case ClassDef::Category: result+=CN_SPC "目录"; break; case ClassDef::Exception: result+=CN_SPC "异常"; break; default: break; } result+=CN_SPC "的文档由以下文件生成:"; 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. */ QCString trType(bool /*first_capital*/, bool /*singular*/) override { return "类型"; } /*! 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. */ QCString trSubprogram(bool /*first_capital*/, bool /*singular*/) override { return "子程序"; } /*! C# Type Constraint list */ QCString trTypeConstraints() override { return "类型限制"; } ////////////////////////////////////////////////////////////////////////// // new since 1.6.0 ////////////////////////////////////////////////////////////////////////// /*! directory relation for \a name */ QCString trDirRelation(const QCString &name) override { // return QCString(name)+" Relation"; // unsure return QCString(name)+CN_SPC "关系"; } /*! Loading message shown when loading search results */ QCString trLoading() override { return "载入中..."; } /*! Label used for search results in the global namespace */ QCString trGlobalNamespace() override { return "全局命名空间"; } /*! Message shown while searching */ QCString trSearching() override { return "搜索中..."; } /*! Text shown when no search results are found */ QCString trNoMatches() override { return "未找到"; } ////////////////////////////////////////////////////////////////////////// // new since 1.6.3 ////////////////////////////////////////////////////////////////////////// /*! when clicking a directory dependency label, a page with a * table is shown. The heading for the first column mentions the * source file that has a relation to another file. */ QCString trFileIn(const QCString &name) override { return QCString("文件在")+CN_SPC+name; } /*! when clicking a directory dependency label, a page with a * table is shown. The heading for the second column mentions the * destination file that is included. */ QCString trIncludesFileIn(const QCString &name) override { return "在" CN_SPC+name+CN_SPC "中引用"; } /** Compiles a date string. * @param year Year in 4 digits * @param month Month of the year: 1=January * @param day Day of the Month: 1..31 * @param dayOfWeek Day of the week: 1=Monday..7=Sunday * @param hour Hour of the day: 0..23 * @param minutes Minutes in the hour: 0..59 * @param seconds Seconds within the minute: 0..59 * @param includeTime Include time in the result string? */ QCString trDateTime(int year,int month,int day,int dayOfWeek, int hour,int minutes,int seconds, DateTimeType includeTime) override { static const char *days[] = { "一","二","三","四","五","六","日" }; static const char *months[] = { "一","二","三","四","五","六","七","八","九","十","十一","十二" }; QCString sdate; if (includeTime == DateTimeType::DateTime || includeTime == DateTimeType::Date) { sdate.sprintf("%d年" CN_SPC "%s月" CN_SPC "%d日" CN_SPC "星期%s",year, months[month-1], day, days[dayOfWeek-1]); } if (includeTime == DateTimeType::DateTime) sdate += " "; if (includeTime == DateTimeType::DateTime || includeTime == DateTimeType::Time) { QCString stime; stime.sprintf("%.2d:%.2d:%.2d",hour,minutes,seconds); sdate+=stime; } return sdate; } QCString trDayOfWeek(int dayOfWeek, bool, bool full) override { static const char *days_short[] = { "周一", "周二", "周三", "周四", "周五", "周六", "周日" }; static const char *days_full[] = { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" }; return full? days_full[dayOfWeek-1] : days_short[dayOfWeek-1]; } QCString trMonth(int month, bool, bool full) override { static const char *months_short[] = { "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" }; static const char *months_full[] = { "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" }; return full? months_full[month-1] : months_short[month-1]; } QCString trDayPeriod(bool period) override { static const char *dayPeriod[] = { "上午", "下午" }; return dayPeriod[period?1:0]; } ////////////////////////////////////////////////////////////////////////// // new since 1.7.5 ////////////////////////////////////////////////////////////////////////// /*! Header for the page with bibliographic citations */ QCString trCiteReferences() override { return "参考文献"; } /*! Text for copyright paragraph */ QCString trCopyright() override { return "版权所有"; } /*! Header for the graph showing the directory dependencies */ QCString trDirDepGraph(const QCString &name) override { return QCString(name)+CN_SPC "的目录依赖关系图"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.0 ////////////////////////////////////////////////////////////////////////// /*! Detail level selector shown for hierarchical indices */ QCString trDetailLevel() override { return "详情级别"; } /*! Section header for list of template parameters */ QCString trTemplateParameters() override { return "模板参数"; } /*! Used in dot graph when UML_LOOK is enabled and there are many fields */ QCString trAndMore(const QCString &number) override { return "和" CN_SPC+number+CN_SPC "更多..."; } /*! Used file list for a Java enum */ QCString trEnumGeneratedFromFiles(bool /*single*/) override { return "枚举说明文档从下列文件生成:"; } /*! Header of a Java enum page (Java enums are represented as classes). */ QCString trEnumReference(const QCString &name) override { return QCString(name)+CN_SPC "枚举类型参考"; } /*! Used for a section containing inherited members */ QCString trInheritedFrom(const QCString &members,const QCString &what) override { return QCString(members)+CN_SPC "继承自" CN_SPC+what; } /*! Header of the sections with inherited members specific for the * base class(es) */ QCString trAdditionalInheritedMembers() override { return "额外继承的成员函数"; } ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // new since 1.8.2 ////////////////////////////////////////////////////////////////////////// /*! Used as a tooltip for the toggle button that appears in the * navigation tree in the HTML output when GENERATE_TREEVIEW is * enabled. This tooltip explains the meaning of the button. */ QCString trPanelSynchronisationTooltip(bool enable) override { QCString opt = enable ? "开启" : "关闭"; return "点击" CN_SPC+opt+CN_SPC "面板同步"; } /*! Used in a method of an Objective-C class that is declared in a * a category. Note that the @1 marker is required and is replaced * by a link. */ QCString trProvidedByCategory() override { return "由 category @0 提供."; } /*! Used in a method of an Objective-C category that extends a class. * Note that the @1 marker is required and is replaced by a link to * the class method. */ QCString trExtendsClass() override { return "扩展类 @0."; } /*! Used as the header of a list of class methods in Objective-C. * These are similar to static public member functions in C++. */ QCString trClassMethods() override { return "类方法"; } /*! Used as the header of a list of instance methods in Objective-C. * These are similar to public member functions in C++. */ QCString trInstanceMethods() override { return "实例方法"; } /*! Used as the header of the member functions of an Objective-C class. */ QCString trMethodDocumentation() override { return "成员函数文档"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.4 ////////////////////////////////////////////////////////////////////////// /** old style UNO IDL services: implemented interfaces */ QCString trInterfaces() override { return "导出的接口"; } /** old style UNO IDL services: inherited services */ QCString trServices() override { return "包含的服务"; } /** UNO IDL constant groups */ QCString trConstantGroups() override { return "常量组"; } /** UNO IDL constant groups */ QCString trConstantGroupReference(const QCString &namespaceName) override { QCString result=namespaceName; result+= CN_SPC "常量组参考"; return result; } /** UNO IDL service page title */ QCString trServiceReference(const QCString &sName) override { QCString result=sName; result+= CN_SPC "服务参考"; return result; } /** UNO IDL singleton page title */ QCString trSingletonReference(const QCString &sName) override { QCString result=sName; result+= CN_SPC "单例参考"; return result; } /** UNO IDL service page */ QCString trServiceGeneratedFromFiles(bool /* single */) override { // single is true implies a single file return "该服务的文档由下列文件生成:"; } /** UNO IDL singleton page */ QCString trSingletonGeneratedFromFiles(bool /* single */) override { // single is true implies a single file return "该单例的文档由下列文件生成:"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.15 ////////////////////////////////////////////////////////////////////////// /** VHDL design unit hierarchy */ QCString trDesignUnitHierarchy() override { return "设计单元层次结构"; } /** VHDL design unit list */ QCString trDesignUnitList() override { return "设计单元列表"; } /** VHDL design unit members */ QCString trDesignUnitMembers() override { return "设计单元成员"; } /** VHDL design unit list description */ QCString trDesignUnitListDescription() override { return "这是所有设计单元成员的列表,以及指向他们所属实体的链接:"; } /** VHDL design unit index */ QCString trDesignUnitIndex() override { return "设计单元索引"; } /** VHDL design units */ QCString trDesignUnits() override { return "设计单元"; } /** VHDL functions/procedures/processes */ QCString trFunctionAndProc() override { return "函数/调用过程/进程语句"; } /** VHDL type */ QCString trVhdlType(VhdlSpecifier type,bool /*single*/) override { switch(type) { case VhdlSpecifier::LIBRARY: return "库"; case VhdlSpecifier::PACKAGE: return "包"; case VhdlSpecifier::SIGNAL: return "信号"; case VhdlSpecifier::COMPONENT: return "元件"; case VhdlSpecifier::CONSTANT: return "常量"; case VhdlSpecifier::ENTITY: return "实体"; case VhdlSpecifier::TYPE: return "类型"; case VhdlSpecifier::SUBTYPE: return "子类型"; case VhdlSpecifier::FUNCTION: return "函数"; case VhdlSpecifier::RECORD: return "记录"; case VhdlSpecifier::PROCEDURE: return "过程"; case VhdlSpecifier::ARCHITECTURE: return "结构体"; case VhdlSpecifier::ATTRIBUTE: return "属性"; case VhdlSpecifier::PROCESS: return "进程语句"; case VhdlSpecifier::PORT: return "端口"; case VhdlSpecifier::USE: return "使用语句"; case VhdlSpecifier::GENERIC: return "类属"; case VhdlSpecifier::PACKAGE_BODY: return "包体"; case VhdlSpecifier::UNITS: return "单元"; case VhdlSpecifier::SHAREDVARIABLE: return "共享变量"; case VhdlSpecifier::VFILE: return "文件"; case VhdlSpecifier::GROUP: return "组"; case VhdlSpecifier::INSTANTIATION: return "实例化"; case VhdlSpecifier::ALIAS: return "别名"; case VhdlSpecifier::CONFIG: return " 配置"; case VhdlSpecifier::MISCELLANEOUS: return "混合运算"; case VhdlSpecifier::UCF_CONST: return "约束"; default: return "类"; } } QCString trCustomReference(const QCString &name) override { return QCString(name)+" 引用"; } /* Slice */ QCString trConstants() override { return "常量"; } QCString trConstantDocumentation() override { return "常量文档"; } QCString trSequences() override { return "序列"; } QCString trSequenceDocumentation() override { return "序列文档"; } QCString trDictionaries() override { return "字典"; } QCString trDictionaryDocumentation() override { return "字典文档"; } QCString trSliceInterfaces() override { return "接口"; } QCString trInterfaceIndex() override { return "接口索引"; } QCString trInterfaceList() override { return "接口列表"; } QCString trInterfaceListDescription() override { return "以下是带有简要说明的接口:"; } QCString trInterfaceHierarchy() override { return "接口层次结构"; } QCString trInterfaceHierarchyDescription() override { return "此继承列表大致按字母顺序排序:"; } QCString trInterfaceDocumentation() override { return "接口文档"; } QCString trStructs() override { return "结构"; } QCString trStructIndex() override { return "结构索引"; } QCString trStructList() override { return "结构列表"; } QCString trStructListDescription() override { return "以下是带有简要说明的结构:"; } QCString trStructDocumentation() override { return "结构文档"; } QCString trExceptionIndex() override { return "异常索引"; } QCString trExceptionList() override { return "异常列表"; } QCString trExceptionListDescription() override { return "以下是带有简要说明的异常:"; } QCString trExceptionHierarchy() override { return "异常层次结构"; } QCString trExceptionHierarchyDescription() override { return "此继承列表大致按字母顺序排序:"; } QCString trExceptionDocumentation() override { return "异常文档"; } QCString trCompoundReferenceSlice(const QCString &clName, ClassDef::CompoundType compType, bool isLocal) override { QCString result=clName; if (isLocal) result+=CN_SPC "局部"; switch(compType) { case ClassDef::Class: result+=CN_SPC "类"; break; case ClassDef::Struct: result+=CN_SPC "结构"; break; case ClassDef::Union: result+=CN_SPC "联合"; break; case ClassDef::Interface: result+=CN_SPC "接口"; break; case ClassDef::Protocol: result+=CN_SPC "协议"; break; case ClassDef::Category: result+=CN_SPC "类别"; break; case ClassDef::Exception: result+=CN_SPC "异常"; break; default: break; } result+="引用"; return result; } QCString trOperations() override { return "操作"; } QCString trOperationDocumentation() override { return "操作文档"; } QCString trDataMembers() override { return "数据成员"; } QCString trDataMemberDocumentation() override { return "数据成员文档"; } ////////////////////////////////////////////////////////////////////////// // new since 1.8.19 ////////////////////////////////////////////////////////////////////////// /** VHDL design unit documentation */ QCString trDesignUnitDocumentation() override { return "设计单元文档"; } ////////////////////////////////////////////////////////////////////////// // new since 1.9.2 ////////////////////////////////////////////////////////////////////////// /** C++20 concept */ QCString trConcept(bool /* first_capital */, bool /* singular */) override { return "概念"; } /*! used as the title of the HTML page of a C++20 concept page */ QCString trConceptReference(const QCString &conceptName) override { QCString result=conceptName; result+=CN_SPC "概念参考"; return result; } /*! used as the title of page containing all the index of all concepts. */ QCString trConceptList() override { return "概念列表"; } /*! used as the title of chapter containing the index listing all concepts. */ QCString trConceptIndex() override { return "概念索引"; } /*! used as the title of chapter containing all information about concepts. */ QCString trConceptDocumentation() override { return "概念文档"; } /*! used as an introduction to the concept list */ QCString trConceptListDescription(bool extractAll) override { QCString result="这里是所有"; if (!extractAll) result+="文档化的"; result+="概念, 并附有简要说明:"; return result; } /*! used to introduce the definition of the C++20 concept */ QCString trConceptDefinition() override { return "概念定义"; } ////////////////////////////////////////////////////////////////////////// // new since 1.9.4 ////////////////////////////////////////////////////////////////////////// QCString trPackageList() override { return "包列表"; } ////////////////////////////////////////////////////////////////////////// // new since 1.9.6 ////////////////////////////////////////////////////////////////////////// /*! This is used for translation of the word that will be * followed by a single name of the VHDL process flowchart. */ QCString trFlowchart() override { return "流程图:"; } /*! Please translate also updated body of the method * trMemberFunctionDocumentation(), now better adapted for * VHDL sources documentation. */ ////////////////////////////////////////////////////////////////////////// // new since 1.9.7 ////////////////////////////////////////////////////////////////////////// /*! used in the compound documentation before a list of related symbols. * * Supersedes trRelatedFunctions */ QCString trRelatedSymbols() override { return "相关符号"; } /*! subscript for the related symbols * * Supersedes trRelatedSubscript */ QCString trRelatedSymbolsSubscript() override { return "(注意: 这些不是成员符号.)"; } /*! used in the class documentation as a header before the list of all * related classes. * * Supersedes trRelatedFunctionDocumentation */ QCString trRelatedSymbolDocumentation() override { return "友元及相关符号说明"; } /*! the compound type as used for the xrefitems */ QCString trCompoundType(ClassDef::CompoundType compType, SrcLangExt lang) override { QCString result; switch(compType) { case ClassDef::Class: if (lang == SrcLangExt::Fortran) trType(true,true); else result=trClass(true,true); break; case ClassDef::Struct: result="结构体"; break; case ClassDef::Union: result="联合体"; break; case ClassDef::Interface: result="接口"; break; case ClassDef::Protocol: result="协议"; break; case ClassDef::Category: result="分类"; break; case ClassDef::Exception: result="异常"; break; case ClassDef::Service: result="服务"; break; case ClassDef::Singleton: result="单例"; break; default: break; } return result; } QCString trFileMembersDescriptionTotal(FileMemberHighlight::Enum hl) override { bool extractAll = Config_getBool(EXTRACT_ALL); QCString result="这里是所有"; if (!extractAll) result+="文档化的"; switch (hl) { case FileMemberHighlight::All: if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="函数、变量、定义、枚举和类型定义"; } else { result+="文件成员"; } break; case FileMemberHighlight::Functions: result+="函数"; break; case FileMemberHighlight::Variables: result+="变量"; break; case FileMemberHighlight::Typedefs: result+="类型定义"; break; case FileMemberHighlight::Sequences: result+="序列"; break; case FileMemberHighlight::Dictionaries: result+="字典"; break; case FileMemberHighlight::Enums: result+="枚举"; break; case FileMemberHighlight::EnumValues: result+="枚举值"; break; case FileMemberHighlight::Defines: result+="宏"; break; case FileMemberHighlight::Total: // for completeness break; } result+=", 及指向"; if (extractAll) result+="其所属文件"; else result+="其文档"; result+="的链接:" CN_SPC; return result; } QCString trCompoundMembersDescriptionTotal(ClassMemberHighlight::Enum hl) override { bool extractAll = Config_getBool(EXTRACT_ALL); QCString result="这里是所有"; if (!extractAll) { result+="文档化的"; } switch (hl) { case ClassMemberHighlight::All: if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="结构体及联合体成员"; } else { result+="类成员"; } break; case ClassMemberHighlight::Functions: result+="函数"; break; case ClassMemberHighlight::Variables: result+="变量"; break; case ClassMemberHighlight::Typedefs: result+="类型定义"; break; case ClassMemberHighlight::Enums: result+="枚举"; break; case ClassMemberHighlight::EnumValues: result+="枚举值"; break; case ClassMemberHighlight::Properties: result+="属性"; break; case ClassMemberHighlight::Events: result+="事件"; break; case ClassMemberHighlight::Related: result+="相关符号"; break; case ClassMemberHighlight::Total: // for completeness break; } result+=", 及指向"; if (!extractAll) { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="结构体 (或联合体) 中所有成员文档"; } else { result+="类中所有成员文档"; } } else { if (Config_getBool(OPTIMIZE_OUTPUT_FOR_C)) { result+="其所属结构体 (或联合体)"; } else { result+="其所属类"; } } result+="的链接:" CN_SPC; return result; } QCString trNamespaceMembersDescriptionTotal(NamespaceMemberHighlight::Enum hl) override { bool extractAll = Config_getBool(EXTRACT_ALL); QCString result="这里是所有"; if (!extractAll) result+="文档化的"; result+="命名空间"; QCString singularResult = ""; switch (hl) { case NamespaceMemberHighlight::All: singularResult="成员"; break; case NamespaceMemberHighlight::Functions: singularResult="函数"; break; case NamespaceMemberHighlight::Variables: singularResult="变量"; break; case NamespaceMemberHighlight::Typedefs: singularResult="类型定义"; break; case NamespaceMemberHighlight::Sequences: singularResult="序列"; break; case NamespaceMemberHighlight::Dictionaries: singularResult="字典"; break; case NamespaceMemberHighlight::Enums: singularResult="枚举"; break; case NamespaceMemberHighlight::EnumValues: singularResult="枚举值"; break; case NamespaceMemberHighlight::Total: // for completeness break; } result+=singularResult; result+=", 及指向"; if (extractAll) result+="每个" + singularResult + "所属命名空间文档"; else result+="其所属命名空间"; result+="的链接:" CN_SPC; return result; } QCString trDefinition() override { return "定义";} QCString trDeclaration() override { return "声明";} ////////////////////////////////////////////////////////////////////////// // new since 1.9.8 ////////////////////////////////////////////////////////////////////////// QCString trTopics() override { return "专题"; } QCString trTopicDocumentation() override { return "专题文档"; } QCString trTopicList() override { return "专题列表"; } QCString trTopicIndex() override { return "专题索引"; } QCString trTopicListDescription() override { return "这里是所有专题及其简介:"; } QCString trModuleMembersDescriptionTotal(ModuleMemberHighlight::Enum hl) override { bool extractAll = Config_getBool(EXTRACT_ALL); QCString result="这里是所有"; if (!extractAll) result+="文档化的"; result+="模块"; QCString singularResult = ""; switch (hl) { case ModuleMemberHighlight::All: singularResult="成员"; break; case ModuleMemberHighlight::Functions: singularResult="函数"; break; case ModuleMemberHighlight::Variables: singularResult="变量"; break; case ModuleMemberHighlight::Typedefs: singularResult="类型定义"; break; case ModuleMemberHighlight::Enums: singularResult="枚举"; break; case ModuleMemberHighlight::EnumValues: singularResult="枚举值"; break; case ModuleMemberHighlight::Total: // for completeness break; } result+=singularResult; result+=", 及指向"; if (extractAll) result+="每个" + singularResult + "的模块文档"; else result+="其所属模块"; result+="的链接:" CN_SPC; return result; } QCString trExportedModules() override { return "导出的模块"; } ////////////////////////////////////////////////////////////////////////// // new since 1.10.0 ////////////////////////////////////////////////////////////////////////// QCString trCopyToClipboard() override { return "复制到剪贴板"; } ////////////////////////////////////////////////////////////////////////// // new since 1.11.0 ////////////////////////////////////////////////////////////////////////// QCString trImportant() override { return "重要事项"; } }; #endif
83,086
C++
.h
2,307
27.416558
120
0.560868
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
28,576
printdocvisitor.h
doxygen_doxygen/src/printdocvisitor.h
/****************************************************************************** * * * * * Copyright (C) 1997-2015 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 PRINTDOCVISITOR_H #define PRINTDOCVISITOR_H #include "htmlentity.h" #include "emoji.h" #include "message.h" /*! Visitor implementation for pretty printing */ class PrintDocVisitor { public: PrintDocVisitor() : m_indent(0), m_needsEnter(FALSE), m_insidePre(FALSE) {} //-------------------------------------- void operator()(const DocWord &w) { indent_leaf(); printf("%s",qPrint(w.word())); } void operator()(const DocLinkedWord &w) { indent_leaf(); printf("%s",qPrint(w.word())); } void operator()(const DocWhiteSpace &w) { indent_leaf(); if (m_insidePre) { printf("%s",qPrint(w.chars())); } else { printf(" "); } } void operator()(const DocSymbol &s) { indent_leaf(); const char *res = HtmlEntityMapper::instance().utf8(s.symbol(),TRUE); if (res) { printf("%s",res); } else { printf("print: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance().html(s.symbol(),TRUE)); } } void operator()(const DocEmoji &s) { indent_leaf(); const char *res = EmojiEntityMapper::instance().name(s.index()); if (res) { printf("%s",res); } else { printf("print: non supported emoji found: %s\n",qPrint(s.name())); } } void operator()(const DocURL &u) { indent_leaf(); printf("%s",qPrint(u.url())); } void operator()(const DocLineBreak &) { indent_leaf(); printf("<br/>"); } void operator()(const DocHorRuler &) { indent_leaf(); printf("<hr>"); } void operator()(const DocStyleChange &s) { indent_leaf(); switch (s.style()) { case DocStyleChange::Bold: if (s.enable()) printf("<bold>"); else printf("</bold>"); break; case DocStyleChange::S: if (s.enable()) printf("<s>"); else printf("</s>"); break; case DocStyleChange::Strike: if (s.enable()) printf("<strike>"); else printf("</strike>"); break; case DocStyleChange::Del: if (s.enable()) printf("<del>"); else printf("</del>"); break; case DocStyleChange::Underline: if (s.enable()) printf("<underline>"); else printf("</underline>"); break; case DocStyleChange::Ins: if (s.enable()) printf("<ins>"); else printf("</ins>"); break; case DocStyleChange::Italic: if (s.enable()) printf("<italic>"); else printf("</italic>"); break; case DocStyleChange::Kbd: if (s.enable()) printf("<kbd>"); else printf("</kbd>"); break; case DocStyleChange::Code: if (s.enable()) printf("<code>"); else printf("</code>"); break; case DocStyleChange::Subscript: if (s.enable()) printf("<sub>"); else printf("</sub>"); break; case DocStyleChange::Superscript: if (s.enable()) printf("<sup>"); else printf("</sup>"); break; case DocStyleChange::Center: if (s.enable()) printf("<center>"); else printf("</center>"); break; case DocStyleChange::Small: if (s.enable()) printf("<small>"); else printf("</small>"); break; case DocStyleChange::Cite: if (s.enable()) printf("<cite>"); else printf("</cite>"); break; case DocStyleChange::Preformatted: if (s.enable()) printf("<pre>"); else printf("</pre>"); break; case DocStyleChange::Div: if (s.enable()) printf("<div>"); else printf("</div>"); break; case DocStyleChange::Span: if (s.enable()) printf("<span>"); else printf("</span>"); break; } } void operator()(const DocVerbatim &s) { indent_leaf(); switch(s.type()) { case DocVerbatim::Code: printf("<code>"); break; case DocVerbatim::Verbatim: printf("<verbatim>"); break; case DocVerbatim::JavaDocLiteral: printf("<javadocliteral>"); break; case DocVerbatim::JavaDocCode: printf("<javadoccode>"); break; case DocVerbatim::HtmlOnly: printf("<htmlonly>"); break; case DocVerbatim::RtfOnly: printf("<rtfonly>"); break; case DocVerbatim::ManOnly: printf("<manonly>"); break; case DocVerbatim::LatexOnly: printf("<latexonly>"); break; case DocVerbatim::XmlOnly: printf("<xmlonly>"); break; case DocVerbatim::DocbookOnly: printf("<docbookonly>"); break; case DocVerbatim::Dot: printf("<dot>"); break; case DocVerbatim::Msc: printf("<msc>"); break; case DocVerbatim::PlantUML: printf("<plantuml>"); break; } printf("%s",qPrint(s.text())); switch(s.type()) { case DocVerbatim::Code: printf("</code>"); break; case DocVerbatim::Verbatim: printf("</verbatim>"); break; case DocVerbatim::JavaDocLiteral: printf("</javadocliteral>"); break; case DocVerbatim::JavaDocCode: printf("</javadoccode>"); break; case DocVerbatim::HtmlOnly: printf("</htmlonly>"); break; case DocVerbatim::RtfOnly: printf("</rtfonly>"); break; case DocVerbatim::ManOnly: printf("</manonly>"); break; case DocVerbatim::LatexOnly: printf("</latexonly>"); break; case DocVerbatim::XmlOnly: printf("</xmlonly>"); break; case DocVerbatim::DocbookOnly: printf("</docbookonly>"); break; case DocVerbatim::Dot: printf("</dot>"); break; case DocVerbatim::Msc: printf("</msc>"); break; case DocVerbatim::PlantUML: printf("</plantuml>"); break; } } void operator()(const DocAnchor &a) { indent_leaf(); printf("<anchor name=\"%s\"/>",qPrint(a.anchor())); } void operator()(const DocInclude &inc) { indent_leaf(); printf("<include file=\"%s\" type=\"",qPrint(inc.file())); switch(inc.type()) { case DocInclude::Include: printf("include"); break; case DocInclude::IncWithLines: printf("incwithlines"); break; case DocInclude::DontInclude: printf("dontinclude"); break; case DocInclude::DontIncWithLines: printf("dontinwithlines"); break; case DocInclude::HtmlInclude: printf("htmlinclude"); if (inc.isBlock()) printf(" block=\"yes\""); break; case DocInclude::LatexInclude: printf("latexinclude"); break; case DocInclude::RtfInclude: printf("rtfinclude"); break; case DocInclude::DocbookInclude: printf("docbookinclude"); break; case DocInclude::ManInclude: printf("maninclude"); break; case DocInclude::XmlInclude: printf("xmlinclude"); break; case DocInclude::VerbInclude: printf("verbinclude"); break; case DocInclude::Snippet: printf("snippet"); break; case DocInclude::SnippetWithLines: printf("snipwithlines"); break; } printf("\"/>"); } void operator()(const DocIncOperator &op) { indent_leaf(); printf("<incoperator pattern=\"%s\" type=\"",qPrint(op.pattern())); switch(op.type()) { case DocIncOperator::Line: printf("line"); break; case DocIncOperator::Skip: printf("skip"); break; case DocIncOperator::SkipLine: printf("skipline"); break; case DocIncOperator::Until: printf("until"); break; } printf("\"/>"); } void operator()(const DocFormula &f) { indent_leaf(); printf("<formula name=%s text=%s/>",qPrint(f.name()),qPrint(f.text())); } void operator()(const DocIndexEntry &i) { indent_leaf(); printf("<indexentry>%s</indexentry\n",qPrint(i.entry())); } void operator()(const DocSimpleSectSep &) { indent_leaf(); printf("<simplesectsep/>"); } void operator()(const DocCite &cite) { indent_leaf(); printf("<cite ref=\"%s\" file=\"%s\" " "anchor=\"%s\" text=\"%s\"" "/>\n", qPrint(cite.ref()),qPrint(cite.file()),qPrint(cite.anchor()), qPrint(cite.text())); } void operator()(const DocSeparator &) { indent_leaf(); printf("<sep/>"); } //-------------------------------------- template<class T> void visitChildren(const T &t) { for (const auto &child : t.children()) { std::visit(*this, child); } } void operator()(const DocAutoList &l) { indent_pre(); if (l.isEnumList()) { printf("<ol>\n"); } else { printf("<ul>\n"); } visitChildren(l); indent_post(); if (l.isEnumList()) { printf("</ol>\n"); } else { printf("</ul>\n"); } } void operator()(const DocAutoListItem &li) { indent_pre(); switch (li.itemNumber()) { case DocAutoList::Unchecked: // unchecked printf("<li class=\"unchecked\">\n"); break; case DocAutoList::Checked_x: // checked with x case DocAutoList::Checked_X: // checked with X printf("<li class=\"checked\">\n"); break; default: printf("<li>\n"); break; } visitChildren(li); indent_post(); printf("</li>\n"); } void operator()(const DocPara &p) { indent_pre(); printf("<para>\n"); visitChildren(p); indent_post(); printf("</para>\n"); } void operator()(const DocRoot &r) { indent_pre(); printf("<root>\n"); visitChildren(r); indent_post(); printf("</root>\n"); } void operator()(const DocSimpleSect &s) { indent_pre(); printf("<simplesect type="); switch(s.type()) { case DocSimpleSect::See: printf("see"); break; case DocSimpleSect::Return: printf("return"); break; case DocSimpleSect::Author: printf("author"); break; case DocSimpleSect::Authors: printf("authors"); break; case DocSimpleSect::Version: printf("version"); break; case DocSimpleSect::Since: printf("since"); break; case DocSimpleSect::Date: printf("date"); break; case DocSimpleSect::Note: printf("note"); break; case DocSimpleSect::Warning: printf("warning"); break; case DocSimpleSect::Pre: printf("pre"); break; case DocSimpleSect::Post: printf("post"); break; case DocSimpleSect::Copyright: printf("copyright"); break; case DocSimpleSect::Invar: printf("invar"); break; case DocSimpleSect::Remark: printf("remark"); break; case DocSimpleSect::Attention: printf("attention"); break; case DocSimpleSect::Important: printf("important"); break; case DocSimpleSect::User: printf("user"); break; case DocSimpleSect::Rcs: printf("rcs"); break; case DocSimpleSect::Unknown: printf("unknown"); break; } printf(">\n"); if (s.title()) { std::visit(*this, *s.title()); } visitChildren(s); indent_post(); printf("</simplesect>\n"); } void operator()(const DocTitle &t) { indent_pre(); printf("<title>\n"); visitChildren(t); indent_post(); printf("</title>\n"); } void operator()(const DocSimpleList &l) { indent_pre(); printf("<ul>\n"); visitChildren(l); indent_post(); printf("</ul>\n"); } void operator()(const DocSimpleListItem &li) { indent_pre(); printf("<li>\n"); if (li.paragraph()) { visit(*this,*li.paragraph()); } indent_post(); printf("</li>\n"); } void operator()(const DocSection &s) { indent_pre(); printf("<sect%d>\n",s.level()); if (s.title()) { std::visit(*this, *s.title()); } visitChildren(s); indent_post(); printf("</sect%d>\n",s.level()); } void operator()(const DocHtmlList &s) { indent_pre(); if (s.type()==DocHtmlList::Ordered) { printf("<ol"); for (const auto &opt : s.attribs()) { printf(" %s=\"%s\"",qPrint(opt.name),qPrint(opt.value)); } printf(">\n"); } else { printf("<ul>\n"); } visitChildren(s); indent_post(); if (s.type()==DocHtmlList::Ordered) { printf("</ol>\n"); } else { printf("</ul>\n"); } } void operator()(const DocHtmlListItem &li) { indent_pre(); printf("<li"); for (const auto &opt : li.attribs()) { printf(" %s=\"%s\"",qPrint(opt.name),qPrint(opt.value)); } printf(">\n"); visitChildren(li); indent_post(); printf("</li>\n"); } void operator()(const DocHtmlDescList &l) { indent_pre(); printf("<dl>\n"); visitChildren(l); indent_post(); printf("</dl>\n"); } void operator()(const DocHtmlDescTitle &dt) { indent_pre(); printf("<dt>\n"); visitChildren(dt); indent_post(); printf("</dt>\n"); } void operator()(const DocHtmlDescData &dd) { indent_pre(); printf("<dd>\n"); visitChildren(dd); indent_post(); printf("</dd>\n"); } void operator()(const DocHtmlTable &t) { indent_pre(); printf("<table rows=\"%zu\" cols=\"%zu\">\n", t.numRows(),t.numColumns()); visitChildren(t); if (t.caption()) { std::visit(*this, *t.caption()); } indent_post(); printf("</table>\n"); } void operator()(const DocHtmlRow &tr) { indent_pre(); printf("<tr>\n"); visitChildren(tr); indent_post(); printf("</tr>\n"); } void operator()(const DocHtmlCell &c) { indent_pre(); printf("<t%c>\n",c.isHeading()?'h':'d'); visitChildren(c); indent_post(); printf("</t%c>\n",c.isHeading()?'h':'d'); } void operator()(const DocHtmlCaption &c) { indent_pre(); printf("<caption>\n"); visitChildren(c); indent_post(); printf("</caption>\n"); } void operator()(const DocInternal &i) { indent_pre(); printf("<internal>\n"); visitChildren(i); indent_post(); printf("</internal>\n"); } void operator()(const DocHRef &href) { indent_pre(); printf("<a url=\"%s\">\n",qPrint(href.url())); visitChildren(href); indent_post(); printf("</a>\n"); } void operator()(const DocHtmlSummary &summary) { indent_pre(); printf("<summary"); for (const auto &opt : summary.attribs()) { printf(" %s=\"%s\"",qPrint(opt.name),qPrint(opt.value)); } printf(">\n"); visitChildren(summary); indent_post(); printf("</summary>\n"); } void operator()(const DocHtmlDetails &details) { indent_pre(); printf("<details"); for (const auto &opt : details.attribs()) { printf(" %s=\"%s\"",qPrint(opt.name),qPrint(opt.value)); } printf(">\n"); auto summary = details.summary(); if (summary) { std::visit(*this,*summary); } visitChildren(details); indent_post(); printf("</details>\n"); } void operator()(const DocHtmlHeader &header) { indent_pre(); printf("<h%d>\n",header.level()); visitChildren(header); indent_post(); printf("</h%d>\n",header.level()); } void operator()(const DocImage &img) { indent_pre(); printf("<image src=\"%s\" type=\"",qPrint(img.name())); switch(img.type()) { case DocImage::Html: printf("html"); break; case DocImage::Latex: printf("latex"); break; case DocImage::Rtf: printf("rtf"); break; case DocImage::DocBook: printf("docbook"); break; case DocImage::Xml: printf("xml"); break; } printf("\" %s %s inline=\"%s\">\n",qPrint(img.width()),qPrint(img.height()),img.isInlineImage() ? "yes" : "no"); visitChildren(img); indent_post(); printf("</image>\n"); } void operator()(const DocDotFile &df) { indent_pre(); printf("<dotfile src=\"%s\">\n",qPrint(df.name())); visitChildren(df); indent_post(); printf("</dotfile>\n"); } void operator()(const DocMscFile &df) { indent_pre(); printf("<mscfile src=\"%s\">\n",qPrint(df.name())); visitChildren(df); indent_post(); printf("</mscfile>\n"); } void operator()(const DocDiaFile &df) { indent_pre(); printf("<diafile src=\"%s\">\n",qPrint(df.name())); visitChildren(df); indent_post(); printf("</diafile>\n"); } void operator()(const DocPlantUmlFile &df) { indent_pre(); printf("<plantumlfile src=\"%s\">\n",qPrint(df.name())); visitChildren(df); indent_post(); printf("</plantumlfile>\n"); } void operator()(const DocLink &lnk) { indent_pre(); printf("<link ref=\"%s\" file=\"%s\" anchor=\"%s\">\n", qPrint(lnk.ref()),qPrint(lnk.file()),qPrint(lnk.anchor())); visitChildren(lnk); indent_post(); printf("</link>\n"); } void operator()(const DocRef &ref) { indent_pre(); printf("<ref ref=\"%s\" file=\"%s\" " "anchor=\"%s\" targetTitle=\"%s\"" " hasLinkText=\"%s\" refToAnchor=\"%s\" refToSection=\"%s\" refToTable=\"%s\">\n", qPrint(ref.ref()),qPrint(ref.file()),qPrint(ref.anchor()), qPrint(ref.targetTitle()),ref.hasLinkText()?"yes":"no", ref.refToAnchor()?"yes":"no", ref.refToSection()?"yes":"no", ref.refToTable()?"yes":"no"); visitChildren(ref); indent_post(); printf("</ref>\n"); } void operator()(const DocSecRefItem &ref) { indent_pre(); printf("<secrefitem target=\"%s\">\n",qPrint(ref.target())); visitChildren(ref); indent_post(); printf("</secrefitem>\n"); } void operator()(const DocSecRefList &rl) { indent_pre(); printf("<secreflist>\n"); visitChildren(rl); indent_post(); printf("</secreflist>\n"); } void operator()(const DocParamList &pl) { indent_pre(); printf("<parameters>"); if (!pl.parameters().empty()) { printf("<param>"); for (const auto &param : pl.parameters()) { std::visit(*this,param); } printf("</param>"); } printf("\n"); indent_post(); printf("</parameters>\n"); } void operator()(const DocParamSect &ps) { indent_pre(); printf("<paramsect type="); switch (ps.type()) { case DocParamSect::Param: printf("param"); break; case DocParamSect::RetVal: printf("retval"); break; case DocParamSect::Exception: printf("exception"); break; case DocParamSect::TemplateParam: printf("templateparam"); break; case DocParamSect::Unknown: printf("unknown"); break; } printf(">\n"); visitChildren(ps); indent_post(); printf("</paramsect>\n"); } void operator()(const DocXRefItem &x) { indent_pre(); printf("<xrefitem file=\"%s\" anchor=\"%s\" title=\"%s\">\n", qPrint(x.file()),qPrint(x.anchor()),qPrint(x.title())); visitChildren(x); indent_post(); printf("</xrefitem>\n"); } void operator()(const DocInternalRef &r) { indent_pre(); printf("<internalref file=%s anchor=%s>\n",qPrint(r.file()),qPrint(r.anchor())); visitChildren(r); indent_post(); printf("</internalref>\n"); } void operator()(const DocText &t) { indent_pre(); printf("<text>\n"); visitChildren(t); indent_post(); printf("</text>\n"); } void operator()(const DocHtmlBlockQuote &q) { indent_pre(); printf("<blockquote>\n"); visitChildren(q); indent_post(); printf("</blockquote>\n"); } void operator()(const DocVhdlFlow &vf) { indent_pre(); printf("<vhdlflow>\n"); visitChildren(vf); indent_post(); printf("</vhdlflow>\n"); } void operator()(const DocParBlock &pb) { indent_pre(); printf("<parblock>\n"); visitChildren(pb); indent_post(); printf("</parblock>\n"); } private: // helper functions void indent() { if (m_needsEnter) printf("\n"); for (int i=0;i<m_indent;i++) printf("."); m_needsEnter=FALSE; } void indent_leaf() { if (!m_needsEnter) indent(); m_needsEnter=TRUE; } void indent_pre() { indent(); m_indent++; } void indent_post() { m_indent--; indent(); } // member variables int m_indent; bool m_needsEnter; bool m_insidePre; }; #endif
21,770
C++
.h
755
22.074172
118
0.551916
doxygen/doxygen
5,592
1,269
1,920
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false