TROOT.cxx

Go to the documentation of this file.
00001 // @(#)root/base:$Id: TROOT.cxx 37531 2010-12-10 20:38:06Z pcanal $
00002 // Author: Rene Brun   08/12/94
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 ////////////////////////////////////////////////////////////////////////////////
00013 //                R O O T top level object description
00014 //
00015 //    The TROOT object is the entry point to the ROOT system.
00016 //    The single instance of TROOT is accessible via the global gROOT.
00017 //    Using the gROOT pointer one has access to basically every object
00018 //    created in a ROOT based program. The TROOT object is essentially a
00019 //    container of several lists pointing to the main ROOT objects.
00020 //
00021 //    The following lists are accessible from gROOT object:
00022 //       gROOT->GetListOfClasses
00023 //       gROOT->GetListOfColors
00024 //       gROOT->GetListOfTypes
00025 //       gROOT->GetListOfGlobals
00026 //       gROOT->GetListOfGlobalFunctions
00027 //       gROOT->GetListOfFiles
00028 //       gROOT->GetListOfMappedFiles
00029 //       gROOT->GetListOfSockets
00030 //       gROOT->GetListOfSecContexts
00031 //       gROOT->GetListOfCanvases
00032 //       gROOT->GetListOfStyles
00033 //       gROOT->GetListOfFunctions
00034 //       gROOT->GetListOfSpecials (for example graphical cuts)
00035 //       gROOT->GetListOfGeometries
00036 //       gROOT->GetListOfBrowsers
00037 //       gROOT->GetListOfCleanups
00038 //       gROOT->GetListOfMessageHandlers
00039 //
00040 //   The TROOT class provides also many useful services:
00041 //     - Get pointer to an object in any of the lists above
00042 //     - Time utilities TROOT::Time
00043 //
00044 //   The ROOT object must be created as a static object. An example
00045 //   of a main program creating an interactive version is shown below:
00046 //
00047 //---------------------Example of a main program--------------------------------
00048 //
00049 //       #include "TRint.h"
00050 //
00051 //       int main(int argc, char **argv)
00052 //       {
00053 //          TRint *theApp = new TRint("ROOT example", &argc, argv);
00054 //
00055 //          // Init Intrinsics, build all windows, and enter event loop
00056 //          theApp->Run();
00057 //
00058 //          return(0);
00059 //       }
00060 //-----------------------End of Main program--------------------------------
00061 ////////////////////////////////////////////////////////////////////////////////
00062 
00063 #include "RConfig.h"
00064 #include "RConfigure.h"
00065 #include "RConfigOptions.h"
00066 
00067 #include <string>
00068 #include <map>
00069 #include <stdlib.h>
00070 #ifdef WIN32
00071 #include <io.h>
00072 #endif
00073 
00074 #include "Riostream.h"
00075 #include "Gtypes.h"
00076 #include "TROOT.h"
00077 #include "TClass.h"
00078 #include "TClassEdit.h"
00079 #include "TClassGenerator.h"
00080 #include "TDataType.h"
00081 #include "TDatime.h"
00082 #include "TStyle.h"
00083 #include "TObjectTable.h"
00084 #include "TClassTable.h"
00085 #include "TSystem.h"
00086 #include "THashList.h"
00087 #include "TObjArray.h"
00088 #include "TEnv.h"
00089 #include "TError.h"
00090 #include "TColor.h"
00091 #include "TGlobal.h"
00092 #include "TFunction.h"
00093 #include "TVirtualPad.h"
00094 #include "TBrowser.h"
00095 #include "TSystemDirectory.h"
00096 #include "TApplication.h"
00097 #include "TInterpreter.h"
00098 #include "TGuiFactory.h"
00099 #include "TMessageHandler.h"
00100 #include "TFolder.h"
00101 #include "TQObject.h"
00102 #include "TProcessUUID.h"
00103 #include "TPluginManager.h"
00104 #include "TMap.h"
00105 #include "TObjString.h"
00106 #include "TVirtualMutex.h"
00107 #ifdef R__HAS_CLING
00108 # include "TCling.h"
00109 #else
00110 # include "TCint.h"
00111 #endif
00112 
00113 #include <string>
00114 namespace std {} using namespace std;
00115 
00116 #if defined(R__UNIX)
00117 #include "TUnixSystem.h"
00118 #elif defined(R__WIN32)
00119 #include "TWinNTSystem.h"
00120 #endif
00121 
00122 extern "C" void R__SetZipMode(int);
00123 
00124 // Mutex for protection of concurrent gROOT access
00125 TVirtualMutex* gROOTMutex = 0;
00126 
00127 //-------- Names of next three routines are a small homage to CMZ --------------
00128 //______________________________________________________________________________
00129 static Int_t IVERSQ()
00130 {
00131    // Return version id as an integer, i.e. "2.22/04" -> 22204.
00132 
00133    Int_t maj, min, cycle;
00134    sscanf(ROOT_RELEASE, "%d.%d/%d", &maj, &min, &cycle);
00135    return 10000*maj + 100*min + cycle;
00136 }
00137 
00138 //______________________________________________________________________________
00139 static Int_t IDATQQ(const char *date)
00140 {
00141    // Return built date as integer, i.e. "Apr 28 2000" -> 20000428.
00142 
00143    static const char *months[] = {"Jan","Feb","Mar","Apr","May",
00144                                   "Jun","Jul","Aug","Sep","Oct",
00145                                   "Nov","Dec"};
00146 
00147    char  sm[12];
00148    Int_t yy, mm=0, dd;
00149    sscanf(date, "%s %d %d", sm, &dd, &yy);
00150    for (int i = 0; i < 12; i++)
00151       if (!strncmp(sm, months[i], 3)) {
00152          mm = i+1;
00153          break;
00154       }
00155    return 10000*yy + 100*mm + dd;
00156 }
00157 
00158 //______________________________________________________________________________
00159 static Int_t ITIMQQ(const char *time)
00160 {
00161    // Return built time as integer (with min precision), i.e.
00162    // "17:32:37" -> 1732.
00163 
00164    Int_t hh, mm, ss;
00165    sscanf(time, "%d:%d:%d", &hh, &mm, &ss);
00166    return 100*hh + mm;
00167 }
00168 //______________________________________________________________________________
00169 static void CleanUpROOTAtExit()
00170 {
00171    // Clean up at program termination before global objects go out of scope.
00172 
00173    if (gROOT) {
00174       R__LOCKGUARD(gROOTMutex);
00175 
00176       if (gROOT->GetListOfFiles())
00177          gROOT->GetListOfFiles()->Delete("slow");
00178       if (gROOT->GetListOfSockets())
00179          gROOT->GetListOfSockets()->Delete();
00180       if (gROOT->GetListOfMappedFiles())
00181          gROOT->GetListOfMappedFiles()->Delete("slow");
00182    }
00183 }
00184 
00185 
00186 
00187 Int_t  TROOT::fgDirLevel = 0;
00188 Bool_t TROOT::fgRootInit = kFALSE;
00189 Bool_t TROOT::fgMemCheck = kFALSE;
00190 
00191 // This local static object initializes the ROOT system
00192 namespace ROOT {
00193    TROOT *GetROOT() {
00194       static TROOT root("root", "The ROOT of EVERYTHING");
00195       return &root;
00196    }
00197    TString &GetMacroPath() {
00198       static TString macroPath;
00199       return macroPath;
00200    }
00201 }
00202 
00203 TROOT *gROOT = ROOT::GetROOT();     // The ROOT of EVERYTHING
00204 
00205 // Global debug flag (set to > 0 to get debug output).
00206 // Can be set either via the interpreter (gDebug is exported to CINT),
00207 // via the rootrc resouce "Root.Debug", via the shell environment variable
00208 // ROOTDEBUG, or via the debugger.
00209 Int_t gDebug;
00210 
00211 
00212 ClassImp(TROOT)
00213 
00214 //______________________________________________________________________________
00215 TROOT::TROOT() : TDirectory(),
00216      fLineIsProcessing(0), fVersion(0), fVersionInt(0), fVersionCode(0),
00217      fVersionDate(0), fVersionTime(0), fBuiltDate(0), fBuiltTime(0), fSvnRevision(0),
00218      fTimer(0), fApplication(0), fInterpreter(0), fBatch(kTRUE), fEditHistograms(kTRUE),
00219      fFromPopUp(kTRUE),fMustClean(kTRUE),fReadingObject(kFALSE),fForceStyle(kFALSE),
00220      fInterrupt(kFALSE),fEscape(kFALSE),fExecutingMacro(kFALSE),fEditorMode(0),
00221      fPrimitive(0),fSelectPad(0),fClasses(0),fTypes(0),fGlobals(0),fGlobalFunctions(0),
00222      fFiles(0),fMappedFiles(0),fSockets(0),fCanvases(0),fStyles(0),fFunctions(0),
00223      fTasks(0),fColors(0),fGeometries(0),fBrowsers(0),fSpecials(0),fCleanups(0),
00224      fMessageHandlers(0),fStreamerInfo(0),fClassGenerators(0),fSecContexts(0),
00225      fProofs(0),fClipboard(0),fDataSets(0),fUUIDs(0),fRootFolder(0),fBrowsables(0),
00226      fPluginManager(0)
00227 {
00228    // Default ctor.
00229 }
00230 
00231 //______________________________________________________________________________
00232 TROOT::TROOT(const char *name, const char *title, VoidFuncPtr_t *initfunc)
00233    : TDirectory(), fLineIsProcessing(0), fVersion(0), fVersionInt(0), fVersionCode(0),
00234      fVersionDate(0), fVersionTime(0), fBuiltDate(0), fBuiltTime(0), fSvnRevision(0),
00235      fTimer(0), fApplication(0), fInterpreter(0), fBatch(kTRUE), fEditHistograms(kTRUE),
00236      fFromPopUp(kTRUE),fMustClean(kTRUE),fReadingObject(kFALSE),fForceStyle(kFALSE),
00237      fInterrupt(kFALSE),fEscape(kFALSE),fExecutingMacro(kFALSE),fEditorMode(0),
00238      fPrimitive(0),fSelectPad(0),fClasses(0),fTypes(0),fGlobals(0),fGlobalFunctions(0),
00239      fFiles(0),fMappedFiles(0),fSockets(0),fCanvases(0),fStyles(0),fFunctions(0),
00240      fTasks(0),fColors(0),fGeometries(0),fBrowsers(0),fSpecials(0),fCleanups(0),
00241      fMessageHandlers(0),fStreamerInfo(0),fClassGenerators(0),fSecContexts(0),
00242      fProofs(0),fClipboard(0),fDataSets(0),fUUIDs(0),fRootFolder(0),fBrowsables(0),
00243      fPluginManager(0)
00244 {
00245    // Initialize the ROOT system. The creation of the TROOT object initializes
00246    // the ROOT system. It must be the first ROOT related action that is
00247    // performed by a program. The TROOT object must be created on the stack
00248    // (can not be called via new since "operator new" is protected). The
00249    // TROOT object is either created as a global object (outside the main()
00250    // program), or it is one of the first objects created in main().
00251    // Make sure that the TROOT object stays in scope for as long as ROOT
00252    // related actions are performed. TROOT is a so called singleton so
00253    // only one instance of it can be created. The single TROOT object can
00254    // always be accessed via the global pointer gROOT.
00255    // The name and title arguments can be used to identify the running
00256    // application. The initfunc argument can contain an array of
00257    // function pointers (last element must be 0). These functions are
00258    // executed at the end of the constructor. This way one can easily
00259    // extend the ROOT system without adding permanent dependencies
00260    // (e.g. the graphics system is initialized via such a function).
00261 
00262    if (fgRootInit) {
00263       //Warning("TROOT", "only one instance of TROOT allowed");
00264       return;
00265    }
00266 
00267    R__LOCKGUARD2(gROOTMutex);
00268 
00269    gROOT      = this;
00270    gDirectory = 0;
00271    SetName(name);
00272    SetTitle(title);
00273    TDirectory::Build();
00274 
00275    // will be used by global "operator delete" so make sure it is set
00276    // before anything is deleted
00277    fMappedFiles = 0;
00278 
00279    // create already here, but only initialize it after gEnv has been created
00280    gPluginMgr = fPluginManager = new TPluginManager;
00281 
00282    // Initialize Operating System interface
00283    InitSystem();
00284 
00285 #ifndef ROOTPREFIX
00286    if (!gSystem->Getenv("ROOTSYS")) {
00287       fprintf(stderr, "Fatal in <TROOT::TROOT>: ROOTSYS not set. Set it before trying to run.\n");
00288       exit(1);
00289    }
00290 #endif
00291 
00292    // Initialize interface to CINT C++ interpreter
00293    fVersionInt      = 0;  // check in TROOT dtor in case TCint fails
00294    fClasses         = 0;  // might be checked via TCint ctor
00295 
00296    fInterpreter     = new TCint("C/C++", "CINT C/C++ Interpreter");
00297 
00298    fConfigOptions   = R__CONFIGUREOPTIONS;
00299    fConfigFeatures  = R__CONFIGUREFEATURES;
00300    fVersion         = ROOT_RELEASE;
00301    fVersionCode     = ROOT_VERSION_CODE;
00302    fVersionInt      = IVERSQ();
00303    fVersionDate     = IDATQQ(ROOT_RELEASE_DATE);
00304    fVersionTime     = ITIMQQ(ROOT_RELEASE_TIME);
00305    fBuiltDate       = IDATQQ(__DATE__);
00306    fBuiltTime       = ITIMQQ(__TIME__);
00307 
00308    ReadSvnInfo();
00309 
00310    fClasses         = new THashTable(800,3);
00311    //fIdMap           = new IdMap_t;
00312    fStreamerInfo    = new TObjArray(100);
00313    fClassGenerators = new TList;
00314 
00315    // initialize plugin manager early
00316    fPluginManager->LoadHandlersFromEnv(gEnv);
00317 
00318    TSystemDirectory *workdir = new TSystemDirectory("workdir", gSystem->WorkingDirectory());
00319 
00320    fTimer       = 0;
00321    fApplication = 0;
00322    fColors      = new TObjArray(1000); fColors->SetName("ListOfColors");
00323    fTypes       = 0;
00324    fGlobals     = 0;
00325    fGlobalFunctions = 0;
00326    // fList was created in TDirectory::Build but with different sizing.
00327    delete fList;
00328    fList        = new THashList(1000,3);
00329    fFiles       = new TList; fFiles->SetName("Files");
00330    fMappedFiles = new TList; fMappedFiles->SetName("MappedFiles");
00331    fSockets     = new TList; fSockets->SetName("Sockets");
00332    fCanvases    = new TList; fCanvases->SetName("Canvases");
00333    fStyles      = new TList; fStyles->SetName("Styles");
00334    fFunctions   = new TList; fFunctions->SetName("Functions");
00335    fTasks       = new TList; fTasks->SetName("Tasks");
00336    fGeometries  = new TList; fGeometries->SetName("Geometries");
00337    fBrowsers    = new TList; fBrowsers->SetName("Browsers");
00338    fSpecials    = new TList; fSpecials->SetName("Specials");
00339    fBrowsables  = new TList; fBrowsables->SetName("Browsables");
00340    fCleanups    = new THashList; fCleanups->SetName("Cleanups");
00341    fMessageHandlers = new TList; fMessageHandlers->SetName("MessageHandlers");
00342    fSecContexts = new TList; fSecContexts->SetName("SecContexts");
00343    fProofs      = new TList; fProofs->SetName("Proofs");
00344    fClipboard   = new TList; fClipboard->SetName("Clipboard");
00345    fDataSets    = new TList; fDataSets->SetName("DataSets");
00346 
00347    TProcessID::AddProcessID();
00348    fUUIDs = new TProcessUUID();
00349 
00350    fRootFolder = new TFolder();
00351    fRootFolder->SetName("root");
00352    fRootFolder->SetTitle("root of all folders");
00353    fRootFolder->AddFolder("Classes",   "List of Active Classes",fClasses);
00354    fRootFolder->AddFolder("Colors",    "List of Active Colors",fColors);
00355    fRootFolder->AddFolder("MapFiles",  "List of MapFiles",fMappedFiles);
00356    fRootFolder->AddFolder("Sockets",   "List of Socket Connections",fSockets);
00357    fRootFolder->AddFolder("Canvases",  "List of Canvases",fCanvases);
00358    fRootFolder->AddFolder("Styles",    "List of Styles",fStyles);
00359    fRootFolder->AddFolder("Functions", "List of Functions",fFunctions);
00360    fRootFolder->AddFolder("Tasks",     "List of Tasks",fTasks);
00361    fRootFolder->AddFolder("Geometries","List of Geometries",fGeometries);
00362    fRootFolder->AddFolder("Browsers",  "List of Browsers",fBrowsers);
00363    fRootFolder->AddFolder("Specials",  "List of Special Objects",fSpecials);
00364    fRootFolder->AddFolder("Handlers",  "List of Message Handlers",fMessageHandlers);
00365    fRootFolder->AddFolder("Cleanups",  "List of RecursiveRemove Collections",fCleanups);
00366    fRootFolder->AddFolder("StreamerInfo","List of Active StreamerInfo Classes",fStreamerInfo);
00367    fRootFolder->AddFolder("SecContexts","List of Security Contexts",fSecContexts);
00368    fRootFolder->AddFolder("PROOF Sessions", "List of PROOF sessions",fProofs);
00369    fRootFolder->AddFolder("ROOT Memory","List of Objects in the gROOT Directory",fList);
00370    fRootFolder->AddFolder("ROOT Files","List of Connected ROOT Files",fFiles);
00371 
00372    // by default, add the list of files, tasks, canvases and browsers in the Cleanups list
00373    fCleanups->Add(fCanvases); fCanvases->SetBit(kMustCleanup);
00374    fCleanups->Add(fBrowsers); fBrowsers->SetBit(kMustCleanup);
00375    fCleanups->Add(fTasks);    fTasks->SetBit(kMustCleanup);
00376    fCleanups->Add(fFiles);    fFiles->SetBit(kMustCleanup);
00377    fCleanups->Add(fInterpreter);
00378 
00379    fExecutingMacro= kFALSE;
00380    fForceStyle    = kFALSE;
00381    fFromPopUp     = kFALSE;
00382    fReadingObject = kFALSE;
00383    fInterrupt     = kFALSE;
00384    fEscape        = kFALSE;
00385    fMustClean     = kTRUE;
00386    fPrimitive     = 0;
00387    fSelectPad     = 0;
00388    fEditorMode    = 0;
00389    fDefCanvasName = "c1";
00390    fEditHistograms= kFALSE;
00391    fLineIsProcessing = 1;   // This prevents WIN32 "Windows" thread to pick ROOT objects with mouse
00392    gDirectory     = this;
00393    gPad           = 0;
00394 
00395    //set name of graphical cut class for the graphics editor
00396    //cannot call SetCutClassName at this point because the TClass of TCutG
00397    //is not yet build
00398    fCutClassName = "TCutG";
00399 
00400    // Create a default MessageHandler
00401    new TMessageHandler((TClass*)0);
00402 
00403    // Create some styles
00404    gStyle = 0;
00405    TStyle::BuildStyles();
00406    SetStyle("Default");
00407 
00408    // Setup default (batch) graphics and GUI environment
00409    gBatchGuiFactory = new TGuiFactory;
00410    gGuiFactory      = gBatchGuiFactory;
00411    gGXBatch         = new TVirtualX("Batch", "ROOT Interface to batch graphics");
00412    gVirtualX        = gGXBatch;
00413 
00414 #ifdef R__WIN32
00415    fBatch = kFALSE;
00416 #else
00417    if (gSystem->Getenv("DISPLAY"))
00418       fBatch = kFALSE;
00419    else
00420       fBatch = kTRUE;
00421 #endif
00422 
00423    int i = 0;
00424    while (initfunc && initfunc[i]) {
00425       (initfunc[i])();
00426       fBatch = kFALSE;  // put system in graphics mode (backward compatible)
00427       i++;
00428    }
00429 
00430    // Load and init threads library
00431    InitThreads();
00432 
00433    // Load RQ_OBJECT.h in interpreter (allows signal/slot programming, like Qt)
00434    TQObject::LoadRQ_OBJECT();
00435 
00436    // Set initial/default list of browsable objects
00437    fBrowsables->Add(fRootFolder, "root");
00438    fBrowsables->Add(fProofs, "PROOF Sessions");
00439    fBrowsables->Add(workdir, gSystem->WorkingDirectory());
00440    fBrowsables->Add(fFiles, "ROOT Files");
00441 
00442    atexit(CleanUpROOTAtExit);
00443 
00444    fgRootInit = kTRUE;
00445 
00446    TClass::ReadRules(); // Read the default customization rules ...
00447 }
00448 
00449 //______________________________________________________________________________
00450 TROOT::~TROOT()
00451 {
00452    // Clean up and free resources used by ROOT (files, network sockets,
00453    // shared memory segments, etc.).
00454 
00455    if (gROOT == this) {
00456 
00457       // Turn-off the global mutex to avoid recreating mutexes that have
00458       // already been deleted during the destruction phase
00459       gGlobalMutex = 0;
00460 
00461       // Return when error occured in TCint, i.e. when setup file(s) are
00462       // out of date
00463       if (!fVersionInt) return;
00464 
00465       // ATTENTION!!! Order is important!
00466 
00467 #ifdef R__COMPLETE_MEM_TERMINATION
00468       SafeDelete(fBrowsables);
00469       SafeDelete(fRootFolder);
00470       fSpecials->Delete();   SafeDelete(fSpecials);    // delete special objects : PostScript, Minuit, Html
00471 #endif
00472       fFiles->Delete("slow"); SafeDelete(fFiles);       // and files
00473       fSecContexts->Delete("slow"); SafeDelete(fSecContexts); // and security contexts
00474       fSockets->Delete();     SafeDelete(fSockets);     // and sockets
00475       fMappedFiles->Delete("slow");                     // and mapped files
00476       delete fUUIDs;
00477       TProcessID::Cleanup();                            // and list of ProcessIDs
00478       TSeqCollection *tl = fMappedFiles; fMappedFiles = 0; delete tl;
00479 
00480       fFunctions->Delete();  SafeDelete(fFunctions);   // etc..
00481       fColors->Delete();     SafeDelete(fColors);
00482       fStyles->Delete();     SafeDelete(fStyles);
00483       fGeometries->Delete(); SafeDelete(fGeometries);
00484       fBrowsers->Delete();   SafeDelete(fBrowsers);
00485       
00486 #ifdef R__COMPLETE_MEM_TERMINATION
00487       if (gGuiFactory != gBatchGuiFactory) SafeDelete(gGuiFactory);
00488       SafeDelete(gBatchGuiFactory);
00489       if (gGXBatch != gVirtualX) SafeDelete(gGXBatch);
00490       SafeDelete(gVirtualX);
00491 #endif
00492       
00493       // Stop emitting signals
00494       TQObject::BlockAllSignals(kTRUE);
00495 
00496       fMessageHandlers->Delete(); SafeDelete(fMessageHandlers);
00497 
00498 #ifdef R__COMPLETE_MEM_TERMINATION
00499       SafeDelete(fCanvases);
00500       SafeDelete(fTasks);
00501       SafeDelete(fProofs);
00502       SafeDelete(fDataSets);
00503       SafeDelete(fClipboard);
00504       fCleanups->Clear();
00505       delete fPluginManager; gPluginMgr = fPluginManager = 0;
00506       delete gClassTable;  gClassTable = 0;
00507       delete gEnv; gEnv = 0;
00508 
00509       if (fTypes) fTypes->Delete();
00510       SafeDelete(fTypes);
00511       if (fGlobals) fGlobals->Delete();
00512       SafeDelete(fGlobals);
00513       if (fGlobalFunctions) fGlobalFunctions->Delete();
00514       SafeDelete(fGlobalFunctions);
00515       fClasses->Delete();    SafeDelete(fClasses);     // TClass'es must be deleted last
00516 #endif
00517 
00518       // Remove shared libraries produced by the TSystem::CompileMacro() call
00519       gSystem->CleanCompiledMacros();
00520 
00521       // Cleanup system class
00522       delete gSystem;
00523 
00524       // Problem deleting the interpreter. Want's to delete objects already
00525       // deleted in the dtor's above. Crash.
00526       // It should only close the files and NOT delete.
00527       SafeDelete(fInterpreter);
00528 
00529 #ifdef R__COMPLETE_MEM_TERMINATION
00530       SafeDelete(fCleanups);
00531 #endif
00532 
00533       // Prints memory stats
00534       TStorage::PrintStatistics();
00535 
00536       gROOT = 0;
00537       fgRootInit = kFALSE;
00538    }
00539 }
00540 
00541 //______________________________________________________________________________
00542 void TROOT::AddClass(TClass *cl)
00543 {
00544    // Add a class to the list and map of classes.
00545 
00546    //if (!cl) return;
00547    //GetListOfClasses()->Add(cl);
00548    //if (cl->GetTypeInfo()) {
00549    //   fIdMap->Add(cl->GetTypeInfo()->name(),cl);
00550    //}
00551    TClass::AddClass(cl);
00552 }
00553 
00554 //______________________________________________________________________________
00555 void TROOT::AddClassGenerator(TClassGenerator *generator)
00556 {
00557    // Add a class generator.  This generator will be called by TClass::GetClass
00558    // in case its does not find a loaded rootcint dictionary to request the
00559    // creation of a TClass object.
00560 
00561    if (!generator) return;
00562    fClassGenerators->Add(generator);
00563 }
00564 
00565 //______________________________________________________________________________
00566 void TROOT::Browse(TBrowser *b)
00567 {
00568    // Add browsable objects to TBrowser.
00569 
00570    TObject *obj;
00571    TIter next(fBrowsables);
00572 
00573    while ((obj = (TObject *) next())) {
00574       const char *opt = next.GetOption();
00575       if (opt && strlen(opt))
00576          b->Add(obj, opt);
00577       else
00578          b->Add(obj, obj->GetName());
00579    }
00580 }
00581 
00582 //______________________________________________________________________________
00583 Bool_t TROOT::ClassSaved(TClass *cl)
00584 {
00585 // return class status bit kClassSaved for class cl
00586 // This function is called by the SavePrimitive functions writing
00587 // the C++ code for an object.
00588 
00589    if (cl == 0) return kFALSE;
00590    if (cl->TestBit(TClass::kClassSaved)) return kTRUE;
00591    cl->SetBit(TClass::kClassSaved);
00592    return kFALSE;
00593 }
00594 
00595 //______________________________________________________________________________
00596 TObject *TROOT::FindObject(const TObject *) const
00597 {
00598 // Find an object in one Root folder
00599 
00600    Error("FindObject","Not yet implemented");
00601    return 0;
00602 }
00603 
00604 //______________________________________________________________________________
00605 TObject *TROOT::FindObject(const char *name) const
00606 {
00607    // Returns address of a ROOT object if it exists
00608    //
00609    // If name contains at least one "/" the function calls FindObjectany
00610    // else
00611    // This function looks in the following order in the ROOT lists:
00612    //     - List of files
00613    //     - List of memory mapped files
00614    //     - List of functions
00615    //     - List of geometries
00616    //     - List of canvases
00617    //     - List of styles
00618    //     - List of specials
00619    //     - List of materials in current geometry
00620    //     - List of shapes in current geometry
00621    //     - List of matrices in current geometry
00622    //     - List of Nodes in current geometry
00623    //     - Current Directory in memory
00624    //     - Current Directory on file
00625 
00626    if (name && strstr(name,"/")) return FindObjectAny(name);
00627 
00628    TObject *temp = 0;
00629 
00630    temp   = fFiles->FindObject(name);       if (temp) return temp;
00631    temp   = fMappedFiles->FindObject(name); if (temp) return temp;
00632    temp   = fFunctions->FindObject(name);   if (temp) return temp;
00633    temp   = fGeometries->FindObject(name);  if (temp) return temp;
00634    temp   = fCanvases->FindObject(name);    if (temp) return temp;
00635    temp   = fStyles->FindObject(name);      if (temp) return temp;
00636    temp   = fSpecials->FindObject(name);    if (temp) return temp;
00637    TIter next(fGeometries);
00638    TObject *obj;
00639    while ((obj=next())) {
00640       temp = obj->FindObject(name);         if (temp) return temp;
00641    }
00642    if (gDirectory) temp = gDirectory->Get(name); if (temp) return temp;
00643    if (gPad) {
00644       TVirtualPad *canvas = gPad->GetVirtCanvas();
00645       if (fCanvases->FindObject(canvas)) {  //this check in case call from TCanvas ctor
00646          temp = canvas->FindObject(name);
00647          if (!temp && canvas != gPad) temp  = gPad->FindObject(name);
00648       }
00649    }
00650    return temp;
00651 }
00652 
00653 //______________________________________________________________________________
00654 TObject *TROOT::FindSpecialObject(const char *name, void *&where)
00655 {
00656    // Returns address and folder of a ROOT object if it exists
00657    //
00658    // This function looks in the following order in the ROOT lists:
00659    //     - List of files
00660    //     - List of memory mapped files
00661    //     - List of functions
00662    //     - List of geometries
00663    //     - List of canvases
00664    //     - List of styles
00665    //     - List of specials
00666    //     - List of materials in current geometry
00667    //     - List of shapes in current geometry
00668    //     - List of matrices in current geometry
00669    //     - List of Nodes in current geometry
00670    //     - Current Directory in memory
00671    //     - Current Directory on file
00672 
00673    TObject *temp = 0;
00674    where = 0;
00675 
00676    if (!temp && !strcmp(name, "gPad")) {
00677       temp = gPad;
00678       if (gPad) {
00679          TVirtualPad *canvas = gPad->GetVirtCanvas();
00680          //this check in case call from TCanvas ctor
00681          if (fCanvases->FindObject(canvas))
00682             where = canvas;
00683       }
00684    }
00685    if (!temp && !strcmp(name, "gVirtualX")) {
00686       return gVirtualX;
00687    }
00688    if (!temp && !strcmp(name, "gInterpreter")) {
00689       return gInterpreter;
00690    }
00691    if (!temp) {
00692       temp  = fFiles->FindObject(name);
00693       where = fFiles;
00694    }
00695    if (!temp) {
00696       temp  = fMappedFiles->FindObject(name);
00697       where = fMappedFiles;
00698    }
00699    if (!temp) {
00700       temp  = fFunctions->FindObject(name);
00701       where = fFunctions;
00702    }
00703    if (!temp) {
00704       temp  = fCanvases->FindObject(name);
00705       where = fCanvases;
00706    }
00707    if (!temp) {
00708       temp  = fStyles->FindObject(name);
00709       where = fStyles;
00710    }
00711    if (!temp) {
00712       temp  = fSpecials->FindObject(name);
00713       where = fSpecials;
00714    }
00715    if (!temp) {
00716       TObject *glast = fGeometries->Last();
00717       if (glast) {where = glast; temp = glast->FindObject(name);}
00718    }
00719    if (!temp && gDirectory) {
00720       temp  = gDirectory->Get(name);
00721       where = gDirectory;
00722    }
00723    if (!temp && gPad) {
00724       TVirtualPad *canvas = gPad->GetVirtCanvas();
00725       if (fCanvases->FindObject(canvas)) {  //this check in case call from TCanvas ctor
00726          temp  = canvas->FindObject(name);
00727          where = canvas;
00728          if (!temp && canvas != gPad) {
00729             temp  = gPad->FindObject(name);
00730             where = gPad;
00731          }
00732       }
00733    }
00734    if (!temp) return 0;
00735    if (temp->TestBit(kNotDeleted)) return temp;
00736    return 0;
00737 }
00738 
00739 //______________________________________________________________________________
00740 TObject *TROOT::FindObjectAny(const char *name) const
00741 {
00742    // Return a pointer to the first object with name starting at //root.
00743    // This function scans the list of all folders.
00744    // if no object found in folders, it scans the memory list of all files.
00745 
00746    TObject *obj = fRootFolder->FindObjectAny(name);
00747    if (obj) return obj;
00748    return gDirectory->FindObjectAnyFile(name);
00749 }
00750 
00751 //______________________________________________________________________________
00752 const char *TROOT::FindObjectClassName(const char *name) const
00753 {
00754    // Returns class name of a ROOT object including CINT globals.
00755 
00756    // Search first in the list of "standard" objects
00757    TObject *obj = FindObject(name);
00758    if (obj) return obj->ClassName();
00759 
00760    // Is it a global variable?
00761    TGlobal *g = GetGlobal(name);
00762    if (g) return g->GetTypeName();
00763 
00764    return 0;
00765 }
00766 
00767 //______________________________________________________________________________
00768 const char *TROOT::FindObjectPathName(const TObject *) const
00769 {
00770    // Return path name of obj somewhere in the //root/... path.
00771    // The function returns the first occurence of the object in the list
00772    // of folders. The returned string points to a static char array in TROOT.
00773    // If this function is called in a loop or recursively, it is the
00774    // user's responsability to copy this string in his area.
00775 
00776    Error("FindObjectPathName","Not yet implemented");
00777    return "??";
00778 }
00779 
00780 //______________________________________________________________________________
00781 static TClass *R__FindSTLClass(const char *name, Bool_t load, Bool_t silent, const char *outername)
00782 {
00783    // return a TClass object corresponding to 'name' assuming it is an STL container.
00784    // In particular we looking for possible alternative name (default template
00785    // parameter, typedefs template arguments, typedefed name).
00786 
00787    TClass *cl = 0;
00788 
00789    // We have not found the STL container yet.
00790    // First we are going to look for a similar name but different 'default' template
00791    // parameter (differences due to different STL implementation)
00792 
00793    string defaultname( TClassEdit::ShortType( name, TClassEdit::kDropStlDefault ) ) ;
00794 
00795    if (defaultname != name) {
00796       cl = (TClass*)gROOT->GetListOfClasses()->FindObject(defaultname.c_str());
00797       if (load && !cl) cl = gROOT->LoadClass(defaultname.c_str(), silent);
00798    }
00799 
00800    if (cl==0) {
00801 
00802       // now look for a typedef
00803       // well for now the typedefing in CINT has some issues
00804       // for examples if we generated the dictionary for
00805       //    set<string,someclass> then set<string> is typedef to it (instead of set<string,less<string> >)
00806 
00807       TDataType *objType = gROOT->GetType(name, load);
00808       if (objType) {
00809          const char *typedfName = objType->GetTypeName();
00810          if (typedfName) {
00811             string defaultTypedefName(TClassEdit::ShortType(typedfName, TClassEdit::kDropStlDefault));
00812 
00813             if (strcmp(typedfName, name) && defaultTypedefName == name) {
00814                cl = (TClass*)gROOT->GetListOfClasses()->FindObject(typedfName);
00815                if (load && !cl) cl = gROOT->LoadClass(typedfName, silent);
00816             }
00817          }
00818       }
00819    }
00820    if (cl==0) {
00821       // Try the alternate name where all the typedefs are resolved:
00822 
00823       const char *altname = gInterpreter->GetInterpreterTypeName(name);
00824       if (altname && strcmp(altname,name)!=0 && strcmp(altname,outername)!=0) {
00825          cl = TClass::GetClass(altname,load,silent);
00826       }
00827    }
00828    if (cl==0) {
00829       // Try with Long64_t instead of long long
00830       string long64name = TClassEdit::GetLong64_Name( name );
00831       if ( long64name != name && long64name != outername ) return R__FindSTLClass( long64name.c_str(), load, silent, outername);
00832    }
00833    if (cl == 0) {
00834       TString resolvedName = TClassEdit::ResolveTypedef(name,kFALSE).c_str();
00835       if (resolvedName != name && resolvedName != outername) cl = TClass::GetClass(resolvedName,load,silent);
00836    }
00837    if (cl == 0 && (strncmp(name,"std::",5)==0)) {
00838       // CINT sometime ignores the std namespace for stl containers,
00839       // so let's try without it.
00840       if (strlen(name+5)) cl = TClass::GetClass(name+5,load,silent);
00841    }
00842 
00843    if (load && cl==0) {
00844       // Create an Emulated class for this container.
00845       cl = new TClass(defaultname.c_str(), TClass::GetClass("TVirtualStreamerInfo")->GetClassVersion(), 0, 0, -1, -1, silent );
00846       cl->SetBit(TClass::kIsEmulation);
00847    }
00848 
00849    return cl;
00850 }
00851 
00852 //______________________________________________________________________________
00853 TClass *TROOT::FindSTLClass(const char *name, Bool_t load, Bool_t silent) const
00854 {
00855    // return a TClass object corresponding to 'name' assuming it is an STL container.
00856    // In particular we looking for possible alternative name (default template
00857    // parameter, typedefs template arguments, typedefed name).
00858 
00859    return R__FindSTLClass(name,load,silent,name);
00860 }
00861 
00862 //______________________________________________________________________________
00863 TClass *TROOT::GetClass(const char *name, Bool_t load, Bool_t silent) const
00864 {
00865    // Return pointer to class with name. Obsolete, use TClass::GetClass directly
00866 
00867    return TClass::GetClass(name,load,silent);
00868 }
00869 
00870 
00871 //______________________________________________________________________________
00872 TClass *TROOT::GetClass(const type_info& typeinfo, Bool_t load, Bool_t silent) const
00873 {
00874    // Return pointer to class from its name. Obsolete, use TClass::GetClass directly
00875    // See TClass::GetClass
00876 
00877    return TClass::GetClass(typeinfo,load,silent);
00878 }
00879 
00880 //______________________________________________________________________________
00881 TColor *TROOT::GetColor(Int_t color) const
00882 {
00883    // Return address of color with index color.
00884 
00885    TColor::InitializeColors();
00886    TObjArray *lcolors = (TObjArray*) GetListOfColors();
00887    if (color < 0 || color >= lcolors->GetSize()) return 0;
00888    TColor *col = (TColor*)lcolors->At(color);
00889    if (col && col->GetNumber() == color) return col;
00890    TIter   next(lcolors);
00891    while ((col = (TColor *) next()))
00892       if (col->GetNumber() == color) return col;
00893 
00894    return 0;
00895 }
00896 
00897 //______________________________________________________________________________
00898 TCanvas *TROOT::MakeDefCanvas() const
00899 {
00900    // Return a default canvas.
00901 
00902    return (TCanvas*)gROOT->ProcessLine("TCanvas::MakeDefCanvas();");
00903 }
00904 
00905 //______________________________________________________________________________
00906 TDataType *TROOT::GetType(const char *name, Bool_t load) const
00907 {
00908    // Return pointer to type with name.
00909 
00910    const char *tname = name + strspn(name," ");
00911    if (!strncmp(tname,"virtual",7)) {
00912       tname += 7; tname += strspn(tname," ");
00913    }
00914    if (!strncmp(tname,"const",5)) {
00915       tname += 5; tname += strspn(tname," ");
00916    }
00917    size_t nch = strlen(tname);
00918    while (tname[nch-1] == ' ') nch--;
00919 
00920    // First try without loading.  We can do that because nothing is
00921    // ever removed from the list of types. (See TCint::UpdateListOfTypes).
00922    TDataType* type = (TDataType*)gROOT->GetListOfTypes(kFALSE)->FindObject(name);
00923    if (type || !load)
00924       return type;
00925    else
00926       return (TDataType*)gROOT->GetListOfTypes(load)->FindObject(name);
00927 }
00928 
00929 //______________________________________________________________________________
00930 TFile *TROOT::GetFile(const char *name) const
00931 {
00932    // Return pointer to file with name.
00933 
00934    return (TFile*)GetListOfFiles()->FindObject(name);
00935 }
00936 
00937 //______________________________________________________________________________
00938 TStyle *TROOT::GetStyle(const char *name) const
00939 {
00940    // Return pointer to style with name
00941 
00942    return (TStyle*)GetListOfStyles()->FindObject(name);
00943 }
00944 
00945 //______________________________________________________________________________
00946 TObject *TROOT::GetFunction(const char *name) const
00947 {
00948    // Return pointer to function with name.
00949 
00950    if (name == 0 || name[0] == 0) {
00951       return 0;
00952    }
00953 
00954    TObject *f1 = fFunctions->FindObject(name);
00955    if (f1) return f1;
00956 
00957    gROOT->ProcessLine("TF1::InitStandardFunctions();");
00958 
00959    return fFunctions->FindObject(name);
00960 }
00961 
00962 //______________________________________________________________________________
00963 TGlobal *TROOT::GetGlobal(const char *name, Bool_t load) const
00964 {
00965    // Return pointer to global variable by name. If load is true force
00966    // reading of all currently defined globals from CINT (more expensive).
00967 
00968    return (TGlobal *)gROOT->GetListOfGlobals(load)->FindObject(name);
00969 }
00970 
00971 //______________________________________________________________________________
00972 TGlobal *TROOT::GetGlobal(const TObject *addr, Bool_t load) const
00973 {
00974    // Return pointer to global variable with address addr. If load is true
00975    // force reading of all currently defined globals from CINT (more
00976    // expensive).
00977 
00978    TIter next(gROOT->GetListOfGlobals(load));
00979 
00980    TGlobal *g;
00981    while ((g = (TGlobal*) next())) {
00982       const char *t = g->GetFullTypeName();
00983       if (!strncmp(t, "class", 5) || !strncmp(t, "struct", 6)) {
00984          int ptr = 0;
00985          if (t[strlen(t)-1] == '*') ptr = 1;
00986          if (ptr) {
00987             if (*(Long_t *)g->GetAddress() == (Long_t)addr) return g;
00988          } else {
00989             if ((Long_t)g->GetAddress() == (Long_t)addr) return g;
00990          }
00991       }
00992    }
00993    return 0;
00994 }
00995 
00996 //______________________________________________________________________________
00997 TFunction *TROOT::GetGlobalFunction(const char *function, const char *params,
00998                                     Bool_t load)
00999 {
01000    // Return pointer to global function by name. If params != 0
01001    // it will also resolve overloading. If load is true force reading
01002    // of all currently defined global functions from CINT (more expensive).
01003    // The param string must be of the form: "3189,\"aap\",1.3".
01004 
01005    if (!params)
01006       return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
01007    else {
01008       if (!fInterpreter)
01009          Fatal("GetGlobalFunction", "fInterpreter not initialized");
01010 
01011       TFunction *f;
01012       TIter      next(GetListOfGlobalFunctions(load));
01013 
01014       TString mangled = gInterpreter->GetMangledName(0, function, params);
01015       while ((f = (TFunction *) next())) {
01016          if (mangled == f->GetMangledName()) return f;
01017       }
01018 
01019       return 0;
01020    }
01021 }
01022 
01023 //______________________________________________________________________________
01024 TFunction *TROOT::GetGlobalFunctionWithPrototype(const char *function,
01025                                                const char *proto, Bool_t load)
01026 {
01027    // Return pointer to global function by name. If proto != 0
01028    // it will also resolve overloading. If load is true force reading
01029    // of all currently defined global functions from CINT (more expensive).
01030    // The proto string must be of the form: "int, char*, float".
01031 
01032    if (!proto)
01033       return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
01034    else {
01035       if (!fInterpreter)
01036          Fatal("GetGlobalFunctionWithPrototype", "fInterpreter not initialized");
01037 
01038       TFunction *f;
01039       TIter      next(GetListOfGlobalFunctions(load));
01040 
01041       TString mangled = gInterpreter->GetMangledNameWithPrototype(0,
01042                                                                      function,
01043                                                                      proto);
01044       while ((f = (TFunction *) next())) {
01045          if (mangled == f->GetMangledName()) return f;
01046       }
01047       return 0;
01048    }
01049 }
01050 
01051 //______________________________________________________________________________
01052 TObject *TROOT::GetGeometry(const char *name) const
01053 {
01054    // Return pointer to Geometry with name
01055 
01056    return GetListOfGeometries()->FindObject(name);
01057 }
01058 
01059 //______________________________________________________________________________
01060 TCollection *TROOT::GetListOfGlobals(Bool_t load)
01061 {
01062    // Return list containing the TGlobals currently defined.
01063    // Since globals are created and deleted during execution of the
01064    // program, we need to update the list of globals every time we
01065    // execute this method. However, when calling this function in
01066    // a (tight) loop where no interpreter symbols will be created
01067    // you can set load=kFALSE (default).
01068 
01069    if (!fGlobals) {
01070       fGlobals = new THashTable(100, 3);
01071       load = kTRUE;
01072    }
01073 
01074    if (!fInterpreter)
01075       Fatal("GetListOfGlobals", "fInterpreter not initialized");
01076 
01077    if (load)
01078       gInterpreter->UpdateListOfGlobals();
01079 
01080    return fGlobals;
01081 }
01082 
01083 //______________________________________________________________________________
01084 TCollection *TROOT::GetListOfGlobalFunctions(Bool_t load)
01085 {
01086    // Return list containing the TFunctions currently defined.
01087    // Since functions are created and deleted during execution of the
01088    // program, we need to update the list of functions every time we
01089    // execute this method. However, when calling this function in
01090    // a (tight) loop where no interpreter symbols will be created
01091    // you can set load=kFALSE (default).
01092 
01093    if (!fGlobalFunctions) {
01094       fGlobalFunctions = new THashTable(100, 3);
01095       load = kTRUE;
01096    }
01097 
01098    if (!fInterpreter)
01099       Fatal("GetListOfGlobalFunctions", "fInterpreter not initialized");
01100 
01101    if (load)
01102       gInterpreter->UpdateListOfGlobalFunctions();
01103 
01104    return fGlobalFunctions;
01105 }
01106 
01107 //______________________________________________________________________________
01108 TCollection *TROOT::GetListOfTypes(Bool_t load)
01109 {
01110    // Return list containing all TDataTypes (typedefs) currently defined.
01111    // Since types can be added and removed during execution of the
01112    // program, we need to update the list of types every time we
01113    // execute this method. However, when calling this function in
01114    // a (tight) loop where no new types will be created
01115    // you can set load=kFALSE (default).
01116 
01117    if (!fTypes) {
01118       fTypes = new THashTable(100, 3);
01119       load = kTRUE;
01120 
01121       // Add also basic types (like a identity typedef "typedef int int")
01122       fTypes->Add(new TDataType("char"));
01123       fTypes->Add(new TDataType("unsigned char"));
01124       fTypes->Add(new TDataType("short"));
01125       fTypes->Add(new TDataType("unsigned short"));
01126       fTypes->Add(new TDataType("int"));
01127       fTypes->Add(new TDataType("unsigned int"));
01128       fTypes->Add(new TDataType("unsigned"));
01129       fTypes->Add(new TDataType("long"));
01130       fTypes->Add(new TDataType("unsigned long"));
01131       fTypes->Add(new TDataType("long long"));
01132       fTypes->Add(new TDataType("unsigned long long"));
01133       fTypes->Add(new TDataType("float"));
01134       fTypes->Add(new TDataType("double"));
01135       fTypes->Add(new TDataType("void"));
01136       fTypes->Add(new TDataType("bool"));
01137       fTypes->Add(new TDataType("char*"));
01138    }
01139 
01140    if (!fInterpreter)
01141       Fatal("GetListOfTypes", "fInterpreter not initialized");
01142 
01143    if (load) {
01144 ///      printf("calling Update ListOfTypes\n");
01145       gInterpreter->UpdateListOfTypes();
01146 ///      printf("after calling Update ListOfTypes\n");
01147    }
01148 
01149    return fTypes;
01150 }
01151 
01152 
01153 //______________________________________________________________________________
01154 void TROOT::Idle(UInt_t idleTimeInSec, const char *command)
01155 {
01156    // Execute command when system has been idle for idleTimeInSec seconds.
01157 
01158    if (!fApplication)
01159       TApplication::CreateApplication();
01160 
01161    if (idleTimeInSec <= 0)
01162       fApplication->RemoveIdleTimer();
01163    else
01164       fApplication->SetIdleTimer(idleTimeInSec, command);
01165 }
01166 
01167 //______________________________________________________________________________
01168 Int_t TROOT::IgnoreInclude(const char *fname, const char * /*expandedfname*/)
01169 {
01170    // Return 1 if the given include file correspond to a class that has
01171    // been loaded through a compiled dictionnary.
01172 
01173    if (fname == 0) return 0;
01174 
01175    TString stem(fname);
01176    // Remove extension if any, ignore files with extension not being .h*
01177    Int_t where = stem.Last('.');
01178    if (where != kNPOS) {
01179       if (stem.EndsWith(".so") || stem.EndsWith(".sl") ||
01180           stem.EndsWith(".dl") || stem.EndsWith(".a")  ||
01181           stem.EndsWith(".dll", TString::kIgnoreCase))
01182          return 0;
01183       stem.Remove(where);
01184    }
01185 
01186    TString className = gSystem->BaseName(stem);
01187    TClass *cla = TClass::GetClass(className);
01188 
01189    if (!cla) {
01190       className = stem;
01191       className.ReplaceAll("/", "::");
01192       className.ReplaceAll("\\", "::");
01193       if (className.Contains(":::")) {
01194          // "C:\dir" becomes "C:::dir".
01195          // fname corresponds to whatever is stated after #include and
01196          // a full path name usually means that it's not a regular #include
01197          // but e.g. a ".L", so we can assume that this is not a header of
01198          // a class in a namespace (a global-namespace class would have been
01199          // detected already before).
01200          return 0;
01201       }
01202       cla = TClass::GetClass(className);
01203    }
01204    if ( cla ) {
01205       if (cla->GetDeclFileLine() <= 0) return 0; // to a void an error with VisualC++
01206       TString decfile = gSystem->BaseName(cla->GetDeclFileName());
01207       if (decfile == gSystem->BaseName(fname)) {
01208          return 1;
01209       }
01210    }
01211    return 0;
01212 }
01213 
01214 //______________________________________________________________________________
01215 void TROOT::InitSystem()
01216 {
01217    // Initialize operating system interface.
01218 
01219    if (gSystem == 0) {
01220 #if defined(R__UNIX)
01221       gSystem = new TUnixSystem;
01222 #elif defined(R__WIN32)
01223       gSystem = new TWinNTSystem;
01224 #else
01225       gSystem = new TSystem;
01226 #endif
01227 
01228       if (gSystem->Init())
01229          fprintf(stderr, "Fatal in <TROOT::InitSystem>: can't init operating system layer\n");
01230 
01231       if (!gSystem->HomeDirectory())
01232          fprintf(stderr, "Fatal in <TROOT::InitSystem>: HOME directory not set\n");
01233 
01234       // read default files
01235       gEnv = new TEnv(".rootrc");
01236 
01237       gDebug = gEnv->GetValue("Root.Debug", 0);
01238 
01239       //By default the zipmode is 1 (see Bits.h)
01240       Int_t zipmode = gEnv->GetValue("Root.ZipMode",1);
01241       if (zipmode !=1) R__SetZipMode(zipmode);
01242 
01243       const char *sdeb;
01244       if ((sdeb = gSystem->Getenv("ROOTDEBUG")))
01245          gDebug = atoi(sdeb);
01246 
01247       if (gDebug > 0 && isatty(2))
01248          fprintf(stderr, "Info in <TROOT::InitSystem>: running with gDebug = %d\n", gDebug);
01249 
01250       if (gEnv->GetValue("Root.MemStat", 0))
01251          TStorage::EnableStatistics();
01252       int msize = gEnv->GetValue("Root.MemStat.size", -1);
01253       int mcnt  = gEnv->GetValue("Root.MemStat.cnt", -1);
01254       if (msize != -1 || mcnt != -1)
01255          TStorage::EnableStatistics(msize, mcnt);
01256 
01257       fgMemCheck = gEnv->GetValue("Root.MemCheck", 0);
01258 
01259       TObject::SetObjectStat(gEnv->GetValue("Root.ObjectStat", 0));
01260 
01261    }
01262 }
01263 
01264 //______________________________________________________________________________
01265 void TROOT::InitThreads()
01266 {
01267    // Load and initialize thread library.
01268 
01269    if (gEnv->GetValue("Root.UseThreads", 0)) {
01270       char *path;
01271       if ((path = gSystem->DynamicPathName("libThread", kTRUE))) {
01272          delete [] path;
01273          LoadClass("TThread", "Thread");
01274       }
01275    }
01276 }
01277 
01278 //______________________________________________________________________________
01279 TClass *TROOT::LoadClass(const char *requestedname, Bool_t silent) const
01280 {
01281    // Helper function used by TClass::GetClass().
01282    // This function attempts to load the dictionary for 'classname'
01283    // either from the TClassTable or from the list of generator.
01284    // If silent is 'true', do not warn about missing dictionary for the class.
01285    // (typically used for class that are used only for transient members)
01286 
01287    // This function does not (and should not) attempt to check in the
01288    // list of loaded classes or in the typedef.
01289 
01290 
01291    // We need to cache the requested name as in some case this function is
01292    // called with gROOT->LoadClass(cl->GetName()) and the loading of a library,
01293    // for example via the autoloader, can result in our argument becoming invalid.
01294    // In addition the call to the dictionary function (dict()) might also have
01295    // the same effect (change/delete requestedname).
01296    TString classname(requestedname);
01297 
01298    VoidFuncPtr_t dict = TClassTable::GetDict(classname);
01299 
01300    TString resolved;
01301 
01302    if (!dict) {
01303       // Try to remove the ROOT typedefs
01304       resolved = TClassEdit::ResolveTypedef(classname,kTRUE);
01305       if (resolved != classname) {
01306          dict = TClassTable::GetDict(resolved.Data());
01307       } else {
01308          resolved.Clear();
01309       }
01310    }
01311    if (!dict) {
01312       if (gInterpreter->AutoLoad(classname)) {
01313          dict = TClassTable::GetDict(classname);
01314          if (!dict) {
01315             // Try the typedefs again.
01316             if (resolved.Length()) {
01317                dict = TClassTable::GetDict(resolved.Data());
01318             }
01319          }
01320       }
01321    }
01322 
01323    if (dict) {
01324       (dict)();
01325       TClass *ncl = TClass::GetClass(classname, kFALSE, silent);
01326       if (ncl) ncl->PostLoadCheck();
01327       return ncl;
01328    }
01329 
01330    TIter next(fClassGenerators);
01331    TClassGenerator *gen;
01332    while ((gen = (TClassGenerator*) next())) {
01333       TClass *cl = gen->GetClass(classname, kTRUE, silent);
01334       if (cl) {
01335          cl->PostLoadCheck();
01336          return cl;
01337       }
01338    }
01339    return 0;
01340 }
01341 
01342 //______________________________________________________________________________
01343 Int_t TROOT::LoadClass(const char * /*classname*/, const char *libname,
01344                        Bool_t check)
01345 {
01346    // Check if class "classname" is known to the interpreter (in fact,
01347    // this check is not needed anymore, so classname is ignored). If
01348    // not it will load library "libname". If the library name does
01349    // not start with "lib", "lib" will be prepended and a search will
01350    // be made in the DynamicPath (see .rootrc). If not found a search
01351    // will be made on libname (without "lib" prepended) and if not found
01352    // a direct try of libname will be made (in case it contained an
01353    // absolute path).
01354    // If check is true it will only check if libname exists and is
01355    // readable.
01356    // Returns 0 on successful loading, -1 in case libname does not
01357    // exist or in case of error and -2 in case of version mismatch.
01358 
01359    Int_t err = -1;
01360 
01361    char *path;
01362    TString lib = libname;
01363    if (!lib.BeginsWith("lib"))
01364       lib = "lib" + lib;
01365    if ((path = gSystem->DynamicPathName(lib, kTRUE))) {
01366       if (check)
01367          err = 0;
01368       else {
01369          err = gSystem->Load(path, 0, kTRUE);
01370       }
01371       delete [] path;
01372    } else {
01373       if (check) {
01374          FileStat_t stat;
01375          if (!gSystem->GetPathInfo(libname, stat)) {
01376             if (R_ISREG(stat.fMode) &&
01377                 !gSystem->AccessPathName(libname, kReadPermission))
01378                err = 0;
01379             else
01380                err = -1;
01381          } else
01382             err = -1;
01383       } else {
01384          err = gSystem->Load(libname, 0, kTRUE);
01385       }
01386    }
01387 
01388    if (err == 0 && !check) {
01389       GetListOfTypes(kTRUE);
01390    }
01391 
01392    if (err == -1) {
01393       //Error("LoadClass", "library %s could not be loaded", libname);
01394    }
01395 
01396    if (err == 1) {
01397       //Error("LoadClass", "library %s already loaded, but class %s unknown",
01398       //      libname, classname);
01399       err = 0;
01400    }
01401 
01402    return err;
01403 }
01404 
01405 //______________________________________________________________________________
01406 void TROOT::ls(Option_t *option) const
01407 {
01408    // To list all objects of the application.
01409    // Loop on all objects created in the ROOT linked lists.
01410    // Objects may be files and windows or any other object directly
01411    // attached to the ROOT linked list.
01412 
01413 //   TObject::SetDirLevel();
01414 //   GetList()->R__FOR_EACH(TObject,ls)(option);
01415    TDirectory::ls(option);
01416 }
01417 
01418 //______________________________________________________________________________
01419 Int_t TROOT::LoadMacro(const char *filename, int *error, Bool_t check)
01420 {
01421    // Load a macro in the interpreter's memory. Equivalent to the command line
01422    // command ".L filename". If the filename has "+" or "++" appended
01423    // the macro will be compiled by ACLiC. The filename must have the format:
01424    // [path/]macro.C[+|++[g|O]].
01425    // The possible error codes are defined by TInterpreter::EErrorCode.
01426    // If check is true it will only check if filename exists and is
01427    // readable.
01428    // Returns 0 on successful loading and -1 in case filename does not
01429    // exist or in case of error.
01430 
01431    Int_t err = -1;
01432    Int_t lerr, *terr;
01433    if (error)
01434       terr = error;
01435    else
01436       terr = &lerr;
01437 
01438    if (fInterpreter) {
01439       TString aclicMode;
01440       TString arguments;
01441       TString io;
01442       TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
01443 
01444       if (arguments.Length()) {
01445          Warning("LoadMacro", "argument(%s) ignored in %s", arguments.Data(), GetMacroPath());
01446       }
01447       char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
01448       if (!mac) {
01449          if (!check)
01450             Error("LoadMacro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
01451          *terr = TInterpreter::kFatal;
01452       } else {
01453          err = 0;
01454          if (!check) {
01455             fname = mac;
01456             fname += aclicMode;
01457             fname += io;
01458             gInterpreter->LoadMacro(fname.Data(), (TInterpreter::EErrorCode*)terr);
01459             if (*terr)
01460                err = -1;
01461             //else   // maybe not needed (RDM)
01462             //   GetListOfTypes(kTRUE);
01463          }
01464       }
01465       delete [] mac;
01466    }
01467    return err;
01468 }
01469 
01470 //______________________________________________________________________________
01471 Long_t TROOT::Macro(const char *filename, Int_t *error, Bool_t padUpdate)
01472 {
01473    // Execute a macro in the interpreter. Equivalent to the command line
01474    // command ".x filename". If the filename has "+" or "++" appended
01475    // the macro will be compiled by ACLiC. The filename must have the format:
01476    // [path/]macro.C[+|++[g|O]][(args)].
01477    // The possible error codes are defined by TInterpreter::EErrorCode.
01478    // If padUpdate is true (default) update the current pad.
01479    // Returns the macro return value.
01480 
01481    Long_t result = 0;
01482 
01483    if (fInterpreter) {
01484       TString aclicMode;
01485       TString arguments;
01486       TString io;
01487       TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
01488 
01489       char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
01490       if (!mac) {
01491          Error("Macro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
01492          if (error)
01493             *error = TInterpreter::kFatal;
01494       } else {
01495          fname = mac;
01496          fname += aclicMode;
01497          fname += arguments;
01498          fname += io;
01499          result = gInterpreter->ExecuteMacro(fname, (TInterpreter::EErrorCode*)error);
01500       }
01501       delete [] mac;
01502 
01503       if (padUpdate && gPad)
01504          gPad->Update();
01505    }
01506 
01507    return result;
01508 }
01509 
01510 //______________________________________________________________________________
01511 void  TROOT::Message(Int_t id, const TObject *obj)
01512 {
01513    // Process message id called by obj.
01514 
01515    TIter next(fMessageHandlers);
01516    TMessageHandler *mh;
01517    while ((mh = (TMessageHandler*)next())) {
01518       mh->HandleMessage(id,obj);
01519    }
01520 }
01521 
01522 //______________________________________________________________________________
01523 Long_t TROOT::ProcessLine(const char *line, Int_t *error)
01524 {
01525    // Process interpreter command via TApplication::ProcessLine().
01526    // On Win32 the line will be processed asynchronously by sending
01527    // it to the CINT interpreter thread. For explicit synchronous processing
01528    // use ProcessLineSync(). On non-Win32 platforms there is no difference
01529    // between ProcessLine() and ProcessLineSync().
01530    // The possible error codes are defined by TInterpreter::EErrorCode. In
01531    // particular, error will equal to TInterpreter::kProcessing until the
01532    // CINT interpreted thread has finished executing the line.
01533    // Returns the result of the command, cast to a Long_t.
01534 
01535    TString sline = line;
01536    sline = sline.Strip(TString::kBoth);
01537 
01538    if (!fApplication)
01539       TApplication::CreateApplication();
01540 
01541    return fApplication->ProcessLine(sline, kFALSE, error);
01542 }
01543 
01544 //______________________________________________________________________________
01545 Long_t TROOT::ProcessLineSync(const char *line, Int_t *error)
01546 {
01547    // Process interpreter command via TApplication::ProcessLine().
01548    // On Win32 the line will be processed synchronously (i.e. it will
01549    // only return when the CINT interpreter thread has finished executing
01550    // the line). On non-Win32 platforms there is no difference between
01551    // ProcessLine() and ProcessLineSync().
01552    // The possible error codes are defined by TInterpreter::EErrorCode.
01553    // Returns the result of the command, cast to a Long_t.
01554 
01555    TString sline = line;
01556    sline = sline.Strip(TString::kBoth);
01557 
01558    if (!fApplication)
01559       TApplication::CreateApplication();
01560 
01561    return fApplication->ProcessLine(sline, kTRUE, error);
01562 }
01563 
01564 //______________________________________________________________________________
01565 Long_t TROOT::ProcessLineFast(const char *line, Int_t *error)
01566 {
01567    // Process interpreter command directly via CINT interpreter.
01568    // Only executable statements are allowed (no variable declarations),
01569    // In all other cases use TROOT::ProcessLine().
01570    // The possible error codes are defined by TInterpreter::EErrorCode.
01571 
01572    TString sline = line;
01573    sline = sline.Strip(TString::kBoth);
01574 
01575    if (!fApplication)
01576       TApplication::CreateApplication();
01577 
01578    Long_t result = 0;
01579 
01580    if (fInterpreter) {
01581       TInterpreter::EErrorCode *code = (TInterpreter::EErrorCode*)error;
01582       result = gInterpreter->Calc(sline, code);
01583    }
01584 
01585    return result;
01586 }
01587 
01588 //______________________________________________________________________________
01589 void TROOT::ReadSvnInfo()
01590 {
01591    // Read Subversion revision information and branch name from the
01592    // etc/svnrev.txt file.
01593 
01594    fSvnRevision = 0;
01595 #ifdef ROOT_SVN_REVISION
01596    fSvnRevision = ROOT_SVN_REVISION;
01597 #endif
01598 #ifdef ROOT_SVN_BRANCH
01599    fSvnBranch = ROOT_SVN_BRANCH;
01600 #endif
01601 
01602    TString svninfo = "svninfo.txt";
01603    char *filename = 0;
01604 #ifdef ROOTETCDIR
01605    filename = gSystem->ConcatFileName(ROOTETCDIR, svninfo);
01606 #else
01607    TString etc = gRootDir;
01608 #ifdef WIN32
01609    etc += "\\etc";
01610 #else
01611    etc += "/etc";
01612 #endif
01613 #if defined(R__MACOSX) && (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
01614    // on iOS etc does not exist and svninfo resides in $ROOTSYS
01615    etc = gRootDir;
01616 #endif
01617    filename = gSystem->ConcatFileName(etc, svninfo);
01618 #endif
01619 
01620    FILE *fp = fopen(filename, "r");
01621    if (fp) {
01622       TString s;
01623       // read branch name
01624       s.Gets(fp);
01625       fSvnBranch = s;
01626       // read revision number
01627       s.Gets(fp);
01628       Int_t r = s.Atoi();
01629       if (r > 0)
01630          fSvnRevision = r;
01631       // read date/time make was run
01632       s.Gets(fp);
01633       fSvnDate = s;
01634       fclose(fp);
01635    }
01636    delete [] filename;
01637 }
01638 
01639 //______________________________________________________________________________
01640 const char *TROOT::GetSvnDate()
01641 {
01642    // Return date/time make was run.
01643 
01644    if (fSvnDate == "") {
01645       Int_t iday,imonth,iyear, ihour, imin;
01646       static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
01647                                       "Jul", "Aug", "Sep", "Oct", "Nov", "De" };
01648       Int_t idate = gROOT->GetBuiltDate();
01649       Int_t itime = gROOT->GetBuiltTime();
01650       iday   = idate%100;
01651       imonth = (idate/100)%100;
01652       iyear  = idate/10000;
01653       ihour  = itime/100;
01654       imin   = itime%100;
01655       fSvnDate.Form("%s %02d %4d, %02d:%02d:00", months[imonth-1], iday, iyear, ihour, imin);
01656    }
01657    return fSvnDate;
01658 }
01659 
01660 //______________________________________________________________________________
01661 void TROOT::RefreshBrowsers()
01662 {
01663    // Refresh all browsers. Call this method when some command line
01664    // command or script has changed the browser contents. Not needed
01665    // for objects that have the kMustCleanup bit set. Most useful to
01666    // update browsers that show the file system or other objects external
01667    // to the running ROOT session.
01668 
01669    TIter next(GetListOfBrowsers());
01670    TBrowser *b;
01671    while ((b = (TBrowser*) next()))
01672       b->SetRefreshFlag(kTRUE);
01673 }
01674 
01675 //______________________________________________________________________________
01676 void TROOT::RemoveClass(TClass *oldcl)
01677 {
01678    // Remove a class from the list and map of classes
01679 
01680    //if (!oldcl) return;
01681    //GetListOfClasses()->Remove(oldcl);
01682    //if (oldcl->GetTypeInfo()) {
01683    //   fIdMap->Remove(oldcl->GetTypeInfo()->name());
01684    //}
01685    TClass::RemoveClass(oldcl);
01686 }
01687 
01688 //______________________________________________________________________________
01689 void TROOT::Reset(Option_t *option)
01690 {
01691    // Delete all global interpreter objects created since the last call to Reset
01692    //
01693    // If option="a" is set reset to startup context (i.e. unload also
01694    // all loaded files, classes, structs, typedefs, etc.).
01695    //
01696    // This function is typically used at the beginning (or end) of an unnamed macro
01697    // to clean the environment.
01698    //
01699    // IMPORTANT WARNING:
01700    // Do not use this call from within any function (neither compiled nor
01701    // interpreted.  This should only be used from a unnamed macro
01702    // (which starts with a { (curly braces)  ).  For example, using TROOT::Reset
01703    // from within an interpreted function will lead to the unloading of the
01704    // dictionary and source file, including the one defining the function being
01705    // executed.
01706    //
01707 
01708    if (IsExecutingMacro()) return;  //True when TMacro::Exec runs
01709    if (fInterpreter) {
01710       if (!strncmp(option, "a", 1)) {
01711          fInterpreter->Reset();
01712          fInterpreter->SaveContext();
01713       } else
01714          gInterpreter->ResetGlobals();
01715 
01716       if (fGlobals) fGlobals->Delete();
01717       if (fGlobalFunctions) fGlobalFunctions->Delete();
01718 
01719       SaveContext();
01720    }
01721 }
01722 
01723 //______________________________________________________________________________
01724 void TROOT::SaveContext()
01725 {
01726    // Save the current interpreter context.
01727 
01728    if (fInterpreter)
01729       gInterpreter->SaveGlobalsContext();
01730 }
01731 
01732 //______________________________________________________________________________
01733 void TROOT::SetCutClassName(const char *name)
01734 {
01735    // Set the default graphical cut class name for the graphics editor
01736    // By default the graphics editor creates an instance of a class TCutG.
01737    // This function may be called to specify a different class that MUST
01738    // derive from TCutG
01739 
01740    if (!name) {
01741       Error("SetCutClassName","Invalid class name");
01742       return;
01743    }
01744    TClass *cl = TClass::GetClass(name);
01745    if (!cl) {
01746       Error("SetCutClassName","Unknown class:%s",name);
01747       return;
01748    }
01749    if (!cl->InheritsFrom("TCutG")) {
01750       Error("SetCutClassName","Class:%s does not derive from TCutG",name);
01751       return;
01752    }
01753    fCutClassName = name;
01754 }
01755 
01756 //______________________________________________________________________________
01757 void TROOT::SetEditorMode(const char *mode)
01758 {
01759    // Set editor mode
01760 
01761    fEditorMode = 0;
01762    if (strlen(mode) == 0) return;
01763    if (!strcmp(mode,"Arc"))      {fEditorMode = kArc;        return;}
01764    if (!strcmp(mode,"Line"))     {fEditorMode = kLine;       return;}
01765    if (!strcmp(mode,"Arrow"))    {fEditorMode = kArrow;      return;}
01766    if (!strcmp(mode,"Button"))   {fEditorMode = kButton;     return;}
01767    if (!strcmp(mode,"Diamond"))  {fEditorMode = kDiamond;    return;}
01768    if (!strcmp(mode,"Ellipse"))  {fEditorMode = kEllipse;    return;}
01769    if (!strcmp(mode,"Pad"))      {fEditorMode = kPad;        return;}
01770    if (!strcmp(mode,"Pave"))     {fEditorMode = kPave;       return;}
01771    if (!strcmp(mode,"PaveLabel")){fEditorMode = kPaveLabel;  return;}
01772    if (!strcmp(mode,"PaveText")) {fEditorMode = kPaveText;   return;}
01773    if (!strcmp(mode,"PavesText")){fEditorMode = kPavesText;  return;}
01774    if (!strcmp(mode,"PolyLine")) {fEditorMode = kPolyLine;   return;}
01775    if (!strcmp(mode,"CurlyLine")){fEditorMode = kCurlyLine;  return;}
01776    if (!strcmp(mode,"CurlyArc")) {fEditorMode = kCurlyArc;   return;}
01777    if (!strcmp(mode,"Text"))     {fEditorMode = kText;       return;}
01778    if (!strcmp(mode,"Marker"))   {fEditorMode = kMarker;     return;}
01779    if (!strcmp(mode,"CutG"))     {fEditorMode = kCutG;       return;}
01780 }
01781 
01782 //______________________________________________________________________________
01783 void TROOT::SetStyle(const char *stylename)
01784 {
01785    // Change current style to style with name stylename
01786 
01787    TStyle *style = GetStyle(stylename);
01788    if (style) style->cd();
01789    else       Error("SetStyle","Unknown style:%s",stylename);
01790 }
01791 
01792 
01793 //-------- Static Member Functions ---------------------------------------------
01794 
01795 
01796 //______________________________________________________________________________
01797 Int_t TROOT::DecreaseDirLevel()
01798 {
01799    // Decrease the indentation level for ls().
01800    return --fgDirLevel;
01801 }
01802 
01803 //______________________________________________________________________________
01804 Int_t TROOT::GetDirLevel()
01805 {
01806    //return directory level
01807    return fgDirLevel;
01808 }
01809 
01810 //______________________________________________________________________________
01811 const char *TROOT::GetMacroPath()
01812 {
01813    // Get macro search path. Static utility function.
01814 
01815    TString &macroPath = ROOT::GetMacroPath();
01816 
01817    if (macroPath.Length() == 0) {
01818       macroPath = gEnv->GetValue("Root.MacroPath", (char*)0);
01819 #if defined(R__WIN32)
01820       macroPath.ReplaceAll("; ", ";");
01821 #else
01822       macroPath.ReplaceAll(": ", ":");
01823 #endif
01824       if (macroPath.Length() == 0)
01825 #if !defined(R__WIN32)
01826    #ifdef ROOTMACRODIR
01827          macroPath = ".:" ROOTMACRODIR;
01828    #else
01829          macroPath = TString(".:") + gRootDir + "/macros";
01830    #endif
01831 #else
01832    #ifdef ROOTMACRODIR
01833          macroPath = ".;" ROOTMACRODIR;
01834    #else
01835          macroPath = TString(".;") + gRootDir + "/macros";
01836    #endif
01837 #endif
01838    }
01839 
01840    return macroPath;
01841 }
01842 
01843 //______________________________________________________________________________
01844 void TROOT::SetMacroPath(const char *newpath)
01845 {
01846    // Set or extend the macro search path. Static utility function.
01847    // If newpath=0 or "" reset to value specified in the rootrc file.
01848 
01849    TString &macroPath = ROOT::GetMacroPath();
01850 
01851    if (!newpath || !*newpath)
01852       macroPath = "";
01853    else
01854       macroPath = newpath;
01855 }
01856 
01857 //______________________________________________________________________________
01858 Int_t TROOT::IncreaseDirLevel()
01859 {
01860    // Increase the indentation level for ls().
01861    return ++fgDirLevel;
01862 }
01863 
01864 //______________________________________________________________________________
01865 void TROOT::IndentLevel()
01866 {
01867    // Functions used by ls() to indent an object hierarchy.
01868 
01869    for (int i = 0; i < fgDirLevel; i++) cout.put(' ');
01870 }
01871 
01872 //______________________________________________________________________________
01873 Bool_t TROOT::Initialized()
01874 {
01875    // Return kTRUE if the TROOT object has been initialized.
01876    return fgRootInit;
01877 }
01878 
01879 //______________________________________________________________________________
01880 Bool_t TROOT::MemCheck()
01881 {
01882    // Return kTRUE if the memory leak checker is on.
01883    return fgMemCheck;
01884 }
01885 
01886 //______________________________________________________________________________
01887 void TROOT::SetDirLevel(Int_t level)
01888 {
01889    // Return Indentation level for ls().
01890    fgDirLevel = level;
01891 }
01892 
01893 //______________________________________________________________________________
01894 Int_t TROOT::ConvertVersionCode2Int(Int_t code)
01895 {
01896    // Convert version code to an integer, i.e. 331527 -> 51507.
01897 
01898    return 10000*(code>>16) + 100*((code&65280)>>8) + (code&255);
01899 }
01900 
01901 //______________________________________________________________________________
01902 Int_t TROOT::ConvertVersionInt2Code(Int_t v)
01903 {
01904    // Convert version as an integer to version code as used in RVersion.h.
01905 
01906    int a = v/10000;
01907    int b = (v - a*10000)/100;
01908    int c = v - a*10000 - b*100;
01909    return (a << 16) + (b << 8) + c;
01910 }
01911 
01912 //______________________________________________________________________________
01913 Int_t TROOT::RootVersionCode()
01914 {
01915    // Return ROOT version code as defined in RVersion.h.
01916 
01917    return ROOT_VERSION_CODE;
01918 }

Generated on Tue Jul 5 14:11:23 2011 for ROOT_528-00b_version by  doxygen 1.5.1