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 otehrwise.
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 sucessfully 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 sucessfuly 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 ////////////////////////////////////////////////////////////////////////////////
744 /* BEGIN_HTML
745 <p>The THtml class is designed to easily document
746 classes, code, and code related text files (like change logs). It generates HTML
747 pages conforming to the XHTML 1.0 transitional specifications; an example of
748 these pages is ROOT's own <a href="http://root.cern.ch/root/html/ClassIndex.html">
749 reference guide</a>. This page was verified to be valid XHTML 1.0 transitional,
750 which proves that all pages generated by THtml can be valid, as long as the user
751 provided XHTML (documentation, header, etc) is valid. You can check the current
752 THtml by clicking this icon:
753 <a href="http://validator.w3.org/check?uri=referer"><img
754  src="http://www.w3.org/Icons/valid-xhtml10"
755  alt="Valid XHTML 1.0 Transitional" height="31" width="88" style="border: none;"/></a></p>
756 Overview:
757 <ol style="list-style-type: upper-roman;">
758  <li><a href="#usage">Usage</a></li>
759  <li><a href="#conf">Configuration</a>
760  <ol><li><a href="#conf:input">Input files</a></li>
761  <li><a href="#conf:output">Output directory</a></li>
762  <li><a href="#conf:liblink">Linking other documentation</a></li>
763  <li><a href="#conf:classdoc">Recognizing class documentation</a></li>
764  <li><a href="#conf:tags">Author, copyright, etc.</a></li>
765  <li><a href="#conf:header">Header and footer</a></li>
766  <li><a href="#conf:search">Links to searches, home page, ViewVC</a></li>
767  <li><a href="#conf:charset">HTML Charset</a></li>
768  </ol></li>
769  <li><a href="#syntax">Documentation syntax</a>
770  <ol><li><a href="#syntax:classdesc">Class description</a></li>
771  <li><a href="#syntax:classidx">Class index</a></li>
772  <li><a href="#syntax:meth">Method documentation</a></li>
773  <li><a href="#syntax:datamem">Data member documentation</a></li>
774  </ol></li>
775  <li><a href="#directive">Documentation directives</a>
776  <ol><li><a href="#directive:html"><tt>BEGIN<!-- -->_HTML</tt> <tt>END<!-- -->_HTML</tt>: include 'raw' HTML</a></li>
777  <li><a href="#directive:macro"><tt>BEGIN<!-- -->_MACRO</tt> <tt>END<!-- -->_MACRO</tt>: include a picture generated by a macro</a></li>
778  <li><a href="#directive:latex"><tt>BEGIN<!-- -->_LATEX</tt> <tt>END<!-- -->_LATEX</tt>: include a latex picture</a></li>
779  </ol></li>
780  <li><a href="#index">Product and module index</a></li>
781  <li><a href="#aux">Auxiliary files: style sheet, JavaScript, help page</a></li>
782  <li><a href="#charts">Class Charts</a></li>
783  <li><a href="#confvar">Configuration variables</a></li>
784  <li><a href="#how">Behind the scenes</a></li>
785 </ol>
786 
787 
788 <h3><a name="usage">I. Usage</a></h3>
789 These are typical things people do with THtml:
790 <pre>
791  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
792  root[] html.LoadAllLibs(); // Load all rootmap'ed libraries
793  root[] html.MakeAll(); // generate documentation for all changed classes
794 </pre>
795 or to run on just a few classes:
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.MakeIndex(); // create auxiliary files (style sheet etc) and indices
799  root[] html.MakeClass("TMyClass"); // create documentation for TMyClass only
800 </pre>
801 To "beautify" (i.e. create links to documentation for class names etc) some text
802 file or macro, use:
803 <pre>
804  root[] html.Convert( "hsimple.C", "Histogram example" )
805 </pre>
806 
807 
808 <h3><a name="conf">II. Configuration</a></h3>
809 Most configuration options can be set as a call to THtml, or as a TEnv variable,
810 which you can set in your .rootrc.
811 
812 <h4><a name="conf:input">II.1 Input files</a></h4>
813 
814 <p>In your .rootrc, define Root.Html.SourceDir to point to directories containing
815 .cxx and .h files (see: <a href="http://root.cern.ch/root/html/TEnv.html">TEnv</a>)
816 of the classes you want to document, or call THtml::SetInputDir()</p>
817 
818 <p>Example:</p><pre>
819  Root.Html.SourceDir: .:src:include
820  Root.Html.Root: http://root.cern.ch/root/html</pre>
821 
822 
823 <h4><a name="conf:output">II.2 Output directory</a></h4>
824 
825 <p>The output directory can be specified using the Root.Html.OutputDir
826 configuration variable (default value: "htmldoc"). If that directory
827 doesn't exist <a href="http://root.cern.ch/root/html/THtml.html">THtml</a>
828 will create it.</p>
829 
830 <p>Example:</p><pre>
831  Root.Html.OutputDir: htmldoc</pre>
832 
833 <h4><a name="conf:liblink">II.3 Linking other documentation</a></h4>
834 
835 <p>When trying to document a class, THtml searches for a source file in
836 the directories set via SetInputDir(). If it cannot find it, it assumes
837 that this class must have been documented before. Based on the library
838 this class is defined in, it checks the configuration variable
839 <tt>Root.Html.LibName</tt>, and creates a link using its value.
840 Alternatively, you can set these URLs via THtml::SetLibURL().</p>
841 
842 <p>Example:<br/>
843 If a class MyClass is defined in class mylibs/libMyLib.so, and .rootrc
844 contains</p><pre>
845  Root.Html.MyLib: ../mylib/</pre>
846 <p>THtml will create a link to "../mylib/MyClass.html".</p>
847 
848 <p>The library name association can be set up using the rootmap facility.
849 For the library in the example above, which contains a dictionary
850 generated from the linkdef MyLinkdef.h, the command to generate the
851 rootmap file is</p>
852 <pre> $ rlibmap -f -r rootmap -l mylib/libMyLib.so -d libCore.so -c MyLinkdef.h</pre>
853 <p>Here, <tt>-r</tt> specifies that the entries for libMyLib should be updated,
854 <tt>-l</tt> specifies the library we're dealing with, <tt>-d</tt> its
855 dependencies, and <tt>-c</tt> its linkdef. The rootmap file must be within
856 one of the <tt>LD_LIBRARY_PATH</tt> (or <tt>PATH</tt> for Windows) directories
857 when ROOT is started, otherwise ROOT will not use it.</p>
858 
859 <h4><a name="conf:classdoc">II.4 Recognizing class documentation</a></h4>
860 
861 <p>The class documentation has to appear in the header file containing the
862 class, right in front of its declaration. It is introduced by a string
863 defined by Root.Html.Description or SetClassDocTag(). See the section on
864 <a href="#syntax">documentation syntax</a> for further details.</p>
865 
866 <p>Example:</p><pre>
867  Root.Html.Description: //____________________</pre>
868 
869 <p>The class documentation will show which include statement is to be used
870 and which library needs to be linked to access it.
871 The include file name is determined via
872 <a href="http://root.cern.ch/root/html/TClass.html#TClass:GetDeclFileName">
873 TClass::GetDeclFileName()</a>;
874 leading parts are removed if they match any of the ':' separated entries in
875 THtml::GetIncludePath().</p>
876 
877 <h4><a name="conf:tags">II.5 Author, copyright, etc.</a></h4>
878 
879 <p>During the conversion,
880 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will look for
881 some strings ("tags") in the source file, which have to appear right in
882 front of e.g. the author's name, copyright notice, etc. These tags can be
883 defined with the following environment variables: Root.Html.Author,
884 Root.Html.LastUpdate and Root.Html.Copyright, or with
885 SetAuthorTag(), SetLastUpdateTag(), SetCopyrightTag().</p>
886 
887 <p>If the LastUpdate tag is not found, the current date and time are used.
888 This is useful when using
889 <a href="http://root.cern.ch/root/html/THtml.html#THtml:MakeAll">THtml::MakeAll()</a>'s
890 default option force=kFALSE, in which case
891 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> generates
892 documentation only for changed classes.</p>
893 
894 Authors can be a comma separated list of author entries. Each entry has
895 one of the following two formats
896 <ul><li><tt>Name (non-alpha)</tt>.
897 <p><a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will generate an
898 HTML link for <tt>Name</tt>, taking the Root.Html.XWho configuration
899 variable (defaults to "http://consult.cern.ch/xwho/people?") and adding
900 all parts of the name with spaces replaces by '+'. Non-alphanumerical
901 characters are printed out behind <tt>Name</tt>.</p>
902 
903 <p>Example:</p>
904 <tt>// Author: Enrico Fermi</tt> appears in the source file.
905 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will generate the link
906 <tt>http://consult.cern.ch/xwho/people?Enrico+Fermi</tt>. This works well for
907 people at CERN.</li>
908 
909 <li><tt>Name &lt;link&gt; Info</tt>.
910 <p><a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will generate
911 an HTML link for <tt>Name</tt> as specified by <tt>link</tt> and print
912 <tt>Info</tt> behind <tt>Name</tt>.</p>
913 
914 <p>Example:</p>
915 <tt>// Author: Enrico Fermi &lt;http://www.enricos-home.it&gt;</tt> or<br/>
916 <tt>// Author: Enrico Fermi &lt;mailto:enrico@fnal.gov&gt;</tt> in the
917 source file. That's world compatible.</li>
918 </ul>
919 
920 <p>Example (with defaults given):</p><pre>
921  Root.Html.Author: // Author:
922  Root.Html.LastUpdate: // @(#)
923  Root.Html.Copyright: * Copyright
924  Root.Html.XWho: http://consult.cern.ch/xwho/people?</pre>
925 
926 
927 <h4><a name="conf:header">II.6 Header and footer</a></h4>
928 
929 <p><a href="http://root.cern.ch/root/html/THtml.html">THtml</a> generates
930 a default header and footer for all pages. You can
931 specify your own versions with the configuration variables Root.Html.Header
932 and Root.Html.Footer, or by calling SetHeader(), SetFooter().
933 Both variables default to "", using the standard Root
934 versions. If it has a "+" appended, <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will
935 write both versions (user and root) to a file, for the header in the order
936 1st root, 2nd user, and for the footer 1st user, 2nd root (the root
937 versions containing "&lt;html&gt;" and &lt;/html&gt; tags, resp).</p>
938 
939 <p>If you want to replace root's header you have to write a file containing
940 all HTML elements necessary starting with the &lt;doctype&gt; tag and ending with
941 (and including) the &lt;body&gt; tag. If you add your header it will be added
942 directly after Root's &lt;body&gt; tag. Any occurrence of the string <tt>%TITLE%</tt>
943 in the user's header file will be replaced by
944 a sensible, automatically generated title. If the header is generated for a
945 class, occurrences of <tt>%CLASS%</tt> will be replaced by the current class's name,
946 <tt>%SRCFILE%</tt> and <tt>%INCFILE%</tt> by the name of the source and header file, resp.
947 (as given by <a href="http://root.cern.ch/root/html/TClass.html#TClass:GetImplFileLine">TClass::GetImplFileName()</a>,
948 <a href="http://root.cern.ch/root/html/TClass.html#TClass:GetImplFileLine">TClass::GetDeclFileName()</a>).
949 If the header is not generated for a class, they will be replaced by "".</p>
950 
951 <p>Root's footer starts with the tag &lt;!--SIGNATURE--&gt;. It includes the
952 author(s), last update, copyright, the links to the Root home page, to the
953 user home page, to the index file (ClassIndex.html), to the top of the page
954 and <tt>this page is automatically generated</tt> infomation. It ends with the
955 tags <tt>&lt;/body&gt;&lt;/html&gt;</tt>. If you want to replace it,
956 <a href="http://root.cern.ch/root/html/THtml.html">THtml</a> will search for some
957 tags in your footer: Occurrences of the strings <tt>%AUTHOR%</tt>, <tt>%UPDATE%</tt>, and
958 <tt>%COPYRIGHT%</tt> are replaced by their
959 corresponding values before writing the html file. The <tt>%AUTHOR%</tt> tag will be
960 replaced by the exact string that follows Root.Html.Author, no link
961 generation will occur.</p>
962 
963 
964 <h4><a name="conf:search">II.7 Links to searches, home page, ViewVC</a></h4>
965 
966 <p>Additional parameters can be set by Root.Html.Homepage (address of the
967 user's home page), Root.Html.SearchEngine (search engine for the class
968 documentation), Root.Html.Search (search URL, where %u is replaced by the
969 referer and %s by the escaped search expression), and a ViewVC base URL
970 Root.Html.ViewCVS. For the latter, the file name is appended or, if
971 the URL contains %f, %f is replaced by the file name.
972 All values default to "".</p>
973 
974 <p>Examples:</p><pre>
975  Root.Html.Homepage: http://www.enricos-home.it
976  Root.Html.SearchEngine: http://root.cern.ch/root/Search.phtml
977  Root.Html.Search: http://www.google.com/search?q=%s+site%3A%u</pre>
978 
979 
980 <h4><a name="conf:charset">II.8 HTML Charset</a></h4>
981 
982 <p>XHTML 1.0 transitional recommends the specification of the charset in the
983 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>
984 <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
985 can be changed using Root.Html.Charset.</p>
986 
987 <p>Example:</p><pre>
988  Root.Html.Charset: EUC-JP</pre>
989 
990 <h3><a name="syntax">III. Documentation syntax</a></h3>
991 <h4><a name="syntax:classdesc">III.1 Class description</a></h4>
992 
993 <p>A class description block, which must be placed before the first
994 member function, has a following form:</p>
995 <pre>
996 ////////////////////////////////////////////////////////////////
997 // //
998 // TMyClass //
999 // //
1000 // This is the description block. //
1001 // //
1002 ////////////////////////////////////////////////////////////////
1003 </pre>
1004 <p>The environment variable Root.Html.Description
1005 (see: <a href="http://root.cern.ch/root/html/TEnv.html">TEnv</a>) contains
1006 the delimiter string (default value: <tt>//_________________</tt>). It means
1007 that you can also write your class description block like this:</p>
1008 <pre>
1009  //_____________________________________________________________
1010  // A description of the class starts with the line above, and
1011  // will take place here !
1012  //
1013 </pre>
1014 <p>Note that <b><i>everything</i></b> until the first non-commented line is considered
1015 as a valid class description block.</p>
1016 
1017 <h4><a name="syntax:classidx">III.2 Class index</a></h4>
1018 
1019 <p>All classes to be documented will have an entry in the ClassIndex.html,
1020 showing their name with a link to their documentation page and a miniature
1021 description. This discription for e.g. the class MyClass has to be given
1022 in MyClass's header as a comment right after ClassDef(MyClass, n).</p>
1023 
1024 <h4><a name="syntax:meth">III.3 Method documentation</a></h4>
1025 <p>A member function description block starts immediately after '{'
1026 and looks like this:</p>
1027 <pre>
1028  void TWorld::HelloWorldFunc(string *text)
1029  {
1030  // This is an example of description for the
1031  // TWorld member function
1032 
1033  helloWorld.Print( text );
1034  }
1035 </pre>
1036 Like in a class description block, <b><i>everything</i></b> until the first
1037 non-commented line is considered as a valid member function
1038 description block.
1039 
1040 If the rootrc variable <tt>Root.Html.DescriptionStyle</tt> is set to
1041 <tt>Doc++</tt> THtml will also look for method documentation in front of
1042 the function implementation. This feature is not recommended; source code
1043 making use of this does not comply to the ROOT documentation standards, which
1044 means future versions of THtml might not support it anymore.
1045 
1046 <h4><a name="syntax:datamem">III.4 Data member documentation</a></h4>
1047 
1048 <p>Data members are documented by putting a C++ comment behind their
1049 declaration in the header file, e.g.</p>
1050 <pre>
1051  int fIAmADataMember; // this is a data member
1052 </pre>
1053 
1054 
1055 <h3><a name="directive">IV. Documentation directives</a></h3>
1056 <em>NOTE that THtml does not yet support nested directives
1057 (i.e. latex inside html etc)!</em>
1058 
1059 <h4><a name="directive:html">IV.1 <tt>BEGIN<!-- -->_HTML</tt> <tt>END<!-- -->_HTML</tt>: include 'raw' HTML</a></h4>
1060 
1061 <p>You can insert pure html code into your documentation comments. During the
1062 generation of the documentation, this code will be inserted as is
1063 into the html file.</p>
1064 <p>Pure html code must be surrounded by the keywords
1065 <tt>BEGIN<!-- -->_HTML</tt> and <tt>END<!-- -->_HTML</tt>, where the
1066 case is ignored.
1067 An example of pure html code is this class description you are reading right now.
1068 THtml uses a
1069 <a href="http://root.cern.ch/root/html/TDocHtmlDirective.html">TDocHtmlDirective</a>
1070 object to process this directive.</p>
1071 
1072 <h4><a name="directive:macro">IV.2 <tt>BEGIN<!-- -->_MACRO</tt> <tt>END<!-- -->_MACRO</tt>: include a picture generated by a macro</a></h4>
1073 
1074 <p>THtml can create images from scripts. You can either call an external
1075 script by surrounding it by "begin_macro"/"end_macro", or include an unnamed
1076 macro within these keywords. The macro should return a pointer to an object;
1077 this object will then be saved as a GIF file.</p>
1078 <p>Objects deriving from
1079 <a href="http://root.cern.ch/root/html/TGObject.html">TGObject</a> (GUI elements)
1080 will need to run in graphics mode (non-batch). You must specify this as a parameter:
1081 "Begin_macro(GUI)...".
1082 To create a second tab that displays the source of the macro you can specify
1083 the argument "Begin_macro(source)...".
1084 Of course you can combine them,
1085 e.g. as "Begin_macro(source,gui)...".
1086 THtml uses a
1087 <a href="http://root.cern.ch/root/html/TDocMacroDirective.html">TDocMacroDirective</a>
1088 object to process this directive.</p>
1089 <p>This is an example:</p> END_HTML
1090 BEGIN_MACRO(source)
1091 {
1092  TCanvas* macro_example_canvas = new TCanvas("macro_example_canvas", "", 150, 150);
1093  macro_example_canvas->SetBorderSize(0);
1094  macro_example_canvas->SetFillStyle(1001);
1095  macro_example_canvas->SetFillColor(kWhite);
1096  macro_example_canvas->cd();
1097  TArc* macro_example_arc = new TArc(0.5,0.32,0.11,180,360);
1098  macro_example_arc->Draw();
1099  TEllipse* macro_example_ellipsis = new TEllipse(0.42,0.58,0.014,0.014,0,360,0);
1100  macro_example_ellipsis->SetFillStyle(0);
1101  macro_example_ellipsis->Draw();
1102  macro_example_ellipsis = new TEllipse(0.58,0.58,0.014,0.014,0,360,0);
1103  macro_example_ellipsis->SetFillStyle(0);
1104  macro_example_ellipsis->Draw();
1105  macro_example_ellipsis = new TEllipse(0.50,0.48,0.22,0.32,0,360,0);
1106  macro_example_ellipsis->SetFillStyle(0);
1107  macro_example_ellipsis->Draw();
1108  TLine* macro_example_line = new TLine(0.48,0.53,0.52,0.41);
1109  macro_example_line->Draw();
1110  return macro_example_canvas;
1111 }
1112 END_MACRO
1113 
1114 BEGIN_HTML
1115 <h4><a name="directive:latex">IV.3 <tt>BEGIN<!-- -->_LATEX</tt> <tt>END<!-- -->_LATEX</tt>: include a latex picture</a></h4>
1116 
1117 <p>You can specify <a href="http://root.cern.ch/root/html/TLatex.html">TLatex</a>
1118 style text and let THtml convert it into an image by surrounding it by "Begin_Latex", "End_Latex".
1119 You can have multiple lines, and e.g. align each line at the '=' sign by passing
1120 the argument <tt>separator='='</tt>. You can also specify how to align these parts;
1121 if you want the part left of the separator to be right aligned, and the right part
1122 to be left aligned, you could specify <tt>align='rl'</tt>.
1123 THtml uses a <a href="http://root.cern.ch/root/html/TDocLatexDirective.html">TDocLatexDirective</a>
1124 object to process the directive.
1125 This is an example output with arguments <tt>separator='=', align='rl'</tt>:</p>
1126 END_HTML BEGIN_LATEX(separator='=', align='rl')#kappa(x)^{2}=sin(x)^{x}
1127 x=#chi^{2} END_LATEX
1128 
1129 BEGIN_HTML
1130 
1131 <h3><a name="index">V. Product and module index</a></h3>
1132 
1133 <p><a href="#THtml:MakeIndex">THtml::MakeIndex()</a> will generate index files for classes
1134 and types, all modules, and the product which you can set by
1135 <a href="#THtml:SetProductName">THtml::SetProductName()</a>.
1136 THtml will make use of external documentation in the module and product index,
1137 either by linking it or by including it.
1138 The files for modules are searched based on the source file directory of the
1139 module's classes.</p>
1140 
1141 <p>A filename starting with "index." will be included in the index page;
1142 all other files will be linked.
1143 Only files ending on <tt>.html</tt> or <tt>.txt</tt> will be taken into account;
1144 the text files will first be run through
1145 <a href="#THtml:Convert">THtml::Convert()</a>.
1146 You can see an example <a href="http://root.cern.ch/root/html/HIST_Index.html">here</a>;
1147 the part between "Index of HIST classes" and "Jump to" is created by parsing
1148 the module's doc directory.</p>
1149 
1150 <h3><a name="aux">VI. Auxiliary files: style sheet, JavaScript, help page</a></h3>
1151 
1152 <p>The documentation pages share a common set of javascript and CSS files. They
1153 are generated automatically when running <a href="#THtml:MakeAll">MakeAll()</a>;
1154 they can be generated on
1155 demand by calling <a href="#THtml:CreateAuxiliaryFiles">CreateAuxiliaryFiles()</a>.</p>
1156 
1157 
1158 <h3><a name="charts">VII. Class Charts</a></h3>
1159 THtml can generate a number of graphical representations for a class, which
1160 are displayed as a tabbed set of imaged ontop of the class description.
1161 It can show the inheritance, inherited and hidden members, directly and
1162 indirectly included files, and library dependencies.
1163 
1164 These graphs are generated using the <a href="http://www.graphviz.org/">Graphviz</a>
1165 package. You can install it from <a href="http://www.graphviz.org">http://www.graphviz.org</a>.
1166 You can either put it into your $PATH, or tell THtml where to find it by calling
1167 <a href="#THtml:SetDotDir">SetDotDir()</a>.
1168 
1169 
1170 <h3><a name="confvar">VIII. Configuration variables</a></h3>
1171 
1172 <p>Here is a list of all configuration variables that are known to THtml.
1173 You can set them in your .rootrc file, see
1174 <a href="http://root.cern.ch/root/html/TEnv.html">TEnv</a>.</p>
1175 
1176 <pre>
1177  Root.Html.OutputDir (default: htmldoc)
1178  Root.Html.SourceDir (default: .:src/:include/)
1179  Root.Html.Author (default: // Author:) - start tag for authors
1180  Root.Html.LastUpdate (default: // @(#)) - start tag for last update
1181  Root.Html.Copyright (default: * Copyright) - start tag for copyright notice
1182  Root.Html.Description (default: //____________________ ) - start tag for class descr
1183  Root.Html.HomePage (default: ) - URL to the user defined home page
1184  Root.Html.Header (default: ) - location of user defined header
1185  Root.Html.Footer (default: ) - location of user defined footer
1186  Root.Html.Root (default: ) - URL of Root's class documentation
1187  Root.Html.SearchEngine (default: ) - link to the search engine
1188  Root.Html.Search (defualt: ) - link to search by replacing "%s" with user input
1189  Root.Html.ViewCVS (default: ) - URL of ViewCVS base
1190  Root.Html.XWho (default: http://consult.cern.ch/xwho/people?) - URL of CERN's xWho
1191  Root.Html.Charset (default: ISO-8859-1) - HTML character set
1192 </pre>
1193 
1194 <h3><a name="how">IX. Behind the scene</a></h3>
1195 
1196 <p>Internally, THtml is just an API class that sets up the list of known
1197 classes, and forwards API invocations to the "work horses".
1198 <a href="http://root.cern.ch/root/html/TDocOutput.html">TDocOutput</a>
1199 generates the output by letting a
1200 <a href="http://root.cern.ch/root/html/TDocParser.html">TDocParser</a>
1201 object parse the sources, which in turn invokes objects deriving from
1202 <a href="http://root.cern.ch/root/html/TDocDirective.html">TDocDirective</a>
1203 to process directives.</p>
1204 
1205 END_HTML */
1206 ////////////////////////////////////////////////////////////////////////////////
1207 
1208 ClassImp(THtml);
1209 ////////////////////////////////////////////////////////////////////////////////
1210 /// Create a THtml object.
1211 /// In case output directory does not exist an error
1212 /// will be printed and gHtml stays 0 also zombie bit will be set.
1213 
1215  fCounterFormat("%12s %5s %s"),
1216  fProductName("(UNKNOWN PRODUCT)"),
1218  fGClient(0), fPathDef(0), fModuleDef(0), fFileDef(0),
1220 {
1221  // check for source directory
1222  fPathInfo.fInputPath = gEnv->GetValue("Root.Html.SourceDir", "./:src/:include/");
1223 
1224  // check for output directory
1225  SetOutputDir(gEnv->GetValue("Root.Html.OutputDir", "htmldoc"));
1226 
1227  fLinkInfo.fXwho = gEnv->GetValue("Root.Html.XWho", "http://consult.cern.ch/xwho/people?");
1228  fLinkInfo.fROOTURL = gEnv->GetValue("Root.Html.Root", "http://root.cern.ch/root/html");
1229  fDocSyntax.fClassDocTag = gEnv->GetValue("Root.Html.Description", "//____________________");
1230  fDocSyntax.fAuthorTag = gEnv->GetValue("Root.Html.Author", "// Author:");
1231  fDocSyntax.fLastUpdateTag = gEnv->GetValue("Root.Html.LastUpdate", "// @(#)");
1232  fDocSyntax.fCopyrightTag = gEnv->GetValue("Root.Html.Copyright", "* Copyright");
1233  fOutputStyle.fHeader = gEnv->GetValue("Root.Html.Header", "");
1234  fOutputStyle.fFooter = gEnv->GetValue("Root.Html.Footer", "");
1235  fLinkInfo.fHomepage = gEnv->GetValue("Root.Html.Homepage", "");
1236  fLinkInfo.fSearchStemURL = gEnv->GetValue("Root.Html.Search", "");
1237  fLinkInfo.fSearchEngine = gEnv->GetValue("Root.Html.SearchEngine", "");
1238  fLinkInfo.fViewCVS = gEnv->GetValue("Root.Html.ViewCVS", "");
1239  fOutputStyle.fCharset = gEnv->GetValue("Root.Html.Charset", "ISO-8859-1");
1240  fDocSyntax.fDocStyle = gEnv->GetValue("Root.Html.DescriptionStyle", "");
1241 
1244  // insert html object in the list of special ROOT objects
1245  if (!gHtml) {
1246  gHtml = this;
1247  gROOT->GetListOfSpecials()->Add(gHtml);
1248  }
1249 
1250 }
1251 
1252 
1253 ////////////////////////////////////////////////////////////////////////////////
1254 /// Default destructor
1255 
1257 {
1260  if (gHtml == this) {
1261  gROOT->GetListOfSpecials()->Remove(gHtml);
1262  gHtml = 0;
1263  }
1264  delete fPathDef;
1265  delete fModuleDef;
1266  delete fFileDef;
1267  delete fLocalFiles;
1268 }
1269 
1270 ////////////////////////////////////////////////////////////////////////////////
1271 /// Add path to the directories to be searched for macro files
1272 /// that are to be executed via the TDocMacroDirective
1273 /// ("Begin_Macro"/"End_Macro"); relative to the source file
1274 /// that the directive is run on.
1275 
1276 void THtml::AddMacroPath(const char* path)
1277 {
1278  const char pathDelimiter =
1279 #ifdef R__WIN32
1280  ';';
1281 #else
1282  ':';
1283 #endif
1284  fPathInfo.fMacroPath += pathDelimiter;
1285  fPathInfo.fMacroPath += path;
1286 }
1287 
1288 
1289 ////////////////////////////////////////////////////////////////////////////////
1290 /// copy CSS, javascript file, etc to the output dir
1291 
1293 {
1294  CreateJavascript();
1295  CreateStyleSheet();
1296  CopyFileFromEtcDir("HELP.html");
1297 }
1298 
1299 ////////////////////////////////////////////////////////////////////////////////
1300 /// Return the TModuleDefinition (or derived) object as set by
1301 /// SetModuleDefinition(); create and return a TModuleDefinition object
1302 /// if none was set.
1303 
1305 {
1306  if (!fModuleDef) {
1307  fModuleDef = new TModuleDefinition();
1308  fModuleDef->SetOwner(const_cast<THtml*>(this));
1309  }
1310  return *fModuleDef;
1311 }
1312 
1313 ////////////////////////////////////////////////////////////////////////////////
1314 /// Return the TFileDefinition (or derived) object as set by
1315 /// SetFileDefinition(); create and return a TFileDefinition object
1316 /// if none was set.
1317 
1319 {
1320  if (!fFileDef) {
1321  fFileDef = new TFileDefinition();
1322  fFileDef->SetOwner(const_cast<THtml*>(this));
1323  }
1324  return *fFileDef;
1325 }
1326 
1327 ////////////////////////////////////////////////////////////////////////////////
1328 /// Return the TModuleDefinition (or derived) object as set by
1329 /// SetModuleDefinition(); create and return a TModuleDefinition object
1330 /// if none was set.
1331 
1333 {
1334  if (!fPathDef) {
1335  fPathDef = new TPathDefinition();
1336  fPathDef->SetOwner(const_cast<THtml*>(this));
1337  }
1338  return *fPathDef;
1339 }
1340 
1341 
1342 ////////////////////////////////////////////////////////////////////////////////
1343 /// Get the directory containing THtml's auxiliary files ($ROOTSYS/etc/html)
1344 
1345 const char* THtml::GetEtcDir() const
1346 {
1347  if (fPathInfo.fEtcDir.Length())
1348  return fPathInfo.fEtcDir;
1349 
1351 
1352  fPathInfo.fEtcDir = "html";
1354 
1355  return fPathInfo.fEtcDir;
1356 }
1357 
1358 
1359 ////////////////////////////////////////////////////////////////////////////////
1360 /// Return the next class to be generated for MakeClassThreaded.
1361 
1363 {
1364  if (!fThreadedClassIter) return 0;
1365 
1367 
1368  TClassDocInfo* classinfo = 0;
1369  while ((classinfo = (TClassDocInfo*)(*fThreadedClassIter)())
1370  && !classinfo->IsSelected()) { }
1371 
1372  if (!classinfo) {
1373  delete fThreadedClassIter;
1374  fThreadedClassIter = 0;
1375  }
1376 
1378 
1379  return classinfo;
1380 }
1381 
1382 
1383 ////////////////////////////////////////////////////////////////////////////////
1384 /// Get the documentation URL for library lib.
1385 /// If lib == 0 or no documentation URL has been set for lib, return the ROOT
1386 /// documentation URL. The return value is always != 0.
1387 
1388 const char* THtml::GetURL(const char* lib /*=0*/) const
1389 {
1391 
1392  if (lib && strlen(lib)) {
1393  std::map<std::string, TString>::const_iterator iUrl = fLinkInfo.fLibURLs.find(lib);
1394  if (iUrl != fLinkInfo.fLibURLs.end()) return iUrl->second;
1395  return gEnv->GetValue(TString("Root.Html.") + lib, fLinkInfo.fROOTURL);
1396  }
1397  return fLinkInfo.fROOTURL;
1398 }
1399 
1400 ////////////////////////////////////////////////////////////////////////////////
1401 /// Check whether dot is available in $PATH or in the directory set
1402 /// by SetDotPath()
1403 
1405 {
1408 
1410 
1411  Info("HaveDot", "Checking for Graphviz (dot)...");
1412  TString runDot("dot");
1413  if (fPathInfo.fDotDir.Length())
1415  runDot += " -V";
1416  if (gDebug > 3)
1417  Info("HaveDot", "Running: %s", runDot.Data());
1418  if (gSystem->Exec(runDot)) {
1420  return kFALSE;
1421  }
1423  return kTRUE;
1424 
1425 }
1426 
1427 ////////////////////////////////////////////////////////////////////////////////
1428 /// Inform the THtml object that one of its helper objects was deleted.
1429 /// Called by THtml::HelperBase::~HelperBase().
1430 
1432 {
1433  THelperBase* helpers[3] = {fPathDef, fModuleDef, fFileDef};
1434  for (int i = 0; who && i < 3; ++i)
1435  if (who == helpers[i])
1436  helpers[i] = who = 0;
1437 }
1438 
1439 
1440 ////////////////////////////////////////////////////////////////////////////////
1441 /// It converts a single text file to HTML
1442 ///
1443 ///
1444 /// Input: filename - name of the file to convert
1445 /// title - title which will be placed at the top of the HTML file
1446 /// dirname - optional parameter, if it's not specified, output will
1447 /// be placed in htmldoc/examples directory.
1448 /// relpath - optional parameter pointing to the THtml generated doc
1449 /// on the server, relative to the current page.
1450 /// includeOutput - if != kNoOutput, run the script passed as filename and
1451 /// store all created canvases in PNG files that are
1452 /// shown next to the converted source. Bitwise-ORing with
1453 /// kForceOutput re-runs the script even if output PNGs exist
1454 /// that are newer than the script. If kCompiledOutput is
1455 /// passed, the script is run through ACLiC (.x filename+)
1456 /// context - line shown verbatim at the top of the page; e.g. for links.
1457 /// If context is non-empty it is expected to also print the
1458 /// title.
1459 ///
1460 /// NOTE: Output file name is the same as filename, but with extension .html
1461 ///
1462 
1463 void THtml::Convert(const char *filename, const char *title,
1464  const char *dirname /*= ""*/, const char *relpath /*= "../"*/,
1465  Int_t includeOutput /* = kNoOutput */,
1466  const char* context /* = "" */)
1467 {
1468  gROOT->GetListOfGlobals(kTRUE); // force update of this list
1469  CreateListOfClasses("*");
1470 
1471  const char *dir;
1472  TString dfltdir;
1473 
1474  // if it's not defined, make the "examples" as a default directory
1475  if (!*dirname) {
1477  char *tmp0 = gSystem->ConcatFileName(fPathInfo.fOutputDir, "examples");
1478  dfltdir = tmp0;
1479  delete [] tmp0;
1480  dir = dfltdir.Data();
1481  } else {
1482  dir = dirname;
1483  }
1484 
1485  // create directory if necessary
1486  if (gSystem->AccessPathName(dir))
1487  gSystem->MakeDirectory(dir);
1488 
1489  // find a file
1490  char *cRealFilename =
1492 
1493  if (!cRealFilename) {
1494  Error("Convert", "Can't find file '%s' !", filename);
1495  return;
1496  }
1497 
1498  TString realFilename = cRealFilename;
1499  delete[] cRealFilename;
1500 
1501  // open source file
1502  std::ifstream sourceFile;
1503  sourceFile.open(realFilename, std::ios::in);
1504 
1505  if (!sourceFile.good()) {
1506  Error("Convert", "Can't open file '%s' !", realFilename.Data());
1507  return;
1508  }
1509 
1510  if (gSystem->AccessPathName(dir)) {
1511  Error("Convert",
1512  "Directory '%s' doesn't exist, or it's write protected !", dir);
1513  return;
1514  }
1515  char *tmp1 =
1516  gSystem->ConcatFileName(dir, gSystem->BaseName(filename));
1517 
1518  TDocOutput output(*this);
1519  if (!fGClient)
1520  gROOT->ProcessLine(TString::Format("*((TGClient**)0x%lx) = gClient;",
1521  (ULong_t)&fGClient));
1522  if (includeOutput && !fGClient)
1523  Warning("Convert", "Output requested but cannot initialize graphics: GUI and GL windows not be available");
1524  output.Convert(sourceFile, realFilename, tmp1, title, relpath, includeOutput, context, fGClient);
1525 
1526  delete [] tmp1;
1527 }
1528 
1529 ////////////////////////////////////////////////////////////////////////////////
1530 /// Return the module name for a given class.
1531 /// Use the cached information from fDocEntityInfo.fClasses.
1532 
1534 {
1535  module = "(UNKNOWN)";
1536  if (!cl) return;
1537 
1539  if (!cdi || !cdi->GetModule())
1540  return;
1541  module = cdi->GetModule()->GetName();
1542 }
1543 
1544 
1545 ////////////////////////////////////////////////////////////////////////////////
1546 /// Create the list of all known classes
1547 
1548 void THtml::CreateListOfClasses(const char* filter)
1549 {
1551  return;
1552 
1553  Info("CreateListOfClasses", "Initializing - this might take a while...");
1554  // get total number of classes
1555  Int_t totalNumberOfClasses = gClassTable->Classes();
1556 
1557  // allocate memory
1560 
1561  fDocEntityInfo.fClassFilter = filter;
1562 
1563  // start from beginning
1564  gClassTable->Init();
1565  if (filter && (!filter[0] || !strcmp(filter, "*")))
1566  filter = ".*";
1567  TString reg = filter;
1568  TPMERegexp re(reg);
1569 
1570  bool skipROOTClasses = false;
1571  std::set<std::string> rootLibs;
1572  TList classesDeclFileNotFound;
1573  TList classesImplFileNotFound;
1574 
1575  // pre-run TObject at i == -1
1576  for (Int_t i = -1; i < totalNumberOfClasses; i++) {
1577 
1578  // get class name
1579  const char *cname = 0;
1580  if (i < 0) cname = "TObject";
1581  else cname = gClassTable->Next();
1582  if (!cname)
1583  continue;
1584 
1585  if (i >= 0 && !strcmp(cname, "TObject")) {
1586  // skip the second iteration on TObject
1587  continue;
1588  }
1589 
1590  // This is a hack for until after Cint and Reflex are one.
1591  if (strstr(cname, "__gnu_cxx::")) continue;
1592  // Work around ROOT-6016
1593  if (!strcmp(cname, "timespec")) continue;
1594  // "tuple"s are synthetic in the interpreter
1595  if (!strncmp(cname, "tuple<", 6)) continue;
1596 
1597  // get class & filename - use TROOT::GetClass, as we also
1598  // want those classes without decl file name!
1599  TClass *classPtr = TClass::GetClass((const char *) cname, kTRUE);
1600  if (!classPtr) continue;
1601 
1602  std::string shortName(ShortType(cname));
1603  cname = shortName.c_str();
1604 
1605  TString s = cname;
1606  Bool_t matchesSelection = re.Match(s);
1607 
1608 
1609  TString hdr;
1610  TString hdrFS;
1611  TString src;
1612  TString srcFS;
1613  TString htmlfilename;
1614  TFileSysEntry* fse = 0;
1615 
1617  if (cdi) {
1618  hdr = cdi->GetDeclFileName();
1619  hdrFS = cdi->GetDeclFileSysName();
1620  src = cdi->GetImplFileName();
1621  srcFS = cdi->GetImplFileSysName();
1622  htmlfilename = cdi->GetHtmlFileName();
1623  }
1624 
1625  if (!hdrFS.Length()) {
1626  if (!GetFileDefinition().GetDeclFileName(classPtr, hdr, hdrFS, &fse)) {
1627  // we don't even know where the class is defined;
1628  // just skip. Silence if it doesn't match the selection anyway
1629  if (i == -1 ) {
1630  skipROOTClasses = true;
1631  Info("CreateListOfClasses", "Cannot find header file for TObject at %s given the input path %s.",
1632  classPtr->GetDeclFileName(), GetInputPath().Data());
1633  Info("CreateListOfClasses", "Assuming documentation is not for ROOT classes, or you need to pass "
1634  "the proper directory to THtml::SetInputDir() so I can find %s.", classPtr->GetDeclFileName());
1635  continue;
1636  }
1637  // ignore STL
1638  if (classPtr->GetClassInfo() &&
1639  (gInterpreter->ClassInfo_Property(classPtr->GetClassInfo()) & kIsDefinedInStd))
1640  continue;
1641  if (classPtr->GetDeclFileName() && (!strncmp(classPtr->GetDeclFileName(), "prec_stl/", 9) ||
1642  strstr(classPtr->GetDeclFileName(), "include/c++/") ||
1643  !strncmp(classPtr->GetDeclFileName(), "/usr/include",12)))
1644  continue;
1645  if (classPtr->GetDeclFileName() && (
1646  !strcmp(classPtr->GetDeclFileName(), "vector") ||
1647  !strcmp(classPtr->GetDeclFileName(), "string") ||
1648  !strcmp(classPtr->GetDeclFileName(), "list") ||
1649  !strcmp(classPtr->GetDeclFileName(), "deque") ||
1650  !strcmp(classPtr->GetDeclFileName(), "map") ||
1651  !strcmp(classPtr->GetDeclFileName(), "valarray") ||
1652  !strcmp(classPtr->GetDeclFileName(), "set") ||
1653  !strcmp(classPtr->GetDeclFileName(), "typeinfo") ||
1654  !strcmp(classPtr->GetDeclFileName(), "stdlib.h") ) )
1655  {
1656  // Those are STL header, just ignore.
1657  continue;
1658  }
1659  if (skipROOTClasses) {
1660  if (classPtr->GetSharedLibs() && classPtr->GetSharedLibs()[0]) {
1661  std::string lib(classPtr->GetSharedLibs());
1662  size_t posSpace = lib.find(' ');
1663  if (posSpace != std::string::npos)
1664  lib.erase(posSpace);
1665  if (rootLibs.find(lib) == rootLibs.end()) {
1666  TString rootlibdir = TROOT::GetLibDir();
1667  TString sLib(lib);
1668  if (sLib.Index('.') == -1) {
1669  sLib += ".";
1670  sLib += gSystem->GetSoExt();
1671  }
1672  gSystem->PrependPathName(rootlibdir, sLib);
1673  if (gSystem->AccessPathName(sLib))
1674  // the library doesn't exist in $ROOTSYS/lib, so it's not
1675  // a root lib and we need to tell the user.
1676  classesDeclFileNotFound.AddLast(classPtr);
1677  else rootLibs.insert(lib);
1678  } // end "if rootLibs does not contain lib"
1679  } else {
1680  // lib name unknown
1681  static const char* rootClassesToIgnore[] =
1682  { "ColorStruct_t", "CpuInfo_t", "Event_t", "FileStat_t", "GCValues_t", "MemInfo_t",
1683  "PictureAttributes_t", "Point_t", "ProcInfo_t", "ROOT", "ROOT::Fit",
1684  "Rectangle_t", "RedirectHandle_t", "Segment_t", "SetWindowAttributes_t",
1685  "SysInfo_t", "TCint", "UserGroup_t", "WindowAttributes_t", "timespec", 0};
1686  static const char* rootClassStemsToIgnore[] =
1687  { "ROOT::Math", "TKDTree", "TMatrixT", "TParameter", "vector", 0 };
1688  static size_t rootClassStemsToIgnoreLen[] = {0, 0, 0, 0, 0};
1689  static std::set<std::string> setRootClassesToIgnore;
1690  if (setRootClassesToIgnore.empty()) {
1691  for (int ii = 0; rootClassesToIgnore[ii]; ++ii)
1692  setRootClassesToIgnore.insert(rootClassesToIgnore[ii]);
1693  for (int ii = 0; rootClassStemsToIgnore[ii]; ++ii)
1694  rootClassStemsToIgnoreLen[ii] = strlen(rootClassStemsToIgnore[ii]);
1695  }
1696  // only complain about this class if it should not be ignored:
1697  if (setRootClassesToIgnore.find(cname) == setRootClassesToIgnore.end()) {
1698  bool matched = false;
1699  for (int ii = 0; !matched && rootClassStemsToIgnore[ii]; ++ii)
1700  matched = !strncmp(cname, rootClassStemsToIgnore[ii], rootClassStemsToIgnoreLen[ii]);
1701  if (!matched)
1702  classesDeclFileNotFound.AddLast(classPtr);
1703  }
1704  } // lib name known
1705  continue;
1706  } else {
1707  if (matchesSelection && (!classPtr->GetDeclFileName() ||
1708  !strstr(classPtr->GetDeclFileName(),"prec_stl/") ||
1709  !strstr(classPtr->GetDeclFileName(), "include/c++/") ||
1710  strncmp(classPtr->GetDeclFileName(), "/usr/include",12)))
1711  classesDeclFileNotFound.AddLast(classPtr);
1712  continue;
1713  }
1714  }
1715  }
1716 
1717  Bool_t haveSource = (srcFS.Length());
1718  if (!haveSource)
1719  haveSource = GetFileDefinition().GetImplFileName(classPtr, src, srcFS, fse ? 0 : &fse);
1720 
1721  if (!haveSource) {
1722  classesImplFileNotFound.AddLast(classPtr);
1723  }
1724 
1725  if (!htmlfilename.Length())
1726  GetHtmlFileName(classPtr, htmlfilename);
1727 
1728  if (!cdi) {
1729  cdi = new TClassDocInfo(classPtr, htmlfilename, hdrFS, srcFS, hdr, src);
1731  } else {
1732  cdi->SetDeclFileName(hdr);
1733  cdi->SetImplFileName(src);
1734  cdi->SetDeclFileSysName(hdrFS);
1735  cdi->SetImplFileSysName(srcFS);
1736  cdi->SetHtmlFileName(htmlfilename);
1737  }
1738 
1739  cdi->SetSelected(matchesSelection);
1740 
1741  TString modulename;
1742  GetModuleDefinition().GetModule(classPtr, fse, modulename);
1743  if (!modulename.Length() || modulename == "USER")
1744  GetModuleNameForClass(modulename, classPtr);
1745 
1747  if (!module) {
1748  bool moduleSelected = cdi->IsSelected();
1749 
1750  TString parentModuleName = gSystem->GetDirName(modulename);
1751  TModuleDocInfo* super = nullptr;
1752  if (parentModuleName.Length() && parentModuleName != ".") {
1753  super = (TModuleDocInfo*) fDocEntityInfo.fModules.FindObject(parentModuleName);
1754  if (!super) {
1755  // create parents:
1756  TString token;
1757  Ssiz_t pos = 0;
1758  while (parentModuleName.Tokenize(token, pos, "/")) {
1759  if (!token.Length() || token == ".") continue;
1760  super = new TModuleDocInfo(token, super);
1761  super->SetSelected(moduleSelected);
1762  fDocEntityInfo.fModules.Add(super);
1763  }
1764  }
1765  }
1766  module = new TModuleDocInfo(modulename, super);
1767  module->SetSelected(moduleSelected);
1769  }
1770 
1771  if (module) {
1772  module->AddClass(cdi);
1773  cdi->SetModule(module);
1774  if (cdi->HaveSource() && cdi->IsSelected())
1775  module->SetSelected();
1776  }
1777 
1778  // clear the typedefs; we fill them later
1779  cdi->GetListOfTypedefs().Clear();
1780 
1781  if (gDebug > 0)
1782  Info("CreateListOfClasses", "Adding class %s, module %s (%sselected)",
1783  cdi->GetName(), module ? module->GetName() : "[UNKNOWN]",
1784  cdi->IsSelected() ? "" : "not ");
1785  }
1786 
1787 
1788 
1789  bool cannotFind = false;
1790  if (!classesDeclFileNotFound.IsEmpty()) {
1791  Warning("CreateListOfClasses",
1792  "Cannot find the header for the following classes [reason]:");
1793  TIter iClassesDeclFileNotFound(&classesDeclFileNotFound);
1794  TClass* iClass = 0;
1795  while ((iClass = (TClass*)iClassesDeclFileNotFound())) {
1796  if (iClass->GetDeclFileName() && iClass->GetDeclFileName()[0]) {
1797  Warning("CreateListOfClasses", " %s [header %s not found]", iClass->GetName(), iClass->GetDeclFileName());
1798  cannotFind = true;
1799  } else
1800  Warning("CreateListOfClasses", " %s [header file is unknown]", iClass->GetName());
1801  }
1802  }
1803 
1804  if (!classesImplFileNotFound.IsEmpty() && gDebug > 3) {
1805  Warning("CreateListOfClasses",
1806  "Cannot find the source file for the following classes [reason]:");
1807  TIter iClassesDeclFileNotFound(&classesImplFileNotFound);
1808  TClass* iClass = 0;
1809  while ((iClass = (TClass*)iClassesDeclFileNotFound())) {
1810  if (iClass->GetDeclFileName() && iClass->GetDeclFileName()[0]) {
1811  Info("CreateListOfClasses", " %s [source %s not found]", iClass->GetName(), iClass->GetImplFileName());
1812  cannotFind = true;
1813  } else
1814  Info("CreateListOfClasses", " %s [source file is unknown, add \"ClassImpl(%s)\" to source file if it exists]",
1815  iClass->GetName(), iClass->GetName());
1816  }
1817  }
1818  if (cannotFind) {
1819  Warning("CreateListOfClasses", "THtml cannot find all headers and sources. ");
1820  Warning("CreateListOfClasses",
1821  "You might need to adjust the input path (currently %s) by calling THtml::SetInputDir()",
1822  GetInputPath().Data());
1823  }
1824 
1825  // fill typedefs
1826  TIter iTypedef(gROOT->GetListOfTypes());
1827  TDataType* dt = 0;
1828  TDocOutput output(*this);
1829  while ((dt = (TDataType*) iTypedef())) {
1830  if (dt->GetType() != -1) continue;
1832  if (cdi) {
1833  cdi->GetListOfTypedefs().Add(dt);
1834  if (gDebug > 1)
1835  Info("CreateListOfClasses", "Adding typedef %s to class %s",
1836  dt->GetName(), cdi->GetName());
1837 
1838  bool inNamespace = true;
1839  TString surroundingNamespace(dt->GetName());
1840  Ssiz_t posTemplate = surroundingNamespace.Last('>');
1841  inNamespace = inNamespace && (posTemplate == kNPOS);
1842  if (inNamespace) {
1843  Ssiz_t posColumn = surroundingNamespace.Last(':');
1844  if (posColumn != kNPOS) {
1845  surroundingNamespace.Remove(posColumn - 1);
1846  TClass* clSurrounding = GetClass(surroundingNamespace);
1847  inNamespace = inNamespace && (!clSurrounding || IsNamespace(clSurrounding));
1848  }
1849  }
1850  if (inNamespace && cdi->GetModule()) {
1851  TString htmlfilename(dt->GetName());
1852  output.NameSpace2FileName(htmlfilename);
1853  htmlfilename += ".html";
1854  TClassDocInfo* cdiTD = new TClassDocInfo(dt, htmlfilename);
1855  cdiTD->SetModule(cdi->GetModule());
1856  cdiTD->SetSelected(cdi->IsSelected());
1857  cdi->GetModule()->AddClass(cdiTD);
1858  }
1859  }
1860  }
1861 
1864  TIter iterModule(&fDocEntityInfo.fModules);
1865  TModuleDocInfo* mdi = 0;
1866  while ((mdi = (TModuleDocInfo*) iterModule()))
1867  mdi->GetClasses()->Sort();
1868 
1869  if (fProductName == "(UNKNOWN PRODUCT)"
1870  && fDocEntityInfo.fModules.FindObject("core/base")
1871  && fDocEntityInfo.fModules.FindObject("core/cont")
1872  && fDocEntityInfo.fModules.FindObject("core/rint")
1873  && gProgName && strstr(gProgName, "root"))
1874  // if we have these modules we're probably building the root doc
1875  fProductName = "ROOT";
1876 
1877  if (fProductName == "(UNKNOWN PRODUCT)") {
1878  Warning("CreateListOfClasses", "Product not set. You should call gHtml->SetProduct(\"MyProductName\");");
1879  } else if (fProductName != "ROOT") {
1880  if (GetViewCVS().Contains("http://root.cern.ch/"))
1881  SetViewCVS("");
1882  }
1883 
1886  && !strcmp(fDocEntityInfo.fModules.At(0)->GetName(), "(UNKNOWN)"))
1887  // Only one module, and its name is not known.
1888  // Let's call it "MAIN":
1889  ((TModuleDocInfo*) fDocEntityInfo.fModules.At(0))->SetName("MAIN");
1890 
1891  Info("CreateListOfClasses", "Initializing - DONE.");
1892 }
1893 
1894 
1895 ////////////////////////////////////////////////////////////////////////////////
1896 /// Create index of all data types and a page for each typedef-to-class
1897 
1899 {
1900  TDocOutput output(*this);
1901  output.CreateTypeIndex();
1902  output.CreateClassTypeDefs();
1903 }
1904 
1905 ////////////////////////////////////////////////////////////////////////////////
1906 /// Copy a file from $ROOTSYS/etc/html into GetOutputDir()
1907 
1908 Bool_t THtml::CopyFileFromEtcDir(const char* filename) const {
1910 
1911  TString outFile(filename);
1912 
1913  TString inFile(outFile);
1914  gSystem->PrependPathName(GetEtcDir(), inFile);
1915 
1916  gSystem->PrependPathName(GetOutputDir(), outFile);
1917 
1918  if (gSystem->CopyFile(inFile, outFile, kTRUE) != 0) {
1919  Warning("CopyFileFromEtcDir", "Could not copy %s to %s", inFile.Data(), outFile.Data());
1920  return kFALSE;
1921  }
1922 
1923  return kTRUE;
1924 }
1925 
1926 ////////////////////////////////////////////////////////////////////////////////
1927 /// Create the inheritance hierarchy diagram for all classes
1928 
1930 {
1931  TDocOutput output(*this);
1932  output.CreateHierarchy();
1933 }
1934 
1935 ////////////////////////////////////////////////////////////////////////////////
1936 /// Write the default ROOT style sheet.
1937 
1939  CopyFileFromEtcDir("ROOT.js");
1940 }
1941 
1942 ////////////////////////////////////////////////////////////////////////////////
1943 /// Write the default ROOT style sheet.
1944 
1946  CopyFileFromEtcDir("ROOT.css");
1947  CopyFileFromEtcDir("shadowAlpha.png");
1948  CopyFileFromEtcDir("shadow.gif");
1949 }
1950 
1951 
1952 
1953 ////////////////////////////////////////////////////////////////////////////////
1954 /// fill derived with all classes inheriting from cl and their inheritance
1955 /// distance to cl
1956 
1957 void THtml::GetDerivedClasses(TClass* cl, std::map<TClass*, Int_t>& derived) const
1958 {
1959  TIter iClass(&fDocEntityInfo.fClasses);
1960  TClassDocInfo* cdi = 0;
1961  while ((cdi = (TClassDocInfo*) iClass())) {
1962  TClass* candidate = dynamic_cast<TClass*>(cdi->GetClass());
1963  if (!candidate) continue;
1964  if (candidate != cl && candidate->InheritsFrom(cl)) {
1965  Int_t level = 0;
1966  TClass* currentBaseOfCandidate = candidate;
1967  while (currentBaseOfCandidate != cl) {
1968  TList* bases = currentBaseOfCandidate->GetListOfBases();
1969  if (!bases) continue;
1970  TIter iBase(bases);
1971  TBaseClass* base = 0;
1972  while ((base = (TBaseClass*) iBase())) {
1973  TClass* clBase = base->GetClassPointer();
1974  if (clBase && clBase->InheritsFrom(cl)) {
1975  ++level;
1976  currentBaseOfCandidate = clBase;
1977  }
1978  }
1979  }
1980  derived[candidate] = level;
1981  }
1982  }
1983 }
1984 
1985 ////////////////////////////////////////////////////////////////////////////////
1986 /// Return real HTML filename
1987 ///
1988 ///
1989 /// Input: classPtr - pointer to a class
1990 /// filename - string containing a full name
1991 /// of the corresponding HTML file after the function returns.
1992 ///
1993 
1994 void THtml::GetHtmlFileName(TClass * classPtr, TString& filename) const
1995 {
1996  filename.Remove(0);
1997  if (!classPtr) return;
1998 
1999  TString cFilename;
2000  if (!GetImplFileName(classPtr, kFALSE, cFilename))
2001  GetDeclFileName(classPtr, kFALSE, cFilename);
2002 
2003  // classes without Impl/DeclFileName don't have docs,
2004  // and classes without docs don't have output file names
2005  if (!cFilename.Length())
2006  return;
2007 
2008  TString libName;
2009  const char *colon = strchr(cFilename, ':');
2010  if (colon)
2011  // old version, where source file name is prepended by "TAG:"
2012  libName = TString(cFilename, colon - cFilename);
2013  else
2014  // New version, check class's libname.
2015  // If libname is dir/libMyLib.so, check Root.Html.MyLib
2016  // If libname is myOtherLib.so.2.3, check Root.Html.myOtherLib
2017  // (i.e. remove directories, "lib" prefix, and any "extension")
2018  if (classPtr->GetSharedLibs()) {
2019  // first one is the class's lib
2020  TString libname(classPtr->GetSharedLibs());
2021  Ssiz_t posSpace = libname.First(' ');
2022  if (posSpace != kNPOS)
2023  libname.Remove(posSpace, libname.Length());
2024  TString libnameBase = gSystem->BaseName(libname);
2025  if (libnameBase.BeginsWith("lib"))
2026  libnameBase.Remove(0, 3);
2027  Ssiz_t posExt = libnameBase.First('.');
2028  if (posExt != '.')
2029  libnameBase.Remove(posExt, libnameBase.Length());
2030  if (libnameBase.Length())
2031  libName = libnameBase;
2032  }
2033 
2034  filename = cFilename;
2035  TString htmlFileName;
2036  if (!filename.Length() ||
2038  htmlFileName = GetURL(libName);
2039  } else
2040  htmlFileName = "./";
2041 
2042  if (htmlFileName.Length()) {
2043  filename = htmlFileName;
2044  TString className(classPtr->GetName());
2045  TDocOutput output(*const_cast<THtml*>(this));
2046  output.NameSpace2FileName(className);
2047  gSystem->PrependPathName(filename, className);
2048  filename = className;
2049  filename.ReplaceAll("\\", "/");
2050  filename += ".html";
2051  } else filename.Remove(0);
2052 }
2053 
2054 ////////////////////////////////////////////////////////////////////////////////
2055 /// Get the html file name for a class named classname.
2056 /// Returns 0 if the class is not documented.
2057 
2058 const char* THtml::GetHtmlFileName(const char* classname) const
2059 {
2061  if (cdi)
2062  return cdi->GetHtmlFileName();
2063  return 0;
2064 }
2065 
2066 ////////////////////////////////////////////////////////////////////////////////
2067 /// Return pointer to class with name.
2068 
2069 TClass *THtml::GetClass(const char *name1) const
2070 {
2071  if(!name1 || !name1[0]) return 0;
2072  // no doc for internal classes
2073  if (strstr(name1,"ROOT::")==name1) {
2074  Bool_t ret = kTRUE;
2075  if (!strncmp(name1 + 6,"Math", 4)) ret = kFALSE;
2076  if (ret) return 0;
2077  }
2078 
2080  if (!cdi) return 0;
2081  TClass *cl = dynamic_cast<TClass*>(cdi->GetClass());
2082  // hack to get rid of prec_stl types
2083  // TClassEdit checks are far too slow...
2084  /*
2085  if (cl && GetDeclFileName(cl) &&
2086  (strstr(GetDeclFileName(cl),"prec_stl/") || !strstr(classPtr->GetDeclFileName(), "include/c++/") )
2087  cl = 0;
2088  */
2089  TString declFileName;
2090  if (cl && GetDeclFileName(cl, kFALSE, declFileName))
2091  return cl;
2092  return 0;
2093 }
2094 
2095 ////////////////////////////////////////////////////////////////////////////////
2096 /// Return declaration file name; return the full path if filesys is true.
2097 
2098 bool THtml::GetDeclFileName(TClass * cl, Bool_t filesys, TString& out_name) const
2099 {
2100  return GetDeclImplFileName(cl, filesys, true, out_name);
2101 }
2102 
2103 ////////////////////////////////////////////////////////////////////////////////
2104 /// Return implementation file name
2105 
2106 bool THtml::GetImplFileName(TClass * cl, Bool_t filesys, TString& out_name) const
2107 {
2108  return GetDeclImplFileName(cl, filesys, false, out_name);
2109 }
2110 
2111 ////////////////////////////////////////////////////////////////////////////////
2112 /// Combined implementation for GetDeclFileName(), GetImplFileName():
2113 /// Return declaration / implementation file name (depending on decl);
2114 /// return the full path if filesys is true.
2115 
2116 bool THtml::GetDeclImplFileName(TClass * cl, bool filesys, bool decl, TString& out_name) const
2117 {
2118  out_name = "";
2119 
2122  // whether we need to determine the fil name
2123  bool determine = (!cdi); // no cdi
2124  if (!determine) determine |= decl && filesys && !cdi->GetDeclFileSysName()[0];
2125  if (!determine) determine |= decl && !filesys && !cdi->GetDeclFileName()[0];
2126  if (!determine) determine |= !decl && filesys && !cdi->GetImplFileSysName()[0];
2127  if (!determine) determine |= !decl && !filesys && !cdi->GetImplFileName()[0];
2128  if (determine) {
2129  TString name;
2130  TString sysname;
2131  if (decl) {
2132  if (!GetFileDefinition().GetDeclFileName(cl, name, sysname))
2133  return false;
2134  } else {
2135  if (!GetFileDefinition().GetImplFileName(cl, name, sysname))
2136  return false;
2137  }
2138  if (cdi) {
2139  if (decl) {
2140  if (!cdi->GetDeclFileName() || !cdi->GetDeclFileName()[0])
2141  cdi->SetDeclFileName(name);
2142  if (!cdi->GetDeclFileSysName() || !cdi->GetDeclFileSysName()[0])
2143  cdi->SetDeclFileSysName(sysname);
2144  } else {
2145  if (!cdi->GetImplFileName() || !cdi->GetImplFileName()[0])
2146  cdi->SetImplFileName(name);
2147  if (!cdi->GetImplFileSysName() || !cdi->GetImplFileSysName()[0])
2148  cdi->SetImplFileSysName(sysname);
2149  }
2150  }
2151 
2152  if (filesys) out_name = sysname;
2153  else out_name = name;
2154  return true;
2155  }
2156  if (filesys) {
2157  if (decl) out_name = cdi->GetDeclFileSysName();
2158  else out_name = cdi->GetImplFileSysName();
2159  } else {
2160  if (decl) out_name = cdi->GetDeclFileName();
2161  else out_name = cdi->GetImplFileName();
2162  }
2163  return true;
2164 }
2165 
2166 ////////////////////////////////////////////////////////////////////////////////
2167 /// Return the output directory as set by SetOutputDir().
2168 /// Create it if it doesn't exist and if createDir is kTRUE.
2169 
2170 const TString& THtml::GetOutputDir(Bool_t createDir /*= kTRUE*/) const
2171 {
2172  if (createDir) {
2174 
2175  gSystem->ExpandPathName(const_cast<THtml*>(this)->fPathInfo.fOutputDir);
2176  Long64_t sSize;
2177  Long_t sId, sFlags, sModtime;
2180  Int_t st = gSystem->GetPathInfo(fPathInfo.fOutputDir, &sId, &sSize, &sFlags, &sModtime);
2181  if (st || !(sFlags & 2)) {
2182  if (st == 0)
2183  Error("GetOutputDir", "output directory %s is an existing file",
2185  else if (gSystem->MakeDirectory(fPathInfo.fOutputDir) == -1)
2186  Error("GetOutputDir", "output directory %s does not exist and can't create it", fPathInfo.fOutputDir.Data());
2187  }
2188  }
2189  return fPathInfo.fOutputDir;
2190 }
2191 
2192 ////////////////////////////////////////////////////////////////////////////////
2193 /// Check whether cl is a namespace
2194 
2196 {
2197  return (cl->Property() & kIsNamespace);
2198 }
2199 
2200 ////////////////////////////////////////////////////////////////////////////////
2201 /// Load all libraries known to ROOT via the rootmap system.
2202 
2204 {
2206 }
2207 
2208 
2209 ////////////////////////////////////////////////////////////////////////////////
2210 /// Produce documentation for all the classes specified in the filter (by default "*")
2211 /// To process all classes having a name starting with XX, do:
2212 /// html.MakeAll(kFALSE,"XX*");
2213 /// If force=kFALSE (default), only the classes that have been modified since
2214 /// the previous call to this function will be generated.
2215 /// If force=kTRUE, all classes passing the filter will be processed.
2216 /// If numthreads is != -1, use numthreads threads, else decide automatically
2217 /// based on the number of CPUs.
2218 
2219 void THtml::MakeAll(Bool_t force, const char *filter, int numthreads /*= -1*/)
2220 {
2221  MakeIndex(filter);
2222 
2223  if (numthreads == 1) {
2224  // CreateListOfClasses(filter); already done by MakeIndex
2225  TClassDocInfo* classinfo = 0;
2226  TIter iClassInfo(&fDocEntityInfo.fClasses);
2227  UInt_t count = 0;
2228 
2229  while ((classinfo = (TClassDocInfo*)iClassInfo())) {
2230  if (!classinfo->IsSelected())
2231  continue;
2232  fCounter.Form("%5d", fDocEntityInfo.fClasses.GetSize() - count++);
2233  MakeClass(classinfo, force);
2234  }
2235  } else {
2236  if (numthreads == -1) {
2237  SysInfo_t sysinfo;
2238  gSystem->GetSysInfo(&sysinfo);
2239  numthreads = sysinfo.fCpus;
2240  if (numthreads < 1)
2241  numthreads = 2;
2242  }
2243  fThreadedClassCount = 0;
2245  THtmlThreadInfo hti(this, force);
2246  if (!fMakeClassMutex && gGlobalMutex) {
2247  gGlobalMutex->Lock();
2249  gGlobalMutex->UnLock();
2250  }
2251 
2252  TList threads;
2253  gSystem->Load("libThread");
2254  while (--numthreads >= 0) {
2255  TThread* thread = new TThread(MakeClassThreaded, &hti);
2256  thread->Run();
2257  threads.Add(thread);
2258  }
2259 
2260  TIter iThread(&threads);
2261  TThread* thread = 0;
2262  Bool_t wait = kTRUE;
2263  while (wait) {
2264  while (wait && (thread = (TThread*) iThread()))
2265  wait &= (thread->GetState() == TThread::kRunningState);
2267  gSystem->Sleep(500);
2268  }
2269 
2270  iThread.Reset();
2271  while ((thread = (TThread*) iThread()))
2272  thread->Join();
2273  }
2274  fCounter.Remove(0);
2275 }
2276 
2277 
2278 ////////////////////////////////////////////////////////////////////////////////
2279 /// Make HTML files for a single class
2280 ///
2281 ///
2282 /// Input: className - name of the class to process
2283 ///
2284 
2285 void THtml::MakeClass(const char *className, Bool_t force)
2286 {
2287  CreateListOfClasses("*");
2288 
2290  if (!cdi) {
2291  if (!TClassEdit::IsStdClass(className)) // stl classes won't be available, so no warning
2292  Error("MakeClass", "Unknown class '%s'!", className);
2293  return;
2294  }
2295 
2296  MakeClass(cdi, force);
2297 }
2298 
2299 ////////////////////////////////////////////////////////////////////////////////
2300 /// Make HTML files for a single class
2301 ///
2302 ///
2303 /// Input: cdi - doc info for class to process
2304 ///
2305 
2306 void THtml::MakeClass(void *cdi_void, Bool_t force)
2307 {
2309  CreateListOfClasses("*");
2310 
2311  TClassDocInfo* cdi = (TClassDocInfo*) cdi_void;
2312  TClass* currentClass = dynamic_cast<TClass*>(cdi->GetClass());
2313 
2314  if (!currentClass) {
2315  if (!cdi->GetClass() &&
2316  !TClassEdit::IsStdClass(cdi->GetName())) // stl classes won't be available, so no warning
2317  Error("MakeClass", "Class '%s' is known, but I cannot find its TClass object!", cdi->GetName());
2318  return;
2319  }
2320  TString htmlFile(cdi->GetHtmlFileName());
2321  if (htmlFile.Length()
2322  && (htmlFile.BeginsWith("http://")
2323  || htmlFile.BeginsWith("https://")
2324  || gSystem->IsAbsoluteFileName(htmlFile))
2325  ) {
2326  htmlFile.Remove(0);
2327  }
2328  if (htmlFile.Length()) {
2329  TClassDocOutput cdo(*this, currentClass, &cdi->GetListOfTypedefs());
2330  cdo.Class2Html(force);
2331  cdo.MakeTree(force);
2332  } else {
2333  TString what(cdi->GetName());
2334  what += " (sources not found)";
2335  Printf(fCounterFormat.Data(), "-skipped-", fCounter.Data(), what.Data());
2336  }
2337 }
2338 
2339 
2340 ////////////////////////////////////////////////////////////////////////////////
2341 /// Entry point of worker threads for multi-threaded MakeAll().
2342 /// info points to an (internal) THtmlThreadInfo object containing the current
2343 /// THtml object, and whether "force" was passed to MakeAll().
2344 /// The thread will poll GetNextClass() until no further class is available.
2345 
2346 void* THtml::MakeClassThreaded(void* info) {
2347  const THtmlThreadInfo* hti = (const THtmlThreadInfo*)info;
2348  if (!hti) return 0;
2349  TClassDocInfo* classinfo = 0;
2350  while ((classinfo = hti->GetHtml()->GetNextClass()))
2351  hti->GetHtml()->MakeClass(classinfo, hti->GetForce());
2352 
2353  return 0;
2354 }
2355 
2356 ////////////////////////////////////////////////////////////////////////////////
2357 /// Create the index files for the product, modules, all types, etc.
2358 /// By default all classes are indexed (if filter="*");
2359 /// to generate an index for all classes starting with "XX", do
2360 /// html.MakeIndex("XX*");
2361 
2362 void THtml::MakeIndex(const char *filter)
2363 {
2364  CreateListOfClasses(filter);
2365 
2366  TDocOutput output(*this);
2367  // create indices
2368  output.CreateTypeIndex();
2369  output.CreateClassTypeDefs();
2370  output.CreateModuleIndex();
2371  output.CreateClassIndex();
2372  output.CreateProductIndex();
2373 
2374  // create a class hierarchy
2375  output.CreateHierarchy();
2376 }
2377 
2378 
2379 ////////////////////////////////////////////////////////////////////////////////
2380 /// Make an inheritance tree
2381 ///
2382 ///
2383 /// Input: className - name of the class to process
2384 ///
2385 
2386 void THtml::MakeTree(const char *className, Bool_t force)
2387 {
2388  // create canvas & set fill color
2389  TClass *classPtr = GetClass(className);
2390 
2391  if (!classPtr) {
2392  Error("MakeTree", "Unknown class '%s' !", className);
2393  return;
2394  }
2395 
2396  TClassDocOutput cdo(*this, classPtr, 0);
2397  cdo.MakeTree(force);
2398 }
2399 
2400 ////////////////////////////////////////////////////////////////////////////////
2401 /// Set whether "dot" (a GraphViz utility) is available
2402 
2406 }
2407 
2408 ////////////////////////////////////////////////////////////////////////////////
2409 /// Fill the files available in the file system below fPathInfo.fInputPath
2410 
2412 {
2413  if (fLocalFiles) delete fLocalFiles;
2415 }
2416 
2417 ////////////////////////////////////////////////////////////////////////////////
2418 /// Set the module defining object to be used; can also be a user derived
2419 /// object (a la traits).
2420 
2422 {
2423  delete fModuleDef;
2425  fModuleDef->SetOwner(const_cast<THtml*>(this));
2426 }
2427 
2428 
2429 ////////////////////////////////////////////////////////////////////////////////
2430 /// Set the file defining object to be used; can also be a user derived
2431 /// object (a la traits).
2432 
2434 {
2435  delete fFileDef;
2436  fFileDef = (TFileDefinition*) md.Clone();
2437  fFileDef->SetOwner(const_cast<THtml*>(this));
2438 }
2439 
2440 
2441 ////////////////////////////////////////////////////////////////////////////////
2442 /// Set the path defining object to be used; can also be a user derived
2443 /// object (a la traits).
2444 
2446 {
2447  delete fPathDef;
2448  fPathDef = (TPathDefinition*) md.Clone();
2449  fPathDef->SetOwner(const_cast<THtml*>(this));
2450 }
2451 
2452 
2453 ////////////////////////////////////////////////////////////////////////////////
2454 /// Set the directory containing the source files.
2455 /// The source file for a class MyClass will be searched
2456 /// by prepending dir to the value of
2457 /// MyClass::Class()->GetImplFileName() - which can contain
2458 /// directory information!
2459 /// Also resets the class structure, in case new files can
2460 /// be found after this call.
2461 
2462 void THtml::SetInputDir(const char *dir)
2463 {
2464  fPathInfo.fInputPath = dir;
2466 
2467  // reset class table
2470 }
2471 
2472 ////////////////////////////////////////////////////////////////////////////////
2473 /// Set the directory where the HTML pages shuold be written to.
2474 /// If the directory does not exist it will be created when needed.
2475 
2476 void THtml::SetOutputDir(const char *dir)
2477 {
2478  fPathInfo.fOutputDir = dir;
2479 #ifdef R__WIN32
2480  fPathInfo.fOutputDir.ReplaceAll("/","\\");
2481 #endif
2482 }
2483 
2484 ////////////////////////////////////////////////////////////////////////////////
2485 /// Explicitly set a decl file name for TClass cl.
2486 
2487 void THtml::SetDeclFileName(TClass* cl, const char* filename)
2488 {
2490  if (!cdi) {
2491  cdi = new TClassDocInfo(cl, "" /*html*/, "" /*fsdecl*/, "" /*fsimpl*/, filename);
2493  } else
2494  cdi->SetDeclFileName(filename);
2495 }
2496 
2497 ////////////////////////////////////////////////////////////////////////////////
2498 /// Explicitly set a impl file name for TClass cl.
2499 
2500 void THtml::SetImplFileName(TClass* cl, const char* filename)
2501 {
2503  if (!cdi) {
2504  cdi = new TClassDocInfo(cl, "" /*html*/, "" /*fsdecl*/, "" /*fsimpl*/, 0 /*decl*/, filename);
2506  } else
2507  cdi->SetImplFileName(filename);
2508 }
2509 
2510 ////////////////////////////////////////////////////////////////////////////////
2511 /// Get short type name, i.e. with default templates removed.
2512 
2513 const char* THtml::ShortType(const char* name) const
2514 {
2515  const char* tmplt = strchr(name, '<');
2516  if (!tmplt) return name;
2517  tmplt = strrchr(tmplt, ':');
2518  if (tmplt > name && tmplt[-1] == ':') {
2519  // work-around for CINT bug: template instantiation can produce bogus
2520  // typedefs e.g. in namespace ROOT::Math::ROOT::Math instead of ROOT::Math.
2521  TString namesp(name, tmplt - name - 1);
2522  // is the enclosing namespace known?
2523  if (!GetClass(namesp)) return name;
2524  }
2526  if (!scn) {
2527  scn = new TNamed(name, TClassEdit::ShortType(name, 1<<7));
2529  }
2530  return scn->GetTitle();
2531 }
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:1318
TClassDocInfo::GetDeclFileSysName
const char * GetDeclFileSysName() const
Definition: TDocInfo.h:63
TPMERegexp
Definition: TPRegexp.h:97
THtml::CreateJavascript
virtual void CreateJavascript() const
Write the default ROOT style sheet.
Definition: THtml.cxx:1938
TThread
Definition: TThread.h:40
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
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:1332
THtml::fCounterFormat
TString fCounterFormat
Definition: THtml.h:409
TObjArray
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:2116
THtml::MakeTree
void MakeTree(const char *className, Bool_t force=kFALSE)
Make an inheritance tree.
Definition: THtml.cxx:2386
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:1276
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:115
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:2203
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:1362
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
Set TObject::fBits and fStreamerType to cache information about the class.
Definition: TClass.cxx:5852
TObjString.h
TSystem::GetSoExt
virtual const char * GetSoExt() const
Get the shared library extension.
Definition: TSystem.cxx:4026
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:472
THtml::MakeIndex
void MakeIndex(const char *filter="*")
Create the index files for the product, modules, all types, etc.
Definition: THtml.cxx:2362
TClassEdit::ShortType
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
Definition: TClassEdit.cxx:1260
THtml::IsNamespace
static Bool_t IsNamespace(const TClass *cl)
Check whether cl is a namespace.
Definition: THtml.cxx:2195
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:2285
gProgName
const R__EXTERN char * gProgName
Definition: TSystem.h:242
kIsNamespace
@ kIsNamespace
Definition: TDictionary.h:92
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:864
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
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:2219
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:1373
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:2106
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:1404
TBaseClass
Definition: TBaseClass.h:33
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
TClassDocOutput::MakeTree
void MakeTree(Bool_t force=kFALSE)
Create an output file with a graphical representation of the class inheritance.
Definition: TClassDocOutput.cxx:1286
kIsDefinedInStd
@ kIsDefinedInStd
Definition: TDictionary.h:95
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:708
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:2177
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:1431
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:1292
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:151
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:2311
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:1852
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:1548
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
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:2487
THtml::SetOutputDir
void SetOutputDir(const char *dir)
Set the directory where the HTML pages shuold be written to.
Definition: THtml.cxx:2476
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:1256
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:2500
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:892
THtml::GetModuleNameForClass
virtual void GetModuleNameForClass(TString &module, TClass *cl) const
Return the module name for a given class.
Definition: THtml.cxx:1533
TList::Sort
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
Definition: TList.cxx:936
TROOT.h
THtml::GetEtcDir
virtual const char * GetEtcDir() const
Get the directory containing THtml's auxiliary files ($ROOTSYS/etc/html)
Definition: THtml.cxx:1345
TObjString
Definition: TObjString.h:28
TThread::Join
Long_t Join(void **ret=0)
Join this thread.
Definition: TThread.cxx:511
TThread::Run
Int_t Run(void *arg=0)
Start the thread.
Definition: TThread.cxx:564
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:356
TString::Form
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
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:1957
THtml::CreateStyleSheet
virtual void CreateStyleSheet() const
Write the default ROOT style sheet.
Definition: THtml.cxx:1945
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:2496
TDataType.h
THtml
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:2197
THtml::SetLocalFiles
void SetLocalFiles() const
Fill the files available in the file system below fPathInfo.fInputPath.
Definition: THtml.cxx:2411
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:4772
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:2098
TModuleDocInfo
Definition: TDocInfo.h:107
SysInfo_t
Definition: TSystem.h:150
TSystem.h
TDataType
Definition: TDataType.h:44
THtml::THtml
THtml()
Create a THtml object.
Definition: THtml.cxx:1214
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:3555
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
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:92
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
gDebug
R__EXTERN Int_t gDebug
Definition: RtypesCore.h:119
THtml::CreateHierarchy
void CreateHierarchy()
Create the inheritance hierarchy diagram for all classes.
Definition: THtml.cxx:1929
Long_t
long Long_t
Definition: RtypesCore.h:54
xmlio::String
const char * String
Definition: TXMLSetup.cxx:100
TString::First
Ssiz_t First(char c) const
Find first occurrence of a character c.
Definition: TString.cxx:499
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:3342
TDocOutput.h
THtml::TFileSysDB
Definition: THtml.h:174
what
static const char * what
Definition: stlLoader.cc:6
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:1994
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:2925
TSystem::LoadAllLibraries
virtual UInt_t LoadAllLibraries()
Load all libraries known to ROOT via the rootmap system.
Definition: TSystem.cxx:1965
TClass::GetClassInfo
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:390
THtml::GetModuleDefinition
const TModuleDefinition & GetModuleDefinition() const
Return the TModuleDefinition (or derived) object as set by SetModuleDefinition(); create and return a...
Definition: THtml.cxx:1304
TClass::GetImplFileName
const char * GetImplFileName() const
Definition: TClass.h:412
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:1898
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:876
TModuleDocInfo::GetClasses
TList * GetClasses()
Definition: TDocInfo.h:122
TClassTable::Next
static char * Next()
Returns next class from sorted class table.
Definition: TClassTable.cxx:678
TClassDocInfo::GetModule
TModuleDocInfo * GetModule() const
Definition: TDocInfo.h:67
TModuleDocInfo::SetSelected
void SetSelected(Bool_t sel=kTRUE)
Definition: TDocInfo.h:118
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:2958
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:2433
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:2403
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:2513
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:1388
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:2069
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:2170
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
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:1463
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:2927
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
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:1908
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:401
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:2445
d
#define d(i)
Definition: RSha256.hxx:120
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:53
SetName
gr SetName("gr")
TThread::kRunningState
@ kRunningState
Definition: TThread.h:64
TModuleDocInfo::AddClass
void AddClass(TClassDocInfo *cl)
Definition: TDocInfo.h:121
launcher.module
module
Definition: launcher.py:31
THtml::fLocalFiles
TFileSysDB * fLocalFiles
Definition: THtml.h:423
TString::ToLower
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
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
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:2421
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
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:2346
TClass::GetSharedLibs
const char * GetSharedLibs()
Get the list of shared libraries containing the code for class cls.
Definition: TClass.cxx:3542
THtml::TFileDefinition
Definition: THtml.h:71
THtml::SetInputDir
void SetInputDir(const char *dir)
Set the directory containing the source files.
Definition: THtml.cxx:2462
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:3339
TClassDocInfo
Definition: TDocInfo.h:29