ROOT  6.06/09
Reference Guide
THtml_001.C
Go to the documentation of this file.
1 /// that the directive is run on.
2 
3 void THtml::AddMacroPath(const char* path)
4 {
5  const char pathDelimiter =
6 #ifdef R__WIN32
7  ';';
8 #else
9  ':';
10 #endif
11  fPathInfo.fMacroPath += pathDelimiter;
12  fPathInfo.fMacroPath += path;
13 }
14 
15 
16 ////////////////////////////////////////////////////////////////////////////////
17 /// copy CSS, javascript file, etc to the output dir
18 
20 {
23  CopyFileFromEtcDir("HELP.html");
24 }
25 
26 ////////////////////////////////////////////////////////////////////////////////
27 /// Return the TModuleDefinition (or derived) object as set by
28 /// SetModuleDefinition(); create and return a TModuleDefinition object
29 /// if none was set.
30 
32 {
33  if (!fModuleDef) {
35  fModuleDef->SetOwner(const_cast<THtml*>(this));
36  }
37  return *fModuleDef;
38 }
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// Return the TFileDefinition (or derived) object as set by
42 /// SetFileDefinition(); create and return a TFileDefinition object
43 /// if none was set.
44 
46 {
47  if (!fFileDef) {
48  fFileDef = new TFileDefinition();
49  fFileDef->SetOwner(const_cast<THtml*>(this));
50  }
51  return *fFileDef;
52 }
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// Return the TModuleDefinition (or derived) object as set by
56 /// SetModuleDefinition(); create and return a TModuleDefinition object
57 /// if none was set.
58 
60 {
61  if (!fPathDef) {
62  fPathDef = new TPathDefinition();
63  fPathDef->SetOwner(const_cast<THtml*>(this));
64  }
65  return *fPathDef;
66 }
67 
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Get the directory containing THtml's auxiliary files ($ROOTSYS/etc/html)
71 
72 const char* THtml::GetEtcDir() const
73 {
74  if (fPathInfo.fEtcDir.Length())
75  return fPathInfo.fEtcDir;
76 
78 
79  fPathInfo.fEtcDir = "html";
80 
81 #ifdef ROOTETCDIR
83 #else
85 # ifdef ROOTPREFIX
87 # else
88  if (getenv("ROOTSYS"))
89  gSystem->PrependPathName(getenv("ROOTSYS"), fPathInfo.fEtcDir);
90 # endif
91 #endif
92 
93  return fPathInfo.fEtcDir;
94 }
95 
96 
97 ////////////////////////////////////////////////////////////////////////////////
98 /// Return the next class to be generated for MakeClassThreaded.
99 
101 {
102  if (!fThreadedClassIter) return 0;
103 
105 
106  TClassDocInfo* classinfo = 0;
107  while ((classinfo = (TClassDocInfo*)(*fThreadedClassIter)())
108  && !classinfo->IsSelected()) { }
109 
110  if (!classinfo) {
111  delete fThreadedClassIter;
112  fThreadedClassIter = 0;
113  }
114 
116 
117  return classinfo;
118 }
119 
120 
121 ////////////////////////////////////////////////////////////////////////////////
122 /// Get the documentation URL for library lib.
123 /// If lib == 0 or no documentation URL has been set for lib, return the ROOT
124 /// documentation URL. The return value is always != 0.
125 
126 const char* THtml::GetURL(const char* lib /*=0*/) const
127 {
129 
130  if (lib && strlen(lib)) {
131  std::map<std::string, TString>::const_iterator iUrl = fLinkInfo.fLibURLs.find(lib);
132  if (iUrl != fLinkInfo.fLibURLs.end()) return iUrl->second;
133  return gEnv->GetValue(TString("Root.Html.") + lib, fLinkInfo.fROOTURL);
134  }
135  return fLinkInfo.fROOTURL;
136 }
137 
138 ////////////////////////////////////////////////////////////////////////////////
139 /// Check whether dot is available in $PATH or in the directory set
140 /// by SetDotPath()
141 
143 {
146 
148 
149  Info("HaveDot", "Checking for Graphviz (dot)...");
150  TString runDot("dot");
151  if (fPathInfo.fDotDir.Length())
153  runDot += " -V";
154  if (gDebug > 3)
155  Info("HaveDot", "Running: %s", runDot.Data());
156  if (gSystem->Exec(runDot)) {
158  return kFALSE;
159  }
161  return kTRUE;
162 
163 }
164 
165 ////////////////////////////////////////////////////////////////////////////////
166 /// Inform the THtml object that one of its helper objects was deleted.
167 /// Called by THtml::HelperBase::~HelperBase().
168 
170 {
171  THelperBase* helpers[3] = {fPathDef, fModuleDef, fFileDef};
172  for (int i = 0; who && i < 3; ++i)
173  if (who == helpers[i])
174  helpers[i] = who = 0;
175 }
176 
177 
178 ////////////////////////////////////////////////////////////////////////////////
179 /// It converts a single text file to HTML
180 ///
181 ///
182 /// Input: filename - name of the file to convert
183 /// title - title which will be placed at the top of the HTML file
184 /// dirname - optional parameter, if it's not specified, output will
185 /// be placed in htmldoc/examples directory.
186 /// relpath - optional parameter pointing to the THtml generated doc
187 /// on the server, relative to the current page.
188 /// includeOutput - if != kNoOutput, run the script passed as filename and
189 /// store all created canvases in PNG files that are
190 /// shown next to the converted source. Bitwise-ORing with
191 /// kForceOutput re-runs the script even if output PNGs exist
192 /// that are newer than the script. If kCompiledOutput is
193 /// passed, the script is run through ACLiC (.x filename+)
194 /// context - line shown verbatim at the top of the page; e.g. for links.
195 /// If context is non-empty it is expected to also print the
196 /// title.
197 ///
198 /// NOTE: Output file name is the same as filename, but with extension .html
199 ///
200 
201 void THtml::Convert(const char *filename, const char *title,
202  const char *dirname /*= ""*/, const char *relpath /*= "../"*/,
203  Int_t includeOutput /* = kNoOutput */,
204  const char* context /* = "" */)
205 {
206  gROOT->GetListOfGlobals(kTRUE); // force update of this list
207  CreateListOfClasses("*");
208 
209  const char *dir;
210 
211  // if it's not defined, make the "examples" as a default directory
212  if (!*dirname) {
214  dir = gSystem->ConcatFileName(fPathInfo.fOutputDir, "examples");
215  } else
216  dir = dirname;
217 
218  // create directory if necessary
219  if (gSystem->AccessPathName(dir))
220  gSystem->MakeDirectory(dir);
221 
222  // find a file
223  char *cRealFilename =
225 
226  if (!cRealFilename) {
227  Error("Convert", "Can't find file '%s' !", filename);
228  return;
229  }
230 
231  TString realFilename(cRealFilename);
232  delete[] cRealFilename;
233  cRealFilename = 0;
234 
235  // open source file
236  std::ifstream sourceFile;
237  sourceFile.open(realFilename, std::ios::in);
238 
239  if (!sourceFile.good()) {
240  Error("Convert", "Can't open file '%s' !", realFilename.Data());
241  return;
242  }
243 
244  if (gSystem->AccessPathName(dir)) {
245  Error("Convert",
246  "Directory '%s' doesn't exist, or it's write protected !", dir);
247  return;
248  }
249  char *tmp1 =
250  gSystem->ConcatFileName(dir, gSystem->BaseName(filename));
251 
252  TDocOutput output(*this);
253  if (!fGClient)
254  gROOT->ProcessLine(TString::Format("*((TGClient**)0x%lx) = gClient;",
255  (ULong_t)&fGClient));
256  if (includeOutput && !fGClient)
257  Warning("Convert", "Output requested but cannot initialize graphics: GUI and GL windows not be available");
258  output.Convert(sourceFile, realFilename, tmp1, title, relpath, includeOutput, context, fGClient);
259 
260  if (tmp1)
261  delete[]tmp1;
262  tmp1 = 0;
263 }
264 
265 ////////////////////////////////////////////////////////////////////////////////
266 /// Return the module name for a given class.
267 /// Use the cached information from fDocEntityInfo.fClasses.
268 
270 {
271  module = "(UNKNOWN)";
272  if (!cl) return;
273 
275  if (!cdi || !cdi->GetModule())
276  return;
277  module = cdi->GetModule()->GetName();
278 }
279 
280 
281 ////////////////////////////////////////////////////////////////////////////////
282 /// Create the list of all known classes
283 
284 void THtml::CreateListOfClasses(const char* filter)
285 {
287  return;
288 
289  Info("CreateListOfClasses", "Initializing - this might take a while...");
290  // get total number of classes
291  Int_t totalNumberOfClasses = gClassTable->Classes();
292 
293  // allocate memory
296 
297  fDocEntityInfo.fClassFilter = filter;
298 
299  // start from begining
300  gClassTable->Init();
301  if (filter && (!filter[0] || !strcmp(filter, "*")))
302  filter = ".*";
303  TString reg = filter;
304  TPMERegexp re(reg);
305 
306  bool skipROOTClasses = false;
307  std::set<std::string> rootLibs;
308  TList classesDeclFileNotFound;
309  TList classesImplFileNotFound;
310 
311  // pre-run TObject at i == -1
312  for (Int_t i = -1; i < totalNumberOfClasses; i++) {
313 
314  // get class name
315  const char *cname = 0;
316  if (i < 0) cname = "TObject";
317  else cname = gClassTable->Next();
318 
319  if (i >= 0 && !strcmp(cname, "TObject")) {
320  // skip the second iteration on TObject
321  continue;
322  }
323 
324  // This is a hack for until after Cint and Reflex are one.
325  if (strstr(cname, "__gnu_cxx::")) continue;
326  // Work around ROOT-6016
327  if (!strcmp(cname, "timespec")) continue;
328 
329  // get class & filename - use TROOT::GetClass, as we also
330  // want those classes without decl file name!
331  TClass *classPtr = TClass::GetClass((const char *) cname, kTRUE);
332  if (!classPtr) continue;
333 
334  std::string shortName(ShortType(cname));
335  cname = shortName.c_str();
336 
337  TString s = cname;
338  Bool_t matchesSelection = re.Match(s);
339 
340 
341  TString hdr;
342  TString hdrFS;
343  TString src;
344  TString srcFS;
345  TString htmlfilename;
346  TFileSysEntry* fse = 0;
347 
349  if (cdi) {
350  hdr = cdi->GetDeclFileName();
351  hdrFS = cdi->GetDeclFileSysName();
352  src = cdi->GetImplFileName();
353  srcFS = cdi->GetImplFileSysName();
354  htmlfilename = cdi->GetHtmlFileName();
355  }
356 
357  if (!hdrFS.Length()) {
358  if (!GetFileDefinition().GetDeclFileName(classPtr, hdr, hdrFS, &fse)) {
359  // we don't even know where the class is defined;
360  // just skip. Silence if it doesn't match the selection anyway
361  if (i == -1 ) {
362  skipROOTClasses = true;
363  Info("CreateListOfClasses", "Cannot find header file for TObject at %s given the input path %s.",
364  classPtr->GetDeclFileName(), GetInputPath().Data());
365  Info("CreateListOfClasses", "Assuming documentation is not for ROOT classes, or you need to pass "
366  "the proper directory to THtml::SetInputDir() so I can find %s.", classPtr->GetDeclFileName());
367  continue;
368  }
369  // ignore STL
370  if (classPtr->GetClassInfo() &&
371  (gInterpreter->ClassInfo_Property(classPtr->GetClassInfo()) & kIsDefinedInStd))
372  continue;
373  if (classPtr->GetDeclFileName() && (!strncmp(classPtr->GetDeclFileName(), "prec_stl/", 9) ||
374  strstr(classPtr->GetDeclFileName(), "include/c++/") ||
375  !strncmp(classPtr->GetDeclFileName(), "/usr/include",12)))
376  continue;
377  if (classPtr->GetDeclFileName() && (
378  !strcmp(classPtr->GetDeclFileName(), "vector") ||
379  !strcmp(classPtr->GetDeclFileName(), "string") ||
380  !strcmp(classPtr->GetDeclFileName(), "list") ||
381  !strcmp(classPtr->GetDeclFileName(), "deque") ||
382  !strcmp(classPtr->GetDeclFileName(), "map") ||
383  !strcmp(classPtr->GetDeclFileName(), "valarray") ||
384  !strcmp(classPtr->GetDeclFileName(), "set") ||
385  !strcmp(classPtr->GetDeclFileName(), "typeinfo") ||
386  !strcmp(classPtr->GetDeclFileName(), "stdlib.h") ) )
387  {
388  // Those are STL header, just ignore.
389  continue;
390  }
391  if (skipROOTClasses) {
392  if (classPtr->GetSharedLibs() && classPtr->GetSharedLibs()[0]) {
393  std::string lib(classPtr->GetSharedLibs());
394  size_t posSpace = lib.find(' ');
395  if (posSpace != std::string::npos)
396  lib.erase(posSpace);
397  if (rootLibs.find(lib) == rootLibs.end()) {
398 #ifdef ROOTLIBDIR
399  TString rootlibdir = ROOTLIBDIR;
400 #else
401  TString rootlibdir = "lib";
402  gSystem->PrependPathName(gRootDir, rootlibdir);
403 #endif
404  TString sLib(lib);
405  if (sLib.Index('.') == -1) {
406  sLib += ".";
407  sLib += gSystem->GetSoExt();
408  }
409  gSystem->PrependPathName(rootlibdir, sLib);
410  if (gSystem->AccessPathName(sLib))
411  // the library doesn't exist in $ROOTSYS/lib, so it's not
412  // a root lib and we need to tell the user.
413  classesDeclFileNotFound.AddLast(classPtr);
414  else rootLibs.insert(lib);
415  } // end "if rootLibs does not contain lib"
416  } else {
417  // lib name unknown
418  static const char* rootClassesToIgnore[] =
419  { "ColorStruct_t", "CpuInfo_t", "Event_t", "FileStat_t", "GCValues_t", "MemInfo_t",
420  "PictureAttributes_t", "Point_t", "ProcInfo_t", "ROOT", "ROOT::Fit",
421  "Rectangle_t", "RedirectHandle_t", "Segment_t", "SetWindowAttributes_t",
422  "SysInfo_t", "TCint", "UserGroup_t", "WindowAttributes_t", "timespec", 0};
423  static const char* rootClassStemsToIgnore[] =
424  { "ROOT::Math", "TKDTree", "TMatrixT", "TParameter", "vector", 0 };
425  static size_t rootClassStemsToIgnoreLen[] = {0, 0, 0, 0, 0};
426  static std::set<std::string> setRootClassesToIgnore;
427  if (setRootClassesToIgnore.empty()) {
428  for (int ii = 0; rootClassesToIgnore[ii]; ++ii)
429  setRootClassesToIgnore.insert(rootClassesToIgnore[ii]);
430  for (int ii = 0; rootClassStemsToIgnore[ii]; ++ii)
431  rootClassStemsToIgnoreLen[ii] = strlen(rootClassStemsToIgnore[ii]);
432  }
433  // only complain about this class if it should not be ignored:
434  if (setRootClassesToIgnore.find(cname) == setRootClassesToIgnore.end()) {
435  bool matched = false;
436  for (int ii = 0; !matched && rootClassStemsToIgnore[ii]; ++ii)
437  matched = !strncmp(cname, rootClassStemsToIgnore[ii], rootClassStemsToIgnoreLen[ii]);
438  if (!matched)
439  classesDeclFileNotFound.AddLast(classPtr);
440  }
441  } // lib name known
442  continue;
443  } else {
444  if (matchesSelection && (!classPtr->GetDeclFileName() ||
445  !strstr(classPtr->GetDeclFileName(),"prec_stl/") ||
446  !strstr(classPtr->GetDeclFileName(), "include/c++/") ||
447  strncmp(classPtr->GetDeclFileName(), "/usr/include",12)))
448  classesDeclFileNotFound.AddLast(classPtr);
449  continue;
450  }
451  }
452  }
453 
454  Bool_t haveSource = (srcFS.Length());
455  if (!haveSource)
456  haveSource = GetFileDefinition().GetImplFileName(classPtr, src, srcFS, fse ? 0 : &fse);
457 
458  if (!haveSource) {
459  classesImplFileNotFound.AddLast(classPtr);
460  }
461 
462  if (!htmlfilename.Length())
463  GetHtmlFileName(classPtr, htmlfilename);
464 
465  if (!cdi) {
466  cdi = new TClassDocInfo(classPtr, htmlfilename, hdrFS, srcFS, hdr, src);
468  } else {
469  cdi->SetDeclFileName(hdr);
470  cdi->SetImplFileName(src);
471  cdi->SetDeclFileSysName(hdrFS);
472  cdi->SetImplFileSysName(srcFS);
473  cdi->SetHtmlFileName(htmlfilename);
474  }
475 
476  cdi->SetSelected(matchesSelection);
477 
478  TString modulename;
479  GetModuleDefinition().GetModule(classPtr, fse, modulename);
480  if (!modulename.Length() || modulename == "USER")
481  GetModuleNameForClass(modulename, classPtr);
482 
484  if (!module) {
485  bool moduleSelected = cdi->IsSelected();
486 
487  TString parentModuleName(gSystem->DirName(modulename));
488  TModuleDocInfo* super = 0;
489  if (parentModuleName.Length() && parentModuleName != ".") {
490  super = (TModuleDocInfo*) fDocEntityInfo.fModules.FindObject(parentModuleName);
491  if (!super) {
492  // create parents:
493  TString token;
494  Ssiz_t pos = 0;
495  while (parentModuleName.Tokenize(token, pos, "/")) {
496  if (!token.Length() || token == ".") continue;
497  super = new TModuleDocInfo(token, super);
498  super->SetSelected(moduleSelected);
499  fDocEntityInfo.fModules.Add(super);
500  }
501  }
502  }
503  module = new TModuleDocInfo(modulename, super);
504  module->SetSelected(moduleSelected);
505  fDocEntityInfo.fModules.Add(module);
506  }
507 
508  if (module) {
509  module->AddClass(cdi);
510  cdi->SetModule(module);
511  if (cdi->HaveSource() && cdi->IsSelected())
512  module->SetSelected();
513  }
514 
515  // clear the typedefs; we fill them later
516  cdi->GetListOfTypedefs().Clear();
517 
518  if (gDebug > 0)
519  Info("CreateListOfClasses", "Adding class %s, module %s (%sselected)",
520  cdi->GetName(), module ? module->GetName() : "[UNKNOWN]",
521  cdi->IsSelected() ? "" : "not ");
522  }
523 
524 
525 
526  bool cannotFind = false;
527  if (!classesDeclFileNotFound.IsEmpty()) {
528  Warning("CreateListOfClasses",
529  "Cannot find the header for the following classes [reason]:");
530  TIter iClassesDeclFileNotFound(&classesDeclFileNotFound);
531  TClass* iClass = 0;
532  while ((iClass = (TClass*)iClassesDeclFileNotFound())) {
533  if (iClass->GetDeclFileName() && iClass->GetDeclFileName()[0]) {
534  Warning("CreateListOfClasses", " %s [header %s not found]", iClass->GetName(), iClass->GetDeclFileName());
535  cannotFind = true;
536  } else
537  Warning("CreateListOfClasses", " %s [header file is unknown]", iClass->GetName());
538  }
539  }
540 
541  if (!classesImplFileNotFound.IsEmpty() && gDebug > 3) {
542  Warning("CreateListOfClasses",
543  "Cannot find the source file for the following classes [reason]:");
544  TIter iClassesDeclFileNotFound(&classesImplFileNotFound);
545  TClass* iClass = 0;
546  while ((iClass = (TClass*)iClassesDeclFileNotFound())) {
547  if (iClass->GetDeclFileName() && iClass->GetDeclFileName()[0]) {
548  Info("CreateListOfClasses", " %s [source %s not found]", iClass->GetName(), iClass->GetImplFileName());
549  cannotFind = true;
550  } else
551  Info("CreateListOfClasses", " %s [source file is unknown, add \"ClassImpl(%s)\" to source file if it exists]",
552  iClass->GetName(), iClass->GetName());
553  }
554  }
555  if (cannotFind) {
556  Warning("CreateListOfClasses", "THtml cannot find all headers and sources. ");
557  Warning("CreateListOfClasses",
558  "You might need to adjust the input path (currently %s) by calling THtml::SetInputDir()",
559  GetInputPath().Data());
560  }
561 
562  // fill typedefs
563  TIter iTypedef(gROOT->GetListOfTypes());
564  TDataType* dt = 0;
565  TDocOutput output(*this);
566  while ((dt = (TDataType*) iTypedef())) {
567  if (dt->GetType() != -1) continue;
568  TClassDocInfo* cdi = (TClassDocInfo*) fDocEntityInfo.fClasses.FindObject(dt->GetFullTypeName());
569  if (cdi) {
570  cdi->GetListOfTypedefs().Add(dt);
571  if (gDebug > 1)
572  Info("CreateListOfClasses", "Adding typedef %s to class %s",
573  dt->GetName(), cdi->GetName());
574 
575  bool inNamespace = true;
576  TString surroundingNamespace(dt->GetName());
577  Ssiz_t posTemplate = surroundingNamespace.Last('>');
578  inNamespace = inNamespace && (posTemplate == kNPOS);
579  if (inNamespace) {
580  Ssiz_t posColumn = surroundingNamespace.Last(':');
581  if (posColumn != kNPOS) {
582  surroundingNamespace.Remove(posColumn - 1);
583  TClass* clSurrounding = GetClass(surroundingNamespace);
584  inNamespace = inNamespace && (!clSurrounding || IsNamespace(clSurrounding));
585  }
586  }
587  if (inNamespace && cdi->GetModule()) {
588  TString htmlfilename(dt->GetName());
589  output.NameSpace2FileName(htmlfilename);
590  htmlfilename += ".html";
591  TClassDocInfo* cdiTD = new TClassDocInfo(dt, htmlfilename);
592  cdiTD->SetModule(cdi->GetModule());
593  cdiTD->SetSelected(cdi->IsSelected());
594  cdi->GetModule()->AddClass(cdiTD);
595  }
596  }
597  }
598 
601  TIter iterModule(&fDocEntityInfo.fModules);
602  TModuleDocInfo* mdi = 0;
603  while ((mdi = (TModuleDocInfo*) iterModule()))
604  mdi->GetClasses()->Sort();
605 
606  if (fProductName == "(UNKNOWN PRODUCT)"
607  && fDocEntityInfo.fModules.FindObject("core/base")
608  && fDocEntityInfo.fModules.FindObject("core/cont")
609  && fDocEntityInfo.fModules.FindObject("core/rint")
610  && gProgName && strstr(gProgName, "root"))
611  // if we have these modules we're probably building the root doc
612  fProductName = "ROOT";
613 
614  if (fProductName == "(UNKNOWN PRODUCT)") {
615  Warning("CreateListOfClasses", "Product not set. You should call gHtml->SetProduct(\"MyProductName\");");
616  } else if (fProductName != "ROOT") {
617  if (GetViewCVS().Contains("http://root.cern.ch/"))
618  SetViewCVS("");
619  }
620 
623  && !strcmp(fDocEntityInfo.fModules.At(0)->GetName(), "(UNKNOWN)"))
624  // Only one module, and its name is not known.
625  // Let's call it "MAIN":
627 
628  Info("CreateListOfClasses", "Initializing - DONE.");
629 }
630 
631 
632 ////////////////////////////////////////////////////////////////////////////////
633 /// Create index of all data types and a page for each typedef-to-class
634 
636 {
637  TDocOutput output(*this);
638  output.CreateTypeIndex();
639  output.CreateClassTypeDefs();
640 }
641 
642 ////////////////////////////////////////////////////////////////////////////////
643 /// Copy a file from $ROOTSYS/etc/html into GetOutputDir()
644 
647 
648  TString outFile(filename);
649 
650  TString inFile(outFile);
651  gSystem->PrependPathName(GetEtcDir(), inFile);
652 
653  gSystem->PrependPathName(GetOutputDir(), outFile);
654 
655  if (gSystem->CopyFile(inFile, outFile, kTRUE) != 0) {
656  Warning("CopyFileFromEtcDir", "Could not copy %s to %s", inFile.Data(), outFile.Data());
657  return kFALSE;
658  }
659 
660  return kTRUE;
661 }
662 
663 ////////////////////////////////////////////////////////////////////////////////
664 /// Create the inheritance hierarchy diagram for all classes
665 
667 {
668  TDocOutput output(*this);
669  output.CreateHierarchy();
670 }
671 
672 ////////////////////////////////////////////////////////////////////////////////
673 /// Write the default ROOT style sheet.
674 
676  CopyFileFromEtcDir("ROOT.js");
677 }
678 
679 ////////////////////////////////////////////////////////////////////////////////
680 /// Write the default ROOT style sheet.
681 
683  CopyFileFromEtcDir("ROOT.css");
684  CopyFileFromEtcDir("shadowAlpha.png");
685  CopyFileFromEtcDir("shadow.gif");
686 }
687 
688 
689 
690 ////////////////////////////////////////////////////////////////////////////////
691 /// fill derived with all classes inheriting from cl and their inheritance
692 /// distance to cl
693 
694 void THtml::GetDerivedClasses(TClass* cl, std::map<TClass*, Int_t>& derived) const
695 {
696  TIter iClass(&fDocEntityInfo.fClasses);
697  TClassDocInfo* cdi = 0;
698  while ((cdi = (TClassDocInfo*) iClass())) {
699  TClass* candidate = dynamic_cast<TClass*>(cdi->GetClass());
700  if (!candidate) continue;
701  if (candidate != cl && candidate->InheritsFrom(cl)) {
702  Int_t level = 0;
703  TClass* currentBaseOfCandidate = candidate;
704  while (currentBaseOfCandidate != cl) {
705  TList* bases = currentBaseOfCandidate->GetListOfBases();
706  if (!bases) continue;
707  TIter iBase(bases);
708  TBaseClass* base = 0;
709  while ((base = (TBaseClass*) iBase())) {
710  TClass* clBase = base->GetClassPointer();
711  if (clBase && clBase->InheritsFrom(cl)) {
712  ++level;
713  currentBaseOfCandidate = clBase;
714  }
715  }
716  }
717  derived[candidate] = level;
718  }
719  }
720 }
721 
722 ////////////////////////////////////////////////////////////////////////////////
723 /// Return real HTML filename
724 ///
725 ///
726 /// Input: classPtr - pointer to a class
727 /// filename - string containing a full name
728 /// of the corresponding HTML file after the function returns.
729 ///
730 
732 {
733  filename.Remove(0);
734  if (!classPtr) return;
735 
736  TString cFilename;
737  if (!GetImplFileName(classPtr, kFALSE, cFilename))
738  GetDeclFileName(classPtr, kFALSE, cFilename);
739 
740  // classes without Impl/DeclFileName don't have docs,
741  // and classes without docs don't have output file names
742  if (!cFilename.Length())
743  return;
744 
745  TString libName;
746  const char *colon = strchr(cFilename, ':');
747  if (colon)
748  // old version, where source file name is prepended by "TAG:"
749  libName = TString(cFilename, colon - cFilename);
750  else
751  // New version, check class's libname.
752  // If libname is dir/libMyLib.so, check Root.Html.MyLib
753  // If libname is myOtherLib.so.2.3, check Root.Html.myOtherLib
754  // (i.e. remove directories, "lib" prefix, and any "extension")
755  if (classPtr->GetSharedLibs()) {
756  // first one is the class's lib
757  TString libname(classPtr->GetSharedLibs());
758  Ssiz_t posSpace = libname.First(' ');
759  if (posSpace != kNPOS)
760  libname.Remove(posSpace, libname.Length());
761  TString libnameBase = gSystem->BaseName(libname);
762  if (libnameBase.BeginsWith("lib"))
763  libnameBase.Remove(0, 3);
764  Ssiz_t posExt = libnameBase.First('.');
765  if (posExt != '.')
766  libnameBase.Remove(posExt, libnameBase.Length());
767  if (libnameBase.Length())
768  libName = libnameBase;
769  }
770 
771  filename = cFilename;
772  TString htmlFileName;
773  if (!filename.Length() ||
775  htmlFileName = GetURL(libName);
776  } else
777  htmlFileName = "./";
778 
779  if (htmlFileName.Length()) {
780  filename = htmlFileName;
781  TString className(classPtr->GetName());
782  TDocOutput output(*const_cast<THtml*>(this));
783  output.NameSpace2FileName(className);
784  gSystem->PrependPathName(filename, className);
785  filename = className;
786  filename.ReplaceAll("\\", "/");
787  filename += ".html";
788  } else filename.Remove(0);
789 }
790 
791 ////////////////////////////////////////////////////////////////////////////////
792 /// Get the html file name for a class named classname.
793 /// Returns 0 if the class is not documented.
794 
795 const char* THtml::GetHtmlFileName(const char* classname) const
796 {
798  if (cdi)
799  return cdi->GetHtmlFileName();
800  return 0;
801 }
802 
803 ////////////////////////////////////////////////////////////////////////////////
804 ///*-*-*-*-*Return pointer to class with name*-*-*-*-*-*-*-*-*-*-*-*-*
805 ///*-* =================================
806 
807 TClass *THtml::GetClass(const char *name1) const
808 {
809  if(!name1 || !name1[0]) return 0;
810  // no doc for internal classes
811  if (strstr(name1,"ROOT::")==name1) {
812  Bool_t ret = kTRUE;
813  if (!strncmp(name1 + 6,"Math", 4)) ret = kFALSE;
814  if (!strncmp(name1 + 6,"Reflex", 6)) ret = kFALSE;
815  if (!strncmp(name1 + 6,"Cintex", 6)) ret = kFALSE;
816  if (ret) return 0;
817  }
818 
820  if (!cdi) return 0;
821  TClass *cl = dynamic_cast<TClass*>(cdi->GetClass());
822  // hack to get rid of prec_stl types
823  // TClassEdit checks are far too slow...
824  /*
825  if (cl && GetDeclFileName(cl) &&
826  (strstr(GetDeclFileName(cl),"prec_stl/") || !strstr(classPtr->GetDeclFileName(), "include/c++/") )
827  cl = 0;
828  */
829  TString declFileName;
830  if (cl && GetDeclFileName(cl, kFALSE, declFileName))
831  return cl;
832  return 0;
833 }
834 
835 ////////////////////////////////////////////////////////////////////////////////
836 /// Return declaration file name; return the full path if filesys is true.
837 
838 bool THtml::GetDeclFileName(TClass * cl, Bool_t filesys, TString& out_name) const
839 {
840  return GetDeclImplFileName(cl, filesys, true, out_name);
841 }
842 
843 ////////////////////////////////////////////////////////////////////////////////
844 /// Return implementation file name
845 
846 bool THtml::GetImplFileName(TClass * cl, Bool_t filesys, TString& out_name) const
847 {
848  return GetDeclImplFileName(cl, filesys, false, out_name);
849 }
850 
851 ////////////////////////////////////////////////////////////////////////////////
852 /// Combined implementation for GetDeclFileName(), GetImplFileName():
853 /// Return declaration / implementation file name (depending on decl);
854 /// return the full path if filesys is true.
855 
856 bool THtml::GetDeclImplFileName(TClass * cl, bool filesys, bool decl, TString& out_name) const
857 {
858  out_name = "";
859 
862  // whether we need to determine the fil name
863  bool determine = (!cdi); // no cdi
864  if (!determine) determine |= decl && filesys && !cdi->GetDeclFileSysName()[0];
865  if (!determine) determine |= decl && !filesys && !cdi->GetDeclFileName()[0];
866  if (!determine) determine |= !decl && filesys && !cdi->GetImplFileSysName()[0];
867  if (!determine) determine |= !decl && !filesys && !cdi->GetImplFileName()[0];
868  if (determine) {
869  TString name;
870  TString sysname;
871  if (decl) {
872  if (!GetFileDefinition().GetDeclFileName(cl, name, sysname))
873  return false;
874  } else {
875  if (!GetFileDefinition().GetImplFileName(cl, name, sysname))
876  return false;
877  }
878  if (cdi) {
879  if (decl) {
880  if (!cdi->GetDeclFileName() || !cdi->GetDeclFileName()[0])
881  cdi->SetDeclFileName(name);
882  if (!cdi->GetDeclFileSysName() || !cdi->GetDeclFileSysName()[0])
883  cdi->SetDeclFileSysName(sysname);
884  } else {
885  if (!cdi->GetImplFileName() || !cdi->GetImplFileName()[0])
886  cdi->SetImplFileName(name);
887  if (!cdi->GetImplFileSysName() || !cdi->GetImplFileSysName()[0])
888  cdi->SetImplFileSysName(sysname);
889  }
890  }
891 
892  if (filesys) out_name = sysname;
893  else out_name = name;
894  return true;
895  }
896  if (filesys) {
897  if (decl) out_name = cdi->GetDeclFileSysName();
898  else out_name = cdi->GetImplFileSysName();
899  } else {
900  if (decl) out_name = cdi->GetDeclFileName();
901  else out_name = cdi->GetImplFileName();
902  }
903  return true;
904 }
905 
906 ////////////////////////////////////////////////////////////////////////////////
907 /// Return the output directory as set by SetOutputDir().
908 /// Create it if it doesn't exist and if createDir is kTRUE.
909 
910 const TString& THtml::GetOutputDir(Bool_t createDir /*= kTRUE*/) const
911 {
912  if (createDir) {
914 
915  gSystem->ExpandPathName(const_cast<THtml*>(this)->fPathInfo.fOutputDir);
916  Long64_t sSize;
917  Long_t sId, sFlags, sModtime;
920  Int_t st = gSystem->GetPathInfo(fPathInfo.fOutputDir, &sId, &sSize, &sFlags, &sModtime);
921  if (st || !(sFlags & 2)) {
922  if (st == 0)
923  Error("GetOutputDir", "output directory %s is an existing file",
925  else if (gSystem->MakeDirectory(fPathInfo.fOutputDir) == -1)
926  Error("GetOutputDir", "output directory %s does not exist and can't create it", fPathInfo.fOutputDir.Data());
927  }
928  }
929  return fPathInfo.fOutputDir;
930 }
931 
932 ////////////////////////////////////////////////////////////////////////////////
933 /// Check whether cl is a namespace
934 
936 {
937  return (cl->Property() & kIsNamespace);
938 }
939 
940 ////////////////////////////////////////////////////////////////////////////////
941 /// Load all libraries known to ROOT via the rootmap system.
942 
944 {
945  TEnv* mapfile = gInterpreter->GetMapfile();
946  if (!mapfile || !mapfile->GetTable()) return;
947 
948  std::set<std::string> loadedlibs;
949  std::set<std::string> failedlibs;
950 
951  TEnvRec* rec = 0;
952  TIter iEnvRec(mapfile->GetTable());
953  while ((rec = (TEnvRec*) iEnvRec())) {
954  TString libs = rec->GetValue();
955  TString lib;
956  Ssiz_t pos = 0;
957  while (libs.Tokenize(lib, pos)) {
958  // check that none of the libs failed to load
959  if (failedlibs.find(lib.Data()) != failedlibs.end()) {
960  // don't load it or any of its dependencies
961  libs = "";
962  break;
963  }
964  }
965  pos = 0;
966  while (libs.Tokenize(lib, pos)) {
967  // ignore libCore - it's already loaded
968  if (lib.BeginsWith("libCore"))
969  continue;
970 
971  if (loadedlibs.find(lib.Data()) == loadedlibs.end()) {
972  // just load the first library - TSystem will do the rest.
973  gSystem->Load(lib);
974  loadedlibs.insert(lib.Data());
975  }
976  }
977  }
978 }
979 
980 
981 ////////////////////////////////////////////////////////////////////////////////
982 /// Produce documentation for all the classes specified in the filter (by default "*")
983 /// To process all classes having a name starting with XX, do:
984 /// html.MakeAll(kFALSE,"XX*");
985 /// If force=kFALSE (default), only the classes that have been modified since
986 /// the previous call to this function will be generated.
987 /// If force=kTRUE, all classes passing the filter will be processed.
988 /// If numthreads is != -1, use numthreads threads, else decide automatically
989 /// based on the number of CPUs.
990 
991 void THtml::MakeAll(Bool_t force, const char *filter, int numthreads /*= -1*/)
992 {
993  MakeIndex(filter);
994 
995  if (numthreads == 1) {
996  // CreateListOfClasses(filter); already done by MakeIndex
997  TClassDocInfo* classinfo = 0;
998  TIter iClassInfo(&fDocEntityInfo.fClasses);
999  UInt_t count = 0;
1000 
1001  while ((classinfo = (TClassDocInfo*)iClassInfo())) {
1002  if (!classinfo->IsSelected())
1003  continue;
1004  fCounter.Form("%5d", fDocEntityInfo.fClasses.GetSize() - count++);
1005  MakeClass(classinfo, force);
1006  }
1007  } else {
1008  if (numthreads == -1) {
1009  SysInfo_t sysinfo;
1010  gSystem->GetSysInfo(&sysinfo);
1011  numthreads = sysinfo.fCpus;
1012  if (numthreads < 1)
1013  numthreads = 2;
1014  }
1015  fThreadedClassCount = 0;
1017  THtmlThreadInfo hti(this, force);
1018  if (!fMakeClassMutex && gGlobalMutex) {
1019  gGlobalMutex->Lock();
1021  gGlobalMutex->UnLock();
1022  }
1023 
1024  TList threads;
1025  gSystem->Load("libThread");
1026  while (--numthreads >= 0) {
1027  TThread* thread = new TThread(MakeClassThreaded, &hti);
1028  thread->Run();
1029  threads.Add(thread);
1030  }
1031 
1032  TIter iThread(&threads);
1033  TThread* thread = 0;
1034  Bool_t wait = kTRUE;
1035  while (wait) {
1036  while (wait && (thread = (TThread*) iThread()))
1037  wait &= (thread->GetState() == TThread::kRunningState);
1039  gSystem->Sleep(500);
1040  }
1041 
1042  iThread.Reset();
1043  while ((thread = (TThread*) iThread()))
1044  thread->Join();
1045  }
1046  fCounter.Remove(0);
1047 }
1048 
1049 
1050 ////////////////////////////////////////////////////////////////////////////////
1051 /// Make HTML files for a single class
1052 ///
1053 ///
1054 /// Input: className - name of the class to process
1055 ///
1056 
1057 void THtml::MakeClass(const char *className, Bool_t force)
1058 {
1059  CreateListOfClasses("*");
1060 
1062  if (!cdi) {
1063  if (!TClassEdit::IsStdClass(className)) // stl classes won't be available, so no warning
1064  Error("MakeClass", "Unknown class '%s'!", className);
1065  return;
1066  }
1067 
1068  MakeClass(cdi, force);
1069 }
1070 
1071 ////////////////////////////////////////////////////////////////////////////////
1072 /// Make HTML files for a single class
1073 ///
1074 ///
1075 /// Input: cdi - doc info for class to process
1076 ///
1077 
1078 void THtml::MakeClass(void *cdi_void, Bool_t force)
1079 {
1081  CreateListOfClasses("*");
1082 
1083  TClassDocInfo* cdi = (TClassDocInfo*) cdi_void;
1084  TClass* currentClass = dynamic_cast<TClass*>(cdi->GetClass());
1085 
1086  if (!currentClass) {
1087  if (!cdi->GetClass() &&
1088  !TClassEdit::IsStdClass(cdi->GetName())) // stl classes won't be available, so no warning
1089  Error("MakeClass", "Class '%s' is known, but I cannot find its TClass object!", cdi->GetName());
1090  return;
1091  }
1092  TString htmlFile(cdi->GetHtmlFileName());
1093  if (htmlFile.Length()
1094  && (htmlFile.BeginsWith("http://")
1095  || htmlFile.BeginsWith("https://")
1096  || gSystem->IsAbsoluteFileName(htmlFile))
1097  ) {
1098  htmlFile.Remove(0);
1099  }
1100  if (htmlFile.Length()) {
1101  TClassDocOutput cdo(*this, currentClass, &cdi->GetListOfTypedefs());
1102  cdo.Class2Html(force);
1103  cdo.MakeTree(force);
1104  } else {
1105  TString what(cdi->GetName());
1106  what += " (sources not found)";
1107  Printf(fCounterFormat.Data(), "-skipped-", fCounter.Data(), what.Data());
1108  }
1109 }
1110 
1111 
1112 ////////////////////////////////////////////////////////////////////////////////
1113 /// Entry point of worker threads for multi-threaded MakeAll().
1114 /// info points to an (internal) THtmlThreadInfo object containing the current
1115 /// THtml object, and whether "force" was passed to MakeAll().
1116 /// The thread will poll GetNextClass() until no further class is available.
1117 
1118 void* THtml::MakeClassThreaded(void* info) {
1119  const THtmlThreadInfo* hti = (const THtmlThreadInfo*)info;
1120  if (!hti) return 0;
1121  TClassDocInfo* classinfo = 0;
1122  while ((classinfo = hti->GetHtml()->GetNextClass()))
1123  hti->GetHtml()->MakeClass(classinfo, hti->GetForce());
1124 
1125  return 0;
1126 }
1127 
1128 ////////////////////////////////////////////////////////////////////////////////
1129 /// Create the index files for the product, modules, all types, etc.
1130 /// By default all classes are indexed (if filter="*");
1131 /// to generate an index for all classes starting with "XX", do
1132 /// html.MakeIndex("XX*");
1133 
1134 void THtml::MakeIndex(const char *filter)
1135 {
1136  CreateListOfClasses(filter);
1137 
1138  TDocOutput output(*this);
1139  // create indices
1140  output.CreateTypeIndex();
1141  output.CreateClassTypeDefs();
1142  output.CreateModuleIndex();
1143  output.CreateClassIndex();
1144  output.CreateProductIndex();
1145 
1146  // create a class hierarchy
1147  output.CreateHierarchy();
1148 }
1149 
1150 
1151 ////////////////////////////////////////////////////////////////////////////////
1152 /// Make an inheritance tree
1153 ///
1154 ///
1155 /// Input: className - name of the class to process
1156 ///
1157 
1158 void THtml::MakeTree(const char *className, Bool_t force)
1159 {
1160  // create canvas & set fill color
1161  TClass *classPtr = GetClass(className);
1162 
1163  if (!classPtr) {
1164  Error("MakeTree", "Unknown class '%s' !", className);
1165  return;
1166  }
1167 
1168  TClassDocOutput cdo(*this, classPtr, 0);
1169  cdo.MakeTree(force);
1170 }
1171 
1172 ////////////////////////////////////////////////////////////////////////////////
1173 /// Set whether "dot" (a GraphViz utility) is available
1174 
1178 }
1179 
1180 ////////////////////////////////////////////////////////////////////////////////
1181 /// Fill the files available in the file system below fPathInfo.fInputPath
1182 
1184 {
1185  if (fLocalFiles) delete fLocalFiles;
1187 }
1188 
1189 ////////////////////////////////////////////////////////////////////////////////
1190 /// Set the module defining object to be used; can also be a user derived
1191 /// object (a la traits).
1192 
1194 {
1195  delete fModuleDef;
1197  fModuleDef->SetOwner(const_cast<THtml*>(this));
1198 }
1199 
1200 
1201 ////////////////////////////////////////////////////////////////////////////////
1202 /// Set the file defining object to be used; can also be a user derived
1203 /// object (a la traits).
1204 
1206 {
1207  delete fFileDef;
1208  fFileDef = (TFileDefinition*) md.Clone();
1209  fFileDef->SetOwner(const_cast<THtml*>(this));
1210 }
1211 
1212 
1213 ////////////////////////////////////////////////////////////////////////////////
1214 /// Set the path defining object to be used; can also be a user derived
1215 /// object (a la traits).
1216 
1218 {
1219  delete fPathDef;
1220  fPathDef = (TPathDefinition*) md.Clone();
1221  fPathDef->SetOwner(const_cast<THtml*>(this));
1222 }
1223 
1224 
1225 ////////////////////////////////////////////////////////////////////////////////
1226 /// Set the directory containing the source files.
1227 /// The source file for a class MyClass will be searched
1228 /// by prepending dir to the value of
1229 /// MyClass::Class()->GetImplFileName() - which can contain
1230 /// directory information!
1231 /// Also resets the class structure, in case new files can
1232 /// be found after this call.
1233 
1234 void THtml::SetInputDir(const char *dir)
1235 {
1236  fPathInfo.fInputPath = dir;
1238 
1239  // reset class table
1242 }
1243 
1244 ////////////////////////////////////////////////////////////////////////////////
1245 /// Set the directory where the HTML pages shuold be written to.
1246 /// If the directory does not exist it will be created when needed.
1247 
1248 void THtml::SetOutputDir(const char *dir)
1249 {
1250  fPathInfo.fOutputDir = dir;
1251 #ifdef R__WIN32
1252  fPathInfo.fOutputDir.ReplaceAll("/","\\");
1253 #endif
1254 }
1255 
1256 ////////////////////////////////////////////////////////////////////////////////
1257 /// Explicitly set a decl file name for TClass cl.
1258 
1260 {
1262  if (!cdi) {
1263  cdi = new TClassDocInfo(cl, "" /*html*/, "" /*fsdecl*/, "" /*fsimpl*/, filename);
1265  } else
1266  cdi->SetDeclFileName(filename);
1267 }
1268 
1269 ////////////////////////////////////////////////////////////////////////////////
1270 /// Explicitly set a impl file name for TClass cl.
1271 
1273 {
1275  if (!cdi) {
1276  cdi = new TClassDocInfo(cl, "" /*html*/, "" /*fsdecl*/, "" /*fsimpl*/, 0 /*decl*/, filename);
1278  } else
1279  cdi->SetImplFileName(filename);
1280 }
1281 
1282 ////////////////////////////////////////////////////////////////////////////////
1283 /// Get short type name, i.e. with default templates removed.
1284 
1285 const char* THtml::ShortType(const char* name) const
1286 {
1287  const char* tmplt = strchr(name, '<');
1288  if (!tmplt) return name;
1289  tmplt = strrchr(tmplt, ':');
1290  if (tmplt > name && tmplt[-1] == ':') {
1291  // work-around for CINT bug: template instantiation can produce bogus
1292  // typedefs e.g. in namespace ROOT::Math::ROOT::Math instead of ROOT::Math.
1293  TString namesp(name, tmplt - name - 1);
1294  // is the enclosing namespace known?
1295  if (!GetClass(namesp)) return name;
1296  }
1298  if (!scn) {
1299  scn = new TNamed(name, TClassEdit::ShortType(name, 1<<7));
1301  }
1302  return scn->GetTitle();
1303 }
TPathDefinition * fPathDef
Definition: THtml.h:419
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:928
virtual Int_t GetEntries() const
Definition: TCollection.h:92
Bool_t IsSelected() const
Definition: TDocInfo.h:71
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1265
static Bool_t IsNamespace(const TClass *cl)
Check whether cl is a namespace.
Definition: THtml_001.C:935
void MakeIndex(const char *filter="*")
Create the index files for the product, modules, all types, etc.
Definition: THtml_001.C:1134
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:864
TModuleDocInfo * GetModule() const
Definition: TDocInfo.h:68
void SetSelected(Bool_t sel=kTRUE)
Definition: TDocInfo.h:119
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition: TSystem.cxx:945
void SetLocalFiles() const
Fill the files available in the file system below fPathInfo.fInputPath.
Definition: THtml_001.C:1183
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3448
static void * MakeClassThreaded(void *info)
Entry point of worker threads for multi-threaded MakeAll().
Definition: THtml_001.C:1118
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:420
virtual bool GetModule(TClass *cl, TFileSysEntry *fse, TString &out_modulename) const
Set out_modulename to cl's module name; return true if it's valid.
Definition: THtml.cxx:103
virtual TVirtualMutex * Factory(Bool_t=kFALSE)=0
TFileSysDB * fLocalFiles
Definition: THtml.h:422
TString fProductName
Definition: THtml.h:409
Bool_t CopyFileFromEtcDir(const char *filename) const
Copy a file from $ROOTSYS/etc/html into GetOutputDir()
Definition: THtml_001.C:645
virtual void CreateProductIndex()
Fetch documentation from THtml::GetProductDocDir() and put it into the product index page...
Int_t fThreadedClassCount
Definition: THtml.h:411
Bool_t HaveDot()
Check whether dot is available in $PATH or in the directory set by SetDotPath()
Definition: THtml_001.C:142
long long Long64_t
Definition: RtypesCore.h:69
virtual void CreateTypeIndex()
Create index of all data types.
EState GetState() const
Definition: TThread.h:138
virtual Int_t UnLock()=0
Ssiz_t Length() const
Definition: TString.h:390
virtual void CreateAuxiliaryFiles() const
copy CSS, javascript file, etc to the output dir
Definition: THtml_001.C:19
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:97
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:212
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
Definition: TBaseClass.cxx:62
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1363
void SetViewCVS(const char *url)
Definition: THtml.h:284
LinkInfo_t fLinkInfo
Definition: THtml.h:415
void AddClass(TClassDocInfo *cl)
Definition: TDocInfo.h:122
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:892
TFileDefinition * fFileDef
Definition: THtml.h:421
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:821
void SetOwner(THtml *html)
Set the THtml object owning this object; if it's already set to a different THtml object than issue a...
Definition: THtml.cxx:73
THashList fClasses
Definition: THtml.h:388
static void LoadAllLibs()
Load all libraries known to ROOT via the rootmap system.
Definition: THtml_001.C:943
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
Definition: TClass.cxx:5652
const char * GetValue() const
Definition: TEnv.h:114
static const char * filename()
#define gROOT
Definition: TROOT.h:340
const char * GetSharedLibs()
Get the list of shared libraries containing the code for class cls.
Definition: TClass.cxx:3435
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1818
The TEnv class reads config files, by default named .rootrc.
Definition: TEnv.h:128
Basic string class.
Definition: TString.h:137
const TPathDefinition & GetPathDefinition() const
Return the TModuleDefinition (or derived) object as set by SetModuleDefinition(); create and return a...
Definition: THtml_001.C:59
virtual void CreateModuleIndex()
Create the class index for each module, picking up documentation from the module's TModuleDocInfo::Ge...
Definition: TDocOutput.cxx:801
TIter * fThreadedClassIter
Definition: THtml.h:410
const TString & GetInputPath() const
Definition: THtml.h:294
int Int_t
Definition: RtypesCore.h:41
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:996
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
#define gInterpreter
Definition: TInterpreter.h:502
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1511
TString fCounterFormat
Definition: THtml.h:408
void MakeAll(Bool_t force=kFALSE, const char *filter="*", int numthreads=1)
Produce documentation for all the classes specified in the filter (by default "*") To process all cla...
Definition: THtml_001.C:991
void MakeTree(const char *className, Bool_t force=kFALSE)
Make an inheritance tree.
Definition: THtml_001.C:1158
const char * ShortType(const char *name) const
Get short type name, i.e. with default templates removed.
Definition: THtml_001.C:1285
virtual bool GetDeclImplFileName(TClass *cl, bool filesys, bool decl, TString &out_name) const
Combined implementation for GetDeclFileName(), GetImplFileName(): Return declaration / implementation...
Definition: THtml_001.C:856
virtual const char * GetName() const
Returns name of object.
Definition: TDocInfo.cxx:26
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:558
void SetDeclFileName(TClass *cl, const char *filename)
Explicitly set a decl file name for TClass cl.
Definition: THtml_001.C:1259
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:310
void SetOutputDir(const char *dir)
Set the directory where the HTML pages shuold be written to.
Definition: THtml_001.C:1248
TString fOutputDir
Definition: THtml.h:227
void Reset()
Definition: TCollection.h:161
virtual void AddLast(TObject *obj)
Add object at the end of the list.
Definition: TList.cxx:136
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1501
void MakeTree(Bool_t force=kFALSE)
Create an output file with a graphical representation of the class inheritance.
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
Definition: TList.cxx:770
static void Init()
const char * Data() const
Definition: TString.h:349
void SetImplFileName(TClass *cl, const char *filename)
Explicitly set a impl file name for TClass cl.
Definition: THtml_001.C:1272
void MakeClass(const char *className, Bool_t force=kFALSE)
Make HTML files for a single class.
Definition: THtml_001.C:1057
TString fIgnorePath
Definition: THtml.h:222
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TObject.cxx:203
const TFileDefinition & GetFileDefinition() const
Return the TFileDefinition (or derived) object as set by SetFileDefinition(); create and return a TFi...
Definition: THtml_001.C:45
virtual void GetModuleNameForClass(TString &module, TClass *cl) const
Return the module name for a given class.
Definition: THtml_001.C:269
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2334
TDictionary * GetClass() const
Definition: TDocInfo.h:59
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition: TSystem.cxx:441
const char * GetDeclFileName() const
Definition: TDocInfo.h:62
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual void CreateHierarchy()
Create a hierarchical class list The algorithm descends from the base classes and branches into all d...
Definition: TDocOutput.cxx:640
virtual Bool_t IsEmpty() const
Definition: TCollection.h:99
void CreateListOfClasses(const char *filter)
Create the list of all known classes.
Definition: THtml_001.C:284
virtual Int_t Lock()=0
virtual void CreateJavascript() const
Write the default ROOT style sheet.
Definition: THtml_001.C:675
TString fInputPath
Definition: THtml.h:220
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Definition: TSystem.cxx:1054
std::vector< std::vector< double > > Data
const char * GetImplFileName() const
Definition: TClass.h:408
const char * GetDeclFileSysName() const
Definition: TDocInfo.h:64
TString fDotDir
Definition: THtml.h:225
void HelperDeleted(THelperBase *who)
Inform the THtml object that one of its helper objects was deleted.
Definition: THtml_001.C:169
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
virtual bool GetDeclFileName(const TClass *cl, TString &out_filename, TString &out_fsys, TFileSysEntry **fse=0) const
Determine cl's declaration file name.
Definition: THtml.cxx:261
Int_t Run(void *arg=0)
Start the thread.
Definition: TThread.cxx:551
TString fROOTURL
Definition: THtml.h:370
const char * GetURL(const char *lib=0) const
Get the documentation URL for library lib.
Definition: THtml_001.C:126
A doubly linked list.
Definition: TList.h:47
static const char * what
Definition: stlLoader.cc:6
R__EXTERN TVirtualMutex * gGlobalMutex
Definition: TVirtualMutex.h:29
DocEntityInfo_t fDocEntityInfo
Definition: THtml.h:418
virtual const char * GetSoExt() const
Get the shared library extension.
Definition: TSystem.cxx:3837
TString fClassFilter
Definition: THtml.h:387
R__EXTERN const char * gProgName
Definition: TSystem.h:234
TList & GetListOfTypedefs()
Definition: TDocInfo.h:83
Definition: TEnv.h:91
void Clear(Option_t *option="")
Remove all objects from the list.
Definition: THashList.cxx:167
Int_t fCpus
Definition: TSystem.h:165
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2220
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
void GetDerivedClasses(TClass *cl, std::map< TClass *, Int_t > &derived) const
fill derived with all classes inheriting from cl and their inheritance distance to cl ...
Definition: THtml_001.C:694
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:46
std::map< std::string, TString > fLibURLs
Definition: THtml.h:371
virtual void NameSpace2FileName(TString &name)
Replace "::" in name by "__" Replace "<", ">", " ", ",", "~", "=" in name by "_" Replace "A::X"...
TString fCounter
Definition: THtml.h:407
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:494
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:391
virtual void CreateStyleSheet() const
Write the default ROOT style sheet.
Definition: THtml_001.C:682
THashList fModules
Definition: THtml.h:390
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void CreateClassTypeDefs()
Create a forwarding page for each typedef pointing to a class.
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
Long_t Join(void **ret=0)
Join this thread.
Definition: TThread.cxx:498
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:657
void Convert(const char *filename, const char *title, const char *dirname="", const char *relpath="../", Int_t includeOutput=kNoOutput, const char *context="")
It converts a single text file to HTML.
Definition: THtml_001.C:201
const TModuleDefinition & GetModuleDefinition() const
Return the TModuleDefinition (or derived) object as set by SetModuleDefinition(); create and return a...
Definition: THtml_001.C:31
THashList * GetTable() const
Definition: TEnv.h:144
TVirtualMutex * GetMakeClassMutex() const
Definition: THtml.h:342
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
void SetFileDefinition(const TFileDefinition &fd)
Set the file defining object to be used; can also be a user derived object (a la traits).
Definition: THtml_001.C:1205
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2240
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:35
void SetImplFileName(const char *name)
Definition: TDocInfo.h:77
#define Printf
Definition: TGeoToOCC.h:18
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
long Long_t
Definition: RtypesCore.h:50
int Ssiz_t
Definition: RtypesCore.h:63
virtual bool GetDeclFileName(TClass *cl, Bool_t filesys, TString &out_name) const
Return declaration file name; return the full path if filesys is true.
Definition: THtml_001.C:838
void Class2Html(Bool_t force=kFALSE)
Create HTML files for a single class.
void CreateListOfTypes()
Create index of all data types and a page for each typedef-to-class.
Definition: THtml_001.C:635
virtual Int_t GetSize() const
Definition: TCollection.h:95
void Convert(std::istream &in, const char *infilename, const char *outfilename, const char *title, const char *relpath="../", Int_t includeOutput=0, const char *context="", TGClient *gclient=0)
Convert a text file into a html file.
Definition: TDocOutput.cxx:311
static char * Next()
Returns next class from sorted class table.
virtual TClass * GetClass(const char *name) const
*-*-*-*-*Return pointer to class with name*-*-*-*-*-*-*-*-*-*-*-*-* *-* =============================...
Definition: THtml_001.C:807
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:415
void CreateHierarchy()
Create the inheritance hierarchy diagram for all classes.
Definition: THtml_001.C:666
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
unsigned long ULong_t
Definition: RtypesCore.h:51
TVirtualMutex * fMakeClassMutex
Definition: THtml.h:412
void SetSelected(Bool_t sel=kTRUE)
Definition: TDocInfo.h:70
TList * GetClasses()
Definition: TDocInfo.h:123
TGClient * fGClient
Definition: THtml.h:413
#define R__LOCKGUARD(mutex)
void SetImplFileSysName(const char *fsname)
Definition: TDocInfo.h:79
TModuleDefinition * fModuleDef
Definition: THtml.h:420
virtual void CreateClassIndex()
Create index of all classes.
Definition: TDocOutput.cxx:693
TString fMacroPath
Definition: THtml.h:224
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2881
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:348
TString fEtcDir
Definition: THtml.h:226
virtual const char * GetEtcDir() const
Get the directory containing THtml's auxiliary files ($ROOTSYS/etc/html)
Definition: THtml_001.C:72
void SetPathDefinition(const TPathDefinition &pd)
Set the path defining object to be used; can also be a user derived object (a la traits).
Definition: THtml_001.C:1217
void SetFoundDot(Bool_t found=kTRUE)
Set whether "dot" (a GraphViz utility) is available.
Definition: THtml_001.C:1175
Int_t Match(const TString &s, UInt_t start=0)
Runs a match on s against the regex 'this' was created with.
Definition: TPRegexp.cxx:704
#define name(a, b)
Definition: linkTestLib0.cpp:5
const char * GetImplFileName() const
Definition: TDocInfo.h:63
Mother of all ROOT objects.
Definition: TObject.h:58
const TString & GetViewCVS() const
Definition: THtml.h:312
PathInfo_t fPathInfo
Definition: THtml.h:417
const char * GetDeclFileName() const
Definition: TClass.h:386
void SetHtmlFileName(const char *name)
Definition: TDocInfo.h:75
void SetInputDir(const char *dir)
Set the directory containing the source files.
Definition: THtml_001.C:1234
virtual void Add(TObject *obj)
Definition: TList.h:81
const Ssiz_t kNPOS
Definition: Rtypes.h:115
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:103
R__EXTERN const char * gRootDir
Definition: TSystem.h:233
void SetDeclFileSysName(const char *fsname)
Definition: TDocInfo.h:78
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
const char * GetHtmlFileName() const
Definition: TDocInfo.h:61
const TString & GetOutputDir(Bool_t createDir=kTRUE) const
Return the output directory as set by SetOutputDir().
Definition: THtml_001.C:910
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE)
Copy a file.
Definition: TSystem.cxx:1310
R__EXTERN Int_t gDebug
Definition: Rtypes.h:128
THashList fShortClassNames
Definition: THtml.h:389
void SetModuleDefinition(const TModuleDefinition &md)
Set the module defining object to be used; can also be a user derived object (a la traits)...
Definition: THtml_001.C:1193
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4579
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1243
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:582
static void output(int code)
Definition: gifencode.c:226
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:459
virtual bool GetImplFileName(TClass *cl, Bool_t filesys, TString &out_name) const
Return implementation file name.
Definition: THtml_001.C:846
const char * GetImplFileSysName() const
Definition: TDocInfo.h:65
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1044
void AddMacroPath(const char *path)
that the directive is run on.
Definition: THtml_001.C:3
Bool_t HaveSource() const
Definition: TDocInfo.h:72
virtual bool GetImplFileName(const TClass *cl, TString &out_filename, TString &out_fsys, TFileSysEntry **fse=0) const
Determine cl's implementation file name.
Definition: THtml.cxx:278
gr SetName("gr")
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition: TString.cxx:466
virtual int GetSysInfo(SysInfo_t *info) const
Returns static system info, like OS type, CPU type, number of CPUs RAM size, etc into the SysInfo_t s...
Definition: TSystem.cxx:2412
EDotAccess fFoundDot
Definition: THtml.h:219
void SetDeclFileName(const char *name)
Definition: TDocInfo.h:76
virtual void GetHtmlFileName(TClass *classPtr, TString &filename) const
Return real HTML filename.
Definition: THtml_001.C:731
TClassDocInfo * GetNextClass()
Return the next class to be generated for MakeClassThreaded.
Definition: THtml_001.C:100
void SetModule(TModuleDocInfo *module)
Definition: TDocInfo.h:67
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904