Logo ROOT  
Reference Guide
THtml.cxx
Go to the documentation of this file.
1 // @(#)root/html:$Id$
2 // Author: Nenad Buncic (18/10/95), Axel Naumann (09/28/01)
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "THtml.h"
13 #include "RConfigure.h"
14 #include "Riostream.h"
15 #include "TBaseClass.h"
16 #include "TClass.h"
17 #include "TClassDocOutput.h"
18 #include "TClassEdit.h"
19 #include "TClassTable.h"
20 #include "TDataType.h"
21 #include "TDocInfo.h"
22 #include "TDocOutput.h"
23 #include "TEnv.h"
24 #include "TInterpreter.h"
25 #include "TObjString.h"
26 #include "TObjArray.h"
27 #include "TPRegexp.h"
28 #include "TRegexp.h"
29 #include "TROOT.h"
30 #include "TSystem.h"
31 #include "TThread.h"
32 
33 #include <stdlib.h>
34 #include <string.h>
35 #include <ctype.h>
36 #include <set>
37 #include <fstream>
38 
39 THtml *gHtml = 0;
40 
41 //______________________________________________________________________________
42 //______________________________________________________________________________
43 namespace {
44  class THtmlThreadInfo {
45  public:
46  THtmlThreadInfo(THtml* html, bool force): fHtml(html), fForce(force) {}
47  Bool_t GetForce() const {return fForce;}
48  THtml* GetHtml() const {return fHtml;}
49 
50  private:
51  THtml* fHtml;
52  Bool_t fForce;
53  };
54 };
55 
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 /// Helper's destructor.
59 /// Check that no THtml object is attached to the helper - it might still need it!
60 
62 {
63  if (fHtml) {
64  fHtml->HelperDeleted(this);
65  }
66 }
67 
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Set the THtml object owning this object; if it's already set to
71 /// a different THtml object than issue an error message and signal to
72 /// the currently set object that we are not belonging to it anymore.
73 
75  if (fHtml && html && html != fHtml) {
76  Error("SetOwner()", "Object already owned by an THtml instance!");
77  fHtml->HelperDeleted(this);
78  }
79  fHtml = html;
80 }
81 
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Set out_modulename to cl's module name; return true if it's valid.
85 /// If applicable, the module contains super modules separated by "/".
86 ///
87 /// ROOT takes the directory part of cl's implementation file name
88 /// (or declaration file name, if the implementation file name is empty),
89 /// removes the last subdirectory if it is "src/" or "inc/", and interprets
90 /// the remaining path as the module hierarchy, converting it to upper case.
91 /// hist/histpainter/src/THistPainter.cxx thus becomes the module
92 /// HIST/HISTPAINTER. (Node: some ROOT packages get special treatment.)
93 /// If the file cannot be mapped into this scheme, the class's library
94 /// name (without directories, leading "lib" prefix or file extensions)
95 /// ius taken as the module name. If the module cannot be determined it is
96 /// set to "USER" and false is returned.
97 ///
98 /// If your software cannot be mapped into this scheme then derive your
99 /// own class from TModuleDefinition and pass it to THtml::SetModuleDefinition().
100 ///
101 /// The fse parameter is used to determine the relevant part of the path, i.e.
102 /// to not include parent directories of a TFileSysRoot.
103 
105  TString& out_modulename) const
106 {
107  out_modulename = "USER";
108  if (!cl) return false;
109 
110  // Filename: impl or decl?
111  TString filename;
112  if (fse) fse->GetFullName(filename, kFALSE);
113  else {
114  if (!GetOwner()->GetImplFileName(cl, kFALSE, filename))
115  if (!GetOwner()->GetDeclFileName(cl, kFALSE, filename))
116  return false;
117  }
118  TString inputdir = GetOwner()->GetInputPath();
119  TString tok;
120  Ssiz_t start = 0;
121  // For -Idir/sub and A.h in dir/sub/A.h, use sub as module name if
122  // it would eb empty otherwise.
123  TString trailingInclude;
124  while (inputdir.Tokenize(tok, start, THtml::GetDirDelimiter())) {
125  if (filename.BeginsWith(tok)) {
126  if (tok.EndsWith("/") || tok.EndsWith("\\"))
127  tok.Remove(tok.Length() - 1);
128  trailingInclude = gSystem->BaseName(tok);
129  filename.Remove(0, tok.Length());
130  break;
131  }
132  }
133 
134  // take the directory name without "/" or leading "."
135  out_modulename = gSystem->GetDirName(filename);
136 
137  while (out_modulename[0] == '.')
138  out_modulename.Remove(0, 1);
139  out_modulename.ReplaceAll("\\", "/");
140  while (out_modulename[0] == '/')
141  out_modulename.Remove(0, 1);
142  while (out_modulename.EndsWith("/"))
143  out_modulename.Remove(out_modulename.Length() - 1);
144 
145  if (!out_modulename[0])
146  out_modulename = trailingInclude;
147 
148  if (!out_modulename[0])
149  out_modulename = trailingInclude;
150 
151  // remove "/src", "/inc"
152  if (out_modulename.EndsWith("/src")
153  || out_modulename.EndsWith("/inc"))
154  out_modulename.Remove(out_modulename.Length() - 4, 4);
155  else {
156  // remove "/src/whatever", "/inc/whatever"
157  Ssiz_t pos = out_modulename.Index("/src/");
158  if (pos == kNPOS)
159  pos = out_modulename.Index("/inc/");
160  if (pos != kNPOS)
161  out_modulename.Remove(pos);
162  }
163 
164  while (out_modulename.EndsWith("/"))
165  out_modulename.Remove(out_modulename.Length() - 1);
166 
167  // special treatment:
168  if (out_modulename == "MATH/GENVECTOR")
169  out_modulename = "MATHCORE";
170  else if (out_modulename == "MATH/MATRIX")
171  out_modulename = "SMATRIX";
172  else if (!out_modulename.Length()) {
173  const char* cname= cl->GetName();
174  if (strstr(cname, "::SMatrix<") || strstr(cname, "::SVector<"))
175  out_modulename = "SMATRIX";
176  else if (strstr(cname, "::TArrayProxy<") || strstr(cname, "::TClaArrayProxy<")
177  || strstr(cname, "::TImpProxy<") || strstr(cname, "::TClaImpProxy<"))
178  out_modulename = "TREEPLAYER";
179  else {
180  // determine the module name from the library name:
181  out_modulename = cl->GetSharedLibs();
182  Ssiz_t pos = out_modulename.Index(' ');
183  if (pos != kNPOS)
184  out_modulename.Remove(pos, out_modulename.Length());
185  if (out_modulename.BeginsWith("lib"))
186  out_modulename.Remove(0,3);
187  pos = out_modulename.Index('.');
188  if (pos != kNPOS)
189  out_modulename.Remove(pos, out_modulename.Length());
190 
191  if (!out_modulename.Length()) {
192  out_modulename = "USER";
193  return false;
194  }
195  }
196  }
197 
198  return true;
199 }
200 
201 ////////////////////////////////////////////////////////////////////////////////
202 /// Create all permutations of path and THtml's input path:
203 /// path being PP/ and THtml's input being .:include/:src/ gives
204 /// .:./PP/:include:include/PP/:src/:src/PP
205 
207 {
208  THtml* owner = GetOwner();
209  if (!owner) return;
210 
211  TString pathext;
212  TString inputdir = owner->GetInputPath();
213  TString tok;
214  Ssiz_t start = 0;
215  while (inputdir.Tokenize(tok, start, THtml::GetDirDelimiter())) {
216  if (pathext.Length())
217  pathext += GetDirDelimiter();
218  if (tok.EndsWith("\\"))
219  tok.Remove(tok.Length() - 1);
220  pathext += tok;
221  if (path.BeginsWith(tok))
222  pathext += GetDirDelimiter() + path;
223  else
224  pathext += GetDirDelimiter() + tok + "/" + path;
225  }
226  path = pathext;
227 
228 }
229 
230 ////////////////////////////////////////////////////////////////////////////////
231 /// Given a class name with a scope, split the class name into directory part
232 /// and file name: A::B::C becomes module B, filename C.
233 
235  TString& filename) const
236 {
237  TString token;
238  Ssiz_t from = 0;
239  filename = "";
240  dir = "";
241  while (clname.Tokenize(token, from, "::") ) {
242  dir = filename;
243  filename = token;
244  }
245 
246  // convert from Scope, class to module, filename.h
247  dir.ToLower();
248 }
249 
250 
251 ////////////////////////////////////////////////////////////////////////////////
252 /// Determine cl's declaration file name. Usually it's just
253 /// cl->GetDeclFileName(), but sometimes conversions need to be done
254 /// like include/ to abc/cde/inc/. If no declaration file name is
255 /// available, look for b/inc/C.h for class A::B::C. out_fsys will contain
256 /// the file system's (i.e. local machine's) full path name to the file.
257 /// The function returns false if the class's header file cannot be found.
258 ///
259 /// If your software cannot be mapped into this scheme then derive your
260 /// own class from TFileDefinition and pass it to THtml::SetFileDefinition().
261 
263  TString& out_fsys, TFileSysEntry** fse) const
264 {
265  return GetFileName(cl, true, out_filename, out_fsys, fse);
266 }
267 
268 ////////////////////////////////////////////////////////////////////////////////
269 /// Determine cl's implementation file name. Usually it's just
270 /// cl->GetImplFileName(), but sometimes conversions need to be done.
271 /// If no implementation file name is available look for b/src/C.cxx for
272 /// class A::B::C. out_fsys will contain the file system's (i.e. local
273 /// machine's) full path name to the file.
274 /// The function returns false if the class's source file cannot be found.
275 ///
276 /// If your software cannot be mapped into this scheme then derive your
277 /// own class from TFileDefinition and pass it to THtml::SetFileDefinition().
278 
280  TString& out_fsys, TFileSysEntry** fse) const
281 {
282  return GetFileName(cl, false, out_filename, out_fsys, fse);
283 }
284 
285 
286 ////////////////////////////////////////////////////////////////////////////////
287 /// Remove "/./" and collapse "/subdir/../" to "/"
288 
290 {
291  static const char* delim[] = {"/", "\\\\"};
292  for (int i = 0; i < 2; ++i) {
293  const char* d = delim[i];
294  filename = filename.ReplaceAll(TString::Format("%c.%c", d[0], d[0]), TString(d[0]));
295  TPRegexp reg(TString::Format("%s[^%s]+%s\\.\\.%s", d, d, d, d));
296  while (reg.Substitute(filename, TString(d[0]), "", 0, 1)) {}
297  }
298  if (filename.BeginsWith("./") || filename.BeginsWith(".\\"))
299  filename.Remove(0,2);
300 }
301 
302 
303 ////////////////////////////////////////////////////////////////////////////////
304 /// Find filename in the list of system files; return the system file name
305 /// and change filename to the file name as included.
306 /// filename must be normalized (no "/./" etc) before calling.
307 
309 {
310  const TList* bucket = GetOwner()->GetLocalFiles()->GetEntries().GetListForObject(gSystem->BaseName(filename));
311  TString filesysname;
312  if (bucket) {
313  TIter iFS(bucket);
314  TFileSysEntry* fsentry = 0;
315  while ((fsentry = (TFileSysEntry*) iFS())) {
316  if (!filename.EndsWith(fsentry->GetName()))
317  continue;
318  fsentry->GetFullName(filesysname, kTRUE); // get the short version
319  filename = filesysname;
320  if (!filename.EndsWith(filesysname)) {
321  // It's something - let's see whether we find something better
322  // else leave it as plan B. This helps finding Reflex sources.
323  //filesysname = "";
324  continue;
325  }
326  fsentry->GetFullName(filesysname, kFALSE); // get the long version
327  if (fse) *fse = fsentry;
328  break;
329  }
330  }
331  return filesysname;
332 }
333 
334 
335 ////////////////////////////////////////////////////////////////////////////////
336 /// Common implementation for GetDeclFileName(), GetImplFileName()
337 
338 bool THtml::TFileDefinition::GetFileName(const TClass* cl, bool decl,
339  TString& out_filename, TString& out_fsys,
340  TFileSysEntry** fse) const
341 {
342  out_fsys = "";
343 
344  if (!cl) {
345  out_filename = "";
346  return false;
347  }
348 
349  TString possibleFileName;
350  TString possiblePath;
351  TString filesysname;
352 
353  TString clfile = decl ? cl->GetDeclFileName() : cl->GetImplFileName();
354  NormalizePath(clfile);
355 
356  out_filename = clfile;
357  if (clfile.Length()) {
358  // check that clfile doesn't start with one of the include paths;
359  // that's not what we want (include/TObject.h), we want the actual file
360  // if it exists (core/base/inc/TObject.h)
361 
362  // special case for TMath namespace:
363  if (clfile == "include/TMathBase.h") {
364  clfile = "math/mathcore/inc/TMath.h";
365  out_filename = clfile;
366  }
367 
368  TString inclDir;
369  TString inclPath(GetOwner()->GetPathInfo().fIncludePath);
370  Ssiz_t pos = 0;
371  Ssiz_t longestMatch = kNPOS;
372  while (inclPath.Tokenize(inclDir, pos, GetOwner()->GetDirDelimiter())) {
373  if (clfile.BeginsWith(inclDir) && (longestMatch == kNPOS || inclDir.Length() > longestMatch))
374  longestMatch = inclDir.Length();
375  }
376  if (longestMatch != kNPOS) {
377  clfile.Remove(0, longestMatch);
378  if (clfile.BeginsWith("/") || clfile.BeginsWith("\\"))
379  clfile.Remove(0, 1);
380  TString asincl(clfile);
381  GetOwner()->GetPathDefinition().GetFileNameFromInclude(asincl, clfile);
382  out_filename = clfile;
383  } else {
384  // header file without a -Iinclude-dir prefix
385  filesysname = MatchFileSysName(out_filename, fse);
386  if (filesysname[0]) {
387  clfile = out_filename;
388  }
389  }
390  } else {
391  // check for a file named like the class:
392  filesysname = cl->GetName();
393  int templateLevel = 0;
394  Ssiz_t end = filesysname.Length();
395  Ssiz_t start = end - 1;
396  for (; start >= 0 && (templateLevel || filesysname[start] != ':'); --start) {
397  if (filesysname[start] == '>')
398  ++templateLevel;
399  else if (filesysname[start] == '<') {
400  --templateLevel;
401  if (!templateLevel)
402  end = start;
403  }
404  }
405  filesysname = filesysname(start + 1, end - start - 1);
406  if (decl)
407  filesysname += ".h";
408  else
409  filesysname += ".cxx";
410  out_filename = filesysname;
411  filesysname = MatchFileSysName(out_filename, fse);
412  if (filesysname[0]) {
413  clfile = out_filename;
414  }
415  }
416 
417  if (!decl && !clfile.Length()) {
418  // determine possible impl file name from the decl file name,
419  // replacing ".whatever" by ".cxx", and looking for it in the known
420  // file names
421  TString declSysFileName;
422  if (GetFileName(cl, true, filesysname, declSysFileName)) {
423  filesysname = gSystem->BaseName(filesysname);
424  Ssiz_t posExt = filesysname.Last('.');
425  if (posExt != kNPOS)
426  filesysname.Remove(posExt);
427  filesysname += ".cxx";
428  out_filename = filesysname;
429  filesysname = MatchFileSysName(out_filename, fse);
430  if (filesysname[0]) {
431  clfile = out_filename;
432  }
433  }
434  }
435 
436  if (clfile.Length() && !decl) {
437  // Do not return the source file for these packages, even though we can find them.
438  // THtml needs to have the class description in the source file if it finds the
439  // source file, and these classes have their class descriptions in the header files.
440  // THtml needs to be improved to collect all of a class' documentation before writing
441  // it out, so it can take the class doc from the header even though a source exists.
442  static const char* vetoClasses[] = {"math/mathcore/", "math/mathmore/", "math/genvector/",
443  "math/minuit2/", "math/smatrix/"};
444  for (unsigned int i = 0; i < sizeof(vetoClasses) / sizeof(char*); ++i) {
445  if (clfile.Contains(vetoClasses[i])) {
446  // of course there are exceptions from the exceptions:
447  // TComplex and TRandom, TRandom1,...
448  if (strcmp(cl->GetName(), "TComplex")
449  && strcmp(cl->GetName(), "TMath")
450  && strncmp(cl->GetName(), "TKDTree", 7)
451  && strcmp(cl->GetName(), "TVirtualFitter")
452  && strncmp(cl->GetName(), "TRandom", 7)) {
453  out_filename = "";
454  return false;
455  } else break;
456  }
457  }
458  }
459 
460 
461  if (!clfile.Length()) {
462  // determine possible decl file name from class + scope name:
463  // A::B::C::myclass will result in possible file name myclass.h
464  // in directory C/inc/
465  out_filename = cl->GetName();
466  if (!out_filename.Contains("::")) {
467  out_filename = "";
468  return false;
469  }
470  SplitClassIntoDirFile(out_filename, possiblePath, possibleFileName);
471 
472  // convert from Scope, class to module, filename.h
473  if (possibleFileName.Length()) {
474  if (decl)
475  possibleFileName += ".h";
476  else
477  possibleFileName += ".cxx";
478  }
479  if (possiblePath.Length())
480  possiblePath += "/";
481  if (decl)
482  possiblePath += "inc/";
483  else
484  possiblePath += "src/";
485  out_filename = possiblePath + "/" + possibleFileName;
486  } else {
487  possiblePath = gSystem->GetDirName(clfile);
488  possibleFileName = gSystem->BaseName(clfile);
489  }
490 
491  if (possiblePath.Length())
492  ExpandSearchPath(possiblePath);
493  else possiblePath=".";
494 
495  out_fsys = gSystem->FindFile(possiblePath, possibleFileName, kReadPermission);
496  if (out_fsys.Length()) {
497  NormalizePath(out_fsys);
498  return true;
499  }
500  out_filename = "";
501  return false;
502 }
503 
504 ////////////////////////////////////////////////////////////////////////////////
505 /// Determine the path to look for macros (see TDocMacroDirective) for
506 /// classes from a given module. If the path was successfully determined return true.
507 /// For ROOT, this directory is the "doc/macros" subdirectory of the module
508 /// directory; the path returned is GetDocDir(module) + "/macros".
509 ///
510 /// If your software cannot be mapped into this scheme then derive your
511 /// own class from TPathDefinition and pass it to THtml::SetPathDefinition().
512 
514 {
515  TString moduledoc;
516  if (!GetDocDir(module, moduledoc))
517  return false;
518  if (moduledoc.EndsWith("\\"))
519  moduledoc.Remove(moduledoc.Length() - 1);
520 
521  TString macropath(GetOwner()->GetMacroPath());
522  TString macrodirpart;
523  out_dir = "";
524  Ssiz_t pos = 0;
525  while (macropath.Tokenize(macrodirpart, pos, ":")) {
526  out_dir += moduledoc + "/" + macrodirpart + ":";
527  }
528  return true;
529 }
530 
531 
532 ////////////////////////////////////////////////////////////////////////////////
533 /// Determine the module's documentation directory. If module is empty,
534 /// set doc_dir to the product's documentation directory.
535 /// If the path was successfully determined return true.
536 /// For ROOT, this directory is the subdir "doc/" in the
537 /// module's path; the directory returned is module + "/doc".
538 ///
539 /// If your software cannot be mapped into this scheme then derive your
540 /// own class from TPathDefinition and pass it to THtml::SetPathDefinition().
541 
543 {
544  doc_dir = "";
545  if (GetOwner()->GetProductName() == "ROOT") {
546  doc_dir = "$ROOTSYS";
547  gSystem->ExpandPathName(doc_dir);
548  doc_dir += "/";
549  }
550 
551  if (module.Length())
552  doc_dir += module + "/";
553  doc_dir += GetOwner()->GetPathInfo().fDocPath;
554  return true;
555 }
556 
557 
558 ////////////////////////////////////////////////////////////////////////////////
559 /// Determine the path and filename used in an include statement for the
560 /// header file of the given class. E.g. the class ROOT::Math::Boost is
561 /// meant to be included as "Math/Genvector/Boost.h" - which is what
562 /// out_dir is set to. GetIncludeAs() returns whether the include
563 /// statement's path was successfully determined.
564 ///
565 /// Any leading directory part that is part of fIncludePath (see SetIncludePath)
566 /// will be removed. For ROOT, leading "include/" is removed; everything after
567 /// is the include path.
568 ///
569 /// If your software cannot be mapped into this scheme then derive your
570 /// own class from TPathDefinition and pass it to THtml::SetPathDefinition().
571 
573 {
574  out_dir = "";
575  if (!cl || !GetOwner()) return false;
576 
577  TString hdr;
578  if (!GetOwner()->GetDeclFileName(cl, kFALSE, hdr))
579  return false;
580 
581  out_dir = hdr;
582  bool includePathMatches = false;
583  TString tok;
584  Ssiz_t pos = 0;
585  while (!includePathMatches && GetOwner()->GetPathInfo().fIncludePath.Tokenize(tok, pos, THtml::GetDirDelimiter()))
586  if (out_dir.BeginsWith(tok)) {
587  out_dir = hdr(tok.Length(), hdr.Length());
588  if (out_dir[0] == '/' || out_dir[0] == '\\')
589  out_dir.Remove(0, 1);
590  includePathMatches = true;
591  }
592 
593  if (!includePathMatches) {
594  // We probably have a file super/module/inc/optional/filename.h.
595  // That gets translated into optional/filename.h.
596  // Assume that only one occurrence of "/inc/" exists in hdr.
597  // If /inc/ is not part of the include file name then
598  // just return the full path.
599  // If we have matched any include path then this ROOT-only
600  // algorithm is skipped!
601  Ssiz_t posInc = hdr.Index("/inc/");
602  if (posInc == kNPOS) return true;
603  hdr.Remove(0, posInc + 5);
604  out_dir = hdr;
605  }
606 
607  return (out_dir.Length());
608 }
609 
610 
611 ////////////////////////////////////////////////////////////////////////////////
612 /// Set out_fsname to the full pathname corresponding to a file
613 /// included as "included". Return false if this file cannot be determined
614 /// or found. For ROOT, out_fsname corresponds to included prepended with
615 /// "include"; only THtml prefers to work on the original files, e.g.
616 /// core/base/inc/TObject.h instead of include/TObject.h, so the
617 /// default implementation searches the TFileSysDB for an entry with
618 /// basename(included) and with matching directory part, setting out_fsname
619 /// to the TFileSysEntry's path.
620 
621 bool THtml::TPathDefinition::GetFileNameFromInclude(const char* included, TString& out_fsname) const
622 {
623  if (!included) return false;
624 
625  out_fsname = included;
626 
627  TString incBase(gSystem->BaseName(included));
628  const TList* bucket = GetOwner()->GetLocalFiles()->GetEntries().GetListForObject(incBase);
629  if (!bucket) return false;
630 
631  TString alldir = gSystem->GetDirName(included);
632  TObjArray* arrSubDirs = alldir.Tokenize("/");
633  TIter iEntry(bucket);
634  TFileSysEntry* entry = 0;
635  while ((entry = (TFileSysEntry*) iEntry())) {
636  if (incBase != entry->GetName()) continue;
637  // find entry with matching enclosing directory
638  THtml::TFileSysDir* parent = entry->GetParent();
639  for (int i = arrSubDirs->GetEntries() - 1; parent && i >= 0; --i) {
640  const TString& subdir(((TObjString*)(*arrSubDirs)[i])->String());
641  if (!subdir.Length() || subdir == ".")
642  continue;
643  if (subdir == parent->GetName())
644  parent = parent->GetParent();
645  else parent = 0;
646  }
647  if (parent) {
648  // entry found!
649  entry->GetFullName(out_fsname, kFALSE);
650  delete arrSubDirs;
651  return true;
652  }
653  }
654  delete arrSubDirs;
655  return false;
656 }
657 
658 ////////////////////////////////////////////////////////////////////////////////
659 /// Recursively fill entries by parsing the contents of path.
660 
661 void THtml::TFileSysDir::Recurse(TFileSysDB* db, const char* path)
662 {
663  TString dir(path);
664  if (gDebug > 0 || GetLevel() < 2)
665  Info("Recurse", "scanning %s...", path);
666  TPMERegexp regexp(db->GetIgnore());
667  dir += "/";
668  void* hDir = gSystem->OpenDirectory(dir);
669  const char* direntry = 0;
670  while ((direntry = gSystem->GetDirEntry(hDir))) {
671  if (!direntry[0] || direntry[0] == '.' || regexp.Match(direntry)) continue;
672  TString entryPath(dir + direntry);
673  if (gSystem->AccessPathName(entryPath, kReadPermission))
674  continue;
675  FileStat_t buf;
676  if (!gSystem->GetPathInfo(entryPath, buf)) {
677  if (R_ISDIR(buf.fMode)) {
678  // skip if we would nest too deeply, and skip soft links:
679  if (GetLevel() > db->GetMaxLevel()
680 #ifndef R__WIN32
681  || db->GetMapIno().GetValue(buf.fIno)
682 #endif
683  ) continue;
684  TFileSysDir* subdir = new TFileSysDir(direntry, this);
685  fDirs.Add(subdir);
686 #ifndef R__WIN32
687  db->GetMapIno().Add(buf.fIno, (Long_t)subdir);
688 #endif
689  subdir->Recurse(db, entryPath);
690  } else {
691  int delen = strlen(direntry);
692  // only .cxx and .h, .hxx are taken
693  if (strcmp(direntry + delen - 4, ".cxx")
694  && strcmp(direntry + delen - 2, ".h")
695  && strcmp(direntry + delen - 4, ".hxx"))
696  continue;
697  TFileSysEntry* entry = new TFileSysEntry(direntry, this);
698  db->GetEntries().Add(entry);
699  fFiles.Add(entry);
700  }
701  } // if !gSystem->GetPathInfo()
702  } // while dir entry
703  gSystem->FreeDirectory(hDir);
704 }
705 
706 
707 ////////////////////////////////////////////////////////////////////////////////
708 /// Recursively fill entries by parsing the path specified in GetName();
709 /// can be a THtml::GetDirDelimiter() delimited list of paths.
710 
712 {
713  TString dir;
714  Ssiz_t posPath = 0;
715  while (fName.Tokenize(dir, posPath, THtml::GetDirDelimiter())) {
716  gSystem->ExpandPathName(dir);
718  Warning("Fill", "Cannot read InputPath \"%s\"!", dir.Data());
719  continue;
720  }
721  FileStat_t buf;
722  if (!gSystem->GetPathInfo(dir, buf) && R_ISDIR(buf.fMode)) {
723 #ifndef R__WIN32
724  TFileSysRoot* prevroot = (TFileSysRoot*) (Long_t)GetMapIno().GetValue(buf.fIno);
725  if (prevroot != 0) {
726  Warning("Fill", "InputPath \"%s\" already present as \"%s\"!", dir.Data(), prevroot->GetName());
727  continue;
728  }
729 #endif
730  TFileSysRoot* root = new TFileSysRoot(dir, this);
731  fDirs.Add(root);
732 #ifndef R__WIN32
733  GetMapIno().Add(buf.fIno, (Long_t)root);
734 #endif
735  root->Recurse(this, dir);
736  } else {
737  Warning("Fill", "Cannot read InputPath \"%s\"!", dir.Data());
738  }
739  }
740 }
741 
742 
743 /** \class THtml
744 \brief Legacy ROOT documentation system.
745 
746 \deprecated
747 We keep THtml for those who still need it for legacy use cases.
748 ROOT has since several years moved to [doxygen](https://www.doxygen.nl) as documentation generator.
749 THtml is not developed nor supported anymore; please migrate to [doxygen](https://www.doxygen.nl) instead.
750 
751 <p>The THtml class is designed to easily document
752 classes, code, and code related text files (like change logs). It generates HTML
753 pages conforming to the XHTML 1.0 transitional specifications; an example of
754 these pages is ROOT's own <a href="http://root.cern.ch/root/html/ClassIndex.html">
755 reference guide</a>. This page was verified to be valid XHTML 1.0 transitional,
756 which proves that all pages generated by THtml can be valid, as long as the user
757 provided XHTML (documentation, header, etc) is valid. You can check the current
758 THtml by clicking this icon:
759 <a href="http://validator.w3.org/check?uri=referer"><img
760  src="http://www.w3.org/Icons/valid-xhtml10"
761  alt="Valid XHTML 1.0 Transitional" height="31" width="88" style="border: none;"/></a></p>
762 Overview:
763 <ol style="list-style-type: upper-roman;">
764  <li><a href="#usage">Usage</a></li>
765  <li><a href="#conf">Configuration</a>
766  <ol><li><a href="#conf:input">Input files</a></li>
767  <li><a href="#conf:output">Output directory</a></li>
768  <li><a href="#conf:liblink">Linking other documentation</a></li>
769  <li><a href="#conf:classdoc">Recognizing class documentation</a></li>
770  <li><a href="#conf:tags">Author, copyright, etc.</a></li>
771  <li><a href="#conf:header">Header and footer</a></li>
772  <li><a href="#conf:search">Links to searches, home page, ViewVC</a></li>
773  <li><a href="#conf:charset">HTML Charset</a></li>
774  </ol></li>
775  <li><a href="#syntax">Documentation syntax</a>
776  <ol><li><a href="#syntax:classdesc">Class description</a></li>
777  <li><a href="#syntax:classidx">Class index</a></li>
778  <li><a href="#syntax:meth">Method documentation</a></li>
779  <li><a href="#syntax:datamem">Data member documentation</a></li>
780  </ol></li>
781  <li><a href="#directive">Documentation directives</a>
782  <ol><li><a href="#directive:html"><tt>BEGIN<!-- -->_HTML</tt> <tt>END<!-- -->_HTML</tt>: include 'raw' HTML</a></li>
783  <li><a href="#directive:macro"><tt>BEGIN<!-- -->_MACRO</tt> <tt>END<!-- -->_MACRO</tt>: include a picture generated by a macro</a></li>
784  <li><a href="#directive:latex"><tt>BEGIN<!-- -->_LATEX</tt> <tt>END<!-- -->_LATEX</tt>: include a latex picture</a></li>
785  </ol></li>
786  <li><a href="#index">Product and module index</a></li>
787  <li><a href="#aux">Auxiliary files: style sheet, JavaScript, help page</a></li>
788  <li><a href="#charts">Class Charts</a></li>
789  <li><a href="#confvar">Configuration variables</a></li>
790  <li><a href="#how">Behind the scenes</a></li>
791 </ol>
792 
793 
794 <h3><a name="usage">I. Usage</a></h3>
795 These are typical things people do with THtml:
796 <pre>
797  root[] <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> html; // create a <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> object
798  root[] html.LoadAllLibs(); // Load all rootmap'ed libraries
799  root[] html.MakeAll(); // generate documentation for all changed classes
800 </pre>
801 or to run on just a few classes:
802 <pre>
803  root[] <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> html; // create a <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> object
804  root[] html.MakeIndex(); // create auxiliary files (style sheet etc) and indices
805  root[] html.MakeClass("TMyClass"); // create documentation for TMyClass only
806 </pre>
807 To "beautify" (i.e. create links to documentation for class names etc) some text
808 file or macro, use:
809 <pre>
810  root[] html.Convert( "hsimple.C", "Histogram example" )
811 </pre>
812 
813 
814 <h3><a name="conf">II. Configuration</a></h3>
815 Most configuration options can be set as a call to THtml, or as a TEnv variable,
816 which you can set in your .rootrc.
817 
818 <h4><a name="conf:input">II.1 Input files</a></h4>
819 
820 <p>In your .rootrc, define Root.Html.SourceDir to point to directories containing
821 .cxx and .h files (see: <a href="http://root.cern.ch/root/html/TEnv.html">TEnv</a>)
822 of the classes you want to document, or call THtml::SetInputDir()</p>
823 
824 <p>Example:</p><pre>
825  Root.Html.SourceDir: .:src:include
826  Root.Html.Root: http://root.cern.ch/root/html</pre>
827 
828 
829 <h4><a name="conf:output">II.2 Output directory</a></h4>
830 
831 <p>The output directory can be specified using the Root.Html.OutputDir
832 configuration variable (default value: "htmldoc"). If that directory
833 doesn't exist <a href="http://root.cern.ch/root/html/THtml.html">THtml</a>
834 will create it.</p>
835 
836 <p>Example:</p><pre>
837  Root.Html.OutputDir: htmldoc</pre>
838 
839 <h4><a name="conf:liblink">II.3 Linking other documentation</a></h4>
840 
841 <p>When trying to document a class, THtml searches for a source file in
842 the directories set via SetInputDir(). If it cannot find it, it assumes
843 that this class must have been documented before. Based on the library
844 this class is defined in, it checks the configuration variable
845 <tt>Root.Html.LibName</tt>, and creates a link using its value.
846 Alternatively, you can set these URLs via THtml::SetLibURL().</p>
847 
848 <p>Example:<br/>
849 If a class MyClass is defined in class mylibs/libMyLib.so, and .rootrc
850 contains</p><pre>
851  Root.Html.MyLib: ../mylib/</pre>
852 <p>THtml will create a link to "../mylib/MyClass.html".</p>
853 
854 <p>The library name association can be set up using the rootmap facility.
855 For the library in the example above, which contains a dictionary
856 generated from the linkdef MyLinkdef.h, the command to generate the
857 rootmap file is</p>
858 <pre> $ rlibmap -f -r rootmap -l mylib/libMyLib.so -d libCore.so -c MyLinkdef.h</pre>
859 <p>Here, <tt>-r</tt> specifies that the entries for libMyLib should be updated,
860 <tt>-l</tt> specifies the library we're dealing with, <tt>-d</tt> its
861 dependencies, and <tt>-c</tt> its linkdef. The rootmap file must be within
862 one of the <tt>LD_LIBRARY_PATH</tt> (or <tt>PATH</tt> for Windows) directories
863 when ROOT is started, otherwise ROOT will not use it.</p>
864 
865 <h4><a name="conf:classdoc">II.4 Recognizing class documentation</a></h4>
866 
867 <p>The class documentation has to appear in the header file containing the
868 class, right in front of its declaration. It is introduced by a string
869 defined by Root.Html.Description or SetClassDocTag(). See the section on
870 <a href="#syntax">documentation syntax</a> for further details.</p>
871 
872 <p>Example:</p><pre>
873  Root.Html.Description: //____________________</pre>
874 
875 <p>The class documentation will show which include statement is to be used
876 and which library needs to be linked to access it.
877 The include file name is determined via
878 <a href="http://root.cern.ch/root/html/TClass.html#TClass:GetDeclFileName">
879 TClass::GetDeclFileName()</a>;
880 leading parts are removed if they match any of the ':' separated entries in
881 THtml::GetIncludePath().</p>
882 
883 <h4><a name="conf:tags">II.5 Author, copyright, etc.</a></h4>
884 
885 <p>During the conversion,
886 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will look for
887 some strings ("tags") in the source file, which have to appear right in
888 front of e.g. the author's name, copyright notice, etc. These tags can be
889 defined with the following environment variables: Root.Html.Author,
890 Root.Html.LastUpdate and Root.Html.Copyright, or with
891 SetAuthorTag(), SetLastUpdateTag(), SetCopyrightTag().</p>
892 
893 <p>If the LastUpdate tag is not found, the current date and time are used.
894 This is useful when using
895 <a href="http://root.cern.ch/root/html/THtml.html#THtml:MakeAll">THtml::MakeAll()</a>'s
896 default option force=kFALSE, in which case
897 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> generates
898 documentation only for changed classes.</p>
899 
900 Authors can be a comma separated list of author entries. Each entry has
901 one of the following two formats
902 <ul><li><tt>Name (non-alpha)</tt>.
903 <p><a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will generate an
904 HTML link for <tt>Name</tt>, taking the Root.Html.XWho configuration
905 variable (defaults to "http://consult.cern.ch/xwho/people?") and adding
906 all parts of the name with spaces replaces by '+'. Non-alphanumerical
907 characters are printed out behind <tt>Name</tt>.</p>
908 
909 <p>Example:</p>
910 <tt>// Author: Enrico Fermi</tt> appears in the source file.
911 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will generate the link
912 <tt>http://consult.cern.ch/xwho/people?Enrico+Fermi</tt>. This works well for
913 people at CERN.</li>
914 
915 <li><tt>Name &lt;link&gt; Info</tt>.
916 <p><a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will generate
917 an HTML link for <tt>Name</tt> as specified by <tt>link</tt> and print
918 <tt>Info</tt> behind <tt>Name</tt>.</p>
919 
920 <p>Example:</p>
921 <tt>// Author: Enrico Fermi &lt;http://www.enricos-home.it&gt;</tt> or<br/>
922 <tt>// Author: Enrico Fermi &lt;mailto:enrico@fnal.gov&gt;</tt> in the
923 source file. That's world compatible.</li>
924 </ul>
925 
926 <p>Example (with defaults given):</p><pre>
927  Root.Html.Author: // Author:
928  Root.Html.LastUpdate: // @(#)
929  Root.Html.Copyright: * Copyright
930  Root.Html.XWho: http://consult.cern.ch/xwho/people?</pre>
931 
932 
933 <h4><a name="conf:header">II.6 Header and footer</a></h4>
934 
935 <p><a href="http://root.cern.ch/root/html/THtml.html">THtml</a> generates
936 a default header and footer for all pages. You can
937 specify your own versions with the configuration variables Root.Html.Header
938 and Root.Html.Footer, or by calling SetHeader(), SetFooter().
939 Both variables default to "", using the standard Root
940 versions. If it has a "+" appended, <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will
941 write both versions (user and root) to a file, for the header in the order
942 1st root, 2nd user, and for the footer 1st user, 2nd root (the root
943 versions containing "&lt;html&gt;" and &lt;/html&gt; tags, resp).</p>
944 
945 <p>If you want to replace root's header you have to write a file containing
946 all HTML elements necessary starting with the &lt;doctype&gt; tag and ending with
947 (and including) the &lt;body&gt; tag. If you add your header it will be added
948 directly after Root's &lt;body&gt; tag. Any occurrence of the string <tt>%TITLE%</tt>
949 in the user's header file will be replaced by
950 a sensible, automatically generated title. If the header is generated for a
951 class, occurrences of <tt>%CLASS%</tt> will be replaced by the current class's name,
952 <tt>%SRCFILE%</tt> and <tt>%INCFILE%</tt> by the name of the source and header file, resp.
953 (as given by <a href="http://root.cern.ch/root/html/TClass.html#TClass:GetImplFileLine">TClass::GetImplFileName()</a>,
954 <a href="http://root.cern.ch/root/html/TClass.html#TClass:GetImplFileLine">TClass::GetDeclFileName()</a>).
955 If the header is not generated for a class, they will be replaced by "".</p>
956 
957 <p>Root's footer starts with the tag &lt;!--SIGNATURE--&gt;. It includes the
958 author(s), last update, copyright, the links to the Root home page, to the
959 user home page, to the index file (ClassIndex.html), to the top of the page
960 and <tt>this page is automatically generated</tt> information. It ends with the
961 tags <tt>&lt;/body&gt;&lt;/html&gt;</tt>. If you want to replace it,
962 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will search for some
963 tags in your footer: Occurrences of the strings <tt>%AUTHOR%</tt>, <tt>%UPDATE%</tt>, and
964 <tt>%COPYRIGHT%</tt> are replaced by their
965 corresponding values before writing the html file. The <tt>%AUTHOR%</tt> tag will be
966 replaced by the exact string that follows Root.Html.Author, no link
967 generation will occur.</p>
968 
969 
970 <h4><a name="conf:search">II.7 Links to searches, home page, ViewVC</a></h4>
971 
972 <p>Additional parameters can be set by Root.Html.Homepage (address of the
973 user's home page), Root.Html.SearchEngine (search engine for the class
974 documentation), Root.Html.Search (search URL, where %u is replaced by the
975 referer and %s by the escaped search expression), and a ViewVC base URL
976 Root.Html.ViewCVS. For the latter, the file name is appended or, if
977 the URL contains %f, %f is replaced by the file name.
978 All values default to "".</p>
979 
980 <p>Examples:</p><pre>
981  Root.Html.Homepage: http://www.enricos-home.it
982  Root.Html.SearchEngine: http://root.cern.ch/root/Search.phtml
983  Root.Html.Search: http://www.google.com/search?q=%s+site%3A%u</pre>
984 
985 
986 <h4><a name="conf:charset">II.8 HTML Charset</a></h4>
987 
988 <p>XHTML 1.0 transitional recommends the specification of the charset in the
989 content type meta tag, see e.g. <a href="http://www.w3.org/TR/2002/REC-xhtml1-20020801/">http://www.w3.org/TR/2002/REC-xhtml1-20020801/</a>
990 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> generates it for the HTML output files. It defaults to ISO-8859-1, and
991 can be changed using Root.Html.Charset.</p>
992 
993 <p>Example:</p><pre>
994  Root.Html.Charset: EUC-JP</pre>
995 
996 <h3><a name="syntax">III. Documentation syntax</a></h3>
997 <h4><a name="syntax:classdesc">III.1 Class description</a></h4>
998 
999 <p>A class description block, which must be placed before the first
1000 member function, has a following form:</p>
1001 <pre>
1002 ////////////////////////////////////////////////////////////////
1003 // //
1004 // TMyClass //
1005 // //
1006 // This is the description block. //
1007 // //
1008 ////////////////////////////////////////////////////////////////
1009 </pre>
1010 <p>The environment variable Root.Html.Description
1011 (see: <a href="http://root.cern.ch/root/html/TEnv.html">TEnv</a>) contains
1012 the delimiter string (default value: <tt>//_________________</tt>). It means
1013 that you can also write your class description block like this:</p>
1014 <pre>
1015  //_____________________________________________________________
1016  // A description of the class starts with the line above, and
1017  // will take place here !
1018  //
1019 </pre>
1020 <p>Note that <b><i>everything</i></b> until the first non-commented line is considered
1021 as a valid class description block.</p>
1022 
1023 <h4><a name="syntax:classidx">III.2 Class index</a></h4>
1024 
1025 <p>All classes to be documented will have an entry in the ClassIndex.html,
1026 showing their name with a link to their documentation page and a miniature
1027 description. This description for e.g. the class MyClass has to be given
1028 in MyClass's header as a comment right after ClassDef(MyClass, n).</p>
1029 
1030 <h4><a name="syntax:meth">III.3 Method documentation</a></h4>
1031 <p>A member function description block starts immediately after '{'
1032 and looks like this:</p>
1033 <pre>
1034  void TWorld::HelloWorldFunc(string *text)
1035  {
1036  // This is an example of description for the
1037  // TWorld member function
1038 
1039  helloWorld.Print( text );
1040  }
1041 </pre>
1042 Like in a class description block, <b><i>everything</i></b> until the first
1043 non-commented line is considered as a valid member function
1044 description block.
1045 
1046 If the rootrc variable <tt>Root.Html.DescriptionStyle</tt> is set to
1047 <tt>Doc++</tt> THtml will also look for method documentation in front of
1048 the function implementation. This feature is not recommended; source code
1049 making use of this does not comply to the ROOT documentation standards, which
1050 means future versions of THtml might not support it anymore.
1051 
1052 <h4><a name="syntax:datamem">III.4 Data member documentation</a></h4>
1053 
1054 <p>Data members are documented by putting a C++ comment behind their
1055 declaration in the header file, e.g.</p>
1056 <pre>
1057  int fIAmADataMember; // this is a data member
1058 </pre>
1059 
1060 
1061 <h3><a name="directive">IV. Documentation directives</a></h3>
1062 <em>NOTE that THtml does not yet support nested directives
1063 (i.e. latex inside html etc)!</em>
1064 
1065 <h4><a name="directive:html">IV.1 <tt>BEGIN<!-- -->_HTML</tt> <tt>END<!-- -->_HTML</tt>: include 'raw' HTML</a></h4>
1066 
1067 <p>You can insert pure html code into your documentation comments. During the
1068 generation of the documentation, this code will be inserted as is
1069 into the html file.</p>
1070 <p>Pure html code must be surrounded by the keywords
1071 <tt>BEGIN<!-- -->_HTML</tt> and <tt>END<!-- -->_HTML</tt>, where the
1072 case is ignored.
1073 An example of pure html code is this class description you are reading right now.
1074 THtml uses a
1075 <a href="http://root.cern.ch/root/html/TDocHtmlDirective.html">TDocHtmlDirective</a>
1076 object to process this directive.</p>
1077 
1078 <h4><a name="directive:macro">IV.2 <tt>BEGIN<!-- -->_MACRO</tt> <tt>END<!-- -->_MACRO</tt>: include a picture generated by a macro</a></h4>
1079 
1080 <p>THtml can create images from scripts. You can either call an external
1081 script by surrounding it by "begin_macro"/"end_macro", or include an unnamed
1082 macro within these keywords. The macro should return a pointer to an object;
1083 this object will then be saved as a GIF file.</p>
1084 <p>Objects deriving from
1085 <a href="http://root.cern.ch/root/html/TGObject.html">TGObject</a> (GUI elements)
1086 will need to run in graphics mode (non-batch). You must specify this as a parameter:
1087 "Begin_macro(GUI)...".
1088 To create a second tab that displays the source of the macro you can specify
1089 the argument "Begin_macro(source)...".
1090 Of course you can combine them,
1091 e.g. as "Begin_macro(source,gui)...".
1092 THtml uses a
1093 <a href="http://root.cern.ch/root/html/TDocMacroDirective.html">TDocMacroDirective</a>
1094 object to process this directive.</p>
1095 <p>This is an example:</p> END_HTML
1096 BEGIN_MACRO(source)
1097 {
1098  TCanvas* macro_example_canvas = new TCanvas("macro_example_canvas", "", 150, 150);
1099  macro_example_canvas->SetBorderSize(0);
1100  macro_example_canvas->SetFillStyle(1001);
1101  macro_example_canvas->SetFillColor(kWhite);
1102  macro_example_canvas->cd();
1103  TArc* macro_example_arc = new TArc(0.5,0.32,0.11,180,360);
1104  macro_example_arc->Draw();
1105  TEllipse* macro_example_ellipsis = new TEllipse(0.42,0.58,0.014,0.014,0,360,0);
1106  macro_example_ellipsis->SetFillStyle(0);
1107  macro_example_ellipsis->Draw();
1108  macro_example_ellipsis = new TEllipse(0.58,0.58,0.014,0.014,0,360,0);
1109  macro_example_ellipsis->SetFillStyle(0);
1110  macro_example_ellipsis->Draw();
1111  macro_example_ellipsis = new TEllipse(0.50,0.48,0.22,0.32,0,360,0);
1112  macro_example_ellipsis->SetFillStyle(0);
1113  macro_example_ellipsis->Draw();
1114  TLine* macro_example_line = new TLine(0.48,0.53,0.52,0.41);
1115  macro_example_line->Draw();
1116  return macro_example_canvas;
1117 }
1118 END_MACRO
1119 
1120 BEGIN_HTML
1121 <h4><a name="directive:latex">IV.3 <tt>BEGIN<!-- -->_LATEX</tt> <tt>END<!-- -->_LATEX</tt>: include a latex picture</a></h4>
1122 
1123 <p>You can specify <a href="http://root.cern.ch/root/html/TLatex.html">TLatex</a>
1124 style text and let THtml convert it into an image by surrounding it by "Begin_Latex", "End_Latex".
1125 You can have multiple lines, and e.g. align each line at the '=' sign by passing
1126 the argument <tt>separator='='</tt>. You can also specify how to align these parts;
1127 if you want the part left of the separator to be right aligned, and the right part
1128 to be left aligned, you could specify <tt>align='rl'</tt>.
1129 THtml uses a <a href="http://root.cern.ch/root/html/TDocLatexDirective.html">TDocLatexDirective</a>
1130 object to process the directive.
1131 This is an example output with arguments <tt>separator='=', align='rl'</tt>:</p>
1132 END_HTML BEGIN_LATEX(separator='=', align='rl')#kappa(x)^{2}=sin(x)^{x}
1133 x=#chi^{2} END_LATEX
1134 
1135 BEGIN_HTML
1136 
1137 <h3><a name="index">V. Product and module index</a></h3>
1138 
1139 <p><a href="#THtml:MakeIndex">THtml::MakeIndex()</a> will generate index files for classes
1140 and types, all modules, and the product which you can set by
1141 <a href="#THtml:SetProductName">THtml::SetProductName()</a>.
1142 THtml will make use of external documentation in the module and product index,
1143 either by linking it or by including it.
1144 The files for modules are searched based on the source file directory of the
1145 module's classes.</p>
1146 
1147 <p>A filename starting with "index." will be included in the index page;
1148 all other files will be linked.
1149 Only files ending on <tt>.html</tt> or <tt>.txt</tt> will be taken into account;
1150 the text files will first be run through
1151 <a href="#THtml:Convert">THtml::Convert()</a>.
1152 You can see an example <a href="http://root.cern.ch/root/html/HIST_Index.html">here</a>;
1153 the part between "Index of HIST classes" and "Jump to" is created by parsing
1154 the module's doc directory.</p>
1155 
1156 <h3><a name="aux">VI. Auxiliary files: style sheet, JavaScript, help page</a></h3>
1157 
1158 <p>The documentation pages share a common set of javascript and CSS files. They
1159 are generated automatically when running <a href="#THtml:MakeAll">MakeAll()</a>;
1160 they can be generated on
1161 demand by calling <a href="#THtml:CreateAuxiliaryFiles">CreateAuxiliaryFiles()</a>.</p>
1162 
1163 
1164 <h3><a name="charts">VII. Class Charts</a></h3>
1165 THtml can generate a number of graphical representations for a class, which
1166 are displayed as a tabbed set of imaged on-top of the class description.
1167 It can show the inheritance, inherited and hidden members, directly and
1168 indirectly included files, and library dependencies.
1169 
1170 These graphs are generated using the <a href="http://www.graphviz.org/">Graphviz</a>
1171 package. You can install it from <a href="http://www.graphviz.org">http://www.graphviz.org</a>.
1172 You can either put it into your $PATH, or tell THtml where to find it by calling
1173 <a href="#THtml:SetDotDir">SetDotDir()</a>.
1174 
1175 
1176 <h3><a name="confvar">VIII. Configuration variables</a></h3>
1177 
1178 <p>Here is a list of all configuration variables that are known to THtml.
1179 You can set them in your .rootrc file, see
1180 <a href="http://root.cern.ch/root/html/TEnv.html">TEnv</a>.</p>
1181 
1182 <pre>
1183  Root.Html.OutputDir (default: htmldoc)
1184  Root.Html.SourceDir (default: .:src/:include/)
1185  Root.Html.Author (default: // Author:) - start tag for authors
1186  Root.Html.LastUpdate (default: // @(#)) - start tag for last update
1187  Root.Html.Copyright (default: * Copyright) - start tag for copyright notice
1188  Root.Html.Description (default: //____________________ ) - start tag for class descr
1189  Root.Html.HomePage (default: ) - URL to the user defined home page
1190  Root.Html.Header (default: ) - location of user defined header
1191  Root.Html.Footer (default: ) - location of user defined footer
1192  Root.Html.Root (default: ) - URL of Root's class documentation
1193  Root.Html.SearchEngine (default: ) - link to the search engine
1194  Root.Html.Search (default: ) - link to search by replacing "%s" with user input
1195  Root.Html.ViewCVS (default: ) - URL of ViewCVS base
1196  Root.Html.XWho (default: http://consult.cern.ch/xwho/people?) - URL of CERN's xWho
1197  Root.Html.Charset (default: ISO-8859-1) - HTML character set
1198 </pre>
1199 
1200 <h3><a name="how">IX. Behind the scene</a></h3>
1201 
1202 <p>Internally, THtml is just an API class that sets up the list of known
1203 classes, and forwards API invocations to the "work horses".
1204 <a href="http://root.cern.ch/root/html/TDocOutput.html">TDocOutput</a>
1205 generates the output by letting a
1206 <a href="http://root.cern.ch/root/html/TDocParser.html">TDocParser</a>
1207 object parse the sources, which in turn invokes objects deriving from
1208 <a href="http://root.cern.ch/root/html/TDocDirective.html">TDocDirective</a>
1209 to process directives.</p>
1210 
1211 */
1212 
1213 ////////////////////////////////////////////////////////////////////////////////
1214 
1215 ClassImp(THtml);
1216 ////////////////////////////////////////////////////////////////////////////////
1217 /// Create a THtml object.
1218 /// In case output directory does not exist an error
1219 /// will be printed and gHtml stays 0 also zombie bit will be set.
1220 
1222  fCounterFormat("%12s %5s %s"),
1223  fProductName("(UNKNOWN PRODUCT)"),
1225  fGClient(0), fPathDef(0), fModuleDef(0), fFileDef(0),
1227 {
1228  // check for source directory
1229  fPathInfo.fInputPath = gEnv->GetValue("Root.Html.SourceDir", "./:src/:include/");
1230 
1231  // check for output directory
1232  SetOutputDir(gEnv->GetValue("Root.Html.OutputDir", "htmldoc"));
1233 
1234  fLinkInfo.fXwho = gEnv->GetValue("Root.Html.XWho", "http://consult.cern.ch/xwho/people?");
1235  fLinkInfo.fROOTURL = gEnv->GetValue("Root.Html.Root", "http://root.cern.ch/root/html");
1236  fDocSyntax.fClassDocTag = gEnv->GetValue("Root.Html.Description", "//____________________");
1237  fDocSyntax.fAuthorTag = gEnv->GetValue("Root.Html.Author", "// Author:");
1238  fDocSyntax.fLastUpdateTag = gEnv->GetValue("Root.Html.LastUpdate", "// @(#)");
1239  fDocSyntax.fCopyrightTag = gEnv->GetValue("Root.Html.Copyright", "* Copyright");
1240  fOutputStyle.fHeader = gEnv->GetValue("Root.Html.Header", "");
1241  fOutputStyle.fFooter = gEnv->GetValue("Root.Html.Footer", "");
1242  fLinkInfo.fHomepage = gEnv->GetValue("Root.Html.Homepage", "");
1243  fLinkInfo.fSearchStemURL = gEnv->GetValue("Root.Html.Search", "");
1244  fLinkInfo.fSearchEngine = gEnv->GetValue("Root.Html.SearchEngine", "");
1245  fLinkInfo.fViewCVS = gEnv->GetValue("Root.Html.ViewCVS", "");
1246  fOutputStyle.fCharset = gEnv->GetValue("Root.Html.Charset", "ISO-8859-1");
1247  fDocSyntax.fDocStyle = gEnv->GetValue("Root.Html.DescriptionStyle", "");
1248 
1251  // insert html object in the list of special ROOT objects
1252  if (!gHtml) {
1253  gHtml = this;
1254  gROOT->GetListOfSpecials()->Add(gHtml);
1255  }
1256 
1257 }
1258 
1259 
1260 ////////////////////////////////////////////////////////////////////////////////
1261 /// Default destructor
1262 
1264 {
1267  if (gHtml == this) {
1268  gROOT->GetListOfSpecials()->Remove(gHtml);
1269  gHtml = 0;
1270  }
1271  delete fPathDef;
1272  delete fModuleDef;
1273  delete fFileDef;
1274  delete fLocalFiles;
1275 }
1276 
1277 ////////////////////////////////////////////////////////////////////////////////
1278 /// Add path to the directories to be searched for macro files
1279 /// that are to be executed via the TDocMacroDirective
1280 /// ("Begin_Macro"/"End_Macro"); relative to the source file
1281 /// that the directive is run on.
1282 
1283 void THtml::AddMacroPath(const char* path)
1284 {
1285  const char pathDelimiter =
1286 #ifdef R__WIN32
1287  ';';
1288 #else
1289  ':';
1290 #endif
1291  fPathInfo.fMacroPath += pathDelimiter;
1292  fPathInfo.fMacroPath += path;
1293 }
1294 
1295 
1296 ////////////////////////////////////////////////////////////////////////////////
1297 /// copy CSS, javascript file, etc to the output dir
1298 
1300 {
1301  CreateJavascript();
1302  CreateStyleSheet();
1303  CopyFileFromEtcDir("HELP.html");
1304 }
1305 
1306 ////////////////////////////////////////////////////////////////////////////////
1307 /// Return the TModuleDefinition (or derived) object as set by
1308 /// SetModuleDefinition(); create and return a TModuleDefinition object
1309 /// if none was set.
1310 
1312 {
1313  if (!fModuleDef) {
1314  fModuleDef = new TModuleDefinition();
1315  fModuleDef->SetOwner(const_cast<THtml*>(this));
1316  }
1317  return *fModuleDef;
1318 }
1319 
1320 ////////////////////////////////////////////////////////////////////////////////
1321 /// Return the TFileDefinition (or derived) object as set by
1322 /// SetFileDefinition(); create and return a TFileDefinition object
1323 /// if none was set.
1324 
1326 {
1327  if (!fFileDef) {
1328  fFileDef = new TFileDefinition();
1329  fFileDef->SetOwner(const_cast<THtml*>(this));
1330  }
1331  return *fFileDef;
1332 }
1333 
1334 ////////////////////////////////////////////////////////////////////////////////
1335 /// Return the TModuleDefinition (or derived) object as set by
1336 /// SetModuleDefinition(); create and return a TModuleDefinition object
1337 /// if none was set.
1338 
1340 {
1341  if (!fPathDef) {
1342  fPathDef = new TPathDefinition();
1343  fPathDef->SetOwner(const_cast<THtml*>(this));
1344  }
1345  return *fPathDef;
1346 }
1347 
1348 
1349 ////////////////////////////////////////////////////////////////////////////////
1350 /// Get the directory containing THtml's auxiliary files ($ROOTSYS/etc/html)
1351 
1352 const char* THtml::GetEtcDir() const
1353 {
1354  if (fPathInfo.fEtcDir.Length())
1355  return fPathInfo.fEtcDir;
1356 
1358 
1359  fPathInfo.fEtcDir = "html";
1361 
1362  return fPathInfo.fEtcDir;
1363 }
1364 
1365 
1366 ////////////////////////////////////////////////////////////////////////////////
1367 /// Return the next class to be generated for MakeClassThreaded.
1368 
1370 {
1371  if (!fThreadedClassIter) return 0;
1372 
1374 
1375  TClassDocInfo* classinfo = 0;
1376  while ((classinfo = (TClassDocInfo*)(*fThreadedClassIter)())
1377  && !classinfo->IsSelected()) { }
1378 
1379  if (!classinfo) {
1380  delete fThreadedClassIter;
1381  fThreadedClassIter = 0;
1382  }
1383 
1385 
1386  return classinfo;
1387 }
1388 
1389 
1390 ////////////////////////////////////////////////////////////////////////////////
1391 /// Get the documentation URL for library lib.
1392 /// If lib == 0 or no documentation URL has been set for lib, return the ROOT
1393 /// documentation URL. The return value is always != 0.
1394 
1395 const char* THtml::GetURL(const char* lib /*=0*/) const
1396 {
1398 
1399  if (lib && strlen(lib)) {
1400  std::map<std::string, TString>::const_iterator iUrl = fLinkInfo.fLibURLs.find(lib);
1401  if (iUrl != fLinkInfo.fLibURLs.end()) return iUrl->second;
1402  return gEnv->GetValue(TString("Root.Html.") + lib, fLinkInfo.fROOTURL);
1403  }
1404  return fLinkInfo.fROOTURL;
1405 }
1406 
1407 ////////////////////////////////////////////////////////////////////////////////
1408 /// Check whether dot is available in $PATH or in the directory set
1409 /// by SetDotPath()
1410 
1412 {
1415 
1417 
1418  Info("HaveDot", "Checking for Graphviz (dot)...");
1419  TString runDot("dot");
1420  if (fPathInfo.fDotDir.Length())
1422  runDot += " -V";
1423  if (gDebug > 3)
1424  Info("HaveDot", "Running: %s", runDot.Data());
1425  if (gSystem->Exec(runDot)) {
1427  return kFALSE;
1428  }
1430  return kTRUE;
1431 
1432 }
1433 
1434 ////////////////////////////////////////////////////////////////////////////////
1435 /// Inform the THtml object that one of its helper objects was deleted.
1436 /// Called by THtml::HelperBase::~HelperBase().
1437 
1439 {
1440  THelperBase* helpers[3] = {fPathDef, fModuleDef, fFileDef};
1441  for (int i = 0; who && i < 3; ++i)
1442  if (who == helpers[i])
1443  helpers[i] = who = 0;
1444 }
1445 
1446 
1447 ////////////////////////////////////////////////////////////////////////////////
1448 /// It converts a single text file to HTML
1449 ///
1450 ///
1451 /// Input: filename - name of the file to convert
1452 /// title - title which will be placed at the top of the HTML file
1453 /// dirname - optional parameter, if it's not specified, output will
1454 /// be placed in htmldoc/examples directory.
1455 /// relpath - optional parameter pointing to the THtml generated doc
1456 /// on the server, relative to the current page.
1457 /// includeOutput - if != kNoOutput, run the script passed as filename and
1458 /// store all created canvases in PNG files that are
1459 /// shown next to the converted source. Bitwise-ORing with
1460 /// kForceOutput re-runs the script even if output PNGs exist
1461 /// that are newer than the script. If kCompiledOutput is
1462 /// passed, the script is run through ACLiC (.x filename+)
1463 /// context - line shown verbatim at the top of the page; e.g. for links.
1464 /// If context is non-empty it is expected to also print the
1465 /// title.
1466 ///
1467 /// NOTE: Output file name is the same as filename, but with extension .html
1468 ///
1469 
1470 void THtml::Convert(const char *filename, const char *title,
1471  const char *dirname /*= ""*/, const char *relpath /*= "../"*/,
1472  Int_t includeOutput /* = kNoOutput */,
1473  const char* context /* = "" */)
1474 {
1475  gROOT->GetListOfGlobals(kTRUE); // force update of this list
1476  CreateListOfClasses("*");
1477 
1478  const char *dir;
1479  TString dfltdir;
1480 
1481  // if it's not defined, make the "examples" as a default directory
1482  if (!*dirname) {
1484  char *tmp0 = gSystem->ConcatFileName(fPathInfo.fOutputDir, "examples");
1485  dfltdir = tmp0;
1486  delete [] tmp0;
1487  dir = dfltdir.Data();
1488  } else {
1489  dir = dirname;
1490  }
1491 
1492  // create directory if necessary
1493  if (gSystem->AccessPathName(dir))
1494  gSystem->MakeDirectory(dir);
1495 
1496  // find a file
1497  char *cRealFilename =
1499 
1500  if (!cRealFilename) {
1501  Error("Convert", "Can't find file '%s' !", filename);
1502  return;
1503  }
1504 
1505  TString realFilename = cRealFilename;
1506  delete[] cRealFilename;
1507 
1508  // open source file
1509  std::ifstream sourceFile;
1510  sourceFile.open(realFilename, std::ios::in);
1511 
1512  if (!sourceFile.good()) {
1513  Error("Convert", "Can't open file '%s' !", realFilename.Data());
1514  return;
1515  }
1516 
1517  if (gSystem->AccessPathName(dir)) {
1518  Error("Convert",
1519  "Directory '%s' doesn't exist, or it's write protected !", dir);
1520  return;
1521  }
1522  char *tmp1 =
1523  gSystem->ConcatFileName(dir, gSystem->BaseName(filename));
1524 
1525  TDocOutput output(*this);
1526  if (!fGClient)
1527  gROOT->ProcessLine(TString::Format("*((TGClient**)0x%lx) = gClient;",
1528  (ULong_t)&fGClient));
1529  if (includeOutput && !fGClient)
1530  Warning("Convert", "Output requested but cannot initialize graphics: GUI and GL windows not be available");
1531  output.Convert(sourceFile, realFilename, tmp1, title, relpath, includeOutput, context, fGClient);
1532 
1533  delete [] tmp1;
1534 }
1535 
1536 ////////////////////////////////////////////////////////////////////////////////
1537 /// Return the module name for a given class.
1538 /// Use the cached information from fDocEntityInfo.fClasses.
1539 
1541 {
1542  module = "(UNKNOWN)";
1543  if (!cl) return;
1544 
1546  if (!cdi || !cdi->GetModule())
1547  return;
1548  module = cdi->GetModule()->GetName();
1549 }
1550 
1551 
1552 ////////////////////////////////////////////////////////////////////////////////
1553 /// Create the list of all known classes
1554 
1555 void THtml::CreateListOfClasses(const char* filter)
1556 {
1558  return;
1559 
1560  Info("CreateListOfClasses", "Initializing - this might take a while...");
1561  // get total number of classes
1562  Int_t totalNumberOfClasses = gClassTable->Classes();
1563 
1564  // allocate memory
1567 
1568  fDocEntityInfo.fClassFilter = filter;
1569 
1570  // start from beginning
1571  gClassTable->Init();
1572  if (filter && (!filter[0] || !strcmp(filter, "*")))
1573  filter = ".*";
1574  TString reg = filter;
1575  TPMERegexp re(reg);
1576 
1577  bool skipROOTClasses = false;
1578  std::set<std::string> rootLibs;
1579  TList classesDeclFileNotFound;
1580  TList classesImplFileNotFound;
1581 
1582  // pre-run TObject at i == -1
1583  for (Int_t i = -1; i < totalNumberOfClasses; i++) {
1584 
1585  // get class name
1586  const char *cname = 0;
1587  if (i < 0) cname = "TObject";
1588  else cname = gClassTable->Next();
1589  if (!cname)
1590  continue;
1591 
1592  if (i >= 0 && !strcmp(cname, "TObject")) {
1593  // skip the second iteration on TObject
1594  continue;
1595  }
1596 
1597  // This is a hack for until after Cint and Reflex are one.
1598  if (strstr(cname, "__gnu_cxx::")) continue;
1599  // Work around ROOT-6016
1600  if (!strcmp(cname, "timespec")) continue;
1601  // "tuple"s are synthetic in the interpreter
1602  if (!strncmp(cname, "tuple<", 6)) continue;
1603 
1604  // get class & filename - use TROOT::GetClass, as we also
1605  // want those classes without decl file name!
1606  TClass *classPtr = TClass::GetClass((const char *) cname, kTRUE);
1607  if (!classPtr) continue;
1608 
1609  std::string shortName(ShortType(cname));
1610  cname = shortName.c_str();
1611 
1612  TString s = cname;
1613  Bool_t matchesSelection = re.Match(s);
1614 
1615 
1616  TString hdr;
1617  TString hdrFS;
1618  TString src;
1619  TString srcFS;
1620  TString htmlfilename;
1621  TFileSysEntry* fse = 0;
1622 
1624  if (cdi) {
1625  hdr = cdi->GetDeclFileName();
1626  hdrFS = cdi->GetDeclFileSysName();
1627  src = cdi->GetImplFileName();
1628  srcFS = cdi->GetImplFileSysName();
1629  htmlfilename = cdi->GetHtmlFileName();
1630  }
1631 
1632  if (!hdrFS.Length()) {
1633  if (!GetFileDefinition().GetDeclFileName(classPtr, hdr, hdrFS, &fse)) {
1634  // we don't even know where the class is defined;
1635  // just skip. Silence if it doesn't match the selection anyway
1636  if (i == -1 ) {
1637  skipROOTClasses = true;
1638  Info("CreateListOfClasses", "Cannot find header file for TObject at %s given the input path %s.",
1639  classPtr->GetDeclFileName(), GetInputPath().Data());
1640  Info("CreateListOfClasses", "Assuming documentation is not for ROOT classes, or you need to pass "
1641  "the proper directory to THtml::SetInputDir() so I can find %s.", classPtr->GetDeclFileName());
1642  continue;
1643  }
1644  // ignore STL
1645  if (classPtr->GetClassInfo() &&
1646  (gInterpreter->ClassInfo_Property(classPtr->GetClassInfo()) & kIsDefinedInStd))
1647  continue;
1648  if (classPtr->GetDeclFileName() && (!strncmp(classPtr->GetDeclFileName(), "prec_stl/", 9) ||
1649  strstr(classPtr->GetDeclFileName(), "include/c++/") ||
1650  !strncmp(classPtr->GetDeclFileName(), "/usr/include",12)))
1651  continue;
1652  if (classPtr->GetDeclFileName() && (
1653  !strcmp(classPtr->GetDeclFileName(), "vector") ||
1654  !strcmp(classPtr->GetDeclFileName(), "string") ||
1655  !strcmp(classPtr->GetDeclFileName(), "list") ||
1656  !strcmp(classPtr->GetDeclFileName(), "deque") ||
1657  !strcmp(classPtr->GetDeclFileName(), "map") ||
1658  !strcmp(classPtr->GetDeclFileName(), "valarray") ||
1659  !strcmp(classPtr->GetDeclFileName(), "set") ||
1660  !strcmp(classPtr->GetDeclFileName(), "typeinfo") ||
1661  !strcmp(classPtr->GetDeclFileName(), "stdlib.h") ) )
1662  {
1663  // Those are STL header, just ignore.
1664  continue;
1665  }
1666  if (skipROOTClasses) {
1667  if (classPtr->GetSharedLibs() && classPtr->GetSharedLibs()[0]) {
1668  std::string lib(classPtr->GetSharedLibs());
1669  size_t posSpace = lib.find(' ');
1670  if (posSpace != std::string::npos)
1671  lib.erase(posSpace);
1672  if (rootLibs.find(lib) == rootLibs.end()) {
1673  TString rootlibdir = TROOT::GetLibDir();
1674  TString sLib(lib);
1675  if (sLib.Index('.') == -1) {
1676  sLib += ".";
1677  sLib += gSystem->GetSoExt();
1678  }
1679  gSystem->PrependPathName(rootlibdir, sLib);
1680  if (gSystem->AccessPathName(sLib))
1681  // the library doesn't exist in $ROOTSYS/lib, so it's not
1682  // a root lib and we need to tell the user.
1683  classesDeclFileNotFound.AddLast(classPtr);
1684  else rootLibs.insert(lib);
1685  } // end "if rootLibs does not contain lib"
1686  } else {
1687  // lib name unknown
1688  static const char* rootClassesToIgnore[] =
1689  { "ColorStruct_t", "CpuInfo_t", "Event_t", "FileStat_t", "GCValues_t", "MemInfo_t",
1690  "PictureAttributes_t", "Point_t", "ProcInfo_t", "ROOT", "ROOT::Fit",
1691  "Rectangle_t", "RedirectHandle_t", "Segment_t", "SetWindowAttributes_t",
1692  "SysInfo_t", "TCint", "UserGroup_t", "WindowAttributes_t", "timespec", 0};
1693  static const char* rootClassStemsToIgnore[] =
1694  { "ROOT::Math", "TKDTree", "TMatrixT", "TParameter", "vector", 0 };
1695  static size_t rootClassStemsToIgnoreLen[] = {0, 0, 0, 0, 0};
1696  static std::set<std::string> setRootClassesToIgnore;
1697  if (setRootClassesToIgnore.empty()) {
1698  for (int ii = 0; rootClassesToIgnore[ii]; ++ii)
1699  setRootClassesToIgnore.insert(rootClassesToIgnore[ii]);
1700  for (int ii = 0; rootClassStemsToIgnore[ii]; ++ii)
1701  rootClassStemsToIgnoreLen[ii] = strlen(rootClassStemsToIgnore[ii]);
1702  }
1703  // only complain about this class if it should not be ignored:
1704  if (setRootClassesToIgnore.find(cname) == setRootClassesToIgnore.end()) {
1705  bool matched = false;
1706  for (int ii = 0; !matched && rootClassStemsToIgnore[ii]; ++ii)
1707  matched = !strncmp(cname, rootClassStemsToIgnore[ii], rootClassStemsToIgnoreLen[ii]);
1708  if (!matched)
1709  classesDeclFileNotFound.AddLast(classPtr);
1710  }
1711  } // lib name known
1712  continue;
1713  } else {
1714  if (matchesSelection && (!classPtr->GetDeclFileName() ||
1715  !strstr(classPtr->GetDeclFileName(),"prec_stl/") ||
1716  !strstr(classPtr->GetDeclFileName(), "include/c++/") ||
1717  strncmp(classPtr->GetDeclFileName(), "/usr/include",12)))
1718  classesDeclFileNotFound.AddLast(classPtr);
1719  continue;
1720  }
1721  }
1722  }
1723 
1724  Bool_t haveSource = (srcFS.Length());
1725  if (!haveSource)
1726  haveSource = GetFileDefinition().GetImplFileName(classPtr, src, srcFS, fse ? 0 : &fse);
1727 
1728  if (!haveSource) {
1729  classesImplFileNotFound.AddLast(classPtr);
1730  }
1731 
1732  if (!htmlfilename.Length())
1733  GetHtmlFileName(classPtr, htmlfilename);
1734 
1735  if (!cdi) {
1736  cdi = new TClassDocInfo(classPtr, htmlfilename, hdrFS, srcFS, hdr, src);
1738  } else {
1739  cdi->SetDeclFileName(hdr);
1740  cdi->SetImplFileName(src);
1741  cdi->SetDeclFileSysName(hdrFS);
1742  cdi->SetImplFileSysName(srcFS);
1743  cdi->SetHtmlFileName(htmlfilename);
1744  }
1745 
1746  cdi->SetSelected(matchesSelection);
1747 
1748  TString modulename;
1749  GetModuleDefinition().GetModule(classPtr, fse, modulename);
1750  if (!modulename.Length() || modulename == "USER")
1751  GetModuleNameForClass(modulename, classPtr);
1752 
1754  if (!module) {
1755  bool moduleSelected = cdi->IsSelected();
1756 
1757  TString parentModuleName = gSystem->GetDirName(modulename);
1758  TModuleDocInfo* super = nullptr;
1759  if (parentModuleName.Length() && parentModuleName != ".") {
1760  super = (TModuleDocInfo*) fDocEntityInfo.fModules.FindObject(parentModuleName);
1761  if (!super) {
1762  // create parents:
1763  TString token;
1764  Ssiz_t pos = 0;
1765  while (parentModuleName.Tokenize(token, pos, "/")) {
1766  if (!token.Length() || token == ".") continue;
1767  super = new TModuleDocInfo(token, super);
1768  super->SetSelected(moduleSelected);
1769  fDocEntityInfo.fModules.Add(super);
1770  }
1771  }
1772  }
1773  module = new TModuleDocInfo(modulename, super);
1774  module->SetSelected(moduleSelected);
1776  }
1777 
1778  if (module) {
1779  module->AddClass(cdi);
1780  cdi->SetModule(module);
1781  if (cdi->HaveSource() && cdi->IsSelected())
1782  module->SetSelected();
1783  }
1784 
1785  // clear the typedefs; we fill them later
1786  cdi->GetListOfTypedefs().Clear();
1787 
1788  if (gDebug > 0)
1789  Info("CreateListOfClasses", "Adding class %s, module %s (%sselected)",
1790  cdi->GetName(), module ? module->GetName() : "[UNKNOWN]",
1791  cdi->IsSelected() ? "" : "not ");
1792  }
1793 
1794 
1795 
1796  bool cannotFind = false;
1797  if (!classesDeclFileNotFound.IsEmpty()) {
1798  Warning("CreateListOfClasses",
1799  "Cannot find the header for the following classes [reason]:");
1800  TIter iClassesDeclFileNotFound(&classesDeclFileNotFound);
1801  TClass* iClass = 0;
1802  while ((iClass = (TClass*)iClassesDeclFileNotFound())) {
1803  if (iClass->GetDeclFileName() && iClass->GetDeclFileName()[0]) {
1804  Warning("CreateListOfClasses", " %s [header %s not found]", iClass->GetName(), iClass->GetDeclFileName());
1805  cannotFind = true;
1806  } else
1807  Warning("CreateListOfClasses", " %s [header file is unknown]", iClass->GetName());
1808  }
1809  }
1810 
1811  if (!classesImplFileNotFound.IsEmpty() && gDebug > 3) {
1812  Warning("CreateListOfClasses",
1813  "Cannot find the source file for the following classes [reason]:");
1814  TIter iClassesDeclFileNotFound(&classesImplFileNotFound);
1815  TClass* iClass = 0;
1816  while ((iClass = (TClass*)iClassesDeclFileNotFound())) {
1817  if (iClass->GetDeclFileName() && iClass->GetDeclFileName()[0]) {
1818  Info("CreateListOfClasses", " %s [source %s not found]", iClass->GetName(), iClass->GetImplFileName());
1819  cannotFind = true;
1820  } else
1821  Info("CreateListOfClasses", " %s [source file is unknown, add \"ClassImpl(%s)\" to source file if it exists]",
1822  iClass->GetName(), iClass->GetName());
1823  }
1824  }
1825  if (cannotFind) {
1826  Warning("CreateListOfClasses", "THtml cannot find all headers and sources. ");
1827  Warning("CreateListOfClasses",
1828  "You might need to adjust the input path (currently %s) by calling THtml::SetInputDir()",
1829  GetInputPath().Data());
1830  }
1831 
1832  // fill typedefs
1833  TIter iTypedef(gROOT->GetListOfTypes());
1834  TDataType* dt = 0;
1835  TDocOutput output(*this);
1836  while ((dt = (TDataType*) iTypedef())) {
1837  if (dt->GetType() != -1) continue;
1839  if (cdi) {
1840  cdi->GetListOfTypedefs().Add(dt);
1841  if (gDebug > 1)
1842  Info("CreateListOfClasses", "Adding typedef %s to class %s",
1843  dt->GetName(), cdi->GetName());
1844 
1845  bool inNamespace = true;
1846  TString surroundingNamespace(dt->GetName());
1847  Ssiz_t posTemplate = surroundingNamespace.Last('>');
1848  inNamespace = inNamespace && (posTemplate == kNPOS);
1849  if (inNamespace) {
1850  Ssiz_t posColumn = surroundingNamespace.Last(':');
1851  if (posColumn != kNPOS) {
1852  surroundingNamespace.Remove(posColumn - 1);
1853  TClass* clSurrounding = GetClass(surroundingNamespace);
1854  inNamespace = inNamespace && (!clSurrounding || IsNamespace(clSurrounding));
1855  }
1856  }
1857  if (inNamespace && cdi->GetModule()) {
1858  TString htmlfilename(dt->GetName());
1859  output.NameSpace2FileName(htmlfilename);
1860  htmlfilename += ".html";
1861  TClassDocInfo* cdiTD = new TClassDocInfo(dt, htmlfilename);
1862  cdiTD->SetModule(cdi->GetModule());
1863  cdiTD->SetSelected(cdi->IsSelected());
1864  cdi->GetModule()->AddClass(cdiTD);
1865  }
1866  }
1867  }
1868 
1871  TIter iterModule(&fDocEntityInfo.fModules);
1872  TModuleDocInfo* mdi = 0;
1873  while ((mdi = (TModuleDocInfo*) iterModule()))
1874  mdi->GetClasses()->Sort();
1875 
1876  if (fProductName == "(UNKNOWN PRODUCT)"
1877  && fDocEntityInfo.fModules.FindObject("core/base")
1878  && fDocEntityInfo.fModules.FindObject("core/cont")
1879  && fDocEntityInfo.fModules.FindObject("core/rint")
1880  && gProgName && strstr(gProgName, "root"))
1881  // if we have these modules we're probably building the root doc
1882  fProductName = "ROOT";
1883 
1884  if (fProductName == "(UNKNOWN PRODUCT)") {
1885  Warning("CreateListOfClasses", "Product not set. You should call gHtml->SetProductName(\"MyProductName\");");
1886  } else if (fProductName != "ROOT") {
1887  if (GetViewCVS().Contains("http://root.cern.ch/"))
1888  SetViewCVS("");
1889  }
1890 
1893  && !strcmp(fDocEntityInfo.fModules.At(0)->GetName(), "(UNKNOWN)"))
1894  // Only one module, and its name is not known.
1895  // Let's call it "MAIN":
1896  ((TModuleDocInfo*) fDocEntityInfo.fModules.At(0))->SetName("MAIN");
1897 
1898  Info("CreateListOfClasses", "Initializing - DONE.");
1899 }
1900 
1901 
1902 ////////////////////////////////////////////////////////////////////////////////
1903 /// Create index of all data types and a page for each typedef-to-class
1904 
1906 {
1907  TDocOutput output(*this);
1908  output.CreateTypeIndex();
1909  output.CreateClassTypeDefs();
1910 }
1911 
1912 ////////////////////////////////////////////////////////////////////////////////
1913 /// Copy a file from $ROOTSYS/etc/html into GetOutputDir()
1914 
1915 Bool_t THtml::CopyFileFromEtcDir(const char* filename) const {
1917 
1918  TString outFile(filename);
1919 
1920  TString inFile(outFile);
1921  gSystem->PrependPathName(GetEtcDir(), inFile);
1922 
1923  gSystem->PrependPathName(GetOutputDir(), outFile);
1924 
1925  if (gSystem->CopyFile(inFile, outFile, kTRUE) != 0) {
1926  Warning("CopyFileFromEtcDir", "Could not copy %s to %s", inFile.Data(), outFile.Data());
1927  return kFALSE;
1928  }
1929 
1930  return kTRUE;
1931 }
1932 
1933 ////////////////////////////////////////////////////////////////////////////////
1934 /// Create the inheritance hierarchy diagram for all classes
1935 
1937 {
1938  TDocOutput output(*this);
1939  output.CreateHierarchy();
1940 }
1941 
1942 ////////////////////////////////////////////////////////////////////////////////
1943 /// Write the default ROOT style sheet.
1944 
1946  CopyFileFromEtcDir("ROOT.js");
1947 }
1948 
1949 ////////////////////////////////////////////////////////////////////////////////
1950 /// Write the default ROOT style sheet.
1951 
1953  CopyFileFromEtcDir("ROOT.css");
1954  CopyFileFromEtcDir("shadowAlpha.png");
1955  CopyFileFromEtcDir("shadow.gif");
1956 }
1957 
1958 
1959 
1960 ////////////////////////////////////////////////////////////////////////////////
1961 /// fill derived with all classes inheriting from cl and their inheritance
1962 /// distance to cl
1963 
1964 void THtml::GetDerivedClasses(TClass* cl, std::map<TClass*, Int_t>& derived) const
1965 {
1966  TIter iClass(&fDocEntityInfo.fClasses);
1967  TClassDocInfo* cdi = 0;
1968  while ((cdi = (TClassDocInfo*) iClass())) {
1969  TClass* candidate = dynamic_cast<TClass*>(cdi->GetClass());
1970  if (!candidate) continue;
1971  if (candidate != cl && candidate->InheritsFrom(cl)) {
1972  Int_t level = 0;
1973  TClass* currentBaseOfCandidate = candidate;
1974  while (currentBaseOfCandidate != cl) {
1975  TList* bases = currentBaseOfCandidate->GetListOfBases();
1976  if (!bases) continue;
1977  TIter iBase(bases);
1978  TBaseClass* base = 0;
1979  while ((base = (TBaseClass*) iBase())) {
1980  TClass* clBase = base->GetClassPointer();
1981  if (clBase && clBase->InheritsFrom(cl)) {
1982  ++level;
1983  currentBaseOfCandidate = clBase;
1984  }
1985  }
1986  }
1987  derived[candidate] = level;
1988  }
1989  }
1990 }
1991 
1992 ////////////////////////////////////////////////////////////////////////////////
1993 /// Return real HTML filename
1994 ///
1995 ///
1996 /// Input: classPtr - pointer to a class
1997 /// filename - string containing a full name
1998 /// of the corresponding HTML file after the function returns.
1999 ///
2000 
2001 void THtml::GetHtmlFileName(TClass * classPtr, TString& filename) const
2002 {
2003  filename.Remove(0);
2004  if (!classPtr) return;
2005 
2006  TString cFilename;
2007  if (!GetImplFileName(classPtr, kFALSE, cFilename))
2008  GetDeclFileName(classPtr, kFALSE, cFilename);
2009 
2010  // classes without Impl/DeclFileName don't have docs,
2011  // and classes without docs don't have output file names
2012  if (!cFilename.Length())
2013  return;
2014 
2015  TString libName;
2016  const char *colon = strchr(cFilename, ':');
2017  if (colon)
2018  // old version, where source file name is prepended by "TAG:"
2019  libName = TString(cFilename, colon - cFilename);
2020  else
2021  // New version, check class's libname.
2022  // If libname is dir/libMyLib.so, check Root.Html.MyLib
2023  // If libname is myOtherLib.so.2.3, check Root.Html.myOtherLib
2024  // (i.e. remove directories, "lib" prefix, and any "extension")
2025  if (classPtr->GetSharedLibs()) {
2026  // first one is the class's lib
2027  TString libname(classPtr->GetSharedLibs());
2028  Ssiz_t posSpace = libname.First(' ');
2029  if (posSpace != kNPOS)
2030  libname.Remove(posSpace, libname.Length());
2031  TString libnameBase = gSystem->BaseName(libname);
2032  if (libnameBase.BeginsWith("lib"))
2033  libnameBase.Remove(0, 3);
2034  Ssiz_t posExt = libnameBase.First('.');
2035  if (posExt != '.')
2036  libnameBase.Remove(posExt, libnameBase.Length());
2037  if (libnameBase.Length())
2038  libName = libnameBase;
2039  }
2040 
2041  filename = cFilename;
2042  TString htmlFileName;
2043  if (!filename.Length() ||
2045  htmlFileName = GetURL(libName);
2046  } else
2047  htmlFileName = "./";
2048 
2049  if (htmlFileName.Length()) {
2050  filename = htmlFileName;
2051  TString className(classPtr->GetName());
2052  TDocOutput output(*const_cast<THtml*>(this));
2053  output.NameSpace2FileName(className);
2054  gSystem->PrependPathName(filename, className);
2055  filename = className;
2056  filename.ReplaceAll("\\", "/");
2057  filename += ".html";
2058  } else filename.Remove(0);
2059 }
2060 
2061 ////////////////////////////////////////////////////////////////////////////////
2062 /// Get the html file name for a class named classname.
2063 /// Returns 0 if the class is not documented.
2064 
2065 const char* THtml::GetHtmlFileName(const char* classname) const
2066 {
2068  if (cdi)
2069  return cdi->GetHtmlFileName();
2070  return 0;
2071 }
2072 
2073 ////////////////////////////////////////////////////////////////////////////////
2074 /// Return pointer to class with name.
2075 
2076 TClass *THtml::GetClass(const char *name1) const
2077 {
2078  if(!name1 || !name1[0]) return 0;
2079  // no doc for internal classes
2080  if (strstr(name1,"ROOT::")==name1) {
2081  Bool_t ret = kTRUE;
2082  if (!strncmp(name1 + 6,"Math", 4)) ret = kFALSE;
2083  if (ret) return 0;
2084  }
2085 
2087  if (!cdi) return 0;
2088  TClass *cl = dynamic_cast<TClass*>(cdi->GetClass());
2089  // hack to get rid of prec_stl types
2090  // TClassEdit checks are far too slow...
2091  /*
2092  if (cl && GetDeclFileName(cl) &&
2093  (strstr(GetDeclFileName(cl),"prec_stl/") || !strstr(classPtr->GetDeclFileName(), "include/c++/") )
2094  cl = 0;
2095  */
2096  TString declFileName;
2097  if (cl && GetDeclFileName(cl, kFALSE, declFileName))
2098  return cl;
2099  return 0;
2100 }
2101 
2102 ////////////////////////////////////////////////////////////////////////////////
2103 /// Return declaration file name; return the full path if filesys is true.
2104 
2105 bool THtml::GetDeclFileName(TClass * cl, Bool_t filesys, TString& out_name) const
2106 {
2107  return GetDeclImplFileName(cl, filesys, true, out_name);
2108 }
2109 
2110 ////////////////////////////////////////////////////////////////////////////////
2111 /// Return implementation file name
2112 
2113 bool THtml::GetImplFileName(TClass * cl, Bool_t filesys, TString& out_name) const
2114 {
2115  return GetDeclImplFileName(cl, filesys, false, out_name);
2116 }
2117 
2118 ////////////////////////////////////////////////////////////////////////////////
2119 /// Combined implementation for GetDeclFileName(), GetImplFileName():
2120 /// Return declaration / implementation file name (depending on decl);
2121 /// return the full path if filesys is true.
2122 
2123 bool THtml::GetDeclImplFileName(TClass * cl, bool filesys, bool decl, TString& out_name) const
2124 {
2125  out_name = "";
2126 
2129  // whether we need to determine the fil name
2130  bool determine = (!cdi); // no cdi
2131  if (!determine) determine |= decl && filesys && !cdi->GetDeclFileSysName()[0];
2132  if (!determine) determine |= decl && !filesys && !cdi->GetDeclFileName()[0];
2133  if (!determine) determine |= !decl && filesys && !cdi->GetImplFileSysName()[0];
2134  if (!determine) determine |= !decl && !filesys && !cdi->GetImplFileName()[0];
2135  if (determine) {
2136  TString name;
2137  TString sysname;
2138  if (decl) {
2139  if (!GetFileDefinition().GetDeclFileName(cl, name, sysname))
2140  return false;
2141  } else {
2142  if (!GetFileDefinition().GetImplFileName(cl, name, sysname))
2143  return false;
2144  }
2145  if (cdi) {
2146  if (decl) {
2147  if (!cdi->GetDeclFileName() || !cdi->GetDeclFileName()[0])
2148  cdi->SetDeclFileName(name);
2149  if (!cdi->GetDeclFileSysName() || !cdi->GetDeclFileSysName()[0])
2150  cdi->SetDeclFileSysName(sysname);
2151  } else {
2152  if (!cdi->GetImplFileName() || !cdi->GetImplFileName()[0])
2153  cdi->SetImplFileName(name);
2154  if (!cdi->GetImplFileSysName() || !cdi->GetImplFileSysName()[0])
2155  cdi->SetImplFileSysName(sysname);
2156  }
2157  }
2158 
2159  if (filesys) out_name = sysname;
2160  else out_name = name;
2161  return true;
2162  }
2163  if (filesys) {
2164  if (decl) out_name = cdi->GetDeclFileSysName();
2165  else out_name = cdi->GetImplFileSysName();
2166  } else {
2167  if (decl) out_name = cdi->GetDeclFileName();
2168  else out_name = cdi->GetImplFileName();
2169  }
2170  return true;
2171 }
2172 
2173 ////////////////////////////////////////////////////////////////////////////////
2174 /// Return the output directory as set by SetOutputDir().
2175 /// Create it if it doesn't exist and if createDir is kTRUE.
2176 
2177 const TString& THtml::GetOutputDir(Bool_t createDir /*= kTRUE*/) const
2178 {
2179  if (createDir) {
2181 
2182  gSystem->ExpandPathName(const_cast<THtml*>(this)->fPathInfo.fOutputDir);
2183  Long64_t sSize;
2184  Long_t sId, sFlags, sModtime;
2187  Int_t st = gSystem->GetPathInfo(fPathInfo.fOutputDir, &sId, &sSize, &sFlags, &sModtime);
2188  if (st || !(sFlags & 2)) {
2189  if (st == 0)
2190  Error("GetOutputDir", "output directory %s is an existing file",
2192  else if (gSystem->MakeDirectory(fPathInfo.fOutputDir) == -1)
2193  Error("GetOutputDir", "output directory %s does not exist and can't create it", fPathInfo.fOutputDir.Data());
2194  }
2195  }
2196  return fPathInfo.fOutputDir;
2197 }
2198 
2199 ////////////////////////////////////////////////////////////////////////////////
2200 /// Check whether cl is a namespace
2201 
2203 {
2204  return (cl->Property() & kIsNamespace);
2205 }
2206 
2207 ////////////////////////////////////////////////////////////////////////////////
2208 /// Load all libraries known to ROOT via the rootmap system.
2209 
2211 {
2213 }
2214 
2215 
2216 ////////////////////////////////////////////////////////////////////////////////
2217 /// Produce documentation for all the classes specified in the filter (by default "*")
2218 /// To process all classes having a name starting with XX, do:
2219 /// html.MakeAll(kFALSE,"XX*");
2220 /// If force=kFALSE (default), only the classes that have been modified since
2221 /// the previous call to this function will be generated.
2222 /// If force=kTRUE, all classes passing the filter will be processed.
2223 /// If numthreads is != -1, use numthreads threads, else decide automatically
2224 /// based on the number of CPUs.
2225 
2226 void THtml::MakeAll(Bool_t force, const char *filter, int numthreads /*= -1*/)
2227 {
2228  MakeIndex(filter);
2229 
2230  if (numthreads == 1) {
2231  // CreateListOfClasses(filter); already done by MakeIndex
2232  TClassDocInfo* classinfo = 0;
2233  TIter iClassInfo(&fDocEntityInfo.fClasses);
2234  UInt_t count = 0;
2235 
2236  while ((classinfo = (TClassDocInfo*)iClassInfo())) {
2237  if (!classinfo->IsSelected())
2238  continue;
2239  fCounter.Form("%5d", fDocEntityInfo.fClasses.GetSize() - count++);
2240  MakeClass(classinfo, force);
2241  }
2242  } else {
2243  if (numthreads == -1) {
2244  SysInfo_t sysinfo;
2245  gSystem->GetSysInfo(&sysinfo);
2246  numthreads = sysinfo.fCpus;
2247  if (numthreads < 1)
2248  numthreads = 2;
2249  }
2250  fThreadedClassCount = 0;
2252  THtmlThreadInfo hti(this, force);
2253  if (!fMakeClassMutex && gGlobalMutex) {
2254  gGlobalMutex->Lock();
2256  gGlobalMutex->UnLock();
2257  }
2258 
2259  TList threads;
2260  gSystem->Load("libThread");
2261  while (--numthreads >= 0) {
2262  TThread* thread = new TThread(MakeClassThreaded, &hti);
2263  thread->Run();
2264  threads.Add(thread);
2265  }
2266 
2267  TIter iThread(&threads);
2268  TThread* thread = 0;
2269  Bool_t wait = kTRUE;
2270  while (wait) {
2271  while (wait && (thread = (TThread*) iThread()))
2272  wait &= (thread->GetState() == TThread::kRunningState);
2274  gSystem->Sleep(500);
2275  }
2276 
2277  iThread.Reset();
2278  while ((thread = (TThread*) iThread()))
2279  thread->Join();
2280  }
2281  fCounter.Remove(0);
2282 }
2283 
2284 
2285 ////////////////////////////////////////////////////////////////////////////////
2286 /// Make HTML files for a single class
2287 ///
2288 ///
2289 /// Input: className - name of the class to process
2290 ///
2291 
2292 void THtml::MakeClass(const char *className, Bool_t force)
2293 {
2294  CreateListOfClasses("*");
2295 
2297  if (!cdi) {
2298  if (!TClassEdit::IsStdClass(className)) // stl classes won't be available, so no warning
2299  Error("MakeClass", "Unknown class '%s'!", className);
2300  return;
2301  }
2302 
2303  MakeClass(cdi, force);
2304 }
2305 
2306 ////////////////////////////////////////////////////////////////////////////////
2307 /// Make HTML files for a single class
2308 ///
2309 ///
2310 /// Input: cdi - doc info for class to process
2311 ///
2312 
2313 void THtml::MakeClass(void *cdi_void, Bool_t force)
2314 {
2316  CreateListOfClasses("*");
2317 
2318  TClassDocInfo* cdi = (TClassDocInfo*) cdi_void;
2319  TClass* currentClass = dynamic_cast<TClass*>(cdi->GetClass());
2320 
2321  if (!currentClass) {
2322  if (!cdi->GetClass() &&
2323  !TClassEdit::IsStdClass(cdi->GetName())) // stl classes won't be available, so no warning
2324  Error("MakeClass", "Class '%s' is known, but I cannot find its TClass object!", cdi->GetName());
2325  return;
2326  }
2327  TString htmlFile(cdi->GetHtmlFileName());
2328  if (htmlFile.Length()
2329  && (htmlFile.BeginsWith("http://")
2330  || htmlFile.BeginsWith("https://")
2331  || gSystem->IsAbsoluteFileName(htmlFile))
2332  ) {
2333  htmlFile.Remove(0);
2334  }
2335  if (htmlFile.Length()) {
2336  TClassDocOutput cdo(*this, currentClass, &cdi->GetListOfTypedefs());
2337  cdo.Class2Html(force);
2338  cdo.MakeTree(force);
2339  } else {
2340  TString what(cdi->GetName());
2341  what += " (sources not found)";
2342  Printf(fCounterFormat.Data(), "-skipped-", fCounter.Data(), what.Data());
2343  }
2344 }
2345 
2346 
2347 ////////////////////////////////////////////////////////////////////////////////
2348 /// Entry point of worker threads for multi-threaded MakeAll().
2349 /// info points to an (internal) THtmlThreadInfo object containing the current
2350 /// THtml object, and whether "force" was passed to MakeAll().
2351 /// The thread will poll GetNextClass() until no further class is available.
2352 
2353 void* THtml::MakeClassThreaded(void* info) {
2354  const THtmlThreadInfo* hti = (const THtmlThreadInfo*)info;
2355  if (!hti) return 0;
2356  TClassDocInfo* classinfo = 0;
2357  while ((classinfo = hti->GetHtml()->GetNextClass()))
2358  hti->GetHtml()->MakeClass(classinfo, hti->GetForce());
2359 
2360  return 0;
2361 }
2362 
2363 ////////////////////////////////////////////////////////////////////////////////
2364 /// Create the index files for the product, modules, all types, etc.
2365 /// By default all classes are indexed (if filter="*");
2366 /// to generate an index for all classes starting with "XX", do
2367 /// html.MakeIndex("XX*");
2368 
2369 void THtml::MakeIndex(const char *filter)
2370 {
2371  CreateListOfClasses(filter);
2372 
2373  TDocOutput output(*this);
2374  // create indices
2375  output.CreateTypeIndex();
2376  output.CreateClassTypeDefs();
2377  output.CreateModuleIndex();
2378  output.CreateClassIndex();
2379  output.CreateProductIndex();
2380 
2381  // create a class hierarchy
2382  output.CreateHierarchy();
2383 }
2384 
2385 
2386 ////////////////////////////////////////////////////////////////////////////////
2387 /// Make an inheritance tree
2388 ///
2389 ///
2390 /// Input: className - name of the class to process
2391 ///
2392 
2393 void THtml::MakeTree(const char *className, Bool_t force)
2394 {
2395  // create canvas & set fill color
2396  TClass *classPtr = GetClass(className);
2397 
2398  if (!classPtr) {
2399  Error("MakeTree", "Unknown class '%s' !", className);
2400  return;
2401  }
2402 
2403  TClassDocOutput cdo(*this, classPtr, 0);
2404  cdo.MakeTree(force);
2405 }
2406 
2407 ////////////////////////////////////////////////////////////////////////////////
2408 /// Set whether "dot" (a GraphViz utility) is available
2409 
2413 }
2414 
2415 ////////////////////////////////////////////////////////////////////////////////
2416 /// Fill the files available in the file system below fPathInfo.fInputPath
2417 
2419 {
2420  if (fLocalFiles) delete fLocalFiles;
2422 }
2423 
2424 ////////////////////////////////////////////////////////////////////////////////
2425 /// Set the module defining object to be used; can also be a user derived
2426 /// object (a la traits).
2427 
2429 {
2430  delete fModuleDef;
2432  fModuleDef->SetOwner(const_cast<THtml*>(this));
2433 }
2434 
2435 
2436 ////////////////////////////////////////////////////////////////////////////////
2437 /// Set the file defining object to be used; can also be a user derived
2438 /// object (a la traits).
2439 
2441 {
2442  delete fFileDef;
2443  fFileDef = (TFileDefinition*) md.Clone();
2444  fFileDef->SetOwner(const_cast<THtml*>(this));
2445 }
2446 
2447 
2448 ////////////////////////////////////////////////////////////////////////////////
2449 /// Set the path defining object to be used; can also be a user derived
2450 /// object (a la traits).
2451 
2453 {
2454  delete fPathDef;
2455  fPathDef = (TPathDefinition*) md.Clone();
2456  fPathDef->SetOwner(const_cast<THtml*>(this));
2457 }
2458 
2459 
2460 ////////////////////////////////////////////////////////////////////////////////
2461 /// Set the directory containing the source files.
2462 /// The source file for a class MyClass will be searched
2463 /// by prepending dir to the value of
2464 /// MyClass::Class()->GetImplFileName() - which can contain
2465 /// directory information!
2466 /// Also resets the class structure, in case new files can
2467 /// be found after this call.
2468 
2469 void THtml::SetInputDir(const char *dir)
2470 {
2471  fPathInfo.fInputPath = dir;
2473 
2474  // reset class table
2477 }
2478 
2479 ////////////////////////////////////////////////////////////////////////////////
2480 /// Set the directory where the HTML pages should be written to.
2481 /// If the directory does not exist it will be created when needed.
2482 
2483 void THtml::SetOutputDir(const char *dir)
2484 {
2485  fPathInfo.fOutputDir = dir;
2486 #ifdef R__WIN32
2487  fPathInfo.fOutputDir.ReplaceAll("/","\\");
2488 #endif
2489 }
2490 
2491 ////////////////////////////////////////////////////////////////////////////////
2492 /// Explicitly set a decl file name for TClass cl.
2493 
2494 void THtml::SetDeclFileName(TClass* cl, const char* filename)
2495 {
2497  if (!cdi) {
2498  cdi = new TClassDocInfo(cl, "" /*html*/, "" /*fsdecl*/, "" /*fsimpl*/, filename);
2500  } else
2501  cdi->SetDeclFileName(filename);
2502 }
2503 
2504 ////////////////////////////////////////////////////////////////////////////////
2505 /// Explicitly set a impl file name for TClass cl.
2506 
2507 void THtml::SetImplFileName(TClass* cl, const char* filename)
2508 {
2510  if (!cdi) {
2511  cdi = new TClassDocInfo(cl, "" /*html*/, "" /*fsdecl*/, "" /*fsimpl*/, 0 /*decl*/, filename);
2513  } else
2514  cdi->SetImplFileName(filename);
2515 }
2516 
2517 ////////////////////////////////////////////////////////////////////////////////
2518 /// Get short type name, i.e. with default templates removed.
2519 
2520 const char* THtml::ShortType(const char* name) const
2521 {
2522  const char* tmplt = strchr(name, '<');
2523  if (!tmplt) return name;
2524  tmplt = strrchr(tmplt, ':');
2525  if (tmplt > name && tmplt[-1] == ':') {
2526  // work-around for CINT bug: template instantiation can produce bogus
2527  // typedefs e.g. in namespace ROOT::Math::ROOT::Math instead of ROOT::Math.
2528  TString namesp(name, tmplt - name - 1);
2529  // is the enclosing namespace known?
2530  if (!GetClass(namesp)) return name;
2531  }
2533  if (!scn) {
2534  scn = new TNamed(name, TClassEdit::ShortType(name, 1<<7));
2536  }
2537  return scn->GetTitle();
2538 }
THtml::TPathDefinition::GetMacroPath
virtual bool GetMacroPath(const TString &module, TString &out_dir) const
Determine the path to look for macros (see TDocMacroDirective) for classes from a given module.
Definition: THtml.cxx:513
THtml::SetViewCVS
void SetViewCVS(const char *url)
Definition: THtml.h:285
TVirtualMutex::Factory
virtual TVirtualMutex * Factory(Bool_t=kFALSE)=0
THtml::DocEntityInfo_t::fModules
THashList fModules
Definition: THtml.h:391
THtml::PathInfo_t::fOutputDir
TString fOutputDir
Definition: THtml.h:228
THtml::GetDirDelimiter
static const char * GetDirDelimiter()
Definition: THtml.h:327
gClassTable
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:95
TSystem::FindFile
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1534
THtml::PathInfo_t::fDotDir
TString fDotDir
Definition: THtml.h:226
TDocInfo.h
TSystem::GetPathInfo
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:1396
THtml::GetFileDefinition
const TFileDefinition & GetFileDefinition() const
Return the TFileDefinition (or derived) object as set by SetFileDefinition(); create and return a TFi...
Definition: THtml.cxx:1325
TClassDocInfo::GetDeclFileSysName
const char * GetDeclFileSysName() const
Definition: TDocInfo.h:63
TPMERegexp
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Definition: TPRegexp.h:97
THtml::CreateJavascript
virtual void CreateJavascript() const
Write the default ROOT style sheet.
Definition: THtml.cxx:1945
TThread
Definition: TThread.h:40
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:95
THtml::THelperBase
Definition: THtml.h:44
TClassDocInfo::SetDeclFileName
void SetDeclFileName(const char *name)
Definition: TDocInfo.h:75
THtml::GetPathDefinition
const TPathDefinition & GetPathDefinition() const
Return the TModuleDefinition (or derived) object as set by SetModuleDefinition(); create and return a...
Definition: THtml.cxx:1339
THtml::fCounterFormat
TString fCounterFormat
Definition: THtml.h:409
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
THtml::GetDeclImplFileName
virtual bool GetDeclImplFileName(TClass *cl, bool filesys, bool decl, TString &out_name) const
Combined implementation for GetDeclFileName(), GetImplFileName(): Return declaration / implementation...
Definition: THtml.cxx:2123
THtml::MakeTree
void MakeTree(const char *className, Bool_t force=kFALSE)
Make an inheritance tree.
Definition: THtml.cxx:2393
THtml::AddMacroPath
void AddMacroPath(const char *path)
Add path to the directories to be searched for macro files that are to be executed via the TDocMacroD...
Definition: THtml.cxx:1283
THtml::PathInfo_t::kDotNotFound
@ kDotNotFound
Definition: THtml.h:203
THtml::OutputStyle_t::fHeader
TString fHeader
Definition: THtml.h:381
THtml::fProductName
TString fProductName
Definition: THtml.h:410
THashTable::Add
void Add(TObject *obj)
Add object to the hash table.
Definition: THashTable.cxx:92
kNPOS
const Ssiz_t kNPOS
Definition: RtypesCore.h:119
TCollection::GetEntries
virtual Int_t GetEntries() const
Definition: TCollection.h:177
THtml::LoadAllLibs
static void LoadAllLibs()
Load all libraries known to ROOT via the rootmap system.
Definition: THtml.cxx:2210
TClassDocInfo::SetHtmlFileName
void SetHtmlFileName(const char *name)
Definition: TDocInfo.h:74
THtml::GetInputPath
const TString & GetInputPath() const
Definition: THtml.h:295
gEnv
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
TSystem::BaseName
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:933
TDataType::GetFullTypeName
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
Definition: TDataType.cxx:175
THtml::GetProductName
const TString & GetProductName() const
Definition: THtml.h:294
TString::Data
const char * Data() const
Definition: TString.h:369
TSystem::FreeDirectory
virtual void FreeDirectory(void *dirp)
Free a directory.
Definition: TSystem.cxx:844
THtml::GetNextClass
TClassDocInfo * GetNextClass()
Return the next class to be generated for MakeClassThreaded.
Definition: THtml.cxx:1369
TSystem::IsAbsoluteFileName
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition: TSystem.cxx:950
TSystem::Which
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1544
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TClass::Property
Long_t Property() const
Returns the properties of the TClass as a bit field stored as a Long_t value.
Definition: TClass.cxx:6029
TObjString.h
TSystem::GetSoExt
virtual const char * GetSoExt() const
Get the shared library extension.
Definition: TSystem.cxx:3997
TClassTable::Init
static void Init()
Definition: TClassTable.cxx:334
FileStat_t
Definition: TSystem.h:124
TPRegexp::Substitute
Int_t Substitute(TString &s, const TString &replace, const TString &mods="", Int_t start=0, Int_t nMatchMax=10)
Substitute replaces the string s by a new string in which matching patterns are replaced by the repla...
Definition: TPRegexp.cxx:470
THtml::MakeIndex
void MakeIndex(const char *filter="*")
Create the index files for the product, modules, all types, etc.
Definition: THtml.cxx:2369
TClassEdit::ShortType
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
Definition: TClassEdit.cxx:1287
THtml::IsNamespace
static Bool_t IsNamespace(const TClass *cl)
Check whether cl is a namespace.
Definition: THtml.cxx:2202
TDataType::GetType
Int_t GetType() const
Definition: TDataType.h:68
THtml::THelperBase::fHtml
THtml * fHtml
Definition: THtml.h:51
THtml::MakeClass
void MakeClass(const char *className, Bool_t force=kFALSE)
Make HTML files for a single class.
Definition: THtml.cxx:2292
kIsNamespace
@ kIsNamespace
Definition: TDictionary.h:95
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:867
Long64_t
long long Long64_t
Definition: RtypesCore.h:75
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
THtml::MakeAll
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.cxx:2226
output
static void output(int code)
Definition: gifencode.c:226
TCollection::SetOwner
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Definition: TCollection.cxx:746
THtml::fLinkInfo
LinkInfo_t fLinkInfo
Definition: THtml.h:416
THtml::TPathDefinition::GetFileNameFromInclude
virtual bool GetFileNameFromInclude(const char *included, TString &out_fsname) const
Set out_fsname to the full pathname corresponding to a file included as "included".
Definition: THtml.cxx:621
THtml::LinkInfo_t::fSearchStemURL
TString fSearchStemURL
Definition: THtml.h:374
TClassEdit::IsStdClass
bool IsStdClass(const char *type)
return true if the class belongs to the std namespace
Definition: TClassEdit.cxx:1400
gInterpreter
#define gInterpreter
Definition: TInterpreter.h:560
THtml::GetImplFileName
virtual bool GetImplFileName(TClass *cl, Bool_t filesys, TString &out_name) const
Return implementation file name.
Definition: THtml.cxx:2113
TClassDocInfo::GetListOfTypedefs
TList & GetListOfTypedefs()
Definition: TDocInfo.h:82
THtml::fFileDef
TFileDefinition * fFileDef
Definition: THtml.h:422
TClassDocInfo::GetDeclFileName
const char * GetDeclFileName() const
Definition: TDocInfo.h:61
THtml::TFileSysRoot
Definition: THtml.h:157
THtml::fThreadedClassCount
Int_t fThreadedClassCount
Definition: THtml.h:412
THtml::LinkInfo_t::fHomepage
TString fHomepage
Definition: THtml.h:373
THtml::HaveDot
Bool_t HaveDot()
Check whether dot is available in $PATH or in the directory set by SetDotPath()
Definition: THtml.cxx:1411
TBaseClass
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:33
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
TClassDocOutput::MakeTree
void MakeTree(Bool_t force=kFALSE)
Create an output file with a graphical representation of the class inheritance.
Definition: TClassDocOutput.cxx:1285
kIsDefinedInStd
@ kIsDefinedInStd
Definition: TDictionary.h:98
TClassDocInfo::HaveSource
Bool_t HaveSource() const
Definition: TDocInfo.h:71
TClassDocInfo::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TDocInfo.cxx:25
THtml::PathInfo_t::fEtcDir
TString fEtcDir
Definition: THtml.h:227
TPMERegexp::Match
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:706
TClassDocInfo::GetImplFileSysName
const char * GetImplFileSysName() const
Definition: TDocInfo.h:64
THtml::TModuleDefinition
Definition: THtml.h:61
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
TString::EndsWith
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2199
THtml::TFileSysDB::GetMapIno
TExMap & GetMapIno()
Definition: THtml.h:180
TObjArray::GetEntries
Int_t GetEntries() const
Return the number of objects in array (i.e.
Definition: TObjArray.cxx:523
THtml::fThreadedClassIter
TIter * fThreadedClassIter
Definition: THtml.h:411
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TSystem::MakeDirectory
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:826
THtml::TModuleDefinition::GetModule
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:104
TBaseClass.h
THtml::DocSyntax_t::fAuthorTag
TString fAuthorTag
Definition: THtml.h:363
TClass.h
THtml::GetMacroPath
const TString & GetMacroPath() const
Definition: THtml.h:302
THtml::PathInfo_t::fFoundDot
EDotAccess fFoundDot
Definition: THtml.h:220
TEnv::GetValue
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
THtml::HelperDeleted
void HelperDeleted(THelperBase *who)
Inform the THtml object that one of its helper objects was deleted.
Definition: THtml.cxx:1438
TIter::Reset
void Reset()
Definition: TCollection.h:252
THtml::DocSyntax_t::fClassDocTag
TString fClassDocTag
Definition: THtml.h:362
THtml::CreateAuxiliaryFiles
virtual void CreateAuxiliaryFiles() const
copy CSS, javascript file, etc to the output dir
Definition: THtml.cxx:1299
TSystem::PrependPathName
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Definition: TSystem.cxx:1079
TClassDocOutput.h
TList::AddLast
virtual void AddLast(TObject *obj)
Add object at the end of the list.
Definition: TList.cxx:152
TString::Format
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:2333
TObject::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:403
TEnv.h
TSystem::Load
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1853
TBaseClass::GetClassPointer
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
Definition: TBaseClass.cxx:63
THtml::CreateListOfClasses
void CreateListOfClasses(const char *filter)
Create the list of all known classes.
Definition: THtml.cxx:1555
TExMap::GetValue
Long64_t GetValue(ULong64_t hash, Long64_t key)
Return the value belonging to specified key and hash value.
Definition: TExMap.cxx:173
THtml::OutputStyle_t::fFooter
TString fFooter
Definition: THtml.h:382
THtml::PathInfo_t::kDotUnknown
@ kDotUnknown
Definition: THtml.h:201
TString
Basic string class.
Definition: TString.h:136
TSystem::AccessPathName
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:1294
gGlobalMutex
R__EXTERN TVirtualMutex * gGlobalMutex
Definition: TVirtualMutex.h:27
THtml::SetDeclFileName
void SetDeclFileName(TClass *cl, const char *filename)
Explicitly set a decl file name for TClass cl.
Definition: THtml.cxx:2494
THtml::SetOutputDir
void SetOutputDir(const char *dir)
Set the directory where the HTML pages should be written to.
Definition: THtml.cxx:2483
THtml::THelperBase::~THelperBase
virtual ~THelperBase()
Helper's destructor.
Definition: THtml.cxx:61
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
THtml::TFileSysEntry
Definition: THtml.h:106
THtml::GetViewCVS
const TString & GetViewCVS() const
Definition: THtml.h:313
THtml::~THtml
virtual ~THtml()
Default destructor.
Definition: THtml.cxx:1263
TClassDocInfo::SetDeclFileSysName
void SetDeclFileSysName(const char *fsname)
Definition: TDocInfo.h:77
TSystem::GetDirName
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:1030
TSystem::CopyFile
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE)
Copy a file.
Definition: TSystem.cxx:1339
bool
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
THtml::SetImplFileName
void SetImplFileName(TClass *cl, const char *filename)
Explicitly set a impl file name for TClass cl.
Definition: THtml.cxx:2507
THtml::TFileDefinition::GetDeclFileName
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:262
THtml::TFileDefinition::MatchFileSysName
TString MatchFileSysName(TString &filename, TFileSysEntry **fse=0) const
Find filename in the list of system files; return the system file name and change filename to the fil...
Definition: THtml.cxx:308
TString::Last
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:913
THtml::GetModuleNameForClass
virtual void GetModuleNameForClass(TString &module, TClass *cl) const
Return the module name for a given class.
Definition: THtml.cxx:1540
TList::Sort
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
Definition: TList.cxx:937
TROOT.h
THtml::GetEtcDir
virtual const char * GetEtcDir() const
Get the directory containing THtml's auxiliary files ($ROOTSYS/etc/html)
Definition: THtml.cxx:1352
TObjString
Collectable string class.
Definition: TObjString.h:28
THtml::DocEntityInfo_t::fShortClassNames
THashList fShortClassNames
Definition: THtml.h:390
TObject::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
TRegexp.h
TList::At
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:357
TString::Form
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2311
THtml::GetDerivedClasses
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.cxx:1964
THtml::CreateStyleSheet
virtual void CreateStyleSheet() const
Write the default ROOT style sheet.
Definition: THtml.cxx:1952
TSystem::GetSysInfo
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:2462
TDataType.h
gProgName
R__EXTERN const char * gProgName
Definition: TSystem.h:242
THtml
Legacy ROOT documentation system.
Definition: THtml.h:40
THtml::GetMakeClassMutex
TVirtualMutex * GetMakeClassMutex() const
Definition: THtml.h:343
TString::Tokenize
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2219
THtml::SetLocalFiles
void SetLocalFiles() const
Fill the files available in the file system below fPathInfo.fInputPath.
Definition: THtml.cxx:2418
THtml::PathInfo_t::kDotFound
@ kDotFound
Definition: THtml.h:202
THtml::DocSyntax_t::fCopyrightTag
TString fCopyrightTag
Definition: THtml.h:365
TClass::InheritsFrom
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4858
TPRegexp.h
THtml::GetPathInfo
const PathInfo_t & GetPathInfo() const
Definition: THtml.h:345
THtml::TFileSysEntry::GetParent
TFileSysDir * GetParent() const
Definition: THtml.h:127
TClassTable.h
THtml::LinkInfo_t::fXwho
TString fXwho
Definition: THtml.h:370
THtml::TFileSysEntry::GetFullName
virtual void GetFullName(TString &fullname, Bool_t asIncluded) const
Definition: THtml.h:117
THtml::GetDeclFileName
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.cxx:2105
TModuleDocInfo
Definition: TDocInfo.h:107
SysInfo_t
Definition: TSystem.h:150
TSystem.h
TDataType
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:44
THtml::THtml
THtml()
Create a THtml object.
Definition: THtml.cxx:1221
THtml::fCounter
TString fCounter
Definition: THtml.h:408
FileStat_t::fMode
Int_t fMode
Definition: TSystem.h:127
TClass::GetListOfBases
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3620
THashList::FindObject
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:262
THtml::TPathDefinition
Definition: THtml.h:92
TString::Remove
TString & Remove(Ssiz_t pos)
Definition: TString.h:673
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
THtml::TFileSysDir
Definition: THtml.h:138
TClassDocInfo::GetClass
TDictionary * GetClass() const
Definition: TDocInfo.h:58
THtml::DocSyntax_t::fLastUpdateTag
TString fLastUpdateTag
Definition: THtml.h:364
THtml::TFileSysDB::GetEntries
THashTable & GetEntries()
Definition: THtml.h:181
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:96
THtml::TFileDefinition::GetFileName
virtual bool GetFileName(const TClass *cl, bool decl, TString &out_filename, TString &out_fsys, TFileSysEntry **fse=0) const
Common implementation for GetDeclFileName(), GetImplFileName()
Definition: THtml.cxx:338
TSystem::Exec
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:654
gHtml
THtml * gHtml
Definition: THtml.cxx:39
THtml::CreateHierarchy
void CreateHierarchy()
Create the inheritance hierarchy diagram for all classes.
Definition: THtml.cxx:1936
Long_t
long Long_t
Definition: RtypesCore.h:54
xmlio::String
const char * String
Definition: TXMLSetup.cxx:94
TString::First
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition: TString.cxx:520
TObject::Clone
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TObject.cxx:146
TClass::GetDeclFileName
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition: TClass.cxx:3407
TDocOutput.h
extract_docstrings.module
module
Definition: extract_docstrings.py:39
THtml::TFileSysDB
Definition: THtml.h:174
what
static const char * what
Definition: stlLoader.cc:6
gDebug
Int_t gDebug
Definition: TROOT.cxx:590
THtml::TFileDefinition::ExpandSearchPath
void ExpandSearchPath(TString &path) const
Create all permutations of path and THtml's input path: path being PP/ and THtml's input being .
Definition: THtml.cxx:206
R__LOCKGUARD
#define R__LOCKGUARD(mutex)
Definition: TVirtualMutex.h:104
TVirtualMutex::Lock
virtual Int_t Lock()=0
THtml::TPathDefinition::GetDocDir
virtual bool GetDocDir(const TString &module, TString &doc_dir) const
Determine the module's documentation directory.
Definition: THtml.cxx:542
TString::BeginsWith
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:615
THtml::GetHtmlFileName
virtual void GetHtmlFileName(TClass *classPtr, TString &filename) const
Return real HTML filename.
Definition: THtml.cxx:2001
THtml::fDocSyntax
DocSyntax_t fDocSyntax
Definition: THtml.h:415
TClass::GetClass
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:2946
TSystem::LoadAllLibraries
virtual UInt_t LoadAllLibraries()
Load all libraries known to ROOT via the rootmap system.
Definition: TSystem.cxx:1966
TClass::GetClassInfo
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:430
THtml::GetModuleDefinition
const TModuleDefinition & GetModuleDefinition() const
Return the TModuleDefinition (or derived) object as set by SetModuleDefinition(); create and return a...
Definition: THtml.cxx:1311
TClass::GetImplFileName
const char * GetImplFileName() const
Definition: TClass.h:453
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TSystem::ExpandPathName
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Definition: TSystem.cxx:1272
TSystem::Sleep
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition: TSystem.cxx:438
THtml::TFileSysDB::GetMaxLevel
Int_t GetMaxLevel() const
Definition: THtml.h:183
THtml::fDocEntityInfo
DocEntityInfo_t fDocEntityInfo
Definition: THtml.h:419
THtml::CreateListOfTypes
void CreateListOfTypes()
Create index of all data types and a page for each typedef-to-class.
Definition: THtml.cxx:1905
THtml::TFileDefinition::GetImplFileName
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:279
TCollection::IsEmpty
virtual Bool_t IsEmpty() const
Definition: TCollection.h:186
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
TModuleDocInfo::GetClasses
TList * GetClasses()
Definition: TDocInfo.h:122
TClassTable::Next
static char * Next()
Returns next class from sorted class table.
Definition: TClassTable.cxx:681
TClassDocInfo::GetModule
TModuleDocInfo * GetModule() const
Definition: TDocInfo.h:67
TModuleDocInfo::SetSelected
void SetSelected(Bool_t sel=kTRUE)
Definition: TDocInfo.h:118
TThread::Join
Long_t Join(void **ret=nullptr)
Join this thread.
Definition: TThread.cxx:515
unsigned int
THtml::DocEntityInfo_t::fClassFilter
TString fClassFilter
Definition: THtml.h:388
THtml::fBatch
Bool_t fBatch
Definition: THtml.h:424
TPRegexp
Definition: TPRegexp.h:36
TString::Index
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:639
TROOT::GetEtcDir
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
Definition: TROOT.cxx:2964
Printf
void Printf(const char *fmt,...)
FileStat_t::fIno
Long_t fIno
Definition: TSystem.h:126
SysInfo_t::fCpus
Int_t fCpus
Definition: TSystem.h:154
TDocOutput
Definition: TDocOutput.h:37
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
THtml::SetFileDefinition
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.cxx:2440
TClassDocInfo::GetImplFileName
const char * GetImplFileName() const
Definition: TDocInfo.h:62
THtml::PathInfo_t::fMacroPath
TString fMacroPath
Definition: THtml.h:225
THtml::THelperBase::SetOwner
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:74
TThread.h
THtml::LinkInfo_t::fSearchEngine
TString fSearchEngine
Definition: THtml.h:375
THtml::fModuleDef
TModuleDefinition * fModuleDef
Definition: THtml.h:421
TClassDocInfo::SetModule
void SetModule(TModuleDocInfo *module)
Definition: TDocInfo.h:66
THtml::TPathDefinition::GetIncludeAs
virtual bool GetIncludeAs(TClass *cl, TString &out_include_as) const
Determine the path and filename used in an include statement for the header file of the given class.
Definition: THtml.cxx:572
THtml::SetFoundDot
void SetFoundDot(Bool_t found=kTRUE)
Set whether "dot" (a GraphViz utility) is available.
Definition: THtml.cxx:2410
TThread::GetState
EState GetState() const
Definition: TThread.h:129
TSystem::OpenDirectory
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TSystem.cxx:835
THtml::ShortType
const char * ShortType(const char *name) const
Get short type name, i.e. with default templates removed.
Definition: THtml.cxx:2520
THtml::OutputStyle_t::fCharset
TString fCharset
Definition: THtml.h:383
THtml::GetURL
const char * GetURL(const char *lib=0) const
Get the documentation URL for library lib.
Definition: THtml.cxx:1395
TObjArray.h
THtml::DocSyntax_t::fDocStyle
TString fDocStyle
Definition: THtml.h:366
TClassEdit.h
THtml::GetClass
virtual TClass * GetClass(const char *name) const
Return pointer to class with name.
Definition: THtml.cxx:2076
TClassDocInfo::SetImplFileName
void SetImplFileName(const char *name)
Definition: TDocInfo.h:76
TVirtualMutex::UnLock
virtual Int_t UnLock()=0
THtml::GetOutputDir
const TString & GetOutputDir(Bool_t createDir=kTRUE) const
Return the output directory as set by SetOutputDir().
Definition: THtml.cxx:2177
TCollection::GetSize
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
TInterpreter.h
THtml::TFileSysEntry::GetName
const char * GetName() const
Returns name of object.
Definition: THtml.h:115
R_ISDIR
Bool_t R_ISDIR(Int_t mode)
Definition: TSystem.h:115
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
THtml::Convert
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.cxx:1470
THashList::Clear
void Clear(Option_t *option="")
Remove all objects from the list.
Definition: THashList.cxx:189
TClassTable::Classes
int Classes()
Definition: TClassTable.cxx:332
TROOT::GetLibDir
static const TString & GetLibDir()
Get the library directory in the installation. Static utility function.
Definition: TROOT.cxx:2933
TList::Add
virtual void Add(TObject *obj)
Definition: TList.h:87
TSystem::GetDirEntry
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
Definition: TSystem.cxx:852
THtml::LinkInfo_t::fViewCVS
TString fViewCVS
Definition: THtml.h:376
THtml::fMakeClassMutex
TVirtualMutex * fMakeClassMutex
Definition: THtml.h:413
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
THtml::fGClient
TGClient * fGClient
Definition: THtml.h:414
TClassDocOutput
Definition: TClassDocOutput.h:21
TClassDocOutput::Class2Html
void Class2Html(Bool_t force=kFALSE)
Create HTML files for a single class.
Definition: TClassDocOutput.cxx:70
THtml::CopyFileFromEtcDir
Bool_t CopyFileFromEtcDir(const char *filename) const
Copy a file from $ROOTSYS/etc/html into GetOutputDir()
Definition: THtml.cxx:1915
THtml::LinkInfo_t::fLibURLs
std::map< std::string, TString > fLibURLs
Definition: THtml.h:372
TList::Clear
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:402
name
char name[80]
Definition: TGX11.cxx:110
THtml::SetPathDefinition
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.cxx:2452
d
#define d(i)
Definition: RSha256.hxx:102
THtml::TFileSysDB::Fill
void Fill()
Recursively fill entries by parsing the path specified in GetName(); can be a THtml::GetDirDelimiter(...
Definition: THtml.cxx:711
TClassDocInfo::SetSelected
void SetSelected(Bool_t sel=kTRUE)
Definition: TDocInfo.h:69
TSystem::ConcatFileName
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1069
THtml::TFileSysDir::Recurse
void Recurse(TFileSysDB *db, const char *path)
Recursively fill entries by parsing the contents of path.
Definition: THtml.cxx:661
TIter
Definition: TCollection.h:233
THtml::fPathDef
TPathDefinition * fPathDef
Definition: THtml.h:420
THtml::fPathInfo
PathInfo_t fPathInfo
Definition: THtml.h:418
THtml::LinkInfo_t::fROOTURL
TString fROOTURL
Definition: THtml.h:371
THtml::TFileSysDB::GetIgnore
const TString & GetIgnore() const
Definition: THtml.h:182
TExMap::Add
void Add(ULong64_t hash, Long64_t key, Long64_t value)
Add an (key,value) pair to the table. The key should be unique.
Definition: TExMap.cxx:87
TClassDocInfo::SetImplFileSysName
void SetImplFileSysName(const char *fsname)
Definition: TDocInfo.h:78
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
SetName
gr SetName("gr")
TThread::kRunningState
@ kRunningState
Definition: TThread.h:64
TModuleDocInfo::AddClass
void AddClass(TClassDocInfo *cl)
Definition: TDocInfo.h:121
THtml::fLocalFiles
TFileSysDB * fLocalFiles
Definition: THtml.h:423
TString::ToLower
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1147
kReadPermission
@ kReadPermission
Definition: TSystem.h:47
THtml::TFileDefinition::SplitClassIntoDirFile
void SplitClassIntoDirFile(const TString &clname, TString &dir, TString &filename) const
Given a class name with a scope, split the class name into directory part and file name: A::B::C beco...
Definition: THtml.cxx:234
Riostream.h
THtml.h
TClassDocInfo::IsSelected
Bool_t IsSelected() const
Definition: TDocInfo.h:70
THtml::fOutputStyle
OutputStyle_t fOutputStyle
Definition: THtml.h:417
THtml::PathInfo_t::fInputPath
TString fInputPath
Definition: THtml.h:221
TThread::Run
Int_t Run(void *arg=nullptr)
Start the thread.
Definition: TThread.cxx:568
THtml::PathInfo_t::fIgnorePath
TString fIgnorePath
Definition: THtml.h:223
THtml::SetModuleDefinition
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.cxx:2428
TSystem::ProcessEvents
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:417
THtml::TFileDefinition::NormalizePath
void NormalizePath(TString &path) const
Remove "/./" and collapse "/subdir/../" to "/".
Definition: THtml.cxx:289
TClassDocInfo::GetHtmlFileName
const char * GetHtmlFileName() const
Definition: TDocInfo.h:60
THtml::DocEntityInfo_t::fClasses
THashList fClasses
Definition: THtml.h:389
TList
A doubly linked list.
Definition: TList.h:44
gROOT
#define gROOT
Definition: TROOT.h:406
int
THtml::MakeClassThreaded
static void * MakeClassThreaded(void *info)
Entry point of worker threads for multi-threaded MakeAll().
Definition: THtml.cxx:2353
TClass::GetSharedLibs
const char * GetSharedLibs()
Get the list of shared libraries containing the code for class cls.
Definition: TClass.cxx:3607
THtml::TFileDefinition
Definition: THtml.h:71
THtml::SetInputDir
void SetInputDir(const char *dir)
Set the directory containing the source files.
Definition: THtml.cxx:2469
ROOT::TMetaUtils::GetFileName
llvm::StringRef GetFileName(const clang::Decl &decl, const cling::Interpreter &interp)
Return the header file to be included to declare the Decl.
Definition: TClingUtils.cxx:3341
TClassDocInfo
Definition: TDocInfo.h:29