5 const char pathDelimiter =
88 if (getenv(
"ROOTSYS"))
130 if (lib && strlen(lib)) {
131 std::map<std::string, TString>::const_iterator iUrl =
fLinkInfo.
fLibURLs.find(lib);
149 Info(
"HaveDot",
"Checking for Graphviz (dot)...");
155 Info(
"HaveDot",
"Running: %s", runDot.
Data());
172 for (
int i = 0; who && i < 3; ++i)
173 if (who == helpers[i])
174 helpers[i] = who = 0;
202 const char *dirname ,
const char *relpath ,
203 Int_t includeOutput ,
204 const char* context )
223 char *cRealFilename =
226 if (!cRealFilename) {
227 Error(
"Convert",
"Can't find file '%s' !", filename);
231 TString realFilename(cRealFilename);
232 delete[] cRealFilename;
236 std::ifstream sourceFile;
237 sourceFile.open(realFilename, std::ios::in);
239 if (!sourceFile.good()) {
240 Error(
"Convert",
"Can't open file '%s' !", realFilename.
Data());
246 "Directory '%s' doesn't exist, or it's write protected !", dir);
256 if (includeOutput && !fGClient)
257 Warning(
"Convert",
"Output requested but cannot initialize graphics: GUI and GL windows not be available");
258 output.
Convert(sourceFile, realFilename, tmp1, title, relpath, includeOutput, context, fGClient);
271 module =
"(UNKNOWN)";
289 Info(
"CreateListOfClasses",
"Initializing - this might take a while...");
301 if (filter && (!filter[0] || !strcmp(filter,
"*")))
306 bool skipROOTClasses =
false;
307 std::set<std::string> rootLibs;
308 TList classesDeclFileNotFound;
309 TList classesImplFileNotFound;
312 for (
Int_t i = -1; i < totalNumberOfClasses; i++) {
315 const char *cname = 0;
316 if (i < 0) cname =
"TObject";
319 if (i >= 0 && !strcmp(cname,
"TObject")) {
325 if (strstr(cname,
"__gnu_cxx::"))
continue;
327 if (!strcmp(cname,
"timespec"))
continue;
332 if (!classPtr)
continue;
335 cname = shortName.c_str();
362 skipROOTClasses =
true;
363 Info(
"CreateListOfClasses",
"Cannot find header file for TObject at %s given the input path %s.",
365 Info(
"CreateListOfClasses",
"Assuming documentation is not for ROOT classes, or you need to pass "
366 "the proper directory to THtml::SetInputDir() so I can find %s.", classPtr->
GetDeclFileName());
391 if (skipROOTClasses) {
394 size_t posSpace = lib.find(
' ');
395 if (posSpace != std::string::npos)
397 if (rootLibs.find(lib) == rootLibs.end()) {
399 TString rootlibdir = ROOTLIBDIR;
405 if (sLib.
Index(
'.') == -1) {
413 classesDeclFileNotFound.
AddLast(classPtr);
414 else rootLibs.insert(lib);
418 static const char* rootClassesToIgnore[] =
419 {
"ColorStruct_t",
"CpuInfo_t",
"Event_t",
"FileStat_t",
"GCValues_t",
"MemInfo_t",
420 "PictureAttributes_t",
"Point_t",
"ProcInfo_t",
"ROOT",
"ROOT::Fit",
421 "Rectangle_t",
"RedirectHandle_t",
"Segment_t",
"SetWindowAttributes_t",
422 "SysInfo_t",
"TCint",
"UserGroup_t",
"WindowAttributes_t",
"timespec", 0};
423 static const char* rootClassStemsToIgnore[] =
424 {
"ROOT::Math",
"TKDTree",
"TMatrixT",
"TParameter",
"vector", 0 };
425 static size_t rootClassStemsToIgnoreLen[] = {0, 0, 0, 0, 0};
426 static std::set<std::string> setRootClassesToIgnore;
427 if (setRootClassesToIgnore.empty()) {
428 for (
int ii = 0; rootClassesToIgnore[
ii]; ++
ii)
429 setRootClassesToIgnore.insert(rootClassesToIgnore[
ii]);
430 for (
int ii = 0; rootClassStemsToIgnore[
ii]; ++
ii)
431 rootClassStemsToIgnoreLen[ii] = strlen(rootClassStemsToIgnore[ii]);
434 if (setRootClassesToIgnore.find(cname) == setRootClassesToIgnore.end()) {
435 bool matched =
false;
436 for (
int ii = 0; !matched && rootClassStemsToIgnore[
ii]; ++
ii)
437 matched = !strncmp(cname, rootClassStemsToIgnore[
ii], rootClassStemsToIgnoreLen[ii]);
439 classesDeclFileNotFound.
AddLast(classPtr);
448 classesDeclFileNotFound.
AddLast(classPtr);
459 classesImplFileNotFound.
AddLast(classPtr);
462 if (!htmlfilename.
Length())
466 cdi =
new TClassDocInfo(classPtr, htmlfilename, hdrFS, srcFS, hdr, src);
480 if (!modulename.
Length() || modulename ==
"USER")
489 if (parentModuleName.Length() && parentModuleName !=
".") {
495 while (parentModuleName.Tokenize(token, pos,
"/")) {
496 if (!token.
Length() || token ==
".")
continue;
498 super->SetSelected(moduleSelected);
519 Info(
"CreateListOfClasses",
"Adding class %s, module %s (%sselected)",
526 bool cannotFind =
false;
527 if (!classesDeclFileNotFound.
IsEmpty()) {
529 "Cannot find the header for the following classes [reason]:");
530 TIter iClassesDeclFileNotFound(&classesDeclFileNotFound);
532 while ((iClass = (
TClass*)iClassesDeclFileNotFound())) {
537 Warning(
"CreateListOfClasses",
" %s [header file is unknown]", iClass->
GetName());
543 "Cannot find the source file for the following classes [reason]:");
544 TIter iClassesDeclFileNotFound(&classesImplFileNotFound);
546 while ((iClass = (
TClass*)iClassesDeclFileNotFound())) {
551 Info(
"CreateListOfClasses",
" %s [source file is unknown, add \"ClassImpl(%s)\" to source file if it exists]",
556 Warning(
"CreateListOfClasses",
"THtml cannot find all headers and sources. ");
558 "You might need to adjust the input path (currently %s) by calling THtml::SetInputDir()",
567 if (dt->GetType() != -1)
continue;
572 Info(
"CreateListOfClasses",
"Adding typedef %s to class %s",
573 dt->GetName(), cdi->
GetName());
575 bool inNamespace =
true;
576 TString surroundingNamespace(dt->GetName());
577 Ssiz_t posTemplate = surroundingNamespace.
Last(
'>');
578 inNamespace = inNamespace && (posTemplate ==
kNPOS);
580 Ssiz_t posColumn = surroundingNamespace.Last(
':');
581 if (posColumn !=
kNPOS) {
582 surroundingNamespace.Remove(posColumn - 1);
584 inNamespace = inNamespace && (!clSurrounding ||
IsNamespace(clSurrounding));
588 TString htmlfilename(dt->GetName());
590 htmlfilename +=
".html";
615 Warning(
"CreateListOfClasses",
"Product not set. You should call gHtml->SetProduct(\"MyProductName\");");
617 if (
GetViewCVS().Contains(
"http://root.cern.ch/"))
628 Info(
"CreateListOfClasses",
"Initializing - DONE.");
656 Warning(
"CopyFileFromEtcDir",
"Could not copy %s to %s", inFile.
Data(), outFile.
Data());
700 if (!candidate)
continue;
703 TClass* currentBaseOfCandidate = candidate;
704 while (currentBaseOfCandidate != cl) {
706 if (!bases)
continue;
713 currentBaseOfCandidate = clBase;
717 derived[candidate] = level;
734 if (!classPtr)
return;
746 const char *colon = strchr(cFilename,
':');
749 libName =
TString(cFilename, colon - cFilename);
759 if (posSpace !=
kNPOS)
760 libname.Remove(posSpace, libname.Length());
768 libName = libnameBase;
771 filename = cFilename;
775 htmlFileName =
GetURL(libName);
779 if (htmlFileName.
Length()) {
780 filename = htmlFileName;
783 output.NameSpace2FileName(className);
785 filename = className;
788 }
else filename.
Remove(0);
809 if(!name1 || !name1[0])
return 0;
811 if (strstr(name1,
"ROOT::")==name1) {
813 if (!strncmp(name1 + 6,
"Math", 4)) ret =
kFALSE;
814 if (!strncmp(name1 + 6,
"Reflex", 6)) ret =
kFALSE;
815 if (!strncmp(name1 + 6,
"Cintex", 6)) ret =
kFALSE;
863 bool determine = (!cdi);
865 if (!determine) determine |= decl && !filesys && !cdi->
GetDeclFileName()[0];
867 if (!determine) determine |= !decl && !filesys && !cdi->
GetImplFileName()[0];
892 if (filesys) out_name = sysname;
893 else out_name =
name;
917 Long_t sId, sFlags, sModtime;
921 if (st || !(sFlags & 2)) {
923 Error(
"GetOutputDir",
"output directory %s is an existing file",
946 if (!mapfile || !mapfile->
GetTable())
return;
948 std::set<std::string> loadedlibs;
949 std::set<std::string> failedlibs;
953 while ((rec = (
TEnvRec*) iEnvRec())) {
959 if (failedlibs.find(lib.
Data()) != failedlibs.end()) {
971 if (loadedlibs.find(lib.
Data()) == loadedlibs.end()) {
974 loadedlibs.insert(lib.
Data());
995 if (numthreads == 1) {
1008 if (numthreads == -1) {
1011 numthreads = sysinfo.
fCpus;
1017 THtmlThreadInfo hti(
this, force);
1026 while (--numthreads >= 0) {
1029 threads.
Add(thread);
1032 TIter iThread(&threads);
1036 while (wait && (thread = (
TThread*) iThread()))
1043 while ((thread = (
TThread*) iThread()))
1064 Error(
"MakeClass",
"Unknown class '%s'!", className);
1086 if (!currentClass) {
1089 Error(
"MakeClass",
"Class '%s' is known, but I cannot find its TClass object!", cdi->
GetName());
1093 if (htmlFile.Length()
1094 && (htmlFile.BeginsWith(
"http://")
1095 || htmlFile.BeginsWith(
"https://")
1100 if (htmlFile.Length()) {
1103 cdo.MakeTree(force);
1106 what +=
" (sources not found)";
1119 const THtmlThreadInfo* hti = (
const THtmlThreadInfo*)info;
1122 while ((classinfo = hti->GetHtml()->GetNextClass()))
1123 hti->GetHtml()->MakeClass(classinfo, hti->GetForce());
1164 Error(
"MakeTree",
"Unknown class '%s' !", className);
1287 const char* tmplt = strchr(name,
'<');
1288 if (!tmplt)
return name;
1289 tmplt = strrchr(tmplt,
':');
1290 if (tmplt > name && tmplt[-1] ==
':') {
1293 TString namesp(name, tmplt - name - 1);
TPathDefinition * fPathDef
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual Int_t GetEntries() const
Bool_t IsSelected() const
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
static Bool_t IsNamespace(const TClass *cl)
Check whether cl is a namespace.
void MakeIndex(const char *filter="*")
Create the index files for the product, modules, all types, etc.
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TModuleDocInfo * GetModule() const
void SetSelected(Bool_t sel=kTRUE)
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
void SetLocalFiles() const
Fill the files available in the file system below fPathInfo.fInputPath.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
static void * MakeClassThreaded(void *info)
Entry point of worker threads for multi-threaded MakeAll().
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
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.
virtual TVirtualMutex * Factory(Bool_t=kFALSE)=0
Bool_t CopyFileFromEtcDir(const char *filename) const
Copy a file from $ROOTSYS/etc/html into GetOutputDir()
virtual void CreateProductIndex()
Fetch documentation from THtml::GetProductDocDir() and put it into the product index page...
Int_t fThreadedClassCount
Bool_t HaveDot()
Check whether dot is available in $PATH or in the directory set by SetDotPath()
virtual void CreateTypeIndex()
Create index of all data types.
virtual void CreateAuxiliaryFiles() const
copy CSS, javascript file, etc to the output dir
R__EXTERN TClassTable * gClassTable
TObject * FindObject(const char *name) const
Find object using its name.
TString & ReplaceAll(const TString &s1, const TString &s2)
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
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.
void SetViewCVS(const char *url)
void AddClass(TClassDocInfo *cl)
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
TFileDefinition * fFileDef
virtual int MakeDirectory(const char *name)
Make a directory.
void SetOwner(THtml *html)
Set the THtml object owning this object; if it's already set to a different THtml object than issue a...
static void LoadAllLibs()
Load all libraries known to ROOT via the rootmap system.
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
const char * GetValue() const
static const char * filename()
const char * GetSharedLibs()
Get the list of shared libraries containing the code for class cls.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
The TEnv class reads config files, by default named .rootrc.
const TPathDefinition & GetPathDefinition() const
Return the TModuleDefinition (or derived) object as set by SetModuleDefinition(); create and return a...
virtual void CreateModuleIndex()
Create the class index for each module, picking up documentation from the module's TModuleDocInfo::Ge...
TIter * fThreadedClassIter
const TString & GetInputPath() const
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
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...
void MakeTree(const char *className, Bool_t force=kFALSE)
Make an inheritance tree.
const char * ShortType(const char *name) const
Get short type name, i.e. with default templates removed.
virtual bool GetDeclImplFileName(TClass *cl, bool filesys, bool decl, TString &out_name) const
Combined implementation for GetDeclFileName(), GetImplFileName(): Return declaration / implementation...
virtual const char * GetName() const
Returns name of object.
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
void SetDeclFileName(TClass *cl, const char *filename)
Explicitly set a decl file name for TClass cl.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
void SetOutputDir(const char *dir)
Set the directory where the HTML pages shuold be written to.
virtual void AddLast(TObject *obj)
Add object at the end of the list.
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
void MakeTree(Bool_t force=kFALSE)
Create an output file with a graphical representation of the class inheritance.
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
const char * Data() const
void SetImplFileName(TClass *cl, const char *filename)
Explicitly set a impl file name for TClass cl.
void MakeClass(const char *className, Bool_t force=kFALSE)
Make HTML files for a single class.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
const TFileDefinition & GetFileDefinition() const
Return the TFileDefinition (or derived) object as set by SetFileDefinition(); create and return a TFi...
virtual void GetModuleNameForClass(TString &module, TClass *cl) const
Return the module name for a given class.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
TDictionary * GetClass() const
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
const char * GetDeclFileName() const
The TNamed class is the base class for all named ROOT classes.
virtual void CreateHierarchy()
Create a hierarchical class list The algorithm descends from the base classes and branches into all d...
virtual Bool_t IsEmpty() const
void CreateListOfClasses(const char *filter)
Create the list of all known classes.
virtual void CreateJavascript() const
Write the default ROOT style sheet.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
std::vector< std::vector< double > > Data
const char * GetImplFileName() const
const char * GetDeclFileSysName() const
void HelperDeleted(THelperBase *who)
Inform the THtml object that one of its helper objects was deleted.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual bool GetDeclFileName(const TClass *cl, TString &out_filename, TString &out_fsys, TFileSysEntry **fse=0) const
Determine cl's declaration file name.
Int_t Run(void *arg=0)
Start the thread.
const char * GetURL(const char *lib=0) const
Get the documentation URL for library lib.
R__EXTERN TVirtualMutex * gGlobalMutex
DocEntityInfo_t fDocEntityInfo
virtual const char * GetSoExt() const
Get the shared library extension.
R__EXTERN const char * gProgName
TList & GetListOfTypedefs()
void Clear(Option_t *option="")
Remove all objects from the list.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
R__EXTERN TSystem * gSystem
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 ...
Basic data type descriptor (datatype information is obtained from CINT).
std::map< std::string, TString > fLibURLs
virtual void NameSpace2FileName(TString &name)
Replace "::" in name by "__" Replace "<", ">", " ", ",", "~", "=" in name by "_" Replace "A::X<A::Y>"...
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
ClassInfo_t * GetClassInfo() const
virtual void CreateStyleSheet() const
Write the default ROOT style sheet.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual void CreateClassTypeDefs()
Create a forwarding page for each typedef pointing to a class.
virtual const char * GetName() const
Returns name of object.
The ROOT global object gROOT contains a list of all defined classes.
Long_t Join(void **ret=0)
Join this thread.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
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.
const TModuleDefinition & GetModuleDefinition() const
Return the TModuleDefinition (or derived) object as set by SetModuleDefinition(); create and return a...
THashList * GetTable() const
TVirtualMutex * GetMakeClassMutex() const
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).
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Each class (see TClass) has a linked list of its base class(es).
void SetImplFileName(const char *name)
TString & Remove(Ssiz_t pos)
virtual bool GetDeclFileName(TClass *cl, Bool_t filesys, TString &out_name) const
Return declaration file name; return the full path if filesys is true.
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.
virtual Int_t GetSize() const
void Convert(std::istream &in, const char *infilename, const char *outfilename, const char *title, const char *relpath="../", Int_t includeOutput=0, const char *context="", TGClient *gclient=0)
Convert a text file into a html file.
static char * Next()
Returns next class from sorted class table.
virtual TClass * GetClass(const char *name) const
*-*-*-*-*Return pointer to class with name*-*-*-*-*-*-*-*-*-*-*-*-* *-* =============================...
virtual const char * GetName() const
Returns name of object.
void CreateHierarchy()
Create the inheritance hierarchy diagram for all classes.
TVirtualMutex * fMakeClassMutex
void SetSelected(Bool_t sel=kTRUE)
#define R__LOCKGUARD(mutex)
void SetImplFileSysName(const char *fsname)
TModuleDefinition * fModuleDef
virtual void CreateClassIndex()
Create index of all classes.
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.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
virtual const char * GetEtcDir() const
Get the directory containing THtml's auxiliary files ($ROOTSYS/etc/html)
void SetPathDefinition(const TPathDefinition &pd)
Set the path defining object to be used; can also be a user derived object (a la traits).
void SetFoundDot(Bool_t found=kTRUE)
Set whether "dot" (a GraphViz utility) is available.
Int_t Match(const TString &s, UInt_t start=0)
Runs a match on s against the regex 'this' was created with.
const char * GetImplFileName() const
Mother of all ROOT objects.
const TString & GetViewCVS() const
const char * GetDeclFileName() const
void SetHtmlFileName(const char *name)
void SetInputDir(const char *dir)
Set the directory containing the source files.
virtual void Add(TObject *obj)
Wrapper for PCRE library (Perl Compatible Regular Expressions).
R__EXTERN const char * gRootDir
void SetDeclFileSysName(const char *fsname)
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
const char * GetHtmlFileName() const
const TString & GetOutputDir(Bool_t createDir=kTRUE) const
Return the output directory as set by SetOutputDir().
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE)
Copy a file.
THashList fShortClassNames
void SetModuleDefinition(const TModuleDefinition &md)
Set the module defining object to be used; can also be a user derived object (a la traits)...
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
static void output(int code)
virtual const char * GetTitle() const
Returns title of object.
virtual bool GetImplFileName(TClass *cl, Bool_t filesys, TString &out_name) const
Return implementation file name.
const char * GetImplFileSysName() const
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
void AddMacroPath(const char *path)
that the directive is run on.
Bool_t HaveSource() const
virtual bool GetImplFileName(const TClass *cl, TString &out_filename, TString &out_fsys, TFileSysEntry **fse=0) const
Determine cl's implementation file name.
Ssiz_t First(char c) const
Find first occurrence of a character c.
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...
void SetDeclFileName(const char *name)
virtual void GetHtmlFileName(TClass *classPtr, TString &filename) const
Return real HTML filename.
TClassDocInfo * GetNextClass()
Return the next class to be generated for MakeClassThreaded.
void SetModule(TModuleDocInfo *module)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.