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