ROOT  6.06/04
Reference Guide
TROOT.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Rene Brun 08/12/94
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TROOT
13 ROOT top level object description.
14 
15  The TROOT object is the entry point to the ROOT system.
16  The single instance of TROOT is accessible via the global gROOT.
17  Using the gROOT pointer one has access to basically every object
18  created in a ROOT based program. The TROOT object is essentially a
19  container of several lists pointing to the main ROOT objects.
20 
21  The following lists are accessible from gROOT object:
22 
23 ~~~ {.cpp}
24  gROOT->GetListOfClasses
25  gROOT->GetListOfColors
26  gROOT->GetListOfTypes
27  gROOT->GetListOfGlobals
28  gROOT->GetListOfGlobalFunctions
29  gROOT->GetListOfFiles
30  gROOT->GetListOfMappedFiles
31  gROOT->GetListOfSockets
32  gROOT->GetListOfSecContexts
33  gROOT->GetListOfCanvases
34  gROOT->GetListOfStyles
35  gROOT->GetListOfFunctions
36  gROOT->GetListOfSpecials (for example graphical cuts)
37  gROOT->GetListOfGeometries
38  gROOT->GetListOfBrowsers
39  gROOT->GetListOfCleanups
40  gROOT->GetListOfMessageHandlers
41 ~~~
42 
43  The TROOT class provides also many useful services:
44  - Get pointer to an object in any of the lists above
45  - Time utilities TROOT::Time
46 
47  The ROOT object must be created as a static object. An example
48  of a main program creating an interactive version is shown below:
49 
50 ### Example of a main program
51 
52 ~~~ {.cpp}
53  #include "TRint.h"
54 
55  int main(int argc, char **argv)
56  {
57  TRint *theApp = new TRint("ROOT example", &argc, argv);
58 
59  // Init Intrinsics, build all windows, and enter event loop
60  theApp->Run();
61 
62  return(0);
63  }
64 ~~~
65 */
66 
67 #include "RConfig.h"
68 #include "RConfigure.h"
69 #include "RConfigOptions.h"
70 #include "RVersion.h"
71 #include "RGitCommit.h"
72 
73 #include <string>
74 #include <map>
75 #include <stdlib.h>
76 #ifdef WIN32
77 #include <io.h>
78 #include "Windows4Root.h"
79 #include <Psapi.h>
80 #define RTLD_DEFAULT ((void *)::GetModuleHandle(NULL))
81 #define dlsym(library, function_name) ::GetProcAddress((HMODULE)library, function_name)
82 #define dlopen(library_name, flags) ::LoadLibrary(library_name)
83 #define dlclose(library) ::FreeLibrary((HMODULE)library)
84 char *dlerror() {
85  static char Msg[1000];
86  FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
87  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), Msg,
88  sizeof(Msg), NULL);
89  return Msg;
90 }
91 #else
92 #include <dlfcn.h>
93 #endif
94 
95 #include "Riostream.h"
96 #include "Gtypes.h"
97 #include "TROOT.h"
98 #include "TClass.h"
99 #include "TClassEdit.h"
100 #include "TClassGenerator.h"
101 #include "TDataType.h"
102 #include "TDatime.h"
103 #include "TStyle.h"
104 #include "TObjectTable.h"
105 #include "TClassTable.h"
106 #include "TSystem.h"
107 #include "THashList.h"
108 #include "TObjArray.h"
109 #include "TEnv.h"
110 #include "TError.h"
111 #include "TColor.h"
112 #include "TGlobal.h"
113 #include "TFunction.h"
114 #include "TVirtualPad.h"
115 #include "TBrowser.h"
116 #include "TSystemDirectory.h"
117 #include "TApplication.h"
118 #include "TInterpreter.h"
119 #include "TGuiFactory.h"
120 #include "TMessageHandler.h"
121 #include "TFolder.h"
122 #include "TQObject.h"
123 #include "TProcessUUID.h"
124 #include "TPluginManager.h"
125 #include "TMap.h"
126 #include "TObjString.h"
127 #include "TVirtualMutex.h"
128 #include "TInterpreter.h"
129 #include "TListOfTypes.h"
130 #include "TListOfDataMembers.h"
131 #include "TListOfEnumsWithLock.h"
132 #include "TListOfFunctions.h"
134 #include "TFunctionTemplate.h"
135 #include "ThreadLocalStorage.h"
136 
137 #include <string>
138 namespace std {} using namespace std;
139 
140 #if defined(R__UNIX)
141 #if defined(R__HAS_COCOA)
142 #include "TMacOSXSystem.h"
143 #include "TUrl.h"
144 #else
145 #include "TUnixSystem.h"
146 #endif
147 #elif defined(R__WIN32)
148 #include "TWinNTSystem.h"
149 #endif
150 
151 extern "C" void R__SetZipMode(int);
152 
153 static DestroyInterpreter_t *gDestroyInterpreter = 0;
154 static void *gInterpreterLib = 0;
155 
156 // Mutex for protection of concurrent gROOT access
157 TVirtualMutex* gROOTMutex = 0;
158 
159 // For accessing TThread::Tsd indirectly.
160 void **(*gThreadTsd)(void*,Int_t) = 0;
161 
162 //-------- Names of next three routines are a small homage to CMZ --------------
163 ////////////////////////////////////////////////////////////////////////////////
164 /// Return version id as an integer, i.e. "2.22/04" -> 22204.
165 
166 static Int_t IVERSQ()
167 {
168  Int_t maj, min, cycle;
169  sscanf(ROOT_RELEASE, "%d.%d/%d", &maj, &min, &cycle);
170  return 10000*maj + 100*min + cycle;
171 }
172 
173 ////////////////////////////////////////////////////////////////////////////////
174 /// Return built date as integer, i.e. "Apr 28 2000" -> 20000428.
175 
176 static Int_t IDATQQ(const char *date)
177 {
178  static const char *months[] = {"Jan","Feb","Mar","Apr","May",
179  "Jun","Jul","Aug","Sep","Oct",
180  "Nov","Dec"};
181 
182  char sm[12];
183  Int_t yy, mm=0, dd;
184  sscanf(date, "%s %d %d", sm, &dd, &yy);
185  for (int i = 0; i < 12; i++)
186  if (!strncmp(sm, months[i], 3)) {
187  mm = i+1;
188  break;
189  }
190  return 10000*yy + 100*mm + dd;
191 }
192 
193 ////////////////////////////////////////////////////////////////////////////////
194 /// Return built time as integer (with min precision), i.e.
195 /// "17:32:37" -> 1732.
196 
197 static Int_t ITIMQQ(const char *time)
198 {
199  Int_t hh, mm, ss;
200  sscanf(time, "%d:%d:%d", &hh, &mm, &ss);
201  return 100*hh + mm;
202 }
203 
204 ////////////////////////////////////////////////////////////////////////////////
205 /// Clean up at program termination before global objects go out of scope.
206 
207 static void CleanUpROOTAtExit()
208 {
209  if (gROOT) {
210  R__LOCKGUARD(gROOTMutex);
211 
212  if (gROOT->GetListOfFiles())
213  gROOT->GetListOfFiles()->Delete("slow");
214  if (gROOT->GetListOfSockets())
215  gROOT->GetListOfSockets()->Delete();
216  if (gROOT->GetListOfMappedFiles())
217  gROOT->GetListOfMappedFiles()->Delete("slow");
218  if (gROOT->GetListOfClosedObjects())
219  gROOT->GetListOfClosedObjects()->Delete("slow");
220  }
221 }
222 
223 ////////////////////////////////////////////////////////////////////////////////
224 /// A module and its headers. Intentionally not a copy:
225 /// If these strings end up in this struct they are
226 /// long lived by definition because they get passed in
227 /// before initialization of TCling.
228 
229 namespace {
230  struct ModuleHeaderInfo_t {
231  ModuleHeaderInfo_t(const char* moduleName,
232  const char** headers,
233  const char** includePaths,
234  const char* payloadCode,
235  const char* fwdDeclCode,
236  void (*triggerFunc)(),
237  const TROOT::FwdDeclArgsToKeepCollection_t& fwdDeclsArgToSkip,
238  const char** classesHeaders):
239  fModuleName(moduleName),
240  fHeaders(headers),
241  fPayloadCode(payloadCode),
242  fFwdDeclCode(fwdDeclCode),
243  fIncludePaths(includePaths),
244  fTriggerFunc(triggerFunc),
245  fClassesHeaders(classesHeaders),
246  fFwdNargsToKeepColl(fwdDeclsArgToSkip){}
247 
248  const char* fModuleName; // module name
249  const char** fHeaders; // 0-terminated array of header files
250  const char* fPayloadCode; // Additional code to be given to cling at library load
251  const char* fFwdDeclCode; // Additional code to let cling know about selected classes and functions
252  const char** fIncludePaths; // 0-terminated array of header files
253  void (*fTriggerFunc)(); // Pointer to the dict initialization used to find the library name
254  const char** fClassesHeaders; // 0-terminated list of classes and related header files
255  const TROOT::FwdDeclArgsToKeepCollection_t fFwdNargsToKeepColl; // Collection of
256  // pairs of template fwd decls and number of
257  };
258 
259  std::vector<ModuleHeaderInfo_t>& GetModuleHeaderInfoBuffer() {
260  static std::vector<ModuleHeaderInfo_t> moduleHeaderInfoBuffer;
261  return moduleHeaderInfoBuffer;
262  }
263 }
264 
265 Int_t TROOT::fgDirLevel = 0;
266 Bool_t TROOT::fgRootInit = kFALSE;
267 Bool_t TROOT::fgMemCheck = kFALSE;
268 
269 static void at_exit_of_TROOT() {
270  if (ROOT::Internal::gROOTLocal)
271  ROOT::Internal::gROOTLocal->~TROOT();
272 }
273 
274 // This local static object initializes the ROOT system
275 namespace ROOT {
276 namespace Internal {
277  class TROOTAllocator {
278  // Simple wrapper to separate, time-wise, the call to the
279  // TROOT destructor and the actual free-ing of the memory.
280  //
281  // Since the interpreter implementation (currently TCling) is
282  // loaded via dlopen by libCore, the destruction of its global
283  // variable (i.e. in particular clang's) is scheduled before
284  // those in libCore so we need to schedule the call to the TROOT
285  // destructor before that *but* we want to make sure the memory
286  // stay around until libCore itself is unloaded so that code
287  // using gROOT can 'properly' check for validity.
288  //
289  // The order of loading for is:
290  // libCore.so
291  // libRint.so
292  // ... anything other library hard linked to the executable ...
293  // ... for example libEvent
294  // libCling.so
295  // ... other libraries like libTree for example ....
296  // and the destruction order is (of course) the reverse.
297  // By default the unloading of the dictionary, does use
298  // the service of the interpreter ... which of course
299  // fails if libCling is already unloaded by that information
300  // has not been registered per se.
301  //
302  // To solve this problem, we now schedule the destruction
303  // of the TROOT object to happen _just_ before the
304  // unloading/destruction of libCling so that we can
305  // maximize the amount of clean-up we can do correctly
306  // and we can still allocate the TROOT object's memory
307  // statically.
308  //
309  char fHolder[sizeof(TROOT)];
310  public:
311  TROOTAllocator() {
312  new(&(fHolder[0])) TROOT("root", "The ROOT of EVERYTHING");
313  }
314 
315  ~TROOTAllocator() {
316  if (gROOTLocal) {
317  gROOTLocal->~TROOT();
318  }
319  }
320  };
321 
322  // The global gROOT is defined to be a function (ROOT::GetROOT())
323  // which itself is dereferencing a function pointer.
324 
325  // Initially this function pointer's value is & GetROOT1 whose role is to
326  // create and initialize the TROOT object itself.
327  // At the very end of the TROOT constructor the value of the function pointer
328  // is switch to & GetROOT2 whose role is to initialize the interpreter.
329 
330  // This mechanism was primarily intended to fix the issues with order in which
331  // global TROOT and LLVM globals are initialized. TROOT was initializing
332  // Cling, but Cling could not be used yet due to LLVM globals not being
333  // initialized yet. The solution is to delay initializing the interpreter in
334  // TROOT till after main() when all LLVM globals are initialized.
335 
336  // Technically, the mechanism used actually delay the interpreter
337  // initialization until the first use of gROOT *after* the end of the
338  // TROOT constructor.
339 
340  // So to delay until after the start of main, we also made sure that none
341  // of the ROOT code (mostly the dictionary code) used during library loading
342  // is using gROOT (directly or indirectly).
343 
344  // In practice, the initialization of the interpreter is now delayed until
345  // the first use gROOT (or gInterpreter) after the start of main (but user
346  // could easily break this by using gROOT in their library initialization
347  // code).
348 
349  extern TROOT *gROOTLocal;
350 
352  if (gROOTLocal)
353  return gROOTLocal;
354  static TROOTAllocator alloc;
355  return gROOTLocal;
356  }
357 
359  static Bool_t initInterpreter = kFALSE;
360  if (!initInterpreter) {
361  initInterpreter = kTRUE;
362  gROOTLocal->InitInterpreter();
363  // Load and init threads library
364  gROOTLocal->InitThreads();
365  }
366  return gROOTLocal;
367  }
368  typedef TROOT *(*GetROOTFun_t)();
369 
371 
372 } // end of Internal sub namespace
373 // back to ROOT namespace
374 
376  return (*Internal::gGetROOT)();
377  }
378 
380  static TString macroPath;
381  return macroPath;
382  }
383 
384  ////////////////////////////////////////////////////////////////////////////////
385  /// Enables the global mutex to make ROOT thread safe/aware.
387  {
388  static void (*tthreadInitialize)() = nullptr;
389 
390  if (!tthreadInitialize) {
391  const static auto loadSuccess = -1 != gSystem->Load("libThread");
392  if (loadSuccess) {
393  if (auto sym = dlsym(RTLD_DEFAULT,"ROOT_TThread_Initialize")) {
394  tthreadInitialize = (void(*)()) sym;
395  tthreadInitialize();
396  } else {
397  Error("EnableThreadSafety","Cannot initialize multithreading support.");
398  }
399  } else {
400  Error("EnableThreadSafety","Cannot load Thread library.");
401  }
402  }
403  }
404 
405 }
406 
407 TROOT *ROOT::Internal::gROOTLocal = ROOT::GetROOT();
408 
409 // Global debug flag (set to > 0 to get debug output).
410 // Can be set either via the interpreter (gDebug is exported to CINT),
411 // via the rootrc resource "Root.Debug", via the shell environment variable
412 // ROOTDEBUG, or via the debugger.
414 
415 
417 
418 ////////////////////////////////////////////////////////////////////////////////
419 /// Default ctor.
420 
422  fLineIsProcessing(0), fVersion(0), fVersionInt(0), fVersionCode(0),
423  fVersionDate(0), fVersionTime(0), fBuiltDate(0), fBuiltTime(0),
424  fTimer(0), fApplication(0), fInterpreter(0), fBatch(kTRUE), fEditHistograms(kTRUE),
425  fFromPopUp(kTRUE),fMustClean(kTRUE),fReadingObject(kFALSE),fForceStyle(kFALSE),
426  fInterrupt(kFALSE),fEscape(kFALSE),fExecutingMacro(kFALSE),fEditorMode(0),
427  fPrimitive(0),fSelectPad(0),fClasses(0),fTypes(0),fGlobals(0),fGlobalFunctions(0),
428  fClosedObjects(0),fFiles(0),fMappedFiles(0),fSockets(0),fCanvases(0),fStyles(0),fFunctions(0),
429  fTasks(0),fColors(0),fGeometries(0),fBrowsers(0),fSpecials(0),fCleanups(0),
430  fMessageHandlers(0),fStreamerInfo(0),fClassGenerators(0),fSecContexts(0),
431  fProofs(0),fClipboard(0),fDataSets(0),fUUIDs(0),fRootFolder(0),fBrowsables(0),
432  fPluginManager(0)
433 {
434 }
435 
436 ////////////////////////////////////////////////////////////////////////////////
437 /// Initialize the ROOT system. The creation of the TROOT object initializes
438 /// the ROOT system. It must be the first ROOT related action that is
439 /// performed by a program. The TROOT object must be created on the stack
440 /// (can not be called via new since "operator new" is protected). The
441 /// TROOT object is either created as a global object (outside the main()
442 /// program), or it is one of the first objects created in main().
443 /// Make sure that the TROOT object stays in scope for as long as ROOT
444 /// related actions are performed. TROOT is a so called singleton so
445 /// only one instance of it can be created. The single TROOT object can
446 /// always be accessed via the global pointer gROOT.
447 /// The name and title arguments can be used to identify the running
448 /// application. The initfunc argument can contain an array of
449 /// function pointers (last element must be 0). These functions are
450 /// executed at the end of the constructor. This way one can easily
451 /// extend the ROOT system without adding permanent dependencies
452 /// (e.g. the graphics system is initialized via such a function).
453 
454 TROOT::TROOT(const char *name, const char *title, VoidFuncPtr_t *initfunc)
455  : TDirectory(), fLineIsProcessing(0), fVersion(0), fVersionInt(0), fVersionCode(0),
456  fVersionDate(0), fVersionTime(0), fBuiltDate(0), fBuiltTime(0),
457  fTimer(0), fApplication(0), fInterpreter(0), fBatch(kTRUE), fEditHistograms(kTRUE),
458  fFromPopUp(kTRUE),fMustClean(kTRUE),fReadingObject(kFALSE),fForceStyle(kFALSE),
459  fInterrupt(kFALSE),fEscape(kFALSE),fExecutingMacro(kFALSE),fEditorMode(0),
460  fPrimitive(0),fSelectPad(0),fClasses(0),fTypes(0),fGlobals(0),fGlobalFunctions(0),
461  fClosedObjects(0),fFiles(0),fMappedFiles(0),fSockets(0),fCanvases(0),fStyles(0),fFunctions(0),
462  fTasks(0),fColors(0),fGeometries(0),fBrowsers(0),fSpecials(0),fCleanups(0),
463  fMessageHandlers(0),fStreamerInfo(0),fClassGenerators(0),fSecContexts(0),
464  fProofs(0),fClipboard(0),fDataSets(0),fUUIDs(0),fRootFolder(0),fBrowsables(0),
465  fPluginManager(0)
466 {
467  if (fgRootInit || ROOT::Internal::gROOTLocal) {
468  //Warning("TROOT", "only one instance of TROOT allowed");
469  return;
470  }
471 
472  R__LOCKGUARD2(gROOTMutex);
473 
474  ROOT::Internal::gROOTLocal = this;
475  gDirectory = 0;
476 
477  // initialize gClassTable is not already done
478  if (!gClassTable) new TClassTable;
479 
480  SetName(name);
481  SetTitle(title);
482 
483  // will be used by global "operator delete" so make sure it is set
484  // before anything is deleted
485  fMappedFiles = 0;
486 
487  // create already here, but only initialize it after gEnv has been created
489 
490  // Initialize Operating System interface
491  InitSystem();
492 
493  // Initialize static directory functions
494  GetRootSys();
495  GetBinDir();
496  GetLibDir();
497  GetIncludeDir();
498  GetEtcDir();
499  GetDataDir();
500  GetDocDir();
501  GetMacroDir();
502  GetTutorialsDir();
503  GetSourceDir();
504  GetIconPath();
505  GetTTFFontDir();
506 
507  gRootDir = GetRootSys().Data();
508 
510 
511  // Initialize interface to CINT C++ interpreter
512  fVersionInt = 0; // check in TROOT dtor in case TCling fails
513  fClasses = 0; // might be checked via TCling ctor
514  fEnums = 0;
515 
516  fConfigOptions = R__CONFIGUREOPTIONS;
517  fConfigFeatures = R__CONFIGUREFEATURES;
520  fVersionInt = IVERSQ();
523  fBuiltDate = IDATQQ(__DATE__);
524  fBuiltTime = ITIMQQ(__TIME__);
525 
526  ReadGitInfo();
527 
528  fClasses = new THashTable(800,3);
529  //fIdMap = new IdMap_t;
530  fStreamerInfo = new TObjArray(100);
531  fClassGenerators = new TList;
532 
533  // usedToIdentifyRootClingByDlSym is available when TROOT is part of
534  // rootcling.
535  if (!dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")) {
536  // initialize plugin manager early
538 #if defined(R__MACOSX) && (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
539  if (TARGET_OS_IPHONE | TARGET_IPHONE_SIMULATOR) {
540  TEnv plugins(".plugins-ios");
542  }
543 #endif
544  }
545 
546  TSystemDirectory *workdir = new TSystemDirectory("workdir", gSystem->WorkingDirectory());
547 
548  fTimer = 0;
549  fApplication = 0;
550  fColors = new TObjArray(1000); fColors->SetName("ListOfColors");
551  fTypes = 0;
552  fGlobals = 0;
553  fGlobalFunctions = 0;
554  // fList was created in TDirectory::Build but with different sizing.
555  delete fList;
556  fList = new THashList(1000,3);
557  fClosedObjects = new TList; fClosedObjects->SetName("ClosedFiles");
558  fFiles = new TList; fFiles->SetName("Files");
559  fMappedFiles = new TList; fMappedFiles->SetName("MappedFiles");
560  fSockets = new TList; fSockets->SetName("Sockets");
561  fCanvases = new TList; fCanvases->SetName("Canvases");
562  fStyles = new TList; fStyles->SetName("Styles");
563  fFunctions = new TList; fFunctions->SetName("Functions");
564  fTasks = new TList; fTasks->SetName("Tasks");
565  fGeometries = new TList; fGeometries->SetName("Geometries");
566  fBrowsers = new TList; fBrowsers->SetName("Browsers");
567  fSpecials = new TList; fSpecials->SetName("Specials");
568  fBrowsables = new TList; fBrowsables->SetName("Browsables");
569  fCleanups = new THashList; fCleanups->SetName("Cleanups");
570  fMessageHandlers = new TList; fMessageHandlers->SetName("MessageHandlers");
571  fSecContexts = new TList; fSecContexts->SetName("SecContexts");
572  fProofs = new TList; fProofs->SetName("Proofs");
573  fClipboard = new TList; fClipboard->SetName("Clipboard");
574  fDataSets = new TList; fDataSets->SetName("DataSets");
575  fTypes = new TListOfTypes;
576 
578  fUUIDs = new TProcessUUID();
579 
580  fRootFolder = new TFolder();
581  fRootFolder->SetName("root");
582  fRootFolder->SetTitle("root of all folders");
583  fRootFolder->AddFolder("Classes", "List of Active Classes",fClasses);
584  fRootFolder->AddFolder("Colors", "List of Active Colors",fColors);
585  fRootFolder->AddFolder("MapFiles", "List of MapFiles",fMappedFiles);
586  fRootFolder->AddFolder("Sockets", "List of Socket Connections",fSockets);
587  fRootFolder->AddFolder("Canvases", "List of Canvases",fCanvases);
588  fRootFolder->AddFolder("Styles", "List of Styles",fStyles);
589  fRootFolder->AddFolder("Functions", "List of Functions",fFunctions);
590  fRootFolder->AddFolder("Tasks", "List of Tasks",fTasks);
591  fRootFolder->AddFolder("Geometries","List of Geometries",fGeometries);
592  fRootFolder->AddFolder("Browsers", "List of Browsers",fBrowsers);
593  fRootFolder->AddFolder("Specials", "List of Special Objects",fSpecials);
594  fRootFolder->AddFolder("Handlers", "List of Message Handlers",fMessageHandlers);
595  fRootFolder->AddFolder("Cleanups", "List of RecursiveRemove Collections",fCleanups);
596  fRootFolder->AddFolder("StreamerInfo","List of Active StreamerInfo Classes",fStreamerInfo);
597  fRootFolder->AddFolder("SecContexts","List of Security Contexts",fSecContexts);
598  fRootFolder->AddFolder("PROOF Sessions", "List of PROOF sessions",fProofs);
599  fRootFolder->AddFolder("ROOT Memory","List of Objects in the gROOT Directory",fList);
600  fRootFolder->AddFolder("ROOT Files","List of Connected ROOT Files",fFiles);
601 
602  // by default, add the list of files, tasks, canvases and browsers in the Cleanups list
608 
611  fFromPopUp = kFALSE;
613  fInterrupt = kFALSE;
614  fEscape = kFALSE;
615  fMustClean = kTRUE;
616  fPrimitive = 0;
617  fSelectPad = 0;
618  fEditorMode = 0;
619  fDefCanvasName = "c1";
621  fLineIsProcessing = 1; // This prevents WIN32 "Windows" thread to pick ROOT objects with mouse
622  gDirectory = this;
623  gPad = 0;
624 
625  //set name of graphical cut class for the graphics editor
626  //cannot call SetCutClassName at this point because the TClass of TCutG
627  //is not yet build
628  fCutClassName = "TCutG";
629 
630  // Create a default MessageHandler
631  new TMessageHandler((TClass*)0);
632 
633  // Create some styles
634  gStyle = 0;
636  SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
637 
638  // Setup default (batch) graphics and GUI environment
641  gGXBatch = new TVirtualX("Batch", "ROOT Interface to batch graphics");
643 
644 #if defined(R__WIN32)
645  fBatch = kFALSE;
646 #elif defined(R__HAS_COCOA)
647  fBatch = kFALSE;
648 #else
649  if (gSystem->Getenv("DISPLAY"))
650  fBatch = kFALSE;
651  else
652  fBatch = kTRUE;
653 #endif
654 
655  int i = 0;
656  while (initfunc && initfunc[i]) {
657  (initfunc[i])();
658  fBatch = kFALSE; // put system in graphics mode (backward compatible)
659  i++;
660  }
661 
662  // Set initial/default list of browsable objects
663  fBrowsables->Add(fRootFolder, "root");
664  fBrowsables->Add(fProofs, "PROOF Sessions");
665  fBrowsables->Add(workdir, gSystem->WorkingDirectory());
666  fBrowsables->Add(fFiles, "ROOT Files");
667 
668  atexit(CleanUpROOTAtExit);
669 
671 }
672 
673 ////////////////////////////////////////////////////////////////////////////////
674 /// Clean up and free resources used by ROOT (files, network sockets,
675 /// shared memory segments, etc.).
676 
678 {
679  using namespace ROOT::Internal;
680 
681  if (gROOTLocal == this) {
682 
683  // If the interpreter has not yet been initialized, don't bother
684  gGetROOT = &GetROOT1;
685 
686  // Mark the object as invalid, so that we can veto some actions
687  // (like autoloading) while we are in the destructor.
689 
690  // Turn-off the global mutex to avoid recreating mutexes that have
691  // already been deleted during the destruction phase
692  gGlobalMutex = 0;
693 
694  // Return when error occurred in TCling, i.e. when setup file(s) are
695  // out of date
696  if (!fVersionInt) return;
697 
698  // ATTENTION!!! Order is important!
699 
700 #ifdef R__COMPLETE_MEM_TERMINATION
703  fSpecials->Delete(); SafeDelete(fSpecials); // delete special objects : PostScript, Minuit, Html
704 #endif
705  fClosedObjects->Delete("slow"); // and closed files
706  fFiles->Delete("slow"); // and files
708  fSecContexts->Delete("slow"); SafeDelete(fSecContexts); // and security contexts
709  fSockets->Delete(); SafeDelete(fSockets); // and sockets
710  fMappedFiles->Delete("slow"); // and mapped files
711  delete fUUIDs;
712  TProcessID::Cleanup(); // and list of ProcessIDs
713  TSeqCollection *tl = fMappedFiles; fMappedFiles = 0; delete tl;
714 
716 
717  fFunctions->Delete(); SafeDelete(fFunctions); // etc..
720 #ifdef R__COMPLETE_MEM_TERMINATION
722 #endif
725 
726 #ifdef R__COMPLETE_MEM_TERMINATION
731 #endif
732 
733  // Stop emitting signals
735 
737 
738 #ifdef R__COMPLETE_MEM_TERMINATION
744 
745  fCleanups->Clear();
747  delete gClassTable; gClassTable = 0;
748  delete gEnv; gEnv = 0;
749 
750  if (fTypes) fTypes->Delete();
752  if (fGlobals) fGlobals->Delete();
756  fEnums->Delete();
757  fClasses->Delete(); SafeDelete(fClasses); // TClass'es must be deleted last
758 #endif
759 
760  // Remove shared libraries produced by the TSystem::CompileMacro() call
762 
763  // Cleanup system class
764  delete gSystem;
765 
766  // ROOT-6022:
767  // if (gInterpreterLib) dlclose(gInterpreterLib);
768 #ifdef R__COMPLETE_MEM_TERMINATION
769  // On some 'newer' platform (Fedora Core 17+, Ubuntu 12), the
770  // initialization order is (by default?) is 'wrong' and so we can't
771  // delete the interpreter now .. because any of the static in the
772  // interpreter's library have already been deleted.
773  // On the link line, we must list the most dependent .o file
774  // and end with the least dependent (LLVM libraries), unfortunately,
775  // Fedora Core 17+ or Ubuntu 12 will also execute the initialization
776  // in the same order (hence doing libCore's before LLVM's and
777  // vice et versa for both the destructor. We worked around the
778  // initialization order by delay the TROOT creation until first use.
779  // We can not do the same for destruction as we have no way of knowing
780  // the last access ...
781  // So for now, let's avoid delete TCling except in the special build
782  // checking the completeness of the termination deletion.
783  gDestroyCling(fInterpreter);
784 #endif
785 
786 #ifdef R__COMPLETE_MEM_TERMINATION
788 #endif
789 
790  // Prints memory stats
792 
793  gROOTLocal = 0;
794  fgRootInit = kFALSE;
795  }
796 }
797 
798 ////////////////////////////////////////////////////////////////////////////////
799 /// Add a class to the list and map of classes.
800 /// This routine is deprecated, use TClass::AddClass directly.
801 
803 {
804  TClass::AddClass(cl);
805 }
806 
807 ////////////////////////////////////////////////////////////////////////////////
808 /// Add a class generator. This generator will be called by TClass::GetClass
809 /// in case its does not find a loaded rootcint dictionary to request the
810 /// creation of a TClass object.
811 
813 {
814  if (!generator) return;
815  fClassGenerators->Add(generator);
816 }
817 
818 ////////////////////////////////////////////////////////////////////////////////
819 /// Add browsable objects to TBrowser.
820 
822 {
823  TObject *obj;
824  TIter next(fBrowsables);
825 
826  while ((obj = (TObject *) next())) {
827  const char *opt = next.GetOption();
828  if (opt && strlen(opt))
829  b->Add(obj, opt);
830  else
831  b->Add(obj, obj->GetName());
832  }
833 }
834 
835 ////////////////////////////////////////////////////////////////////////////////
836 /// return class status bit kClassSaved for class cl
837 /// This function is called by the SavePrimitive functions writing
838 /// the C++ code for an object.
839 
841 {
842  if (cl == 0) return kFALSE;
843  if (cl->TestBit(TClass::kClassSaved)) return kTRUE;
845  return kFALSE;
846 }
847 
848 namespace {
849  static void R__ListSlowClose(TList *files)
850  {
851  // Routine to close a list of files using the 'slow' techniques
852  // that also for the deletion ot update the list itself.
853 
854  static TObject harmless;
855  TObjLink *cursor = files->FirstLink();
856  while (cursor) {
857  TDirectory *dir = static_cast<TDirectory*>( cursor->GetObject() );
858  if (dir) {
859  // In order for the iterator to stay valid, we must
860  // prevent the removal of the object (dir) from the list
861  // (which is done in TFile::Close). We can also can not
862  // just move to the next iterator since the Close might
863  // also (indirectly) remove that file.
864  // So we SetObject to a harmless value, so that 'dir'
865  // is not seen as part of the list.
866  // We will later, remove all the object (see files->Clear()
867  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
868  dir->Close();
869  // Put it back
870  cursor->SetObject(dir);
871  }
872  cursor = cursor->Next();
873  };
874  // Now were done, clear the list but do not delete the objects as
875  // they have been moved to the list of closed objects and must be
876  // deleted from there in order to avoid a double delete from a
877  // use objects (on the interpreter stack).
878  files->Clear("nodelete");
879  }
880 }
881 
882 ////////////////////////////////////////////////////////////////////////////////
883 /// Close any files and sockets that gROOT knows about.
884 /// This can be used to insures that the files and sockets are closed before any library is unloaded!
885 
887 {
888  if (fFiles && fFiles->First()) {
889  R__ListSlowClose(static_cast<TList*>(fFiles));
890  }
891  // and Close TROOT itself.
892  Close();
893  // Now sockets.
894  if (fSockets && fSockets->First()) {
895  if (0==fCleanups->FindObject(fSockets) ) {
898  }
899  CallFunc_t *socketCloser = gInterpreter->CallFunc_Factory();
900  Long_t offset = 0;
901  TClass *socketClass = TClass::GetClass("TSocket");
902  gInterpreter->CallFunc_SetFuncProto(socketCloser, socketClass->GetClassInfo(), "Close", "", &offset);
903  if (gInterpreter->CallFunc_IsValid(socketCloser)) {
904  static TObject harmless;
905  TObjLink *cursor = static_cast<TList*>(fSockets)->FirstLink();
906  TList notclosed;
907  while (cursor) {
908  TObject *socket = cursor->GetObject();
909  // In order for the iterator to stay valid, we must
910  // prevent the removal of the object (dir) from the list
911  // (which is done in TFile::Close). We can also can not
912  // just move to the next iterator since the Close might
913  // also (indirectly) remove that file.
914  // So we SetObject to a harmless value, so that 'dir'
915  // is not seen as part of the list.
916  // We will later, remove all the object (see files->Clear()
917  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
918 
919  if (socket->IsA()->InheritsFrom(socketClass)) {
920  gInterpreter->CallFunc_Exec(socketCloser, ((char*)socket)+offset);
921  // Put the object in the closed list for later deletion.
922  socket->SetBit(kMustCleanup);
923  fClosedObjects->AddLast(socket);
924  } else {
925  // Crap ... this is not a socket, likely Proof or something, let's try to find a Close
926  Long_t other_offset;
927  CallFunc_t *otherCloser = gInterpreter->CallFunc_Factory();
928  gInterpreter->CallFunc_SetFuncProto(otherCloser, socket->IsA()->GetClassInfo(), "Close", "", &other_offset);
929  if (gInterpreter->CallFunc_IsValid(otherCloser)) {
930  gInterpreter->CallFunc_Exec(otherCloser, ((char*)socket)+other_offset);
931  // Put the object in the closed list for later deletion.
932  socket->SetBit(kMustCleanup);
933  fClosedObjects->AddLast(socket);
934  } else {
935  notclosed.AddLast(socket);
936  }
937  gInterpreter->CallFunc_Delete(otherCloser);
938  // Put it back
939  cursor->SetObject(socket);
940  }
941  cursor = cursor->Next();
942  }
943  // Now were done, clear the list
944  fSockets->Clear();
945  // Read the one we did not close
946  cursor = notclosed.FirstLink();
947  while (cursor) {
948  static_cast<TList*>(fSockets)->AddLast(cursor->GetObject());
949  cursor = cursor->Next();
950  }
951  }
952  gInterpreter->CallFunc_Delete(socketCloser);
953  }
954  if (fMappedFiles && fMappedFiles->First()) {
955  R__ListSlowClose(static_cast<TList*>(fMappedFiles));
956  }
957 
958 }
959 
960 ////////////////////////////////////////////////////////////////////////////////
961 /// Execute the cleanups necessary at the end of the process, in particular
962 /// those that must be executed before the library start being unloaded.
963 
965 {
966  CloseFiles();
967 
968  if (gInterpreter) {
969  gInterpreter->ResetGlobals();
970  }
971 
972  // Now a set of simpler things to delete. See the same ordering in
973  // TROOT::~TROOT
974  fFunctions->Delete();
975  fGeometries->Delete();
976  fBrowsers->Delete();
977  fCanvases->Delete();
978  fColors->Delete();
979  fStyles->Delete();
980 }
981 
982 
983 ////////////////////////////////////////////////////////////////////////////////
984 /// Find an object in one Root folder
985 
987 {
988  Error("FindObject","Not yet implemented");
989  return 0;
990 }
991 
992 ////////////////////////////////////////////////////////////////////////////////
993 /// Returns address of a ROOT object if it exists
994 ///
995 /// If name contains at least one "/" the function calls FindObjectany
996 /// else
997 /// This function looks in the following order in the ROOT lists:
998 /// - List of files
999 /// - List of memory mapped files
1000 /// - List of functions
1001 /// - List of geometries
1002 /// - List of canvases
1003 /// - List of styles
1004 /// - List of specials
1005 /// - List of materials in current geometry
1006 /// - List of shapes in current geometry
1007 /// - List of matrices in current geometry
1008 /// - List of Nodes in current geometry
1009 /// - Current Directory in memory
1010 /// - Current Directory on file
1011 
1012 TObject *TROOT::FindObject(const char *name) const
1013 {
1014  if (name && strstr(name,"/")) return FindObjectAny(name);
1015 
1016  TObject *temp = 0;
1017 
1018  temp = fFiles->FindObject(name); if (temp) return temp;
1019  temp = fMappedFiles->FindObject(name); if (temp) return temp;
1020  {
1021  R__LOCKGUARD2(gROOTMutex);
1022  temp = fFunctions->FindObject(name); if (temp) return temp;
1023  }
1024  temp = fGeometries->FindObject(name); if (temp) return temp;
1025  temp = fCanvases->FindObject(name); if (temp) return temp;
1026  temp = fStyles->FindObject(name); if (temp) return temp;
1027  temp = fSpecials->FindObject(name); if (temp) return temp;
1028  TIter next(fGeometries);
1029  TObject *obj;
1030  while ((obj=next())) {
1031  temp = obj->FindObject(name); if (temp) return temp;
1032  }
1033  if (gDirectory) temp = gDirectory->Get(name); if (temp) return temp;
1034  if (gPad) {
1035  TVirtualPad *canvas = gPad->GetVirtCanvas();
1036  if (fCanvases->FindObject(canvas)) { //this check in case call from TCanvas ctor
1037  temp = canvas->FindObject(name);
1038  if (!temp && canvas != gPad) temp = gPad->FindObject(name);
1039  }
1040  }
1041  return temp;
1042 }
1043 
1044 ////////////////////////////////////////////////////////////////////////////////
1045 /// Returns address and folder of a ROOT object if it exists
1046 ///
1047 /// This function looks in the following order in the ROOT lists:
1048 /// - List of files
1049 /// - List of memory mapped files
1050 /// - List of functions
1051 /// - List of geometries
1052 /// - List of canvases
1053 /// - List of styles
1054 /// - List of specials
1055 /// - List of materials in current geometry
1056 /// - List of shapes in current geometry
1057 /// - List of matrices in current geometry
1058 /// - List of Nodes in current geometry
1059 /// - Current Directory in memory
1060 /// - Current Directory on file
1061 
1062 TObject *TROOT::FindSpecialObject(const char *name, void *&where)
1063 {
1064  TObject *temp = 0;
1065  where = 0;
1066 
1067  if (!temp) {
1068  temp = fFiles->FindObject(name);
1069  where = fFiles;
1070  }
1071  if (!temp) {
1072  temp = fMappedFiles->FindObject(name);
1073  where = fMappedFiles;
1074  }
1075  if (!temp) {
1076  R__LOCKGUARD2(gROOTMutex);
1077  temp = fFunctions->FindObject(name);
1078  where = fFunctions;
1079  }
1080  if (!temp) {
1081  temp = fCanvases->FindObject(name);
1082  where = fCanvases;
1083  }
1084  if (!temp) {
1085  temp = fStyles->FindObject(name);
1086  where = fStyles;
1087  }
1088  if (!temp) {
1089  temp = fSpecials->FindObject(name);
1090  where = fSpecials;
1091  }
1092  if (!temp) {
1093  TObject *glast = fGeometries->Last();
1094  if (glast) {where = glast; temp = glast->FindObject(name);}
1095  }
1096  if (!temp && gDirectory) {
1097  temp = gDirectory->Get(name);
1098  where = gDirectory;
1099  }
1100  if (!temp && gPad) {
1101  TVirtualPad *canvas = gPad->GetVirtCanvas();
1102  if (fCanvases->FindObject(canvas)) { //this check in case call from TCanvas ctor
1103  temp = canvas->FindObject(name);
1104  where = canvas;
1105  if (!temp && canvas != gPad) {
1106  temp = gPad->FindObject(name);
1107  where = gPad;
1108  }
1109  }
1110  }
1111  if (!temp) return 0;
1112  if (temp->TestBit(kNotDeleted)) return temp;
1113  return 0;
1114 }
1115 
1116 ////////////////////////////////////////////////////////////////////////////////
1117 /// Return a pointer to the first object with name starting at //root.
1118 /// This function scans the list of all folders.
1119 /// if no object found in folders, it scans the memory list of all files.
1120 
1121 TObject *TROOT::FindObjectAny(const char *name) const
1122 {
1123  TObject *obj = fRootFolder->FindObjectAny(name);
1124  if (obj) return obj;
1125  return gDirectory->FindObjectAnyFile(name);
1126 }
1127 
1128 ////////////////////////////////////////////////////////////////////////////////
1129 /// Scan the memory lists of all files for an object with name
1130 
1132 {
1133  R__LOCKGUARD(gROOTMutex);
1134  TDirectory *d;
1135  TIter next(GetListOfFiles());
1136  while ((d = (TDirectory*)next())) {
1137  // Call explicitly TDirectory::FindObject to restrict the search to the
1138  // already in memory object.
1139  TObject *obj = d->TDirectory::FindObject(name);
1140  if (obj) return obj;
1141  }
1142  return 0;
1143 }
1144 
1145 ////////////////////////////////////////////////////////////////////////////////
1146 /// Returns class name of a ROOT object including CINT globals.
1147 
1148 const char *TROOT::FindObjectClassName(const char *name) const
1149 {
1150  // Search first in the list of "standard" objects
1151  TObject *obj = FindObject(name);
1152  if (obj) return obj->ClassName();
1153 
1154  // Is it a global variable?
1155  TGlobal *g = GetGlobal(name);
1156  if (g) return g->GetTypeName();
1157 
1158  return 0;
1159 }
1160 
1161 ////////////////////////////////////////////////////////////////////////////////
1162 /// Return path name of obj somewhere in the //root/... path.
1163 /// The function returns the first occurence of the object in the list
1164 /// of folders. The returned string points to a static char array in TROOT.
1165 /// If this function is called in a loop or recursively, it is the
1166 /// user's responsibility to copy this string in their area.
1167 
1168 const char *TROOT::FindObjectPathName(const TObject *) const
1169 {
1170  Error("FindObjectPathName","Not yet implemented");
1171  return "??";
1172 }
1173 
1174 ////////////////////////////////////////////////////////////////////////////////
1175 /// return a TClass object corresponding to 'name' assuming it is an STL container.
1176 /// In particular we looking for possible alternative name (default template
1177 /// parameter, typedefs template arguments, typedefed name).
1178 
1179 TClass *TROOT::FindSTLClass(const char *name, Bool_t load, Bool_t silent) const
1180 {
1181  // Example of inputs are
1182  // vector<int> (*)
1183  // vector<Int_t>
1184  // vector<long long>
1185  // vector<Long_64_t> (*)
1186  // vector<int, allocator<int> >
1187  // vector<Int_t, allocator<int> >
1188  //
1189  // One of the possibly expensive operation is the resolving of the typedef
1190  // which can provoke the parsing of the header files (and/or the loading
1191  // of clang pcms information).
1192 
1194 
1195  // Remove std::, allocator, typedef, add Long64_t, etc. in just one call.
1196  std::string normalized;
1197  TClassEdit::GetNormalizedName(normalized, name);
1198 
1199  TClass *cl = 0;
1200  if (normalized != name) cl = TClass::GetClass(normalized.c_str(),load,silent);
1201 
1202  if (load && cl==0) {
1203  // Create an Emulated class for this container.
1204  cl = gInterpreter->GenerateTClass(normalized.c_str(), kTRUE, silent);
1205  }
1206 
1207  return cl;
1208 }
1209 
1210 ////////////////////////////////////////////////////////////////////////////////
1211 /// Return pointer to class with name. Obsolete, use TClass::GetClass directly
1212 
1213 TClass *TROOT::GetClass(const char *name, Bool_t load, Bool_t silent) const
1214 {
1215  return TClass::GetClass(name,load,silent);
1216 }
1217 
1218 
1219 ////////////////////////////////////////////////////////////////////////////////
1220 /// Return pointer to class from its name. Obsolete, use TClass::GetClass directly
1221 /// See TClass::GetClass
1222 
1223 TClass *TROOT::GetClass(const type_info& typeinfo, Bool_t load, Bool_t silent) const
1224 {
1225  return TClass::GetClass(typeinfo,load,silent);
1226 }
1227 
1228 ////////////////////////////////////////////////////////////////////////////////
1229 /// Return address of color with index color.
1230 
1232 {
1234  TObjArray *lcolors = (TObjArray*) GetListOfColors();
1235  if (!lcolors) return 0;
1236  if (color < 0 || color >= lcolors->GetSize()) return 0;
1237  TColor *col = (TColor*)lcolors->At(color);
1238  if (col && col->GetNumber() == color) return col;
1239  TIter next(lcolors);
1240  while ((col = (TColor *) next()))
1241  if (col->GetNumber() == color) return col;
1242 
1243  return 0;
1244 }
1245 
1246 ////////////////////////////////////////////////////////////////////////////////
1247 /// Return a default canvas.
1248 
1250 {
1251  return (TCanvas*)gROOT->ProcessLine("TCanvas::MakeDefCanvas();");
1252 }
1253 
1254 ////////////////////////////////////////////////////////////////////////////////
1255 /// Return pointer to type with name.
1256 
1257 TDataType *TROOT::GetType(const char *name, Bool_t /* load */) const
1258 {
1259  return (TDataType*)gROOT->GetListOfTypes()->FindObject(name);
1260 }
1261 
1262 ////////////////////////////////////////////////////////////////////////////////
1263 /// Return pointer to file with name.
1264 
1265 TFile *TROOT::GetFile(const char *name) const
1266 {
1267  R__LOCKGUARD(gROOTMutex);
1268  return (TFile*)GetListOfFiles()->FindObject(name);
1269 }
1270 
1271 ////////////////////////////////////////////////////////////////////////////////
1272 /// Return pointer to style with name
1273 
1274 TStyle *TROOT::GetStyle(const char *name) const
1275 {
1276  return (TStyle*)GetListOfStyles()->FindObject(name);
1277 }
1278 
1279 ////////////////////////////////////////////////////////////////////////////////
1280 /// Return pointer to function with name.
1281 
1282 TObject *TROOT::GetFunction(const char *name) const
1283 {
1284  if (name == 0 || name[0] == 0) {
1285  return 0;
1286  }
1287 
1288  {
1289  R__LOCKGUARD2(gROOTMutex);
1290  TObject *f1 = fFunctions->FindObject(name);
1291  if (f1) return f1;
1292  }
1293 
1294  gROOT->ProcessLine("TF1::InitStandardFunctions();");
1295 
1296  R__LOCKGUARD2(gROOTMutex);
1297  return fFunctions->FindObject(name);
1298 }
1299 
1300 ////////////////////////////////////////////////////////////////////////////////
1301 
1303 {
1304  if (!gInterpreter) return 0;
1305 
1307 
1308  return (TFunctionTemplate*)fFuncTemplate->FindObject(name);
1309 }
1310 
1311 ////////////////////////////////////////////////////////////////////////////////
1312 /// Return pointer to global variable by name. If load is true force
1313 /// reading of all currently defined globals from CINT (more expensive).
1314 
1315 TGlobal *TROOT::GetGlobal(const char *name, Bool_t load) const
1316 {
1317  return (TGlobal *)gROOT->GetListOfGlobals(load)->FindObject(name);
1318 }
1319 
1320 ////////////////////////////////////////////////////////////////////////////////
1321 /// Return pointer to global variable with address addr.
1322 
1323 TGlobal *TROOT::GetGlobal(const TObject *addr, Bool_t /* load */) const
1324 {
1325  if (addr == 0 || ((Long_t)addr) == -1) return 0;
1326 
1327  TInterpreter::DeclId_t decl = gInterpreter->GetDataMemberAtAddr(addr);
1328  if (decl) {
1329  TListOfDataMembers *globals = ((TListOfDataMembers*)(gROOT->GetListOfGlobals(kFALSE)));
1330  return (TGlobal*)globals->Get(decl);
1331  }
1332  // If we are actually looking for a global that is held by a global
1333  // pointer (for example gRandom), we need to find a pointer with the
1334  // correct value.
1335  decl = gInterpreter->GetDataMemberWithValue(addr);
1336  if (decl) {
1337  TListOfDataMembers *globals = ((TListOfDataMembers*)(gROOT->GetListOfGlobals(kFALSE)));
1338  return (TGlobal*)globals->Get(decl);
1339  }
1340  return 0;
1341 }
1342 
1343 ////////////////////////////////////////////////////////////////////////////////
1344 /// Internal routine returning, and creating if necessary, the list
1345 /// of global function.
1346 
1348 {
1350  return fGlobalFunctions;
1351 }
1352 
1353 ////////////////////////////////////////////////////////////////////////////////
1354 /// Return the collection of functions named "name".
1355 
1357 {
1358  return ((TListOfFunctions*)fFunctions)->GetListForObject(name);
1359 }
1360 
1361 ////////////////////////////////////////////////////////////////////////////////
1362 /// Return pointer to global function by name.
1363 /// If params != 0 it will also resolve overloading other it returns the first
1364 /// name match.
1365 /// If params == 0 and load is true force reading of all currently defined
1366 /// global functions from Cling.
1367 /// The param string must be of the form: "3189,\"aap\",1.3".
1368 
1369 TFunction *TROOT::GetGlobalFunction(const char *function, const char *params,
1370  Bool_t load)
1371 {
1372  if (!params) {
1373  R__LOCKGUARD2(gROOTMutex);
1374  return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
1375  } else {
1376  if (!fInterpreter)
1377  Fatal("GetGlobalFunction", "fInterpreter not initialized");
1378 
1379  R__LOCKGUARD2(gROOTMutex);
1380  TInterpreter::DeclId_t decl = gInterpreter->GetFunctionWithValues(0,
1381  function, params,
1382  false);
1383 
1384  if (!decl) return 0;
1385 
1386  TFunction *f = GetGlobalFunctions()->Get(decl);
1387  if (f) return f;
1388 
1389  Error("GetGlobalFunction",
1390  "\nDid not find matching TFunction <%s> with \"%s\".",
1391  function,params);
1392  return 0;
1393  }
1394 }
1395 
1396 ////////////////////////////////////////////////////////////////////////////////
1397 /// Return pointer to global function by name. If proto != 0
1398 /// it will also resolve overloading. If load is true force reading
1399 /// of all currently defined global functions from CINT (more expensive).
1400 /// The proto string must be of the form: "int, char*, float".
1401 
1403  const char *proto, Bool_t load)
1404 {
1405  if (!proto) {
1406  R__LOCKGUARD2(gROOTMutex);
1407  return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
1408  } else {
1409  if (!fInterpreter)
1410  Fatal("GetGlobalFunctionWithPrototype", "fInterpreter not initialized");
1411 
1412  R__LOCKGUARD2(gROOTMutex);
1413  TInterpreter::DeclId_t decl = gInterpreter->GetFunctionWithPrototype(0,
1414  function, proto);
1415 
1416  if (!decl) return 0;
1417 
1418  TFunction *f = GetGlobalFunctions()->Get(decl);
1419  if (f) return f;
1420 
1421  Error("GetGlobalFunctionWithPrototype",
1422  "\nDid not find matching TFunction <%s> with \"%s\".",
1423  function,proto);
1424  return 0;
1425  }
1426 }
1427 
1428 ////////////////////////////////////////////////////////////////////////////////
1429 /// Return pointer to Geometry with name
1430 
1431 TObject *TROOT::GetGeometry(const char *name) const
1432 {
1433  return GetListOfGeometries()->FindObject(name);
1434 }
1435 
1436 ////////////////////////////////////////////////////////////////////////////////
1437 
1439 {
1440  if(!fEnums.load()) {
1441  R__LOCKGUARD2(gROOTMutex);
1442  // Test again just in case, another thread did the work while we were
1443  // waiting.
1444  if (!fEnums.load()) fEnums = new TListOfEnumsWithLock(0);
1445  }
1446  if (load) {
1447  R__LOCKGUARD2(gROOTMutex);
1448  (*fEnums).Load(); // Refresh the list of enums.
1449  }
1450  return fEnums.load();
1451 }
1452 
1453 ////////////////////////////////////////////////////////////////////////////////
1454 
1456 {
1457  R__LOCKGUARD2(gROOTMutex);
1458  if(!fFuncTemplate) {
1460  }
1461  return fFuncTemplate;
1462 }
1463 
1464 ////////////////////////////////////////////////////////////////////////////////
1465 /// Return list containing the TGlobals currently defined.
1466 /// Since globals are created and deleted during execution of the
1467 /// program, we need to update the list of globals every time we
1468 /// execute this method. However, when calling this function in
1469 /// a (tight) loop where no interpreter symbols will be created
1470 /// you can set load=kFALSE (default).
1471 
1473 {
1474  if (!fGlobals) {
1475  // We add to the list the "funcky-fake" globals.
1476  fGlobals = new TListOfDataMembers(0);
1477  fGlobals->Add(new TGlobalMappedFunction("gROOT", "TROOT*",
1479  fGlobals->Add(new TGlobalMappedFunction("gPad", "TVirtualPad*",
1481  fGlobals->Add(new TGlobalMappedFunction("gInterpreter", "TInterpreter*",
1483  fGlobals->Add(new TGlobalMappedFunction("gVirtualX", "TTVirtualX*",
1485  fGlobals->Add(new TGlobalMappedFunction("gDirectory", "TDirectory*",
1489  }
1490 
1491  if (!fInterpreter)
1492  Fatal("GetListOfGlobals", "fInterpreter not initialized");
1493 
1494  if (load) fGlobals->Load();
1495 
1496  return fGlobals;
1497 }
1498 
1499 ////////////////////////////////////////////////////////////////////////////////
1500 /// Return list containing the TFunctions currently defined.
1501 /// Since functions are created and deleted during execution of the
1502 /// program, we need to update the list of functions every time we
1503 /// execute this method. However, when calling this function in
1504 /// a (tight) loop where no interpreter symbols will be created
1505 /// you can set load=kFALSE (default).
1506 
1508 {
1509  R__LOCKGUARD2(gROOTMutex);
1510 
1511  if (!fGlobalFunctions) {
1513  }
1514 
1515  if (!fInterpreter)
1516  Fatal("GetListOfGlobalFunctions", "fInterpreter not initialized");
1517 
1518  // A thread that calls with load==true and a thread that calls with load==false
1519  // will conflict here (the load==true will be updating the list while the
1520  // other is reading it). To solve the problem, we could use a read-write lock
1521  // inside the list itself.
1522  if (load) fGlobalFunctions->Load();
1523 
1524  return fGlobalFunctions;
1525 }
1526 
1527 ////////////////////////////////////////////////////////////////////////////////
1528 /// Return a dynamic list giving access to all TDataTypes (typedefs)
1529 /// currently defined.
1530 ///
1531 /// The list is populated on demand. Calling
1532 /// ~~~ {.cpp}
1533 /// gROOT->GetListOfTypes()->FindObject(nameoftype);
1534 /// ~~~
1535 /// will return the TDataType corresponding to 'nameoftype'. If the
1536 /// TDataType is not already in the list itself and the type does exist,
1537 /// a new TDataType will be created and added to the list.
1538 ///
1539 /// Calling
1540 /// ~~~ {.cpp}
1541 /// gROOT->GetListOfTypes()->ls(); // or Print()
1542 /// ~~~
1543 /// list only the typedefs that have been previously accessed through the
1544 /// list (plus the builtins types).
1545 
1547 {
1548  if (!fInterpreter)
1549  Fatal("GetListOfTypes", "fInterpreter not initialized");
1550 
1551  return fTypes;
1552 }
1553 
1554 
1555 ////////////////////////////////////////////////////////////////////////////////
1556 /// Execute command when system has been idle for idleTimeInSec seconds.
1557 
1558 void TROOT::Idle(UInt_t idleTimeInSec, const char *command)
1559 {
1560  if (!fApplication.load())
1562 
1563  if (idleTimeInSec <= 0)
1564  (*fApplication).RemoveIdleTimer();
1565  else
1566  (*fApplication).SetIdleTimer(idleTimeInSec, command);
1567 }
1568 
1569 ////////////////////////////////////////////////////////////////////////////////
1570 /// Check whether className is a known class, and only autoload
1571 /// if we can. Helper function for TROOT::IgnoreInclude().
1572 
1573 static TClass* R__GetClassIfKnown(const char* className)
1574 {
1575  // Check whether the class is available for auto-loading first:
1576  const char* libsToLoad = gInterpreter->GetClassSharedLibs(className);
1577  TClass* cla = 0;
1578  if (libsToLoad) {
1579  // trigger autoload, and only create TClass in this case.
1580  return TClass::GetClass(className);
1581  } else if (gROOT->GetListOfClasses()
1582  && (cla = (TClass*)gROOT->GetListOfClasses()->FindObject(className))) {
1583  // cla assigned in if statement
1584  } else if (gClassTable->FindObject(className)) {
1585  return TClass::GetClass(className);
1586  }
1587  return cla;
1588 }
1589 
1590 ////////////////////////////////////////////////////////////////////////////////
1591 /// Return 1 if the name of the given include file corresponds to a class that
1592 /// is known to ROOT, e.g. "TLorentzVector.h" versus TLorentzVector.
1593 
1594 Int_t TROOT::IgnoreInclude(const char *fname, const char * /*expandedfname*/)
1595 {
1596  if (fname == 0) return 0;
1597 
1598  TString stem(fname);
1599  // Remove extension if any, ignore files with extension not being .h*
1600  Int_t where = stem.Last('.');
1601  if (where != kNPOS) {
1602  if (stem.EndsWith(".so") || stem.EndsWith(".sl") ||
1603  stem.EndsWith(".dl") || stem.EndsWith(".a") ||
1604  stem.EndsWith(".dll", TString::kIgnoreCase))
1605  return 0;
1606  stem.Remove(where);
1607  }
1608 
1609  TString className = gSystem->BaseName(stem);
1610  TClass* cla = R__GetClassIfKnown(className);
1611  if (!cla) {
1612  // Try again with modifications to the file name:
1613  className = stem;
1614  className.ReplaceAll("/", "::");
1615  className.ReplaceAll("\\", "::");
1616  if (className.Contains(":::")) {
1617  // "C:\dir" becomes "C:::dir".
1618  // fname corresponds to whatever is stated after #include and
1619  // a full path name usually means that it's not a regular #include
1620  // but e.g. a ".L", so we can assume that this is not a header of
1621  // a class in a namespace (a global-namespace class would have been
1622  // detected already before).
1623  return 0;
1624  }
1625  cla = R__GetClassIfKnown(className);
1626  }
1627 
1628  if (!cla) {
1629  return 0;
1630  }
1631 
1632  // cla is valid, check wether it's actually in the header of the same name:
1633  if (cla->GetDeclFileLine() <= 0) return 0; // to a void an error with VisualC++
1634  TString decfile = gSystem->BaseName(cla->GetDeclFileName());
1635  if (decfile != gSystem->BaseName(fname)) {
1636  return 0;
1637  }
1638  return 1;
1639 }
1640 
1641 ////////////////////////////////////////////////////////////////////////////////
1642 /// Initialize operating system interface.
1643 
1645 {
1646  if (gSystem == 0) {
1647 #if defined(R__UNIX)
1648 #if defined(R__HAS_COCOA)
1649  gSystem = new TMacOSXSystem;
1650 #else
1651  gSystem = new TUnixSystem;
1652 #endif
1653 #elif defined(R__WIN32)
1654  gSystem = new TWinNTSystem;
1655 #else
1656  gSystem = new TSystem;
1657 #endif
1658 
1659  if (gSystem->Init())
1660  fprintf(stderr, "Fatal in <TROOT::InitSystem>: can't init operating system layer\n");
1661 
1662  if (!gSystem->HomeDirectory()) {
1663  fprintf(stderr, "Fatal in <TROOT::InitSystem>: HOME directory not set\n");
1664  fprintf(stderr, "Fix this by defining the HOME shell variable\n");
1665  }
1666 
1667  // read default files
1668  gEnv = new TEnv(".rootrc");
1669 
1670  gDebug = gEnv->GetValue("Root.Debug", 0);
1671 
1672  if (!gEnv->GetValue("Root.ErrorHandlers", 1))
1673  gSystem->ResetSignals();
1674 
1675  // by default the zipmode is 1 (see Bits.h)
1676  Int_t zipmode = gEnv->GetValue("Root.ZipMode", 1);
1677  if (zipmode != 1) R__SetZipMode(zipmode);
1678 
1679  const char *sdeb;
1680  if ((sdeb = gSystem->Getenv("ROOTDEBUG")))
1681  gDebug = atoi(sdeb);
1682 
1683  if (gDebug > 0 && isatty(2))
1684  fprintf(stderr, "Info in <TROOT::InitSystem>: running with gDebug = %d\n", gDebug);
1685 
1686  if (gEnv->GetValue("Root.MemStat", 0))
1688  int msize = gEnv->GetValue("Root.MemStat.size", -1);
1689  int mcnt = gEnv->GetValue("Root.MemStat.cnt", -1);
1690  if (msize != -1 || mcnt != -1)
1691  TStorage::EnableStatistics(msize, mcnt);
1692 
1693  fgMemCheck = gEnv->GetValue("Root.MemCheck", 0);
1694 
1695 #if defined(R__HAS_COCOA)
1696  // create and delete a dummy TUrl so that TObjectStat table does not contain
1697  // objects that are deleted after recording is turned-off (in next line),
1698  // like the TUrl::fgSpecialProtocols list entries which are created in the
1699  // TMacOSXSystem ctor.
1700  { TUrl dummy("/dummy"); }
1701 #endif
1702  TObject::SetObjectStat(gEnv->GetValue("Root.ObjectStat", 0));
1703  }
1704 }
1705 
1706 ////////////////////////////////////////////////////////////////////////////////
1707 /// Load and initialize thread library.
1708 
1710 {
1711  if (gEnv->GetValue("Root.UseThreads", 0) || gEnv->GetValue("Root.EnableThreadSafety", 0)) {
1713  }
1714 }
1715 
1716 ////////////////////////////////////////////////////////////////////////////////
1717 /// Initialize the interpreter. Should be called only after main(),
1718 /// to make sure LLVM/Clang is fully initialized.
1719 
1721 {
1722  // usedToIdentifyRootClingByDlSym is available when TROOT is part of
1723  // rootcling.
1724  if (!dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")
1725  && !dlsym(RTLD_DEFAULT, "usedToIdentifyStaticRoot")) {
1726  // Make sure no llvm symbols are visible before loading libCling. If they
1727  // exist libCling will use those and not ours, causing havoc in the
1728  // interpreter. Look for an extern "C" symbol to avoid mangling; look for a
1729  // symbol from llvm because clang builds on top, so users would likely
1730  // have also their own llvm symbols when providing their own clang.
1731  void *LLVMEnablePrettyStackTraceAddr = 0;
1732  // Can't use gSystem->DynFindSymbol() because that iterates over all *known*
1733  // libraries which is not the same!
1734  LLVMEnablePrettyStackTraceAddr = dlsym(RTLD_DEFAULT, "LLVMEnablePrettyStackTrace");
1735  if (LLVMEnablePrettyStackTraceAddr) {
1736  Error("InitInterpreter()", "LLVM SYMBOLS ARE EXPOSED TO CLING! "
1737  "This will cause problems; please hide them or dlopen() them "
1738  "after the call to TROOT::InitInterpreter()!");
1739  }
1740 
1741  char *libcling = gSystem->DynamicPathName("libCling");
1742  gInterpreterLib = dlopen(libcling, RTLD_LAZY|RTLD_LOCAL);
1743  delete [] libcling;
1744 
1745  if (!gInterpreterLib) {
1746  TString err = dlerror();
1747  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load library %s\n", err.Data());
1748  exit(1);
1749  }
1750  dlerror(); // reset error message
1751  } else {
1752  gInterpreterLib = RTLD_DEFAULT;
1753  }
1754  CreateInterpreter_t *CreateInterpreter = (CreateInterpreter_t*) dlsym(gInterpreterLib, "CreateInterpreter");
1755  if (!CreateInterpreter) {
1756  TString err = dlerror();
1757  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load symbol %s\n", err.Data());
1758  exit(1);
1759  }
1760  // Schedule the destruction of TROOT.
1761  atexit(at_exit_of_TROOT);
1762 
1763  gDestroyInterpreter = (DestroyInterpreter_t*) dlsym(gInterpreterLib, "DestroyInterpreter");
1764  if (!gDestroyInterpreter) {
1765  TString err = dlerror();
1766  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load symbol %s\n", err.Data());
1767  exit(1);
1768  }
1769 
1770  fInterpreter = CreateInterpreter(gInterpreterLib);
1771 
1774 
1775  fgRootInit = kTRUE;
1776 
1777  // Initialize all registered dictionaries.
1778  for (std::vector<ModuleHeaderInfo_t>::const_iterator
1779  li = GetModuleHeaderInfoBuffer().begin(),
1780  le = GetModuleHeaderInfoBuffer().end(); li != le; ++li) {
1781  // process buffered module registrations
1782  fInterpreter->RegisterModule(li->fModuleName,
1783  li->fHeaders,
1784  li->fIncludePaths,
1785  li->fPayloadCode,
1786  li->fFwdDeclCode,
1787  li->fTriggerFunc,
1788  li->fFwdNargsToKeepColl,
1789  li->fClassesHeaders);
1790  }
1791  GetModuleHeaderInfoBuffer().clear();
1792 
1794 
1795  // Read the rules before enabling the auto loading to not inadvertently
1796  // load the libraries for the classes concerned even-though the user is
1797  // *not* using them.
1798  TClass::ReadRules(); // Read the default customization rules ...
1799 
1800  // Enable autoloading
1802 }
1803 
1804 ////////////////////////////////////////////////////////////////////////////////
1805 /// Helper function used by TClass::GetClass().
1806 /// This function attempts to load the dictionary for 'classname'
1807 /// either from the TClassTable or from the list of generator.
1808 /// If silent is 'true', do not warn about missing dictionary for the class.
1809 /// (typically used for class that are used only for transient members)
1810 ///
1811 /// The 'requestedname' is expected to be already normalized.
1812 
1813 TClass *TROOT::LoadClass(const char *requestedname, Bool_t silent) const
1814 {
1815  return TClass::LoadClass(requestedname, silent);
1816 }
1817 
1818 ////////////////////////////////////////////////////////////////////////////////
1819 /// Check if class "classname" is known to the interpreter (in fact,
1820 /// this check is not needed anymore, so classname is ignored). If
1821 /// not it will load library "libname". If the library name does
1822 /// not start with "lib", "lib" will be prepended and a search will
1823 /// be made in the DynamicPath (see .rootrc). If not found a search
1824 /// will be made on libname (without "lib" prepended) and if not found
1825 /// a direct try of libname will be made (in case it contained an
1826 /// absolute path).
1827 /// If check is true it will only check if libname exists and is
1828 /// readable.
1829 /// Returns 0 on successful loading, -1 in case libname does not
1830 /// exist or in case of error and -2 in case of version mismatch.
1831 
1832 Int_t TROOT::LoadClass(const char * /*classname*/, const char *libname,
1833  Bool_t check)
1834 {
1835  Int_t err = -1;
1836 
1837  char *path;
1838  TString lib = libname;
1839  if (!lib.BeginsWith("lib"))
1840  lib = "lib" + lib;
1841  if ((path = gSystem->DynamicPathName(lib, kTRUE))) {
1842  if (check)
1843  err = 0;
1844  else {
1845  err = gSystem->Load(path, 0, kTRUE);
1846  }
1847  delete [] path;
1848  } else {
1849  if (check) {
1850  FileStat_t stat;
1851  if (!gSystem->GetPathInfo(libname, stat)) {
1852  if (R_ISREG(stat.fMode) &&
1854  err = 0;
1855  else
1856  err = -1;
1857  } else
1858  err = -1;
1859  } else {
1860  err = gSystem->Load(libname, 0, kTRUE);
1861  }
1862  }
1863 
1864  if (err == -1) {
1865  //Error("LoadClass", "library %s could not be loaded", libname);
1866  }
1867 
1868  if (err == 1) {
1869  //Error("LoadClass", "library %s already loaded, but class %s unknown",
1870  // libname, classname);
1871  err = 0;
1872  }
1873 
1874  return err;
1875 }
1876 
1877 ////////////////////////////////////////////////////////////////////////////////
1878 /// Return true if the file is local and is (likely) to be a ROOT file
1879 
1881 {
1882  Bool_t result = kFALSE;
1883  FILE *mayberootfile = fopen(filename,"rb");
1884  if (mayberootfile) {
1885  char header[5];
1886  if (fgets(header,5,mayberootfile)) {
1887  result = strncmp(header,"root",4)==0;
1888  }
1889  fclose(mayberootfile);
1890  }
1891  return result;
1892 }
1893 
1894 ////////////////////////////////////////////////////////////////////////////////
1895 /// To list all objects of the application.
1896 /// Loop on all objects created in the ROOT linked lists.
1897 /// Objects may be files and windows or any other object directly
1898 /// attached to the ROOT linked list.
1899 
1900 void TROOT::ls(Option_t *option) const
1901 {
1902 // TObject::SetDirLevel();
1903 // GetList()->R__FOR_EACH(TObject,ls)(option);
1904  TDirectory::ls(option);
1905 }
1906 
1907 ////////////////////////////////////////////////////////////////////////////////
1908 /// Load a macro in the interpreter's memory. Equivalent to the command line
1909 /// command ".L filename". If the filename has "+" or "++" appended
1910 /// the macro will be compiled by ACLiC. The filename must have the format:
1911 /// [path/]macro.C[+|++[g|O]].
1912 /// The possible error codes are defined by TInterpreter::EErrorCode.
1913 /// If check is true it will only check if filename exists and is
1914 /// readable.
1915 /// Returns 0 on successful loading and -1 in case filename does not
1916 /// exist or in case of error.
1917 
1918 Int_t TROOT::LoadMacro(const char *filename, int *error, Bool_t check)
1919 {
1920  Int_t err = -1;
1921  Int_t lerr, *terr;
1922  if (error)
1923  terr = error;
1924  else
1925  terr = &lerr;
1926 
1927  if (fInterpreter) {
1928  TString aclicMode;
1929  TString arguments;
1930  TString io;
1931  TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
1932 
1933  if (arguments.Length()) {
1934  Warning("LoadMacro", "argument(%s) ignored in %s", arguments.Data(), GetMacroPath());
1935  }
1936  char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
1937  if (!mac) {
1938  if (!check)
1939  Error("LoadMacro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
1940  *terr = TInterpreter::kFatal;
1941  } else {
1942  err = 0;
1943  if (!check) {
1944  fname = mac;
1945  fname += aclicMode;
1946  fname += io;
1947  gInterpreter->LoadMacro(fname.Data(), (TInterpreter::EErrorCode*)terr);
1948  if (*terr)
1949  err = -1;
1950  }
1951  }
1952  delete [] mac;
1953  }
1954  return err;
1955 }
1956 
1957 ////////////////////////////////////////////////////////////////////////////////
1958 /// Execute a macro in the interpreter. Equivalent to the command line
1959 /// command ".x filename". If the filename has "+" or "++" appended
1960 /// the macro will be compiled by ACLiC. The filename must have the format:
1961 /// [path/]macro.C[+|++[g|O]][(args)].
1962 /// The possible error codes are defined by TInterpreter::EErrorCode.
1963 /// If padUpdate is true (default) update the current pad.
1964 /// Returns the macro return value.
1965 
1966 Long_t TROOT::Macro(const char *filename, Int_t *error, Bool_t padUpdate)
1967 {
1968  Long_t result = 0;
1969 
1970  if (fInterpreter) {
1971  TString aclicMode;
1972  TString arguments;
1973  TString io;
1974  TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
1975 
1976  char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
1977  if (!mac) {
1978  Error("Macro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
1979  if (error)
1980  *error = TInterpreter::kFatal;
1981  } else {
1982  fname = mac;
1983  fname += aclicMode;
1984  fname += arguments;
1985  fname += io;
1986  result = gInterpreter->ExecuteMacro(fname, (TInterpreter::EErrorCode*)error);
1987  }
1988  delete [] mac;
1989 
1990  if (padUpdate && gPad)
1991  gPad->Update();
1992  }
1993 
1994  return result;
1995 }
1996 
1997 ////////////////////////////////////////////////////////////////////////////////
1998 /// Process message id called by obj.
1999 
2000 void TROOT::Message(Int_t id, const TObject *obj)
2001 {
2002  TIter next(fMessageHandlers);
2003  TMessageHandler *mh;
2004  while ((mh = (TMessageHandler*)next())) {
2005  mh->HandleMessage(id,obj);
2006  }
2007 }
2008 
2009 ////////////////////////////////////////////////////////////////////////////////
2010 /// Process interpreter command via TApplication::ProcessLine().
2011 /// On Win32 the line will be processed asynchronously by sending
2012 /// it to the CINT interpreter thread. For explicit synchronous processing
2013 /// use ProcessLineSync(). On non-Win32 platforms there is no difference
2014 /// between ProcessLine() and ProcessLineSync().
2015 /// The possible error codes are defined by TInterpreter::EErrorCode. In
2016 /// particular, error will equal to TInterpreter::kProcessing until the
2017 /// CINT interpreted thread has finished executing the line.
2018 /// Returns the result of the command, cast to a Long_t.
2019 
2020 Long_t TROOT::ProcessLine(const char *line, Int_t *error)
2021 {
2022  TString sline = line;
2023  sline = sline.Strip(TString::kBoth);
2024 
2025  if (!fApplication.load())
2027 
2028  return (*fApplication).ProcessLine(sline, kFALSE, error);
2029 }
2030 
2031 ////////////////////////////////////////////////////////////////////////////////
2032 /// Process interpreter command via TApplication::ProcessLine().
2033 /// On Win32 the line will be processed synchronously (i.e. it will
2034 /// only return when the CINT interpreter thread has finished executing
2035 /// the line). On non-Win32 platforms there is no difference between
2036 /// ProcessLine() and ProcessLineSync().
2037 /// The possible error codes are defined by TInterpreter::EErrorCode.
2038 /// Returns the result of the command, cast to a Long_t.
2039 
2041 {
2042  TString sline = line;
2043  sline = sline.Strip(TString::kBoth);
2044 
2045  if (!fApplication.load())
2047 
2048  return (*fApplication).ProcessLine(sline, kTRUE, error);
2049 }
2050 
2051 ////////////////////////////////////////////////////////////////////////////////
2052 /// Process interpreter command directly via CINT interpreter.
2053 /// Only executable statements are allowed (no variable declarations),
2054 /// In all other cases use TROOT::ProcessLine().
2055 /// The possible error codes are defined by TInterpreter::EErrorCode.
2056 
2058 {
2059  TString sline = line;
2060  sline = sline.Strip(TString::kBoth);
2061 
2062  if (!fApplication.load())
2064 
2065  Long_t result = 0;
2066 
2067  if (fInterpreter) {
2069  result = gInterpreter->Calc(sline, code);
2070  }
2071 
2072  return result;
2073 }
2074 
2075 ////////////////////////////////////////////////////////////////////////////////
2076 /// Read Git commit information and branch name from the
2077 /// etc/gitinfo.txt file.
2078 
2080 {
2081 #ifdef ROOT_GIT_COMMIT
2082  fGitCommit = ROOT_GIT_COMMIT;
2083 #endif
2084 #ifdef ROOT_GIT_BRANCH
2085  fGitBranch = ROOT_GIT_BRANCH;
2086 #endif
2087 
2088  TString gitinfo = "gitinfo.txt";
2089  char *filename = gSystem->ConcatFileName(TROOT::GetEtcDir(), gitinfo);
2090 
2091  FILE *fp = fopen(filename, "r");
2092  if (fp) {
2093  TString s;
2094  // read branch name
2095  s.Gets(fp);
2096  fGitBranch = s;
2097  // read commit SHA1
2098  s.Gets(fp);
2099  fGitCommit = s;
2100  // read date/time make was run
2101  s.Gets(fp);
2102  fGitDate = s;
2103  fclose(fp);
2104  }
2105  delete [] filename;
2106 }
2107 
2109  TTHREAD_TLS(Bool_t) fgReadingObject = false;
2110  return fgReadingObject;
2111 }
2112 
2113 ////////////////////////////////////////////////////////////////////////////////
2114 /// Deprecated (will be removed in next release).
2115 
2117 {
2118  return GetReadingObject();
2119 }
2120 
2122 {
2123  GetReadingObject() = flag;
2124 }
2125 
2126 
2127 ////////////////////////////////////////////////////////////////////////////////
2128 /// Return date/time make was run.
2129 
2130 const char *TROOT::GetGitDate()
2131 {
2132  if (fGitDate == "") {
2133  Int_t iday,imonth,iyear, ihour, imin;
2134  static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2135  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
2136  Int_t idate = gROOT->GetBuiltDate();
2137  Int_t itime = gROOT->GetBuiltTime();
2138  iday = idate%100;
2139  imonth = (idate/100)%100;
2140  iyear = idate/10000;
2141  ihour = itime/100;
2142  imin = itime%100;
2143  fGitDate.Form("%s %02d %4d, %02d:%02d:00", months[imonth-1], iday, iyear, ihour, imin);
2144  }
2145  return fGitDate;
2146 }
2147 
2148 ////////////////////////////////////////////////////////////////////////////////
2149 /// Refresh all browsers. Call this method when some command line
2150 /// command or script has changed the browser contents. Not needed
2151 /// for objects that have the kMustCleanup bit set. Most useful to
2152 /// update browsers that show the file system or other objects external
2153 /// to the running ROOT session.
2154 
2156 {
2157  TIter next(GetListOfBrowsers());
2158  TBrowser *b;
2159  while ((b = (TBrowser*) next()))
2160  b->SetRefreshFlag(kTRUE);
2161 }
2162 ////////////////////////////////////////////////////////////////////////////////
2163 /// Insure that the files, canvases and sockets are closed.
2164 
2165 static void CallCloseFiles()
2166 {
2167  if (TROOT::Initialized() && ROOT::Internal::gROOTLocal) {
2168  gROOT->CloseFiles();
2169  }
2170 }
2171 
2172 ////////////////////////////////////////////////////////////////////////////////
2173 /// Called by static dictionary initialization to register clang modules
2174 /// for headers. Calls TCling::RegisterModule() unless gCling
2175 /// is NULL, i.e. during startup, where the information is buffered in
2176 /// the static GetModuleHeaderInfoBuffer().
2177 
2178 void TROOT::RegisterModule(const char* modulename,
2179  const char** headers,
2180  const char** includePaths,
2181  const char* payloadCode,
2182  const char* fwdDeclCode,
2183  void (*triggerFunc)(),
2184  const TInterpreter::FwdDeclArgsToKeepCollection_t& fwdDeclsArgToSkip,
2185  const char** classesHeaders)
2186 {
2187 
2188  // First a side track to insure proper end of process behavior.
2189 
2190  // Register for each loaded dictionary (and thus for each library),
2191  // that we need to Close the ROOT files as soon as this library
2192  // might start being unloaded after main.
2193  //
2194  // By calling atexit here (rather than directly from within the
2195  // library) we make sure that this is not called if the library is
2196  // 'only' dlclosed.
2197 
2198  // On Ubuntu the linker strips the unused libraries. Eventhough
2199  // stressHistogram is explicitly linked against libNet, it is not
2200  // retained and thus is loaded only as needed in the middle part of
2201  // the execution. Concretely this also means that it is loaded
2202  // *after* the construction of the TApplication object and thus
2203  // after the registration (atexit) of the EndOfProcessCleanups
2204  // routine. Consequently, after the end of main, libNet is
2205  // unloaded before EndOfProcessCleanups is called. When
2206  // EndOfProcessCleanups is executed it indirectly needs the TClass
2207  // for TSocket and its search will use resources that have already
2208  // been unloaded (technically the function static in TUnixSystem's
2209  // DynamicPath and the dictionary from libNet).
2210 
2211  // Similarly, the ordering (before this commit) was broken in the
2212  // following case:
2213 
2214  // TApplication creation (EndOfProcessCleanups registration)
2215  // load UserLibrary
2216  // create TFile
2217  // Append UserObject to TFile
2218 
2219  // and after the end of main the order of execution was
2220 
2221  // unload UserLibrary
2222  // call EndOfProcessCleanups
2223  // Write the TFile
2224  // attempt to write the user object.
2225  // ....
2226 
2227  // where what we need is to have the files closen/written before
2228  // the unloading of the library.
2229 
2230  // To solve the problem we now register an atexit function for
2231  // every dictionary thus making sure there is at least one executed
2232  // before the first library tear down after main.
2233 
2234  // If atexit is called directly within a library's code, the
2235  // function will called *either* when the library is 'dlclose'd or
2236  // after then end of main (whichever comes first). We do *not*
2237  // want the files to be closed whenever a library is unloaded via
2238  // dlclose. To avoid this, we add the function (CallCloseFiles)
2239  // from the dictionary indirectly (via ROOT::RegisterModule). In
2240  // this case the function will only only be called either when
2241  // libCore is 'dlclose'd or right after the end of main.
2242 
2243  atexit(CallCloseFiles);
2244 
2245  // Now register with TCling.
2246  if (gCling) {
2247  gCling->RegisterModule(modulename, headers, includePaths, payloadCode, fwdDeclCode,
2248  triggerFunc, fwdDeclsArgToSkip, classesHeaders);
2249  } else {
2250  GetModuleHeaderInfoBuffer()
2251  .push_back(ModuleHeaderInfo_t (modulename, headers, includePaths, payloadCode, fwdDeclCode,
2252  triggerFunc, fwdDeclsArgToSkip,classesHeaders));
2253  }
2254 }
2255 
2256 ////////////////////////////////////////////////////////////////////////////////
2257 /// Remove a class from the list and map of classes.
2258 /// This routine is deprecated, use TClass::RemoveClass directly.
2259 
2261 {
2262  TClass::RemoveClass(oldcl);
2263 }
2264 
2265 ////////////////////////////////////////////////////////////////////////////////
2266 /// Delete all global interpreter objects created since the last call to Reset
2267 ///
2268 /// If option="a" is set reset to startup context (i.e. unload also
2269 /// all loaded files, classes, structs, typedefs, etc.).
2270 ///
2271 /// This function is typically used at the beginning (or end) of an unnamed macro
2272 /// to clean the environment.
2273 ///
2274 /// IMPORTANT WARNING:
2275 /// Do not use this call from within any function (neither compiled nor
2276 /// interpreted. This should only be used from a unnamed macro
2277 /// (which starts with a { (curly braces) ). For example, using TROOT::Reset
2278 /// from within an interpreted function will lead to the unloading of the
2279 /// dictionary and source file, including the one defining the function being
2280 /// executed.
2281 ///
2282 
2283 void TROOT::Reset(Option_t *option)
2284 {
2285  if (IsExecutingMacro()) return; //True when TMacro::Exec runs
2286  if (fInterpreter) {
2287  if (!strncmp(option, "a", 1)) {
2288  fInterpreter->Reset();
2290  } else
2291  gInterpreter->ResetGlobals();
2292 
2293  if (fGlobals) fGlobals->Unload();
2295 
2296  SaveContext();
2297  }
2298 }
2299 
2300 ////////////////////////////////////////////////////////////////////////////////
2301 /// Save the current interpreter context.
2302 
2304 {
2305  if (fInterpreter)
2306  gInterpreter->SaveGlobalsContext();
2307 }
2308 
2309 ////////////////////////////////////////////////////////////////////////////////
2310 /// Set the default graphical cut class name for the graphics editor
2311 /// By default the graphics editor creates an instance of a class TCutG.
2312 /// This function may be called to specify a different class that MUST
2313 /// derive from TCutG
2314 
2315 void TROOT::SetCutClassName(const char *name)
2316 {
2317  if (!name) {
2318  Error("SetCutClassName","Invalid class name");
2319  return;
2320  }
2321  TClass *cl = TClass::GetClass(name);
2322  if (!cl) {
2323  Error("SetCutClassName","Unknown class:%s",name);
2324  return;
2325  }
2326  if (!cl->InheritsFrom("TCutG")) {
2327  Error("SetCutClassName","Class:%s does not derive from TCutG",name);
2328  return;
2329  }
2330  fCutClassName = name;
2331 }
2332 
2333 ////////////////////////////////////////////////////////////////////////////////
2334 /// Set editor mode
2335 
2336 void TROOT::SetEditorMode(const char *mode)
2337 {
2338  fEditorMode = 0;
2339  if (!mode[0]) return;
2340  if (!strcmp(mode,"Arc")) {fEditorMode = kArc; return;}
2341  if (!strcmp(mode,"Line")) {fEditorMode = kLine; return;}
2342  if (!strcmp(mode,"Arrow")) {fEditorMode = kArrow; return;}
2343  if (!strcmp(mode,"Button")) {fEditorMode = kButton; return;}
2344  if (!strcmp(mode,"Diamond")) {fEditorMode = kDiamond; return;}
2345  if (!strcmp(mode,"Ellipse")) {fEditorMode = kEllipse; return;}
2346  if (!strcmp(mode,"Pad")) {fEditorMode = kPad; return;}
2347  if (!strcmp(mode,"Pave")) {fEditorMode = kPave; return;}
2348  if (!strcmp(mode,"PaveLabel")){fEditorMode = kPaveLabel; return;}
2349  if (!strcmp(mode,"PaveText")) {fEditorMode = kPaveText; return;}
2350  if (!strcmp(mode,"PavesText")){fEditorMode = kPavesText; return;}
2351  if (!strcmp(mode,"PolyLine")) {fEditorMode = kPolyLine; return;}
2352  if (!strcmp(mode,"CurlyLine")){fEditorMode = kCurlyLine; return;}
2353  if (!strcmp(mode,"CurlyArc")) {fEditorMode = kCurlyArc; return;}
2354  if (!strcmp(mode,"Text")) {fEditorMode = kText; return;}
2355  if (!strcmp(mode,"Marker")) {fEditorMode = kMarker; return;}
2356  if (!strcmp(mode,"CutG")) {fEditorMode = kCutG; return;}
2357 }
2358 
2359 ////////////////////////////////////////////////////////////////////////////////
2360 /// Change current style to style with name stylename
2361 
2362 void TROOT::SetStyle(const char *stylename)
2363 {
2364  TString style_name = stylename;
2365 
2366  TStyle *style = GetStyle(style_name);
2367  if (style) style->cd();
2368  else Error("SetStyle","Unknown style:%s",style_name.Data());
2369 }
2370 
2371 
2372 //-------- Static Member Functions ---------------------------------------------
2373 
2374 
2375 ////////////////////////////////////////////////////////////////////////////////
2376 /// Decrease the indentation level for ls().
2377 
2379 {
2380  return --fgDirLevel;
2381 }
2382 
2383 ////////////////////////////////////////////////////////////////////////////////
2384 ///return directory level
2385 
2387 {
2388  return fgDirLevel;
2389 }
2390 
2391 ////////////////////////////////////////////////////////////////////////////////
2392 /// Get macro search path. Static utility function.
2393 
2394 const char *TROOT::GetMacroPath()
2395 {
2396  TString &macroPath = ROOT::GetMacroPath();
2397 
2398  if (macroPath.Length() == 0) {
2399  macroPath = gEnv->GetValue("Root.MacroPath", (char*)0);
2400 #if defined(R__WIN32)
2401  macroPath.ReplaceAll("; ", ";");
2402 #else
2403  macroPath.ReplaceAll(": ", ":");
2404 #endif
2405  if (macroPath.Length() == 0)
2406 #if !defined(R__WIN32)
2407  macroPath = ".:" + TROOT::GetMacroDir();
2408 #else
2409  macroPath = ".;" + TROOT::GetMacroDir();
2410 #endif
2411  }
2412 
2413  return macroPath;
2414 }
2415 
2416 ////////////////////////////////////////////////////////////////////////////////
2417 /// Set or extend the macro search path. Static utility function.
2418 /// If newpath=0 or "" reset to value specified in the rootrc file.
2419 
2420 void TROOT::SetMacroPath(const char *newpath)
2421 {
2422  TString &macroPath = ROOT::GetMacroPath();
2423 
2424  if (!newpath || !*newpath)
2425  macroPath = "";
2426  else
2427  macroPath = newpath;
2428 }
2429 
2430 ////////////////////////////////////////////////////////////////////////////////
2431 /// Increase the indentation level for ls().
2432 
2434 {
2435  return ++fgDirLevel;
2436 }
2437 
2438 ////////////////////////////////////////////////////////////////////////////////
2439 /// Functions used by ls() to indent an object hierarchy.
2440 
2442 {
2443  for (int i = 0; i < fgDirLevel; i++) std::cout.put(' ');
2444 }
2445 
2446 ////////////////////////////////////////////////////////////////////////////////
2447 /// Return kTRUE if the TROOT object has been initialized.
2448 
2450 {
2451  return fgRootInit;
2452 }
2453 
2454 ////////////////////////////////////////////////////////////////////////////////
2455 /// Return kTRUE if the memory leak checker is on.
2456 
2458 {
2459  return fgMemCheck;
2460 }
2461 
2462 ////////////////////////////////////////////////////////////////////////////////
2463 /// Return Indentation level for ls().
2464 
2466 {
2467  fgDirLevel = level;
2468 }
2469 
2470 ////////////////////////////////////////////////////////////////////////////////
2471 /// Convert version code to an integer, i.e. 331527 -> 51507.
2472 
2474 {
2475  return 10000*(code>>16) + 100*((code&65280)>>8) + (code&255);
2476 }
2477 
2478 ////////////////////////////////////////////////////////////////////////////////
2479 /// Convert version as an integer to version code as used in RVersion.h.
2480 
2482 {
2483  int a = v/10000;
2484  int b = (v - a*10000)/100;
2485  int c = v - a*10000 - b*100;
2486  return (a << 16) + (b << 8) + c;
2487 }
2488 
2489 ////////////////////////////////////////////////////////////////////////////////
2490 /// Return ROOT version code as defined in RVersion.h.
2491 
2493 {
2494  return ROOT_VERSION_CODE;
2495 }
2496 
2497 ////////////////////////////////////////////////////////////////////////////////
2498 
2500  static const char** extraInterpArgs = 0;
2501  return extraInterpArgs;
2502 }
2503 
2504 ////////////////////////////////////////////////////////////////////////////////
2505 
2506 #ifdef ROOTPREFIX
2507 static Bool_t IgnorePrefix() {
2508  static Bool_t ignorePrefix = gSystem->Getenv("ROOTIGNOREPREFIX");
2509  return ignorePrefix;
2510 }
2511 #endif
2512 
2513 ////////////////////////////////////////////////////////////////////////////////
2514 /// Get the rootsys directory in the installation. Static utility function.
2515 
2517 #ifdef ROOTPREFIX
2518  if (IgnorePrefix()) {
2519 #endif
2520  static TString rootsys;
2521  if (rootsys.IsNull())
2522  rootsys = gSystem->Getenv("ROOTSYS");
2523  if (rootsys.IsNull())
2524  rootsys = gRootDir;
2525  return rootsys;
2526 #ifdef ROOTPREFIX
2527  } else {
2528  const static TString rootsys = ROOTPREFIX;
2529  return rootsys;
2530  }
2531 #endif
2532 }
2533 
2534 ////////////////////////////////////////////////////////////////////////////////
2535 /// Get the binary directory in the installation. Static utility function.
2536 
2538 #ifdef ROOTBINDIR
2539  if (IgnorePrefix()) {
2540 #endif
2541  static TString rootbindir;
2542  if (rootbindir.IsNull()) {
2543  rootbindir = "bin";
2544  gSystem->PrependPathName(GetRootSys(), rootbindir);
2545  }
2546  return rootbindir;
2547 #ifdef ROOTBINDIR
2548  } else {
2549  const static TString rootbindir = ROOTBINDIR;
2550  return rootbindir;
2551  }
2552 #endif
2553 }
2554 
2555 ////////////////////////////////////////////////////////////////////////////////
2556 /// Get the library directory in the installation. Static utility function.
2557 
2559 #ifdef ROOTLIBDIR
2560  if (IgnorePrefix()) {
2561 #endif
2562  static TString rootlibdir;
2563  if (rootlibdir.IsNull()) {
2564  rootlibdir = "lib";
2565  gSystem->PrependPathName(GetRootSys(), rootlibdir);
2566  }
2567  return rootlibdir;
2568 #ifdef ROOTLIBDIR
2569  } else {
2570  const static TString rootlibdir = ROOTLIBDIR;
2571  return rootlibdir;
2572  }
2573 #endif
2574 }
2575 
2576 ////////////////////////////////////////////////////////////////////////////////
2577 /// Get the include directory in the installation. Static utility function.
2578 
2580 #ifdef ROOTINCDIR
2581  if (IgnorePrefix()) {
2582 #endif
2583  static TString rootincdir;
2584  if (rootincdir.IsNull()) {
2585  rootincdir = "include";
2586  gSystem->PrependPathName(GetRootSys(), rootincdir);
2587  }
2588  return rootincdir;
2589 #ifdef ROOTINCDIR
2590  } else {
2591  const static TString rootincdir = ROOTINCDIR;
2592  return rootincdir;
2593  }
2594 #endif
2595 }
2596 
2597 ////////////////////////////////////////////////////////////////////////////////
2598 /// Get the sysconfig directory in the installation. Static utility function.
2599 
2601 #ifdef ROOTETCDIR
2602  if (IgnorePrefix()) {
2603 #endif
2604  static TString rootetcdir;
2605  if (rootetcdir.IsNull()) {
2606  rootetcdir = "etc";
2607  gSystem->PrependPathName(GetRootSys(), rootetcdir);
2608  }
2609  return rootetcdir;
2610 #ifdef ROOTETCDIR
2611  } else {
2612  const static TString rootetcdir = ROOTETCDIR;
2613  return rootetcdir;
2614  }
2615 #endif
2616 }
2617 
2618 ////////////////////////////////////////////////////////////////////////////////
2619 /// Get the data directory in the installation. Static utility function.
2620 
2622 #ifdef ROOTDATADIR
2623  if (IgnorePrefix()) {
2624 #endif
2625  return GetRootSys();
2626 #ifdef ROOTDATADIR
2627  } else {
2628  const static TString rootdatadir = ROOTDATADIR;
2629  return rootdatadir;
2630  }
2631 #endif
2632 }
2633 
2634 ////////////////////////////////////////////////////////////////////////////////
2635 /// Get the documentation directory in the installation. Static utility function.
2636 
2638 #ifdef ROOTDOCDIR
2639  if (IgnorePrefix()) {
2640 #endif
2641  return GetRootSys();
2642 #ifdef ROOTDOCDIR
2643  } else {
2644  const static TString rootdocdir = ROOTDOCDIR;
2645  return rootdocdir;
2646  }
2647 #endif
2648 }
2649 
2650 ////////////////////////////////////////////////////////////////////////////////
2651 /// Get the macro directory in the installation. Static utility function.
2652 
2654 #ifdef ROOTMACRODIR
2655  if (IgnorePrefix()) {
2656 #endif
2657  static TString rootmacrodir;
2658  if (rootmacrodir.IsNull()) {
2659  rootmacrodir = "macros";
2660  gSystem->PrependPathName(GetRootSys(), rootmacrodir);
2661  }
2662  return rootmacrodir;
2663 #ifdef ROOTMACRODIR
2664  } else {
2665  const static TString rootmacrodir = ROOTMACRODIR;
2666  return rootmacrodir;
2667  }
2668 #endif
2669 }
2670 
2671 ////////////////////////////////////////////////////////////////////////////////
2672 /// Get the tutorials directory in the installation. Static utility function.
2673 
2675 #ifdef ROOTTUTDIR
2676  if (IgnorePrefix()) {
2677 #endif
2678  static TString roottutdir;
2679  if (roottutdir.IsNull()) {
2680  roottutdir = "tutorials";
2681  gSystem->PrependPathName(GetRootSys(), roottutdir);
2682  }
2683  return roottutdir;
2684 #ifdef ROOTTUTDIR
2685  } else {
2686  const static TString roottutdir = ROOTTUTDIR;
2687  return roottutdir;
2688  }
2689 #endif
2690 }
2691 
2692 ////////////////////////////////////////////////////////////////////////////////
2693 /// Get the source directory in the installation. Static utility function.
2694 
2696 #ifdef ROOTSRCDIR
2697  if (IgnorePrefix()) {
2698 #endif
2699  static TString rootsrcdir;
2700  if (rootsrcdir.IsNull()) {
2701  rootsrcdir = "src";
2702  gSystem->PrependPathName(GetRootSys(), rootsrcdir);
2703  }
2704  return rootsrcdir;
2705 #ifdef ROOTSRCDIR
2706  } else {
2707  const static TString rootsrcdir = ROOTSRCDIR;
2708  return rootsrcdir;
2709  }
2710 #endif
2711 }
2712 
2713 ////////////////////////////////////////////////////////////////////////////////
2714 /// Get the icon path in the installation. Static utility function.
2715 
2717 #ifdef ROOTICONPATH
2718  if (IgnorePrefix()) {
2719 #endif
2720  static TString rooticonpath;
2721  if (rooticonpath.IsNull()) {
2722  rooticonpath = "icons";
2723  gSystem->PrependPathName(GetRootSys(), rooticonpath);
2724  }
2725  return rooticonpath;
2726 #ifdef ROOTICONPATH
2727  } else {
2728  const static TString rooticonpath = ROOTICONPATH;
2729  return rooticonpath;
2730  }
2731 #endif
2732 }
2733 
2734 ////////////////////////////////////////////////////////////////////////////////
2735 /// Get the fonts directory in the installation. Static utility function.
2736 
2738 #ifdef TTFFONTDIR
2739  if (IgnorePrefix()) {
2740 #endif
2741  static TString ttffontdir;
2742  if (ttffontdir.IsNull()) {
2743  ttffontdir = "fonts";
2744  gSystem->PrependPathName(GetRootSys(), ttffontdir);
2745  }
2746  return ttffontdir;
2747 #ifdef TTFFONTDIR
2748  } else {
2749  const static TString ttffontdir = TTFFONTDIR;
2750  return ttffontdir;
2751  }
2752 #endif
2753 }
TSeqCollection * fStreamerInfo
Definition: TROOT.h:144
virtual const char * GetTypeName() const
Get type of global variable, e,g.
Definition: TGlobal.cxx:111
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
Definition: TBrowser.cxx:259
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:912
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1213
Bool_t fExecutingMacro
Definition: TROOT.h:121
void AddClass(TClass *cl)
Add a class to the list and map of classes.
Definition: TROOT.cxx:802
virtual void Add(TObject *obj)
TListOfFunctionTemplates * fFuncTemplate
Definition: TROOT.h:127
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:864
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
Definition: TROOT.cxx:2737
TInterpreter * CreateInterpreter_t(void *shlibHandle)
Definition: TInterpreter.h:498
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:32
R__EXTERN TGuiFactory * gBatchGuiFactory
Definition: TGuiFactory.h:69
A collection of TDataMember objects designed for fast access given a DeclId_t and for keep track of T...
Semi-Abstract base class defining a generic interface to the underlying, low level, native graphics backend (X11, Win32, MacOS, OpenGL...).
Definition: TVirtualX.h:70
virtual TString SplitAclicMode(const char *filename, TString &mode, TString &args, TString &io) const
This method split a filename of the form: ~~~ {.cpp} [path/]macro.C[+|++[k|f|g|O|c|s|d|v|-]][(args)]...
Definition: TSystem.cxx:3950
An array of TObjects.
Definition: TObjArray.h:39
virtual void Clear(Option_t *option="")=0
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Definition: TROOT.cxx:2378
static Bool_t BlockAllSignals(Bool_t b)
Block or unblock all signals. Returns the previous block status.
Definition: TQObject.cxx:1323
TFolder * fRootFolder
Definition: TROOT.h:152
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
Definition: vector.h:433
TCollection * GetListOfEnums(Bool_t load=kFALSE)
Definition: TROOT.cxx:1438
ROOT top level object description.
Definition: TROOT.h:80
static const TString & GetMacroDir()
Get the macro directory in the installation. Static utility function.
Definition: TROOT.cxx:2653
void * DestroyInterpreter_t(TInterpreter *)
Definition: TInterpreter.h:499
This class is a specialized TProcessID managing the list of UUIDs.
Definition: TProcessUUID.h:34
TSeqCollection * fProofs
Definition: TROOT.h:147
TClass * FindSTLClass(const char *name, Bool_t load, Bool_t silent=kFALSE) const
return a TClass object corresponding to &#39;name&#39; assuming it is an STL container.
Definition: TROOT.cxx:1179
void RemoveClass(TClass *)
Remove a class from the list and map of classes.
Definition: TROOT.cxx:2260
TCollection * GetListOfGlobalFunctions(Bool_t load=kFALSE)
Return list containing the TFunctions currently defined.
Definition: TROOT.cxx:1507
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:865
Int_t LoadMacro(const char *filename, Int_t *error=0, Bool_t check=kFALSE)
Load a macro in the interpreter&#39;s memory.
Definition: TROOT.cxx:1918
virtual void Build(TFile *motherFile=0, TDirectory *motherDir=0)
Initialise directory to defaults.
Definition: TDirectory.cxx:198
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:487
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
static const char **& GetExtraInterpreterArgs()
Definition: TROOT.cxx:2499
Ssiz_t Length() const
Definition: TString.h:390
TLine * line
TSeqCollection * fGeometries
Definition: TROOT.h:139
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:97
Handle messages that might be generated by the system.
TStyle * GetStyle(const char *name) const
Return pointer to style with name.
Definition: TROOT.cxx:1274
TDictionary::DeclId_t DeclId_t
Definition: TInterpreter.h:236
virtual TObject * FindObject(const char *name) const
Returns address of a ROOT object if it exists.
Definition: TROOT.cxx:1012
const char Option_t
Definition: RtypesCore.h:62
Dictionary for function template This class describes one single function template.
static TVirtualX *& Instance()
Returns gVirtualX global.
Definition: TVirtualX.cxx:56
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
#define ROOT_RELEASE_TIME
Definition: RVersion.h:19
TList * fList
Definition: TDirectory.h:96
static const TString & GetIconPath()
Get the icon path in the installation. Static utility function.
Definition: TROOT.cxx:2716
R__EXTERN TVirtualMutex * gInterpreterMutex
Definition: TInterpreter.h:46
This class represents a WWW compatible URL.
Definition: TUrl.h:41
Int_t fVersionDate
Definition: TROOT.h:103
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
Definition: Buttons.h:33
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1311
Bool_t fForceStyle
Definition: TROOT.h:118
virtual void HandleMessage(Int_t id, const TObject *obj)
Store message origin, keep statistics and call Notify().
#define gDirectory
Definition: TDirectory.h:218
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
static Int_t RootVersionCode()
Return ROOT version code as defined in RVersion.h.
Definition: TROOT.cxx:2492
static Bool_t MemCheck()
Return kTRUE if the memory leak checker is on.
Definition: TROOT.cxx:2457
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
TString fVersion
Definition: TROOT.h:100
void R__SetZipMode(int)
virtual const char * HomeDirectory(const char *userName=0)
Return the user&#39;s home directory.
Definition: TSystem.cxx:873
#define ROOT_RELEASE_DATE
Definition: RVersion.h:18
virtual void AddAll(const TCollection *col)
Add all objects from collection col to this collection.
Definition: TCollection.cxx:57
static void SetObjectStat(Bool_t stat)
Turn on/off tracking of objects in the TObjectTable.
Definition: TObject.cxx:999
This class implements a mutex interface.
Definition: TVirtualMutex.h:34
virtual TObject * FindObject(const char *name) const
Specialize FindObject to do search for the a function just by name or create it if its not already in...
#define sym(otri1, otri2)
Definition: triangle.c:932
static const char * filename()
void InitInterpreter()
Initialize the interpreter.
Definition: TROOT.cxx:1720
#define gROOT
Definition: TROOT.h:352
void LoadHandlersFromEnv(TEnv *env)
Load plugin handlers specified in config file, like: Plugin.TFile: ^rfio: TRFIOFile RFI...
TROOT * GetROOT2()
Definition: TROOT.cxx:358
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1766
The TEnv class reads config files, by default named .rootrc.
Definition: TEnv.h:128
Basic string class.
Definition: TString.h:137
TSeqCollection * GetListOfStyles() const
Definition: TROOT.h:225
void RefreshBrowsers()
Refresh all browsers.
Definition: TROOT.cxx:2155
void ls(Option_t *option="") const
To list all objects of the application.
Definition: TROOT.cxx:1900
TString & GetMacroPath()
Definition: TROOT.cxx:379
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TSeqCollection * GetListOfColors() const
Definition: TROOT.h:216
TArc * a
Definition: textangle.C:12
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
Definition: TInterpreter.h:108
const Bool_t kFALSE
Definition: Rtypes.h:92
static const TString & GetRootSys()
Get the rootsys directory in the installation. Static utility function.
Definition: TROOT.cxx:2516
#define gInterpreter
Definition: TInterpreter.h:502
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
Definition: TSystem.cxx:1459
Int_t fVersionCode
Definition: TROOT.h:102
void Reset(Option_t *option="")
Delete all global interpreter objects created since the last call to Reset.
Definition: TROOT.cxx:2283
Definition: Buttons.h:30
void Load()
Load all the DataMembers known to the interpreter for the scope &#39;fClass&#39; into this collection...
TCollection * GetListOfFunctionOverloads(const char *name) const
Return the collection of functions named "name".
Definition: TROOT.cxx:1356
TFunction * Get(DeclId_t id)
Return (after creating it if necessary) the TMethod or TFunction describing the function correspondin...
This class registers for all classes their name, id and dictionary function in a hash table...
Definition: TClassTable.h:40
STL namespace.
#define ROOT_VERSION_CODE
Definition: RVersion.h:21
virtual void ResetSignals()
Reset signals handlers to previous behaviour.
Definition: TSystem.cxx:588
std::atomic< TApplication * > fApplication
Definition: TROOT.h:111
void SetStyle(const char *stylename="Default")
Change current style to style with name stylename.
Definition: TROOT.cxx:2362
TCollection * GetListOfGlobals(Bool_t load=kFALSE)
Return list containing the TGlobals currently defined.
Definition: TROOT.cxx:1472
TString fGitCommit
Definition: TROOT.h:107
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:558
static const TString & GetIncludeDir()
Get the include directory in the installation. Static utility function.
Definition: TROOT.cxx:2579
TROOT * GetROOT1()
Definition: TROOT.cxx:351
TObject * GetGeometry(const char *name) const
Return pointer to Geometry with name.
Definition: TROOT.cxx:1431
TSeqCollection * GetListOfBrowsers() const
Definition: TROOT.h:229
Bool_t R_ISREG(Int_t mode)
Definition: TSystem.h:129
virtual void AddLast(TObject *obj)
Add object at the end of the list.
Definition: TList.cxx:136
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
TString fCutClassName
Definition: TROOT.h:155
Bool_t & GetReadingObject()
Definition: TROOT.cxx:2108
TListOfFunctions * GetGlobalFunctions()
Internal routine returning, and creating if necessary, the list of global function.
Definition: TROOT.cxx:1347
TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE) const
Return pointer to class with name. Obsolete, use TClass::GetClass directly.
Definition: TROOT.cxx:1213
static Int_t fgDirLevel
Definition: TROOT.h:88
Definition: Buttons.h:30
static const char * GetMacroPath()
Get macro search path. Static utility function.
Definition: TROOT.cxx:2394
TInterpreter * fInterpreter
Definition: TROOT.h:112
Int_t fMode
Definition: TSystem.h:138
static TList & GetEarlyRegisteredGlobals()
Definition: TGlobal.cxx:171
const char * GetGitDate()
Return date/time make was run.
Definition: TROOT.cxx:2130
virtual void cd()
Change current style.
Definition: TStyle.cxx:303
virtual void ls(Option_t *option="") const
List Directory contents.
Definition: TDirectory.cxx:998
AListOfEnums_t fEnums
Definition: TROOT.h:150
const char * Data() const
Definition: TString.h:349
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:946
TSeqCollection * fMappedFiles
Definition: TROOT.h:132
virtual void Delete(Option_t *option="")=0
Delete this object.
#define SafeDelete(p)
Definition: RConfig.h:449
Sequenceable collection abstract base class.
THashTable implements a hash table to store TObject&#39;s.
Definition: THashTable.h:39
static TVirtualPad *& Pad()
Return the current pad for the current thread.
Definition: TVirtualPad.cxx:29
Int_t fVersionInt
Definition: TROOT.h:101
virtual TObject * Last() const =0
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:36
void SetEditorMode(const char *mode="")
Set editor mode.
Definition: TROOT.cxx:2336
const char * FindObjectClassName(const char *name) const
Returns class name of a ROOT object including CINT globals.
Definition: TROOT.cxx:1148
static Int_t ReadRules()
Read the class.rules files from the default location:.
Definition: TClass.cxx:1718
TSeqCollection * fCleanups
Definition: TROOT.h:142
Int_t fEditorMode
Definition: TROOT.h:122
Bool_t fMustClean
Definition: TROOT.h:116
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
Definition: TROOT.cxx:2449
void EndOfProcessCleanups()
Execute the cleanups necessary at the end of the process, in particular those that must be executed b...
Definition: TROOT.cxx:964
static Bool_t fgRootInit
Definition: TROOT.h:89
Long_t ProcessLineSync(const char *line, Int_t *error=0)
Process interpreter command via TApplication::ProcessLine().
Definition: TROOT.cxx:2040
void Message(Int_t id, const TObject *obj)
Process message id called by obj.
Definition: TROOT.cxx:2000
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1575
static const TString & GetDocDir()
Get the documentation directory in the installation. Static utility function.
Definition: TROOT.cxx:2637
TCollection * GetListOfFunctionTemplates()
Definition: TROOT.cxx:1455
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Definition: TSystem.cxx:1038
static Int_t ITIMQQ(const char *time)
Return built time as integer (with min precision), i.e.
Definition: TROOT.cxx:197
virtual void EnableAutoLoading()=0
void SaveContext()
Save the current interpreter context.
Definition: TROOT.cxx:2303
virtual void Close(Option_t *option="")
Delete all objects from memory and directory structure itself.
Definition: TDirectory.cxx:517
virtual void Delete(Option_t *option="")
Delete all TFunction object files.
static void at_exit_of_TROOT()
Definition: TROOT.cxx:269
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
TSeqCollection * fClipboard
Definition: TROOT.h:148
virtual void Initialize()=0
TFolder * AddFolder(const char *name, const char *title, TCollection *collection=0)
Create a new folder and add it to the list of folders of this folder, return a pointer to the created...
Definition: TFolder.cxx:184
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
R__EXTERN TGuiFactory * gGuiFactory
Definition: TGuiFactory.h:68
static void Cleanup()
static function (called by TROOT destructor) to delete all TProcessIDs
Definition: TProcessID.cxx:173
void Error(const char *location, const char *msgfmt,...)
R__EXTERN TPluginManager * gPluginMgr
Definition: Buttons.h:38
Bool_t fEscape
Definition: TROOT.h:120
TSeqCollection * fFiles
Definition: TROOT.h:131
Describes an Operating System directory for the browser.
TCollection * fClasses
Definition: TROOT.h:125
A doubly linked list.
Definition: TList.h:47
Long_t Macro(const char *filename, Int_t *error=0, Bool_t padUpdate=kTRUE)
Execute a macro in the interpreter.
Definition: TROOT.cxx:1966
R__EXTERN TVirtualMutex * gGlobalMutex
Definition: TVirtualMutex.h:29
TStyle objects may be created to define special styles.
Definition: TStyle.h:52
R__EXTERN TROOT * gROOTLocal
Definition: TROOT.h:349
TSeqCollection * GetListOfGeometries() const
Definition: TROOT.h:228
Bool_t fEditHistograms
Definition: TROOT.h:114
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual void AddLast(TObject *obj)=0
Bool_t ClassSaved(TClass *cl)
return class status bit kClassSaved for class cl This function is called by the SavePrimitive functio...
Definition: TROOT.cxx:840
Int_t fVersionTime
Definition: TROOT.h:104
static void RegisterModule(const char *modulename, const char **headers, const char **includePaths, const char *payLoadCode, const char *fwdDeclCode, void(*triggerFunc)(), const FwdDeclArgsToKeepCollection_t &fwdDeclsArgToSkip, const char **classesHeaders)
Called by static dictionary initialization to register clang modules for headers. ...
Definition: TROOT.cxx:2178
R__EXTERN TVirtualX * gGXBatch
Definition: TVirtualX.h:365
static Bool_t fgMemCheck
Definition: TROOT.h:90
TSeqCollection * fDataSets
Definition: TROOT.h:149
Definition: Buttons.h:33
TSeqCollection * fMessageHandlers
Definition: TROOT.h:143
Bool_t ReadingObject() const
Deprecated (will be removed in next release).
Definition: TROOT.cxx:2116
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2220
void Browse(TBrowser *b)
Add browsable objects to TBrowser.
Definition: TROOT.cxx:821
virtual Bool_t Init()
Initialize the OS interface.
Definition: TSystem.cxx:186
void AddClassGenerator(TClassGenerator *gen)
Add a class generator.
Definition: TROOT.cxx:812
TString fDefCanvasName
Definition: TROOT.h:156
R__EXTERN TSystem * gSystem
Definition: TSystem.h:545
void SetCutClassName(const char *name="TCutG")
Set the default graphical cut class name for the graphics editor By default the graphics editor creat...
Definition: TROOT.cxx:2315
Definition: Buttons.h:33
SVector< double, 2 > v
Definition: Dict.h:5
void GetNormalizedName(std::string &norm_name, std::string_view name)
Return the normalized name.
Definition: TClassEdit.cxx:787
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:46
Int_t gDebug
Definition: TROOT.cxx:413
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:480
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:187
TPluginManager * fPluginManager
Definition: TROOT.h:154
TString fGitBranch
Definition: TROOT.h:108
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:391
Bool_t Gets(FILE *fp, Bool_t chop=kTRUE)
Read one line from the stream, including the , or until EOF.
Definition: Stringio.cxx:198
TSeqCollection * fSecContexts
Definition: TROOT.h:146
Collection abstract base class.
Definition: TCollection.h:48
void(* VoidFuncPtr_t)()
Definition: Rtypes.h:74
void SetRefreshFlag(Bool_t flag)
Definition: TBrowser.h:101
static Int_t ConvertVersionCode2Int(Int_t code)
Convert version code to an integer, i.e. 331527 -> 51507.
Definition: TROOT.cxx:2473
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
void ReadGitInfo()
Read Git commit information and branch name from the etc/gitinfo.txt file.
Definition: TROOT.cxx:2079
Short_t GetDeclFileLine() const
Definition: TClass.h:387
virtual void RegisterModule(const char *, const char **, const char **, const char *, const char *, void(*)(), const FwdDeclArgsToKeepCollection_t &fwdDeclArgsToKeep, const char **classesHeaders)=0
static void EnableStatistics(int size=-1, int ix=-1)
Enable memory usage statistics gathering.
Definition: TStorage.cxx:433
This class implements a plugin library manager.
static const TString & GetSourceDir()
Get the source directory in the installation. Static utility function.
Definition: TROOT.cxx:2695
Int_t LoadClass(const char *classname, const char *libname, Bool_t check=kFALSE)
Check if class "classname" is known to the interpreter (in fact, this check is not needed anymore...
Definition: TROOT.cxx:1832
Objects following this interface can be passed onto the TROOT object to implement a user customized w...
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2441
static TProcessID * AddProcessID()
Static function to add a new TProcessID to the list of PIDs.
Definition: TProcessID.cxx:89
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1069
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
virtual void SaveContext()=0
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:29
Bool_t IsNull() const
Definition: TString.h:387
TSeqCollection * GetListOfFiles() const
Definition: TROOT.h:221
virtual TObjLink * FirstLink() const
Definition: TList.h:101
A collection of TDataType designed to hold the typedef information and numerical type information...
Definition: TListOfTypes.h:32
void SetName(const char *name)
Definition: TCollection.h:116
TROOT * GetROOT()
Definition: TROOT.cxx:375
static TInterpreter * Instance()
returns gInterpreter global
void InitSystem()
Initialize operating system interface.
Definition: TROOT.cxx:1644
#define gVirtualX
Definition: TVirtualX.h:362
TSeqCollection * fSpecials
Definition: TROOT.h:141
TGlobal * GetGlobal(const char *name, Bool_t load=kFALSE) const
Return pointer to global variable by name.
Definition: TROOT.cxx:1315
#define R__LOCKGUARD2(mutex)
static void CreateApplication()
Static function used to create a default application environment.
static void RemoveClass(TClass *cl)
static: Remove a class from the list and map of classes
Definition: TClass.cxx:476
Bool_t IsExecutingMacro() const
Definition: TROOT.h:263
TString fGitDate
Definition: TROOT.h:109
static void SetDirLevel(Int_t level=0)
Return Indentation level for ls().
Definition: TROOT.cxx:2465
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
long Long_t
Definition: RtypesCore.h:50
Option_t * GetOption() const
Definition: TCollection.h:160
The Canvas class.
Definition: TCanvas.h:48
TListOfFunctions * fGlobalFunctions
Definition: TROOT.h:129
Long_t ProcessLine(const char *line, Int_t *error=0)
Process interpreter command via TApplication::ProcessLine().
Definition: TROOT.cxx:2020
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
virtual Int_t GetSize() const
Definition: TCollection.h:95
TSeqCollection * fCanvases
Definition: TROOT.h:134
virtual TObject * FindObjectAnyFile(const char *name) const
Scan the memory lists of all files for an object with name.
Definition: TROOT.cxx:1131
static void BuildStyles()
Create some standard styles.
Definition: TStyle.cxx:287
virtual void SetName(const char *newname)
Set the name for directory If the directory name is changed after the directory was written once...
#define ClassImp(name)
Definition: Rtypes.h:279
double f(double x)
void EnableThreadSafety()
Enables the global mutex to make ROOT thread safe/aware.
Definition: TROOT.cxx:386
TFunction * GetGlobalFunctionWithPrototype(const char *name, const char *proto=0, Bool_t load=kFALSE)
Return pointer to global function by name.
Definition: TROOT.cxx:1402
void SetReadingObject(Bool_t flag=kTRUE)
Definition: TROOT.cxx:2121
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:415
char * DynamicPathName(const char *lib, Bool_t quiet=kFALSE)
Find a dynamic library called lib using the system search paths.
Definition: TSystem.cxx:1894
TString fConfigOptions
Definition: TROOT.h:98
void InitThreads()
Load and initialize thread library.
Definition: TROOT.cxx:1709
void Unload()
Mark &#39;all func&#39; as being unloaded.
Describe directory structure in memory.
Definition: TDirectory.h:41
static TDirectory *& CurrentDirectory()
Return the current directory for the current thread.
Definition: TDirectory.cxx:316
virtual TObject * First() const =0
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
static void AddClass(TClass *cl)
static: Add a class to the list and map of classes.
Definition: TClass.cxx:450
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
Definition: TROOT.cxx:2600
Definition: Buttons.h:31
Bool_t fFromPopUp
Definition: TROOT.h:115
static RooMathCoreReg dummy
Int_t fTimer
Definition: TROOT.h:110
TCanvas * style()
Definition: style.C:1
static void CallCloseFiles()
Insure that the files, canvases and sockets are closed.
Definition: TROOT.cxx:2165
TCanvas * MakeDefCanvas() const
Return a default canvas.
Definition: TROOT.cxx:1249
Bool_t fBatch
Definition: TROOT.h:113
Long_t ProcessLineFast(const char *line, Int_t *error=0)
Process interpreter command directly via CINT interpreter.
Definition: TROOT.cxx:2057
void CloseFiles()
Close any files and sockets that gROOT knows about.
Definition: TROOT.cxx:886
virtual ~TROOT()
Clean up and free resources used by ROOT (files, network sockets, shared memory segments, etc.).
Definition: TROOT.cxx:677
#define R__LOCKGUARD(mutex)
The color creation and management class.
Definition: TColor.h:23
TSeqCollection * fStyles
Definition: TROOT.h:135
virtual void Add(TObject *obj)=0
virtual void CleanCompiledMacros()
Remove the shared libs produced by the CompileMacro() function.
Definition: TSystem.cxx:4035
Bool_t fReadingObject
Definition: TROOT.h:117
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2871
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:348
TCollection * fClassGenerators
Definition: TROOT.h:145
Int_t IgnoreInclude(const char *fname, const char *expandedfname)
Return 1 if the name of the given include file corresponds to a class that is known to ROOT...
Definition: TROOT.cxx:1594
static TClass * LoadClass(const char *requestedname, Bool_t silent)
Helper function used by TClass::GetClass().
Definition: TClass.cxx:5359
virtual void Reset()=0
virtual void Delete(Option_t *option="")
Delete all TDataMember object files.
#define name(a, b)
Definition: linkTestLib0.cpp:5
const char * FindObjectPathName(const TObject *obj) const
Return path name of obj somewhere in the //root/...
Definition: TROOT.cxx:1168
static Int_t GetDirLevel()
return directory level
Definition: TROOT.cxx:2386
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at //root.
Definition: TROOT.cxx:1121
Int_t fBuiltTime
Definition: TROOT.h:106
Mother of all ROOT objects.
Definition: TObject.h:58
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
This ABC is a factory for GUI components.
Definition: TGuiFactory.h:44
TFunction * GetGlobalFunction(const char *name, const char *params=0, Bool_t load=kFALSE)
Return pointer to global function by name.
Definition: TROOT.cxx:1369
std::vector< std::pair< std::string, int > > FwdDeclArgsToKeepCollection_t
Definition: TROOT.h:172
static Int_t ConvertVersionInt2Code(Int_t v)
Convert version as an integer to version code as used in RVersion.h.
Definition: TROOT.cxx:2481
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
Definition: TROOT.cxx:2433
typedef void((*Func_t)())
TCollection * GetListOfTypes(Bool_t load=kFALSE)
Return a dynamic list giving access to all TDataTypes (typedefs) currently defined.
Definition: TROOT.cxx:1546
TFile * GetFile() const
Definition: TROOT.h:244
static const TString & GetDataDir()
Get the data directory in the installation. Static utility function.
Definition: TROOT.cxx:2621
Int_t fBuiltDate
Definition: TROOT.h:105
void Unload()
Mark &#39;all func&#39; as being unloaded.
const char * GetDeclFileName() const
Definition: TClass.h:386
TFunctionTemplate * GetFunctionTemplate(const char *name)
Definition: TROOT.cxx:1302
TDataType * GetType(const char *name, Bool_t load=kFALSE) const
Return pointer to type with name.
Definition: TROOT.cxx:1257
void Load()
Load all the functions known to the interpreter for the scope &#39;fClass&#39; into this collection.
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at this folder.
Definition: TFolder.cxx:350
TColor * GetColor(Int_t color) const
Return address of color with index color.
Definition: TROOT.cxx:1231
TCollection * fFunctions
Definition: TROOT.h:136
static void SetMacroPath(const char *newpath)
Set or extend the macro search path.
Definition: TROOT.cxx:2420
TROOT *(* GetROOTFun_t)()
Definition: TROOT.cxx:368
static Int_t IDATQQ(const char *date)
Return built date as integer, i.e. "Apr 28 2000" -> 20000428.
Definition: TROOT.cxx:176
virtual void Add(TObject *obj)
Definition: TList.h:81
const Ssiz_t kNPOS
Definition: Rtypes.h:115
TListOfDataMembers * fGlobals
Definition: TROOT.h:128
static const TString & GetLibDir()
Get the library directory in the installation. Static utility function.
Definition: TROOT.cxx:2558
R__EXTERN const char * gRootDir
Definition: TSystem.h:233
TSeqCollection * fClosedObjects
Definition: TROOT.h:130
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
TObject * GetFunction(const char *name) const
Return pointer to function with name.
Definition: TROOT.cxx:1282
#define ROOT_RELEASE
Definition: RVersion.h:17
TF1 * f1
Definition: legend1.C:11
static Int_t IVERSQ()
Return version id as an integer, i.e. "2.22/04" -> 22204.
Definition: TROOT.cxx:166
Int_t fLineIsProcessing
Definition: TROOT.h:86
TSeqCollection * fTasks
Definition: TROOT.h:137
static void CleanUpROOTAtExit()
Clean up at program termination before global objects go out of scope.
Definition: TROOT.cxx:207
TSeqCollection * fColors
Definition: TROOT.h:138
#define NULL
Definition: Rtypes.h:82
TCollection * fTypes
Definition: TROOT.h:126
#define gPad
Definition: TVirtualPad.h:288
TSeqCollection * fBrowsers
Definition: TROOT.h:140
Bool_t IsRootFile(const char *filename) const
Return true if the file is local and is (likely) to be a ROOT file.
Definition: TROOT.cxx:1880
static GetROOTFun_t gGetROOT
Definition: TROOT.cxx:370
static const TString & GetTutorialsDir()
Get the tutorials directory in the installation. Static utility function.
Definition: TROOT.cxx:2674
static void InitializeColors()
Initialize colors used by the TCanvas based graphics (via TColor objects).
Definition: TColor.cxx:1008
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition: TROOT.cxx:2537
double result[121]
TList * fBrowsables
Definition: TROOT.h:153
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4568
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
TSeqCollection * fSockets
Definition: TROOT.h:133
TObject * FindSpecialObject(const char *name, void *&where)
Returns address and folder of a ROOT object if it exists.
Definition: TROOT.cxx:1062
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:504
R__DLLEXPORT TInterpreter * CreateInterpreter(void *interpLibHandle)
Definition: TCling.cxx:574
Bool_t fInterrupt
Definition: TROOT.h:119
Abstract base class defining a generic interface to the underlying Operating System.
Definition: TSystem.h:258
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
void Idle(UInt_t idleTimeInSec, const char *command=0)
Execute command when system has been idle for idleTimeInSec seconds.
Definition: TROOT.cxx:1558
void *(* GlobalFunc_t)()
Definition: TGlobal.h:56
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TObject.cxx:379
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
Definition: TSystem.cxx:1028
static TClass * R__GetClassIfKnown(const char *className)
Check whether className is a known class, and only autoload if we can.
Definition: TROOT.cxx:1573
TString fConfigFeatures
Definition: TROOT.h:99
TProcessUUID * fUUIDs
Definition: TROOT.h:151
static void PrintStatistics()
Print memory usage statistics.
Definition: TStorage.cxx:389
const TObject * fPrimitive
Definition: TROOT.h:123
TVirtualPad * fSelectPad
Definition: TROOT.h:124
Int_t GetNumber() const
Definition: TColor.h:58
TDictionary * Get(DeclId_t id)
Return (after creating it if necessary) the TDataMember describing the data member corresponding to t...
TROOT()
Default ctor.
Definition: TROOT.cxx:421
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904