ROOT  6.06/09
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 
421 TROOT::TROOT() : TDirectory(),
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 
494 
495  // Initialize interface to CINT C++ interpreter
496  fVersionInt = 0; // check in TROOT dtor in case TCling fails
497  fClasses = 0; // might be checked via TCling ctor
498  fEnums = 0;
499 
500  fConfigOptions = R__CONFIGUREOPTIONS;
501  fConfigFeatures = R__CONFIGUREFEATURES;
504  fVersionInt = IVERSQ();
507  fBuiltDate = IDATQQ(__DATE__);
508  fBuiltTime = ITIMQQ(__TIME__);
509 
510  ReadGitInfo();
511 
512  fClasses = new THashTable(800,3);
513  //fIdMap = new IdMap_t;
514  fStreamerInfo = new TObjArray(100);
515  fClassGenerators = new TList;
516 
517  // usedToIdentifyRootClingByDlSym is available when TROOT is part of
518  // rootcling.
519  if (!dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")) {
520  // initialize plugin manager early
522 #if defined(R__MACOSX) && (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
523  if (TARGET_OS_IPHONE | TARGET_IPHONE_SIMULATOR) {
524  TEnv plugins(".plugins-ios");
526  }
527 #endif
528  }
529 
531 
532  fTimer = 0;
533  fApplication = 0;
534  fColors = new TObjArray(1000); fColors->SetName("ListOfColors");
535  fTypes = 0;
536  fGlobals = 0;
537  fGlobalFunctions = 0;
538  // fList was created in TDirectory::Build but with different sizing.
539  delete fList;
540  fList = new THashList(1000,3);
541  fClosedObjects = new TList; fClosedObjects->SetName("ClosedFiles");
542  fFiles = new TList; fFiles->SetName("Files");
543  fMappedFiles = new TList; fMappedFiles->SetName("MappedFiles");
544  fSockets = new TList; fSockets->SetName("Sockets");
545  fCanvases = new TList; fCanvases->SetName("Canvases");
546  fStyles = new TList; fStyles->SetName("Styles");
547  fFunctions = new TList; fFunctions->SetName("Functions");
548  fTasks = new TList; fTasks->SetName("Tasks");
549  fGeometries = new TList; fGeometries->SetName("Geometries");
550  fBrowsers = new TList; fBrowsers->SetName("Browsers");
551  fSpecials = new TList; fSpecials->SetName("Specials");
552  fBrowsables = new TList; fBrowsables->SetName("Browsables");
553  fCleanups = new THashList; fCleanups->SetName("Cleanups");
554  fMessageHandlers = new TList; fMessageHandlers->SetName("MessageHandlers");
555  fSecContexts = new TList; fSecContexts->SetName("SecContexts");
556  fProofs = new TList; fProofs->SetName("Proofs");
557  fClipboard = new TList; fClipboard->SetName("Clipboard");
558  fDataSets = new TList; fDataSets->SetName("DataSets");
559  fTypes = new TListOfTypes;
560 
562  fUUIDs = new TProcessUUID();
563 
564  fRootFolder = new TFolder();
565  fRootFolder->SetName("root");
566  fRootFolder->SetTitle("root of all folders");
567  fRootFolder->AddFolder("Classes", "List of Active Classes",fClasses);
568  fRootFolder->AddFolder("Colors", "List of Active Colors",fColors);
569  fRootFolder->AddFolder("MapFiles", "List of MapFiles",fMappedFiles);
570  fRootFolder->AddFolder("Sockets", "List of Socket Connections",fSockets);
571  fRootFolder->AddFolder("Canvases", "List of Canvases",fCanvases);
572  fRootFolder->AddFolder("Styles", "List of Styles",fStyles);
573  fRootFolder->AddFolder("Functions", "List of Functions",fFunctions);
574  fRootFolder->AddFolder("Tasks", "List of Tasks",fTasks);
575  fRootFolder->AddFolder("Geometries","List of Geometries",fGeometries);
576  fRootFolder->AddFolder("Browsers", "List of Browsers",fBrowsers);
577  fRootFolder->AddFolder("Specials", "List of Special Objects",fSpecials);
578  fRootFolder->AddFolder("Handlers", "List of Message Handlers",fMessageHandlers);
579  fRootFolder->AddFolder("Cleanups", "List of RecursiveRemove Collections",fCleanups);
580  fRootFolder->AddFolder("StreamerInfo","List of Active StreamerInfo Classes",fStreamerInfo);
581  fRootFolder->AddFolder("SecContexts","List of Security Contexts",fSecContexts);
582  fRootFolder->AddFolder("PROOF Sessions", "List of PROOF sessions",fProofs);
583  fRootFolder->AddFolder("ROOT Memory","List of Objects in the gROOT Directory",fList);
584  fRootFolder->AddFolder("ROOT Files","List of Connected ROOT Files",fFiles);
585 
586  // by default, add the list of files, tasks, canvases and browsers in the Cleanups list
592 
595  fFromPopUp = kFALSE;
597  fInterrupt = kFALSE;
598  fEscape = kFALSE;
599  fMustClean = kTRUE;
600  fPrimitive = 0;
601  fSelectPad = 0;
602  fEditorMode = 0;
603  fDefCanvasName = "c1";
605  fLineIsProcessing = 1; // This prevents WIN32 "Windows" thread to pick ROOT objects with mouse
606  gDirectory = this;
607  gPad = 0;
608 
609  //set name of graphical cut class for the graphics editor
610  //cannot call SetCutClassName at this point because the TClass of TCutG
611  //is not yet build
612  fCutClassName = "TCutG";
613 
614  // Create a default MessageHandler
615  new TMessageHandler((TClass*)0);
616 
617  // Create some styles
618  gStyle = 0;
620  SetStyle(gEnv->GetValue("Canvas.Style", "Modern"));
621 
622  // Setup default (batch) graphics and GUI environment
625  gGXBatch = new TVirtualX("Batch", "ROOT Interface to batch graphics");
627 
628 #if defined(R__WIN32)
629  fBatch = kFALSE;
630 #elif defined(R__HAS_COCOA)
631  fBatch = kFALSE;
632 #else
633  if (gSystem->Getenv("DISPLAY"))
634  fBatch = kFALSE;
635  else
636  fBatch = kTRUE;
637 #endif
638 
639  int i = 0;
640  while (initfunc && initfunc[i]) {
641  (initfunc[i])();
642  fBatch = kFALSE; // put system in graphics mode (backward compatible)
643  i++;
644  }
645 
646  // Set initial/default list of browsable objects
647  fBrowsables->Add(fRootFolder, "root");
648  fBrowsables->Add(fProofs, "PROOF Sessions");
649  fBrowsables->Add(workdir, gSystem->WorkingDirectory());
650  fBrowsables->Add(fFiles, "ROOT Files");
651 
652  atexit(CleanUpROOTAtExit);
653 
655 }
656 
657 ////////////////////////////////////////////////////////////////////////////////
658 /// Clean up and free resources used by ROOT (files, network sockets,
659 /// shared memory segments, etc.).
660 
662 {
663  using namespace ROOT::Internal;
664 
665  if (gROOTLocal == this) {
666 
667  // If the interpreter has not yet been initialized, don't bother
668  gGetROOT = &GetROOT1;
669 
670  // Mark the object as invalid, so that we can veto some actions
671  // (like autoloading) while we are in the destructor.
673 
674  // Turn-off the global mutex to avoid recreating mutexes that have
675  // already been deleted during the destruction phase
676  gGlobalMutex = 0;
677 
678  // Return when error occurred in TCling, i.e. when setup file(s) are
679  // out of date
680  if (!fVersionInt) return;
681 
682  // ATTENTION!!! Order is important!
683 
684 #ifdef R__COMPLETE_MEM_TERMINATION
687  fSpecials->Delete(); SafeDelete(fSpecials); // delete special objects : PostScript, Minuit, Html
688 #endif
689  fClosedObjects->Delete("slow"); // and closed files
690  fFiles->Delete("slow"); // and files
692  fSecContexts->Delete("slow"); SafeDelete(fSecContexts); // and security contexts
693  fSockets->Delete(); SafeDelete(fSockets); // and sockets
694  fMappedFiles->Delete("slow"); // and mapped files
695  delete fUUIDs;
696  TProcessID::Cleanup(); // and list of ProcessIDs
697  TSeqCollection *tl = fMappedFiles; fMappedFiles = 0; delete tl;
698 
700 
701  fFunctions->Delete(); SafeDelete(fFunctions); // etc..
704 #ifdef R__COMPLETE_MEM_TERMINATION
706 #endif
709 
710 #ifdef R__COMPLETE_MEM_TERMINATION
715 #endif
716 
717  // Stop emitting signals
719 
721 
722 #ifdef R__COMPLETE_MEM_TERMINATION
728 
729  fCleanups->Clear();
731  delete gClassTable; gClassTable = 0;
732  delete gEnv; gEnv = 0;
733 
734  if (fTypes) fTypes->Delete();
736  if (fGlobals) fGlobals->Delete();
740  fEnums->Delete();
741  fClasses->Delete(); SafeDelete(fClasses); // TClass'es must be deleted last
742 #endif
743 
744  // Remove shared libraries produced by the TSystem::CompileMacro() call
746 
747  // Cleanup system class
748  delete gSystem;
749 
750  // ROOT-6022:
751  // if (gInterpreterLib) dlclose(gInterpreterLib);
752 #ifdef R__COMPLETE_MEM_TERMINATION
753  // On some 'newer' platform (Fedora Core 17+, Ubuntu 12), the
754  // initialization order is (by default?) is 'wrong' and so we can't
755  // delete the interpreter now .. because any of the static in the
756  // interpreter's library have already been deleted.
757  // On the link line, we must list the most dependent .o file
758  // and end with the least dependent (LLVM libraries), unfortunately,
759  // Fedora Core 17+ or Ubuntu 12 will also execute the initialization
760  // in the same order (hence doing libCore's before LLVM's and
761  // vice et versa for both the destructor. We worked around the
762  // initialization order by delay the TROOT creation until first use.
763  // We can not do the same for destruction as we have no way of knowing
764  // the last access ...
765  // So for now, let's avoid delete TCling except in the special build
766  // checking the completeness of the termination deletion.
767  gDestroyCling(fInterpreter);
768 #endif
769 
770 #ifdef R__COMPLETE_MEM_TERMINATION
772 #endif
773 
774  // Prints memory stats
776 
777  gROOTLocal = 0;
778  fgRootInit = kFALSE;
779  }
780 }
781 
782 ////////////////////////////////////////////////////////////////////////////////
783 /// Add a class to the list and map of classes.
784 /// This routine is deprecated, use TClass::AddClass directly.
785 
787 {
788  TClass::AddClass(cl);
789 }
790 
791 ////////////////////////////////////////////////////////////////////////////////
792 /// Add a class generator. This generator will be called by TClass::GetClass
793 /// in case its does not find a loaded rootcint dictionary to request the
794 /// creation of a TClass object.
795 
797 {
798  if (!generator) return;
799  fClassGenerators->Add(generator);
800 }
801 
802 ////////////////////////////////////////////////////////////////////////////////
803 /// Add browsable objects to TBrowser.
804 
806 {
807  TObject *obj;
809 
810  while ((obj = (TObject *) next())) {
811  const char *opt = next.GetOption();
812  if (opt && strlen(opt))
813  b->Add(obj, opt);
814  else
815  b->Add(obj, obj->GetName());
816  }
817 }
818 
819 ////////////////////////////////////////////////////////////////////////////////
820 /// return class status bit kClassSaved for class cl
821 /// This function is called by the SavePrimitive functions writing
822 /// the C++ code for an object.
823 
825 {
826  if (cl == 0) return kFALSE;
827  if (cl->TestBit(TClass::kClassSaved)) return kTRUE;
829  return kFALSE;
830 }
831 
832 namespace {
833  static void R__ListSlowClose(TList *files)
834  {
835  // Routine to close a list of files using the 'slow' techniques
836  // that also for the deletion ot update the list itself.
837 
838  static TObject harmless;
839  TObjLink *cursor = files->FirstLink();
840  while (cursor) {
841  TDirectory *dir = static_cast<TDirectory*>( cursor->GetObject() );
842  if (dir) {
843  // In order for the iterator to stay valid, we must
844  // prevent the removal of the object (dir) from the list
845  // (which is done in TFile::Close). We can also can not
846  // just move to the next iterator since the Close might
847  // also (indirectly) remove that file.
848  // So we SetObject to a harmless value, so that 'dir'
849  // is not seen as part of the list.
850  // We will later, remove all the object (see files->Clear()
851  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
852  dir->Close();
853  // Put it back
854  cursor->SetObject(dir);
855  }
856  cursor = cursor->Next();
857  };
858  // Now were done, clear the list but do not delete the objects as
859  // they have been moved to the list of closed objects and must be
860  // deleted from there in order to avoid a double delete from a
861  // use objects (on the interpreter stack).
862  files->Clear("nodelete");
863  }
864 }
865 
866 ////////////////////////////////////////////////////////////////////////////////
867 /// Close any files and sockets that gROOT knows about.
868 /// This can be used to insures that the files and sockets are closed before any library is unloaded!
869 
871 {
872  if (fFiles && fFiles->First()) {
873  R__ListSlowClose(static_cast<TList*>(fFiles));
874  }
875  // and Close TROOT itself.
876  Close();
877  // Now sockets.
878  if (fSockets && fSockets->First()) {
879  if (0==fCleanups->FindObject(fSockets) ) {
882  }
883  CallFunc_t *socketCloser = gInterpreter->CallFunc_Factory();
884  Long_t offset = 0;
885  TClass *socketClass = TClass::GetClass("TSocket");
886  gInterpreter->CallFunc_SetFuncProto(socketCloser, socketClass->GetClassInfo(), "Close", "", &offset);
887  if (gInterpreter->CallFunc_IsValid(socketCloser)) {
888  static TObject harmless;
889  TObjLink *cursor = static_cast<TList*>(fSockets)->FirstLink();
890  TList notclosed;
891  while (cursor) {
892  TObject *socket = cursor->GetObject();
893  // In order for the iterator to stay valid, we must
894  // prevent the removal of the object (dir) from the list
895  // (which is done in TFile::Close). We can also can not
896  // just move to the next iterator since the Close might
897  // also (indirectly) remove that file.
898  // So we SetObject to a harmless value, so that 'dir'
899  // is not seen as part of the list.
900  // We will later, remove all the object (see files->Clear()
901  cursor->SetObject(&harmless); // this must not be zero otherwise things go wrong.
902 
903  if (socket->IsA()->InheritsFrom(socketClass)) {
904  gInterpreter->CallFunc_Exec(socketCloser, ((char*)socket)+offset);
905  // Put the object in the closed list for later deletion.
906  socket->SetBit(kMustCleanup);
907  fClosedObjects->AddLast(socket);
908  } else {
909  // Crap ... this is not a socket, likely Proof or something, let's try to find a Close
910  Long_t other_offset;
911  CallFunc_t *otherCloser = gInterpreter->CallFunc_Factory();
912  gInterpreter->CallFunc_SetFuncProto(otherCloser, socket->IsA()->GetClassInfo(), "Close", "", &other_offset);
913  if (gInterpreter->CallFunc_IsValid(otherCloser)) {
914  gInterpreter->CallFunc_Exec(otherCloser, ((char*)socket)+other_offset);
915  // Put the object in the closed list for later deletion.
916  socket->SetBit(kMustCleanup);
917  fClosedObjects->AddLast(socket);
918  } else {
919  notclosed.AddLast(socket);
920  }
921  gInterpreter->CallFunc_Delete(otherCloser);
922  // Put it back
923  cursor->SetObject(socket);
924  }
925  cursor = cursor->Next();
926  }
927  // Now were done, clear the list
928  fSockets->Clear();
929  // Read the one we did not close
930  cursor = notclosed.FirstLink();
931  while (cursor) {
932  static_cast<TList*>(fSockets)->AddLast(cursor->GetObject());
933  cursor = cursor->Next();
934  }
935  }
936  gInterpreter->CallFunc_Delete(socketCloser);
937  }
938  if (fMappedFiles && fMappedFiles->First()) {
939  R__ListSlowClose(static_cast<TList*>(fMappedFiles));
940  }
941 
942 }
943 
944 ////////////////////////////////////////////////////////////////////////////////
945 /// Execute the cleanups necessary at the end of the process, in particular
946 /// those that must be executed before the library start being unloaded.
947 
949 {
950  CloseFiles();
951 
952  if (gInterpreter) {
953  gInterpreter->ResetGlobals();
954  }
955 
956  // Now a set of simpler things to delete. See the same ordering in
957  // TROOT::~TROOT
958  fFunctions->Delete();
959  fGeometries->Delete();
960  fBrowsers->Delete();
961  fCanvases->Delete();
962  fColors->Delete();
963  fStyles->Delete();
964 }
965 
966 
967 ////////////////////////////////////////////////////////////////////////////////
968 /// Find an object in one Root folder
969 
971 {
972  Error("FindObject","Not yet implemented");
973  return 0;
974 }
975 
976 ////////////////////////////////////////////////////////////////////////////////
977 /// Returns address of a ROOT object if it exists
978 ///
979 /// If name contains at least one "/" the function calls FindObjectany
980 /// else
981 /// This function looks in the following order in the ROOT lists:
982 /// - List of files
983 /// - List of memory mapped files
984 /// - List of functions
985 /// - List of geometries
986 /// - List of canvases
987 /// - List of styles
988 /// - List of specials
989 /// - List of materials in current geometry
990 /// - List of shapes in current geometry
991 /// - List of matrices in current geometry
992 /// - List of Nodes in current geometry
993 /// - Current Directory in memory
994 /// - Current Directory on file
995 
996 TObject *TROOT::FindObject(const char *name) const
997 {
998  if (name && strstr(name,"/")) return FindObjectAny(name);
999 
1000  TObject *temp = 0;
1001 
1002  temp = fFiles->FindObject(name); if (temp) return temp;
1003  temp = fMappedFiles->FindObject(name); if (temp) return temp;
1004  {
1005  R__LOCKGUARD2(gROOTMutex);
1006  temp = fFunctions->FindObject(name); if (temp) return temp;
1007  }
1008  temp = fGeometries->FindObject(name); if (temp) return temp;
1009  temp = fCanvases->FindObject(name); if (temp) return temp;
1010  temp = fStyles->FindObject(name); if (temp) return temp;
1011  temp = fSpecials->FindObject(name); if (temp) return temp;
1013  TObject *obj;
1014  while ((obj=next())) {
1015  temp = obj->FindObject(name); if (temp) return temp;
1016  }
1017  if (gDirectory) temp = gDirectory->Get(name);
1018  if (temp) return temp;
1019  if (gPad) {
1020  TVirtualPad *canvas = gPad->GetVirtCanvas();
1021  if (fCanvases->FindObject(canvas)) { //this check in case call from TCanvas ctor
1022  temp = canvas->FindObject(name);
1023  if (!temp && canvas != gPad) temp = gPad->FindObject(name);
1024  }
1025  }
1026  return temp;
1027 }
1028 
1029 ////////////////////////////////////////////////////////////////////////////////
1030 /// Returns address and folder of a ROOT object if it exists
1031 ///
1032 /// This function looks in the following order in the ROOT lists:
1033 /// - List of files
1034 /// - List of memory mapped files
1035 /// - List of functions
1036 /// - List of geometries
1037 /// - List of canvases
1038 /// - List of styles
1039 /// - List of specials
1040 /// - List of materials in current geometry
1041 /// - List of shapes in current geometry
1042 /// - List of matrices in current geometry
1043 /// - List of Nodes in current geometry
1044 /// - Current Directory in memory
1045 /// - Current Directory on file
1046 
1047 TObject *TROOT::FindSpecialObject(const char *name, void *&where)
1048 {
1049  TObject *temp = 0;
1050  where = 0;
1051 
1052  if (!temp) {
1053  temp = fFiles->FindObject(name);
1054  where = fFiles;
1055  }
1056  if (!temp) {
1057  temp = fMappedFiles->FindObject(name);
1058  where = fMappedFiles;
1059  }
1060  if (!temp) {
1061  R__LOCKGUARD2(gROOTMutex);
1062  temp = fFunctions->FindObject(name);
1063  where = fFunctions;
1064  }
1065  if (!temp) {
1066  temp = fCanvases->FindObject(name);
1067  where = fCanvases;
1068  }
1069  if (!temp) {
1070  temp = fStyles->FindObject(name);
1071  where = fStyles;
1072  }
1073  if (!temp) {
1074  temp = fSpecials->FindObject(name);
1075  where = fSpecials;
1076  }
1077  if (!temp) {
1078  TObject *glast = fGeometries->Last();
1079  if (glast) {where = glast; temp = glast->FindObject(name);}
1080  }
1081  if (!temp && gDirectory) {
1082  temp = gDirectory->Get(name);
1083  where = gDirectory;
1084  }
1085  if (!temp && gPad) {
1086  TVirtualPad *canvas = gPad->GetVirtCanvas();
1087  if (fCanvases->FindObject(canvas)) { //this check in case call from TCanvas ctor
1088  temp = canvas->FindObject(name);
1089  where = canvas;
1090  if (!temp && canvas != gPad) {
1091  temp = gPad->FindObject(name);
1092  where = gPad;
1093  }
1094  }
1095  }
1096  if (!temp) return 0;
1097  if (temp->TestBit(kNotDeleted)) return temp;
1098  return 0;
1099 }
1100 
1101 ////////////////////////////////////////////////////////////////////////////////
1102 /// Return a pointer to the first object with name starting at //root.
1103 /// This function scans the list of all folders.
1104 /// if no object found in folders, it scans the memory list of all files.
1105 
1106 TObject *TROOT::FindObjectAny(const char *name) const
1107 {
1109  if (obj) return obj;
1110  return gDirectory->FindObjectAnyFile(name);
1111 }
1112 
1113 ////////////////////////////////////////////////////////////////////////////////
1114 /// Scan the memory lists of all files for an object with name
1115 
1117 {
1118  R__LOCKGUARD(gROOTMutex);
1119  TDirectory *d;
1121  while ((d = (TDirectory*)next())) {
1122  // Call explicitly TDirectory::FindObject to restrict the search to the
1123  // already in memory object.
1124  TObject *obj = d->TDirectory::FindObject(name);
1125  if (obj) return obj;
1126  }
1127  return 0;
1128 }
1129 
1130 ////////////////////////////////////////////////////////////////////////////////
1131 /// Returns class name of a ROOT object including CINT globals.
1132 
1133 const char *TROOT::FindObjectClassName(const char *name) const
1134 {
1135  // Search first in the list of "standard" objects
1136  TObject *obj = FindObject(name);
1137  if (obj) return obj->ClassName();
1138 
1139  // Is it a global variable?
1140  TGlobal *g = GetGlobal(name);
1141  if (g) return g->GetTypeName();
1142 
1143  return 0;
1144 }
1145 
1146 ////////////////////////////////////////////////////////////////////////////////
1147 /// Return path name of obj somewhere in the //root/... path.
1148 /// The function returns the first occurence of the object in the list
1149 /// of folders. The returned string points to a static char array in TROOT.
1150 /// If this function is called in a loop or recursively, it is the
1151 /// user's responsibility to copy this string in their area.
1152 
1153 const char *TROOT::FindObjectPathName(const TObject *) const
1154 {
1155  Error("FindObjectPathName","Not yet implemented");
1156  return "??";
1157 }
1158 
1159 ////////////////////////////////////////////////////////////////////////////////
1160 /// return a TClass object corresponding to 'name' assuming it is an STL container.
1161 /// In particular we looking for possible alternative name (default template
1162 /// parameter, typedefs template arguments, typedefed name).
1163 
1164 TClass *TROOT::FindSTLClass(const char *name, Bool_t load, Bool_t silent) const
1165 {
1166  // Example of inputs are
1167  // vector<int> (*)
1168  // vector<Int_t>
1169  // vector<long long>
1170  // vector<Long_64_t> (*)
1171  // vector<int, allocator<int> >
1172  // vector<Int_t, allocator<int> >
1173  //
1174  // One of the possibly expensive operation is the resolving of the typedef
1175  // which can provoke the parsing of the header files (and/or the loading
1176  // of clang pcms information).
1177 
1179 
1180  // Remove std::, allocator, typedef, add Long64_t, etc. in just one call.
1181  std::string normalized;
1182  TClassEdit::GetNormalizedName(normalized, name);
1183 
1184  TClass *cl = 0;
1185  if (normalized != name) cl = TClass::GetClass(normalized.c_str(),load,silent);
1186 
1187  if (load && cl==0) {
1188  // Create an Emulated class for this container.
1189  cl = gInterpreter->GenerateTClass(normalized.c_str(), kTRUE, silent);
1190  }
1191 
1192  return cl;
1193 }
1194 
1195 ////////////////////////////////////////////////////////////////////////////////
1196 /// Return pointer to class with name. Obsolete, use TClass::GetClass directly
1197 
1198 TClass *TROOT::GetClass(const char *name, Bool_t load, Bool_t silent) const
1199 {
1200  return TClass::GetClass(name,load,silent);
1201 }
1202 
1203 
1204 ////////////////////////////////////////////////////////////////////////////////
1205 /// Return pointer to class from its name. Obsolete, use TClass::GetClass directly
1206 /// See TClass::GetClass
1207 
1208 TClass *TROOT::GetClass(const type_info& typeinfo, Bool_t load, Bool_t silent) const
1209 {
1210  return TClass::GetClass(typeinfo,load,silent);
1211 }
1212 
1213 ////////////////////////////////////////////////////////////////////////////////
1214 /// Return address of color with index color.
1215 
1217 {
1219  TObjArray *lcolors = (TObjArray*) GetListOfColors();
1220  if (!lcolors) return 0;
1221  if (color < 0 || color >= lcolors->GetSize()) return 0;
1222  TColor *col = (TColor*)lcolors->At(color);
1223  if (col && col->GetNumber() == color) return col;
1224  TIter next(lcolors);
1225  while ((col = (TColor *) next()))
1226  if (col->GetNumber() == color) return col;
1227 
1228  return 0;
1229 }
1230 
1231 ////////////////////////////////////////////////////////////////////////////////
1232 /// Return a default canvas.
1233 
1235 {
1236  return (TCanvas*)gROOT->ProcessLine("TCanvas::MakeDefCanvas();");
1237 }
1238 
1239 ////////////////////////////////////////////////////////////////////////////////
1240 /// Return pointer to type with name.
1241 
1242 TDataType *TROOT::GetType(const char *name, Bool_t /* load */) const
1243 {
1244  return (TDataType*)gROOT->GetListOfTypes()->FindObject(name);
1245 }
1246 
1247 ////////////////////////////////////////////////////////////////////////////////
1248 /// Return pointer to file with name.
1249 
1250 TFile *TROOT::GetFile(const char *name) const
1251 {
1252  R__LOCKGUARD(gROOTMutex);
1253  return (TFile*)GetListOfFiles()->FindObject(name);
1254 }
1255 
1256 ////////////////////////////////////////////////////////////////////////////////
1257 /// Return pointer to style with name
1258 
1259 TStyle *TROOT::GetStyle(const char *name) const
1260 {
1261  return (TStyle*)GetListOfStyles()->FindObject(name);
1262 }
1263 
1264 ////////////////////////////////////////////////////////////////////////////////
1265 /// Return pointer to function with name.
1266 
1267 TObject *TROOT::GetFunction(const char *name) const
1268 {
1269  if (name == 0 || name[0] == 0) {
1270  return 0;
1271  }
1272 
1273  {
1274  R__LOCKGUARD2(gROOTMutex);
1275  TObject *f1 = fFunctions->FindObject(name);
1276  if (f1) return f1;
1277  }
1278 
1279  gROOT->ProcessLine("TF1::InitStandardFunctions();");
1280 
1281  R__LOCKGUARD2(gROOTMutex);
1282  return fFunctions->FindObject(name);
1283 }
1284 
1285 ////////////////////////////////////////////////////////////////////////////////
1286 
1288 {
1289  if (!gInterpreter) return 0;
1290 
1292 
1293  return (TFunctionTemplate*)fFuncTemplate->FindObject(name);
1294 }
1295 
1296 ////////////////////////////////////////////////////////////////////////////////
1297 /// Return pointer to global variable by name. If load is true force
1298 /// reading of all currently defined globals from CINT (more expensive).
1299 
1300 TGlobal *TROOT::GetGlobal(const char *name, Bool_t load) const
1301 {
1302  return (TGlobal *)gROOT->GetListOfGlobals(load)->FindObject(name);
1303 }
1304 
1305 ////////////////////////////////////////////////////////////////////////////////
1306 /// Return pointer to global variable with address addr.
1307 
1308 TGlobal *TROOT::GetGlobal(const TObject *addr, Bool_t /* load */) const
1309 {
1310  if (addr == 0 || ((Long_t)addr) == -1) return 0;
1311 
1312  TInterpreter::DeclId_t decl = gInterpreter->GetDataMemberAtAddr(addr);
1313  if (decl) {
1314  TListOfDataMembers *globals = ((TListOfDataMembers*)(gROOT->GetListOfGlobals(kFALSE)));
1315  return (TGlobal*)globals->Get(decl);
1316  }
1317  // If we are actually looking for a global that is held by a global
1318  // pointer (for example gRandom), we need to find a pointer with the
1319  // correct value.
1320  decl = gInterpreter->GetDataMemberWithValue(addr);
1321  if (decl) {
1322  TListOfDataMembers *globals = ((TListOfDataMembers*)(gROOT->GetListOfGlobals(kFALSE)));
1323  return (TGlobal*)globals->Get(decl);
1324  }
1325  return 0;
1326 }
1327 
1328 ////////////////////////////////////////////////////////////////////////////////
1329 /// Internal routine returning, and creating if necessary, the list
1330 /// of global function.
1331 
1333 {
1335  return fGlobalFunctions;
1336 }
1337 
1338 ////////////////////////////////////////////////////////////////////////////////
1339 /// Return the collection of functions named "name".
1340 
1342 {
1343  return ((TListOfFunctions*)fFunctions)->GetListForObject(name);
1344 }
1345 
1346 ////////////////////////////////////////////////////////////////////////////////
1347 /// Return pointer to global function by name.
1348 /// If params != 0 it will also resolve overloading other it returns the first
1349 /// name match.
1350 /// If params == 0 and load is true force reading of all currently defined
1351 /// global functions from Cling.
1352 /// The param string must be of the form: "3189,\"aap\",1.3".
1353 
1354 TFunction *TROOT::GetGlobalFunction(const char *function, const char *params,
1355  Bool_t load)
1356 {
1357  if (!params) {
1358  R__LOCKGUARD2(gROOTMutex);
1359  return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
1360  } else {
1361  if (!fInterpreter)
1362  Fatal("GetGlobalFunction", "fInterpreter not initialized");
1363 
1364  R__LOCKGUARD2(gROOTMutex);
1365  TInterpreter::DeclId_t decl = gInterpreter->GetFunctionWithValues(0,
1366  function, params,
1367  false);
1368 
1369  if (!decl) return 0;
1370 
1371  TFunction *f = GetGlobalFunctions()->Get(decl);
1372  if (f) return f;
1373 
1374  Error("GetGlobalFunction",
1375  "\nDid not find matching TFunction <%s> with \"%s\".",
1376  function,params);
1377  return 0;
1378  }
1379 }
1380 
1381 ////////////////////////////////////////////////////////////////////////////////
1382 /// Return pointer to global function by name. If proto != 0
1383 /// it will also resolve overloading. If load is true force reading
1384 /// of all currently defined global functions from CINT (more expensive).
1385 /// The proto string must be of the form: "int, char*, float".
1386 
1388  const char *proto, Bool_t load)
1389 {
1390  if (!proto) {
1391  R__LOCKGUARD2(gROOTMutex);
1392  return (TFunction *)GetListOfGlobalFunctions(load)->FindObject(function);
1393  } else {
1394  if (!fInterpreter)
1395  Fatal("GetGlobalFunctionWithPrototype", "fInterpreter not initialized");
1396 
1397  R__LOCKGUARD2(gROOTMutex);
1398  TInterpreter::DeclId_t decl = gInterpreter->GetFunctionWithPrototype(0,
1399  function, proto);
1400 
1401  if (!decl) return 0;
1402 
1403  TFunction *f = GetGlobalFunctions()->Get(decl);
1404  if (f) return f;
1405 
1406  Error("GetGlobalFunctionWithPrototype",
1407  "\nDid not find matching TFunction <%s> with \"%s\".",
1408  function,proto);
1409  return 0;
1410  }
1411 }
1412 
1413 ////////////////////////////////////////////////////////////////////////////////
1414 /// Return pointer to Geometry with name
1415 
1416 TObject *TROOT::GetGeometry(const char *name) const
1417 {
1418  return GetListOfGeometries()->FindObject(name);
1419 }
1420 
1421 ////////////////////////////////////////////////////////////////////////////////
1422 
1424 {
1425  if(!fEnums.load()) {
1426  R__LOCKGUARD2(gROOTMutex);
1427  // Test again just in case, another thread did the work while we were
1428  // waiting.
1429  if (!fEnums.load()) fEnums = new TListOfEnumsWithLock(0);
1430  }
1431  if (load) {
1432  R__LOCKGUARD2(gROOTMutex);
1433  (*fEnums).Load(); // Refresh the list of enums.
1434  }
1435  return fEnums.load();
1436 }
1437 
1438 ////////////////////////////////////////////////////////////////////////////////
1439 
1441 {
1442  R__LOCKGUARD2(gROOTMutex);
1443  if(!fFuncTemplate) {
1445  }
1446  return fFuncTemplate;
1447 }
1448 
1449 ////////////////////////////////////////////////////////////////////////////////
1450 /// Return list containing the TGlobals currently defined.
1451 /// Since globals are created and deleted during execution of the
1452 /// program, we need to update the list of globals every time we
1453 /// execute this method. However, when calling this function in
1454 /// a (tight) loop where no interpreter symbols will be created
1455 /// you can set load=kFALSE (default).
1456 
1458 {
1459  if (!fGlobals) {
1460  // We add to the list the "funcky-fake" globals.
1461  fGlobals = new TListOfDataMembers(0);
1462  fGlobals->Add(new TGlobalMappedFunction("gROOT", "TROOT*",
1464  fGlobals->Add(new TGlobalMappedFunction("gPad", "TVirtualPad*",
1466  fGlobals->Add(new TGlobalMappedFunction("gInterpreter", "TInterpreter*",
1468  fGlobals->Add(new TGlobalMappedFunction("gVirtualX", "TTVirtualX*",
1470  fGlobals->Add(new TGlobalMappedFunction("gDirectory", "TDirectory*",
1474  }
1475 
1476  if (!fInterpreter)
1477  Fatal("GetListOfGlobals", "fInterpreter not initialized");
1478 
1479  if (load) fGlobals->Load();
1480 
1481  return fGlobals;
1482 }
1483 
1484 ////////////////////////////////////////////////////////////////////////////////
1485 /// Return list containing the TFunctions currently defined.
1486 /// Since functions are created and deleted during execution of the
1487 /// program, we need to update the list of functions every time we
1488 /// execute this method. However, when calling this function in
1489 /// a (tight) loop where no interpreter symbols will be created
1490 /// you can set load=kFALSE (default).
1491 
1493 {
1494  R__LOCKGUARD2(gROOTMutex);
1495 
1496  if (!fGlobalFunctions) {
1498  }
1499 
1500  if (!fInterpreter)
1501  Fatal("GetListOfGlobalFunctions", "fInterpreter not initialized");
1502 
1503  // A thread that calls with load==true and a thread that calls with load==false
1504  // will conflict here (the load==true will be updating the list while the
1505  // other is reading it). To solve the problem, we could use a read-write lock
1506  // inside the list itself.
1507  if (load) fGlobalFunctions->Load();
1508 
1509  return fGlobalFunctions;
1510 }
1511 
1512 ////////////////////////////////////////////////////////////////////////////////
1513 /// Return a dynamic list giving access to all TDataTypes (typedefs)
1514 /// currently defined.
1515 ///
1516 /// The list is populated on demand. Calling
1517 /// ~~~ {.cpp}
1518 /// gROOT->GetListOfTypes()->FindObject(nameoftype);
1519 /// ~~~
1520 /// will return the TDataType corresponding to 'nameoftype'. If the
1521 /// TDataType is not already in the list itself and the type does exist,
1522 /// a new TDataType will be created and added to the list.
1523 ///
1524 /// Calling
1525 /// ~~~ {.cpp}
1526 /// gROOT->GetListOfTypes()->ls(); // or Print()
1527 /// ~~~
1528 /// list only the typedefs that have been previously accessed through the
1529 /// list (plus the builtins types).
1530 
1532 {
1533  if (!fInterpreter)
1534  Fatal("GetListOfTypes", "fInterpreter not initialized");
1535 
1536  return fTypes;
1537 }
1538 
1539 
1540 ////////////////////////////////////////////////////////////////////////////////
1541 /// Execute command when system has been idle for idleTimeInSec seconds.
1542 
1543 void TROOT::Idle(UInt_t idleTimeInSec, const char *command)
1544 {
1545  if (!fApplication.load())
1547 
1548  if (idleTimeInSec <= 0)
1549  (*fApplication).RemoveIdleTimer();
1550  else
1551  (*fApplication).SetIdleTimer(idleTimeInSec, command);
1552 }
1553 
1554 ////////////////////////////////////////////////////////////////////////////////
1555 /// Check whether className is a known class, and only autoload
1556 /// if we can. Helper function for TROOT::IgnoreInclude().
1557 
1558 static TClass* R__GetClassIfKnown(const char* className)
1559 {
1560  // Check whether the class is available for auto-loading first:
1561  const char* libsToLoad = gInterpreter->GetClassSharedLibs(className);
1562  TClass* cla = 0;
1563  if (libsToLoad) {
1564  // trigger autoload, and only create TClass in this case.
1565  return TClass::GetClass(className);
1566  } else if (gROOT->GetListOfClasses()
1567  && (cla = (TClass*)gROOT->GetListOfClasses()->FindObject(className))) {
1568  // cla assigned in if statement
1569  } else if (gClassTable->FindObject(className)) {
1570  return TClass::GetClass(className);
1571  }
1572  return cla;
1573 }
1574 
1575 ////////////////////////////////////////////////////////////////////////////////
1576 /// Return 1 if the name of the given include file corresponds to a class that
1577 /// is known to ROOT, e.g. "TLorentzVector.h" versus TLorentzVector.
1578 
1579 Int_t TROOT::IgnoreInclude(const char *fname, const char * /*expandedfname*/)
1580 {
1581  if (fname == 0) return 0;
1582 
1583  TString stem(fname);
1584  // Remove extension if any, ignore files with extension not being .h*
1585  Int_t where = stem.Last('.');
1586  if (where != kNPOS) {
1587  if (stem.EndsWith(".so") || stem.EndsWith(".sl") ||
1588  stem.EndsWith(".dl") || stem.EndsWith(".a") ||
1589  stem.EndsWith(".dll", TString::kIgnoreCase))
1590  return 0;
1591  stem.Remove(where);
1592  }
1593 
1594  TString className = gSystem->BaseName(stem);
1595  TClass* cla = R__GetClassIfKnown(className);
1596  if (!cla) {
1597  // Try again with modifications to the file name:
1598  className = stem;
1599  className.ReplaceAll("/", "::");
1600  className.ReplaceAll("\\", "::");
1601  if (className.Contains(":::")) {
1602  // "C:\dir" becomes "C:::dir".
1603  // fname corresponds to whatever is stated after #include and
1604  // a full path name usually means that it's not a regular #include
1605  // but e.g. a ".L", so we can assume that this is not a header of
1606  // a class in a namespace (a global-namespace class would have been
1607  // detected already before).
1608  return 0;
1609  }
1610  cla = R__GetClassIfKnown(className);
1611  }
1612 
1613  if (!cla) {
1614  return 0;
1615  }
1616 
1617  // cla is valid, check wether it's actually in the header of the same name:
1618  if (cla->GetDeclFileLine() <= 0) return 0; // to a void an error with VisualC++
1619  TString decfile = gSystem->BaseName(cla->GetDeclFileName());
1620  if (decfile != gSystem->BaseName(fname)) {
1621  return 0;
1622  }
1623  return 1;
1624 }
1625 
1626 ////////////////////////////////////////////////////////////////////////////////
1627 /// Initialize operating system interface.
1628 
1630 {
1631  if (gSystem == 0) {
1632 #if defined(R__UNIX)
1633 #if defined(R__HAS_COCOA)
1634  gSystem = new TMacOSXSystem;
1635 #else
1636  gSystem = new TUnixSystem;
1637 #endif
1638 #elif defined(R__WIN32)
1639  gSystem = new TWinNTSystem;
1640 #else
1641  gSystem = new TSystem;
1642 #endif
1643 
1644  if (gSystem->Init())
1645  fprintf(stderr, "Fatal in <TROOT::InitSystem>: can't init operating system layer\n");
1646 
1647  if (!gSystem->HomeDirectory()) {
1648  fprintf(stderr, "Fatal in <TROOT::InitSystem>: HOME directory not set\n");
1649  fprintf(stderr, "Fix this by defining the HOME shell variable\n");
1650  }
1651 
1652  // read default files
1653  gEnv = new TEnv(".rootrc");
1654 
1655  gDebug = gEnv->GetValue("Root.Debug", 0);
1656 
1657  if (!gEnv->GetValue("Root.ErrorHandlers", 1))
1658  gSystem->ResetSignals();
1659 
1660  // by default the zipmode is 1 (see Bits.h)
1661  Int_t zipmode = gEnv->GetValue("Root.ZipMode", 1);
1662  if (zipmode != 1) R__SetZipMode(zipmode);
1663 
1664  const char *sdeb;
1665  if ((sdeb = gSystem->Getenv("ROOTDEBUG")))
1666  gDebug = atoi(sdeb);
1667 
1668  if (gDebug > 0 && isatty(2))
1669  fprintf(stderr, "Info in <TROOT::InitSystem>: running with gDebug = %d\n", gDebug);
1670 
1671  if (gEnv->GetValue("Root.MemStat", 0))
1673  int msize = gEnv->GetValue("Root.MemStat.size", -1);
1674  int mcnt = gEnv->GetValue("Root.MemStat.cnt", -1);
1675  if (msize != -1 || mcnt != -1)
1676  TStorage::EnableStatistics(msize, mcnt);
1677 
1678  fgMemCheck = gEnv->GetValue("Root.MemCheck", 0);
1679 
1680 #if defined(R__HAS_COCOA)
1681  // create and delete a dummy TUrl so that TObjectStat table does not contain
1682  // objects that are deleted after recording is turned-off (in next line),
1683  // like the TUrl::fgSpecialProtocols list entries which are created in the
1684  // TMacOSXSystem ctor.
1685  { TUrl dummy("/dummy"); }
1686 #endif
1687  TObject::SetObjectStat(gEnv->GetValue("Root.ObjectStat", 0));
1688  }
1689 }
1690 
1691 ////////////////////////////////////////////////////////////////////////////////
1692 /// Load and initialize thread library.
1693 
1695 {
1696  if (gEnv->GetValue("Root.UseThreads", 0) || gEnv->GetValue("Root.EnableThreadSafety", 0)) {
1698  }
1699 }
1700 
1701 ////////////////////////////////////////////////////////////////////////////////
1702 /// Initialize the interpreter. Should be called only after main(),
1703 /// to make sure LLVM/Clang is fully initialized.
1704 
1706 {
1707  // usedToIdentifyRootClingByDlSym is available when TROOT is part of
1708  // rootcling.
1709  if (!dlsym(RTLD_DEFAULT, "usedToIdentifyRootClingByDlSym")
1710  && !dlsym(RTLD_DEFAULT, "usedToIdentifyStaticRoot")) {
1711  // Make sure no llvm symbols are visible before loading libCling. If they
1712  // exist libCling will use those and not ours, causing havoc in the
1713  // interpreter. Look for an extern "C" symbol to avoid mangling; look for a
1714  // symbol from llvm because clang builds on top, so users would likely
1715  // have also their own llvm symbols when providing their own clang.
1716  void *LLVMEnablePrettyStackTraceAddr = 0;
1717  // Can't use gSystem->DynFindSymbol() because that iterates over all *known*
1718  // libraries which is not the same!
1719  LLVMEnablePrettyStackTraceAddr = dlsym(RTLD_DEFAULT, "LLVMEnablePrettyStackTrace");
1720  if (LLVMEnablePrettyStackTraceAddr) {
1721  Error("InitInterpreter()", "LLVM SYMBOLS ARE EXPOSED TO CLING! "
1722  "This will cause problems; please hide them or dlopen() them "
1723  "after the call to TROOT::InitInterpreter()!");
1724  }
1725 
1726  const char *libcling = 0;
1727  char *libclingStorage = 0;
1728 #ifdef ROOTLIBDIR
1729  libcling = ROOTLIBDIR "/libCling."
1730 # ifdef R__WIN32
1731  "dll";
1732 # else
1733  "so";
1734 # endif
1735 #else
1736  libclingStorage = gSystem->DynamicPathName("libCling");
1737  libcling = libclingStorage;
1738 #endif
1739  gInterpreterLib = dlopen(libcling, RTLD_LAZY|RTLD_LOCAL);
1740  delete [] libclingStorage;
1741 
1742  if (!gInterpreterLib) {
1743  TString err = dlerror();
1744  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load library %s\n", err.Data());
1745  exit(1);
1746  }
1747  dlerror(); // reset error message
1748  } else {
1749  gInterpreterLib = RTLD_DEFAULT;
1750  }
1751  CreateInterpreter_t *CreateInterpreter = (CreateInterpreter_t*) dlsym(gInterpreterLib, "CreateInterpreter");
1752  if (!CreateInterpreter) {
1753  TString err = dlerror();
1754  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load symbol %s\n", err.Data());
1755  exit(1);
1756  }
1757  // Schedule the destruction of TROOT.
1758  atexit(at_exit_of_TROOT);
1759 
1760  gDestroyInterpreter = (DestroyInterpreter_t*) dlsym(gInterpreterLib, "DestroyInterpreter");
1761  if (!gDestroyInterpreter) {
1762  TString err = dlerror();
1763  fprintf(stderr, "Fatal in <TROOT::InitInterpreter>: cannot load symbol %s\n", err.Data());
1764  exit(1);
1765  }
1766 
1767  fInterpreter = CreateInterpreter(gInterpreterLib);
1768 
1771 
1772  fgRootInit = kTRUE;
1773 
1774  // Initialize all registered dictionaries.
1775  for (std::vector<ModuleHeaderInfo_t>::const_iterator
1776  li = GetModuleHeaderInfoBuffer().begin(),
1777  le = GetModuleHeaderInfoBuffer().end(); li != le; ++li) {
1778  // process buffered module registrations
1779  fInterpreter->RegisterModule(li->fModuleName,
1780  li->fHeaders,
1781  li->fIncludePaths,
1782  li->fPayloadCode,
1783  li->fFwdDeclCode,
1784  li->fTriggerFunc,
1785  li->fFwdNargsToKeepColl,
1786  li->fClassesHeaders);
1787  }
1788  GetModuleHeaderInfoBuffer().clear();
1789 
1791 
1792  // Read the rules before enabling the auto loading to not inadvertently
1793  // load the libraries for the classes concerned even-though the user is
1794  // *not* using them.
1795  TClass::ReadRules(); // Read the default customization rules ...
1796 
1797  // Enable autoloading
1799 }
1800 
1801 ////////////////////////////////////////////////////////////////////////////////
1802 /// Helper function used by TClass::GetClass().
1803 /// This function attempts to load the dictionary for 'classname'
1804 /// either from the TClassTable or from the list of generator.
1805 /// If silent is 'true', do not warn about missing dictionary for the class.
1806 /// (typically used for class that are used only for transient members)
1807 ///
1808 /// The 'requestedname' is expected to be already normalized.
1809 
1810 TClass *TROOT::LoadClass(const char *requestedname, Bool_t silent) const
1811 {
1812  return TClass::LoadClass(requestedname, silent);
1813 }
1814 
1815 ////////////////////////////////////////////////////////////////////////////////
1816 /// Check if class "classname" is known to the interpreter (in fact,
1817 /// this check is not needed anymore, so classname is ignored). If
1818 /// not it will load library "libname". If the library name does
1819 /// not start with "lib", "lib" will be prepended and a search will
1820 /// be made in the DynamicPath (see .rootrc). If not found a search
1821 /// will be made on libname (without "lib" prepended) and if not found
1822 /// a direct try of libname will be made (in case it contained an
1823 /// absolute path).
1824 /// If check is true it will only check if libname exists and is
1825 /// readable.
1826 /// Returns 0 on successful loading, -1 in case libname does not
1827 /// exist or in case of error and -2 in case of version mismatch.
1828 
1829 Int_t TROOT::LoadClass(const char * /*classname*/, const char *libname,
1830  Bool_t check)
1831 {
1832  Int_t err = -1;
1833 
1834  char *path;
1835  TString lib = libname;
1836  if (!lib.BeginsWith("lib"))
1837  lib = "lib" + lib;
1838  if ((path = gSystem->DynamicPathName(lib, kTRUE))) {
1839  if (check)
1840  err = 0;
1841  else {
1842  err = gSystem->Load(path, 0, kTRUE);
1843  }
1844  delete [] path;
1845  } else {
1846  if (check) {
1847  FileStat_t stat;
1848  if (!gSystem->GetPathInfo(libname, stat)) {
1849  if (R_ISREG(stat.fMode) &&
1851  err = 0;
1852  else
1853  err = -1;
1854  } else
1855  err = -1;
1856  } else {
1857  err = gSystem->Load(libname, 0, kTRUE);
1858  }
1859  }
1860 
1861  if (err == -1) {
1862  //Error("LoadClass", "library %s could not be loaded", libname);
1863  }
1864 
1865  if (err == 1) {
1866  //Error("LoadClass", "library %s already loaded, but class %s unknown",
1867  // libname, classname);
1868  err = 0;
1869  }
1870 
1871  return err;
1872 }
1873 
1874 ////////////////////////////////////////////////////////////////////////////////
1875 /// Return true if the file is local and is (likely) to be a ROOT file
1876 
1878 {
1879  Bool_t result = kFALSE;
1880  FILE *mayberootfile = fopen(filename,"rb");
1881  if (mayberootfile) {
1882  char header[5];
1883  if (fgets(header,5,mayberootfile)) {
1884  result = strncmp(header,"root",4)==0;
1885  }
1886  fclose(mayberootfile);
1887  }
1888  return result;
1889 }
1890 
1891 ////////////////////////////////////////////////////////////////////////////////
1892 /// To list all objects of the application.
1893 /// Loop on all objects created in the ROOT linked lists.
1894 /// Objects may be files and windows or any other object directly
1895 /// attached to the ROOT linked list.
1896 
1897 void TROOT::ls(Option_t *option) const
1898 {
1899 // TObject::SetDirLevel();
1900 // GetList()->R__FOR_EACH(TObject,ls)(option);
1901  TDirectory::ls(option);
1902 }
1903 
1904 ////////////////////////////////////////////////////////////////////////////////
1905 /// Load a macro in the interpreter's memory. Equivalent to the command line
1906 /// command ".L filename". If the filename has "+" or "++" appended
1907 /// the macro will be compiled by ACLiC. The filename must have the format:
1908 /// [path/]macro.C[+|++[g|O]].
1909 /// The possible error codes are defined by TInterpreter::EErrorCode.
1910 /// If check is true it will only check if filename exists and is
1911 /// readable.
1912 /// Returns 0 on successful loading and -1 in case filename does not
1913 /// exist or in case of error.
1914 
1915 Int_t TROOT::LoadMacro(const char *filename, int *error, Bool_t check)
1916 {
1917  Int_t err = -1;
1918  Int_t lerr, *terr;
1919  if (error)
1920  terr = error;
1921  else
1922  terr = &lerr;
1923 
1924  if (fInterpreter) {
1925  TString aclicMode;
1926  TString arguments;
1927  TString io;
1928  TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
1929 
1930  if (arguments.Length()) {
1931  Warning("LoadMacro", "argument(%s) ignored in %s", arguments.Data(), GetMacroPath());
1932  }
1933  char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
1934  if (!mac) {
1935  if (!check)
1936  Error("LoadMacro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
1937  *terr = TInterpreter::kFatal;
1938  } else {
1939  err = 0;
1940  if (!check) {
1941  fname = mac;
1942  fname += aclicMode;
1943  fname += io;
1944  gInterpreter->LoadMacro(fname.Data(), (TInterpreter::EErrorCode*)terr);
1945  if (*terr)
1946  err = -1;
1947  }
1948  }
1949  delete [] mac;
1950  }
1951  return err;
1952 }
1953 
1954 ////////////////////////////////////////////////////////////////////////////////
1955 /// Execute a macro in the interpreter. Equivalent to the command line
1956 /// command ".x filename". If the filename has "+" or "++" appended
1957 /// the macro will be compiled by ACLiC. The filename must have the format:
1958 /// [path/]macro.C[+|++[g|O]][(args)].
1959 /// The possible error codes are defined by TInterpreter::EErrorCode.
1960 /// If padUpdate is true (default) update the current pad.
1961 /// Returns the macro return value.
1962 
1963 Long_t TROOT::Macro(const char *filename, Int_t *error, Bool_t padUpdate)
1964 {
1965  Long_t result = 0;
1966 
1967  if (fInterpreter) {
1968  TString aclicMode;
1969  TString arguments;
1970  TString io;
1971  TString fname = gSystem->SplitAclicMode(filename, aclicMode, arguments, io);
1972 
1973  char *mac = gSystem->Which(GetMacroPath(), fname, kReadPermission);
1974  if (!mac) {
1975  Error("Macro", "macro %s not found in path %s", fname.Data(), GetMacroPath());
1976  if (error)
1977  *error = TInterpreter::kFatal;
1978  } else {
1979  fname = mac;
1980  fname += aclicMode;
1981  fname += arguments;
1982  fname += io;
1983  result = gInterpreter->ExecuteMacro(fname, (TInterpreter::EErrorCode*)error);
1984  }
1985  delete [] mac;
1986 
1987  if (padUpdate && gPad)
1988  gPad->Update();
1989  }
1990 
1991  return result;
1992 }
1993 
1994 ////////////////////////////////////////////////////////////////////////////////
1995 /// Process message id called by obj.
1996 
1998 {
2000  TMessageHandler *mh;
2001  while ((mh = (TMessageHandler*)next())) {
2002  mh->HandleMessage(id,obj);
2003  }
2004 }
2005 
2006 ////////////////////////////////////////////////////////////////////////////////
2007 /// Process interpreter command via TApplication::ProcessLine().
2008 /// On Win32 the line will be processed asynchronously by sending
2009 /// it to the CINT interpreter thread. For explicit synchronous processing
2010 /// use ProcessLineSync(). On non-Win32 platforms there is no difference
2011 /// between ProcessLine() and ProcessLineSync().
2012 /// The possible error codes are defined by TInterpreter::EErrorCode. In
2013 /// particular, error will equal to TInterpreter::kProcessing until the
2014 /// CINT interpreted thread has finished executing the line.
2015 /// Returns the result of the command, cast to a Long_t.
2016 
2017 Long_t TROOT::ProcessLine(const char *line, Int_t *error)
2018 {
2019  TString sline = line;
2020  sline = sline.Strip(TString::kBoth);
2021 
2022  if (!fApplication.load())
2024 
2025  return (*fApplication).ProcessLine(sline, kFALSE, error);
2026 }
2027 
2028 ////////////////////////////////////////////////////////////////////////////////
2029 /// Process interpreter command via TApplication::ProcessLine().
2030 /// On Win32 the line will be processed synchronously (i.e. it will
2031 /// only return when the CINT interpreter thread has finished executing
2032 /// the line). On non-Win32 platforms there is no difference between
2033 /// ProcessLine() and ProcessLineSync().
2034 /// The possible error codes are defined by TInterpreter::EErrorCode.
2035 /// Returns the result of the command, cast to a Long_t.
2036 
2038 {
2039  TString sline = line;
2040  sline = sline.Strip(TString::kBoth);
2041 
2042  if (!fApplication.load())
2044 
2045  return (*fApplication).ProcessLine(sline, kTRUE, error);
2046 }
2047 
2048 ////////////////////////////////////////////////////////////////////////////////
2049 /// Process interpreter command directly via CINT interpreter.
2050 /// Only executable statements are allowed (no variable declarations),
2051 /// In all other cases use TROOT::ProcessLine().
2052 /// The possible error codes are defined by TInterpreter::EErrorCode.
2053 
2055 {
2056  TString sline = line;
2057  sline = sline.Strip(TString::kBoth);
2058 
2059  if (!fApplication.load())
2061 
2062  Long_t result = 0;
2063 
2064  if (fInterpreter) {
2066  result = gInterpreter->Calc(sline, code);
2067  }
2068 
2069  return result;
2070 }
2071 
2072 ////////////////////////////////////////////////////////////////////////////////
2073 /// Read Git commit information and branch name from the
2074 /// etc/gitinfo.txt file.
2075 
2077 {
2078 #ifdef ROOT_GIT_COMMIT
2079  fGitCommit = ROOT_GIT_COMMIT;
2080 #endif
2081 #ifdef ROOT_GIT_BRANCH
2082  fGitBranch = ROOT_GIT_BRANCH;
2083 #endif
2084 
2085  TString gitinfo = "gitinfo.txt";
2086  char *filename = 0;
2087 #ifdef ROOTETCDIR
2088  filename = gSystem->ConcatFileName(ROOTETCDIR, gitinfo);
2089 #else
2090  TString etc = gRootDir;
2091 #ifdef WIN32
2092  etc += "\\etc";
2093 #else
2094  etc += "/etc";
2095 #endif
2096 #if defined(R__MACOSX) && (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
2097  // on iOS etc does not exist and gitinfo resides in $ROOTSYS
2098  etc = gRootDir;
2099 #endif
2100  filename = gSystem->ConcatFileName(etc, gitinfo);
2101 #endif
2102 
2103  FILE *fp = fopen(filename, "r");
2104  if (fp) {
2105  TString s;
2106  // read branch name
2107  s.Gets(fp);
2108  fGitBranch = s;
2109  // read commit SHA1
2110  s.Gets(fp);
2111  fGitCommit = s;
2112  // read date/time make was run
2113  s.Gets(fp);
2114  fGitDate = s;
2115  fclose(fp);
2116  }
2117  delete [] filename;
2118 }
2119 
2121  TTHREAD_TLS(Bool_t) fgReadingObject = false;
2122  return fgReadingObject;
2123 }
2124 
2125 ////////////////////////////////////////////////////////////////////////////////
2126 /// Deprecated (will be removed in next release).
2127 
2129 {
2130  return GetReadingObject();
2131 }
2132 
2134 {
2135  GetReadingObject() = flag;
2136 }
2137 
2138 
2139 ////////////////////////////////////////////////////////////////////////////////
2140 /// Return date/time make was run.
2141 
2142 const char *TROOT::GetGitDate()
2143 {
2144  if (fGitDate == "") {
2145  Int_t iday,imonth,iyear, ihour, imin;
2146  static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2147  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
2148  Int_t idate = gROOT->GetBuiltDate();
2149  Int_t itime = gROOT->GetBuiltTime();
2150  iday = idate%100;
2151  imonth = (idate/100)%100;
2152  iyear = idate/10000;
2153  ihour = itime/100;
2154  imin = itime%100;
2155  fGitDate.Form("%s %02d %4d, %02d:%02d:00", months[imonth-1], iday, iyear, ihour, imin);
2156  }
2157  return fGitDate;
2158 }
2159 
2160 ////////////////////////////////////////////////////////////////////////////////
2161 /// Refresh all browsers. Call this method when some command line
2162 /// command or script has changed the browser contents. Not needed
2163 /// for objects that have the kMustCleanup bit set. Most useful to
2164 /// update browsers that show the file system or other objects external
2165 /// to the running ROOT session.
2166 
2168 {
2170  TBrowser *b;
2171  while ((b = (TBrowser*) next()))
2172  b->SetRefreshFlag(kTRUE);
2173 }
2174 ////////////////////////////////////////////////////////////////////////////////
2175 /// Insure that the files, canvases and sockets are closed.
2176 
2177 static void CallCloseFiles()
2178 {
2179  if (TROOT::Initialized() && ROOT::Internal::gROOTLocal) {
2180  gROOT->CloseFiles();
2181  }
2182 }
2183 
2184 ////////////////////////////////////////////////////////////////////////////////
2185 /// Called by static dictionary initialization to register clang modules
2186 /// for headers. Calls TCling::RegisterModule() unless gCling
2187 /// is NULL, i.e. during startup, where the information is buffered in
2188 /// the static GetModuleHeaderInfoBuffer().
2189 
2190 void TROOT::RegisterModule(const char* modulename,
2191  const char** headers,
2192  const char** includePaths,
2193  const char* payloadCode,
2194  const char* fwdDeclCode,
2195  void (*triggerFunc)(),
2196  const TInterpreter::FwdDeclArgsToKeepCollection_t& fwdDeclsArgToSkip,
2197  const char** classesHeaders)
2198 {
2199 
2200  // First a side track to insure proper end of process behavior.
2201 
2202  // Register for each loaded dictionary (and thus for each library),
2203  // that we need to Close the ROOT files as soon as this library
2204  // might start being unloaded after main.
2205  //
2206  // By calling atexit here (rather than directly from within the
2207  // library) we make sure that this is not called if the library is
2208  // 'only' dlclosed.
2209 
2210  // On Ubuntu the linker strips the unused libraries. Eventhough
2211  // stressHistogram is explicitly linked against libNet, it is not
2212  // retained and thus is loaded only as needed in the middle part of
2213  // the execution. Concretely this also means that it is loaded
2214  // *after* the construction of the TApplication object and thus
2215  // after the registration (atexit) of the EndOfProcessCleanups
2216  // routine. Consequently, after the end of main, libNet is
2217  // unloaded before EndOfProcessCleanups is called. When
2218  // EndOfProcessCleanups is executed it indirectly needs the TClass
2219  // for TSocket and its search will use resources that have already
2220  // been unloaded (technically the function static in TUnixSystem's
2221  // DynamicPath and the dictionary from libNet).
2222 
2223  // Similarly, the ordering (before this commit) was broken in the
2224  // following case:
2225 
2226  // TApplication creation (EndOfProcessCleanups registration)
2227  // load UserLibrary
2228  // create TFile
2229  // Append UserObject to TFile
2230 
2231  // and after the end of main the order of execution was
2232 
2233  // unload UserLibrary
2234  // call EndOfProcessCleanups
2235  // Write the TFile
2236  // attempt to write the user object.
2237  // ....
2238 
2239  // where what we need is to have the files closen/written before
2240  // the unloading of the library.
2241 
2242  // To solve the problem we now register an atexit function for
2243  // every dictionary thus making sure there is at least one executed
2244  // before the first library tear down after main.
2245 
2246  // If atexit is called directly within a library's code, the
2247  // function will called *either* when the library is 'dlclose'd or
2248  // after then end of main (whichever comes first). We do *not*
2249  // want the files to be closed whenever a library is unloaded via
2250  // dlclose. To avoid this, we add the function (CallCloseFiles)
2251  // from the dictionary indirectly (via ROOT::RegisterModule). In
2252  // this case the function will only only be called either when
2253  // libCore is 'dlclose'd or right after the end of main.
2254 
2255  atexit(CallCloseFiles);
2256 
2257  // Now register with TCling.
2258  if (gCling) {
2259  gCling->RegisterModule(modulename, headers, includePaths, payloadCode, fwdDeclCode,
2260  triggerFunc, fwdDeclsArgToSkip, classesHeaders);
2261  } else {
2262  GetModuleHeaderInfoBuffer()
2263  .push_back(ModuleHeaderInfo_t (modulename, headers, includePaths, payloadCode, fwdDeclCode,
2264  triggerFunc, fwdDeclsArgToSkip,classesHeaders));
2265  }
2266 }
2267 
2268 ////////////////////////////////////////////////////////////////////////////////
2269 /// Remove a class from the list and map of classes.
2270 /// This routine is deprecated, use TClass::RemoveClass directly.
2271 
2273 {
2274  TClass::RemoveClass(oldcl);
2275 }
2276 
2277 ////////////////////////////////////////////////////////////////////////////////
2278 /// Delete all global interpreter objects created since the last call to Reset
2279 ///
2280 /// If option="a" is set reset to startup context (i.e. unload also
2281 /// all loaded files, classes, structs, typedefs, etc.).
2282 ///
2283 /// This function is typically used at the beginning (or end) of an unnamed macro
2284 /// to clean the environment.
2285 ///
2286 /// IMPORTANT WARNING:
2287 /// Do not use this call from within any function (neither compiled nor
2288 /// interpreted. This should only be used from a unnamed macro
2289 /// (which starts with a { (curly braces) ). For example, using TROOT::Reset
2290 /// from within an interpreted function will lead to the unloading of the
2291 /// dictionary and source file, including the one defining the function being
2292 /// executed.
2293 ///
2294 
2295 void TROOT::Reset(Option_t *option)
2296 {
2297  if (IsExecutingMacro()) return; //True when TMacro::Exec runs
2298  if (fInterpreter) {
2299  if (!strncmp(option, "a", 1)) {
2300  fInterpreter->Reset();
2302  } else
2303  gInterpreter->ResetGlobals();
2304 
2305  if (fGlobals) fGlobals->Unload();
2307 
2308  SaveContext();
2309  }
2310 }
2311 
2312 ////////////////////////////////////////////////////////////////////////////////
2313 /// Save the current interpreter context.
2314 
2316 {
2317  if (fInterpreter)
2318  gInterpreter->SaveGlobalsContext();
2319 }
2320 
2321 ////////////////////////////////////////////////////////////////////////////////
2322 /// Set the default graphical cut class name for the graphics editor
2323 /// By default the graphics editor creates an instance of a class TCutG.
2324 /// This function may be called to specify a different class that MUST
2325 /// derive from TCutG
2326 
2327 void TROOT::SetCutClassName(const char *name)
2328 {
2329  if (!name) {
2330  Error("SetCutClassName","Invalid class name");
2331  return;
2332  }
2333  TClass *cl = TClass::GetClass(name);
2334  if (!cl) {
2335  Error("SetCutClassName","Unknown class:%s",name);
2336  return;
2337  }
2338  if (!cl->InheritsFrom("TCutG")) {
2339  Error("SetCutClassName","Class:%s does not derive from TCutG",name);
2340  return;
2341  }
2342  fCutClassName = name;
2343 }
2344 
2345 ////////////////////////////////////////////////////////////////////////////////
2346 /// Set editor mode
2347 
2348 void TROOT::SetEditorMode(const char *mode)
2349 {
2350  fEditorMode = 0;
2351  if (!mode[0]) return;
2352  if (!strcmp(mode,"Arc")) {fEditorMode = kArc; return;}
2353  if (!strcmp(mode,"Line")) {fEditorMode = kLine; return;}
2354  if (!strcmp(mode,"Arrow")) {fEditorMode = kArrow; return;}
2355  if (!strcmp(mode,"Button")) {fEditorMode = kButton; return;}
2356  if (!strcmp(mode,"Diamond")) {fEditorMode = kDiamond; return;}
2357  if (!strcmp(mode,"Ellipse")) {fEditorMode = kEllipse; return;}
2358  if (!strcmp(mode,"Pad")) {fEditorMode = kPad; return;}
2359  if (!strcmp(mode,"Pave")) {fEditorMode = kPave; return;}
2360  if (!strcmp(mode,"PaveLabel")){fEditorMode = kPaveLabel; return;}
2361  if (!strcmp(mode,"PaveText")) {fEditorMode = kPaveText; return;}
2362  if (!strcmp(mode,"PavesText")){fEditorMode = kPavesText; return;}
2363  if (!strcmp(mode,"PolyLine")) {fEditorMode = kPolyLine; return;}
2364  if (!strcmp(mode,"CurlyLine")){fEditorMode = kCurlyLine; return;}
2365  if (!strcmp(mode,"CurlyArc")) {fEditorMode = kCurlyArc; return;}
2366  if (!strcmp(mode,"Text")) {fEditorMode = kText; return;}
2367  if (!strcmp(mode,"Marker")) {fEditorMode = kMarker; return;}
2368  if (!strcmp(mode,"CutG")) {fEditorMode = kCutG; return;}
2369 }
2370 
2371 ////////////////////////////////////////////////////////////////////////////////
2372 /// Change current style to style with name stylename
2373 
2374 void TROOT::SetStyle(const char *stylename)
2375 {
2376  TString style_name = stylename;
2377 
2378  TStyle *style = GetStyle(style_name);
2379  if (style) style->cd();
2380  else Error("SetStyle","Unknown style:%s",style_name.Data());
2381 }
2382 
2383 
2384 //-------- Static Member Functions ---------------------------------------------
2385 
2386 
2387 ////////////////////////////////////////////////////////////////////////////////
2388 /// Decrease the indentation level for ls().
2389 
2391 {
2392  return --fgDirLevel;
2393 }
2394 
2395 ////////////////////////////////////////////////////////////////////////////////
2396 ///return directory level
2397 
2399 {
2400  return fgDirLevel;
2401 }
2402 
2403 ////////////////////////////////////////////////////////////////////////////////
2404 /// Get macro search path. Static utility function.
2405 
2406 const char *TROOT::GetMacroPath()
2407 {
2408  TString &macroPath = ROOT::GetMacroPath();
2409 
2410  if (macroPath.Length() == 0) {
2411  macroPath = gEnv->GetValue("Root.MacroPath", (char*)0);
2412 #if defined(R__WIN32)
2413  macroPath.ReplaceAll("; ", ";");
2414 #else
2415  macroPath.ReplaceAll(": ", ":");
2416 #endif
2417  if (macroPath.Length() == 0)
2418 #if !defined(R__WIN32)
2419  #ifdef ROOTMACRODIR
2420  macroPath = ".:" ROOTMACRODIR;
2421  #else
2422  macroPath = TString(".:") + gRootDir + "/macros";
2423  #endif
2424 #else
2425  #ifdef ROOTMACRODIR
2426  macroPath = ".;" ROOTMACRODIR;
2427  #else
2428  macroPath = TString(".;") + gRootDir + "/macros";
2429  #endif
2430 #endif
2431  }
2432 
2433  return macroPath;
2434 }
2435 
2436 ////////////////////////////////////////////////////////////////////////////////
2437 /// Set or extend the macro search path. Static utility function.
2438 /// If newpath=0 or "" reset to value specified in the rootrc file.
2439 
2440 void TROOT::SetMacroPath(const char *newpath)
2441 {
2442  TString &macroPath = ROOT::GetMacroPath();
2443 
2444  if (!newpath || !*newpath)
2445  macroPath = "";
2446  else
2447  macroPath = newpath;
2448 }
2449 
2450 ////////////////////////////////////////////////////////////////////////////////
2451 /// Increase the indentation level for ls().
2452 
2454 {
2455  return ++fgDirLevel;
2456 }
2457 
2458 ////////////////////////////////////////////////////////////////////////////////
2459 /// Functions used by ls() to indent an object hierarchy.
2460 
2462 {
2463  for (int i = 0; i < fgDirLevel; i++) std::cout.put(' ');
2464 }
2465 
2466 ////////////////////////////////////////////////////////////////////////////////
2467 /// Return kTRUE if the TROOT object has been initialized.
2468 
2470 {
2471  return fgRootInit;
2472 }
2473 
2474 ////////////////////////////////////////////////////////////////////////////////
2475 /// Return kTRUE if the memory leak checker is on.
2476 
2478 {
2479  return fgMemCheck;
2480 }
2481 
2482 ////////////////////////////////////////////////////////////////////////////////
2483 /// Return Indentation level for ls().
2484 
2486 {
2487  fgDirLevel = level;
2488 }
2489 
2490 ////////////////////////////////////////////////////////////////////////////////
2491 /// Convert version code to an integer, i.e. 331527 -> 51507.
2492 
2494 {
2495  return 10000*(code>>16) + 100*((code&65280)>>8) + (code&255);
2496 }
2497 
2498 ////////////////////////////////////////////////////////////////////////////////
2499 /// Convert version as an integer to version code as used in RVersion.h.
2500 
2502 {
2503  int a = v/10000;
2504  int b = (v - a*10000)/100;
2505  int c = v - a*10000 - b*100;
2506  return (a << 16) + (b << 8) + c;
2507 }
2508 
2509 ////////////////////////////////////////////////////////////////////////////////
2510 /// Return ROOT version code as defined in RVersion.h.
2511 
2513 {
2514  return ROOT_VERSION_CODE;
2515 }
2516 
2517 ////////////////////////////////////////////////////////////////////////////////
2518 
2520  static const char** extraInterpArgs = 0;
2521  return extraInterpArgs;
2522 }
2523 
2524 ////////////////////////////////////////////////////////////////////////////////
2525 /// Get the tutorials directory in the installation. Static utility function.
2526 
2528 {
2529 #ifdef ROOTTUTDIR
2530  return ROOTTUTDIR;
2531 #else
2532  static TString tutdir = TString(gRootDir) + "/tutorials";
2533  return tutdir;
2534 #endif
2535 }
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:928
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:1265
Bool_t fExecutingMacro
Definition: TROOT.h:121
void AddClass(TClass *cl)
Add a class to the list and map of classes.
Definition: TROOT.cxx:786
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
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:4071
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:2390
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:1423
ROOT top level object description.
Definition: TROOT.h:80
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 'name' assuming it is an STL container.
Definition: TROOT.cxx:1164
void RemoveClass(TClass *)
Remove a class from the list and map of classes.
Definition: TROOT.cxx:2272
TCollection * GetListOfGlobalFunctions(Bool_t load=kFALSE)
Return list containing the TFunctions currently defined.
Definition: TROOT.cxx:1492
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's memory.
Definition: TROOT.cxx:1915
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:2519
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
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:1259
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:996
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
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:1363
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:2512
static Bool_t MemCheck()
Return kTRUE if the memory leak checker is on.
Definition: TROOT.cxx:2477
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's home directory.
Definition: TSystem.cxx:881
#define ROOT_RELEASE_DATE
Definition: RVersion.h:18
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...
static const char * filename()
void InitInterpreter()
Initialize the interpreter.
Definition: TROOT.cxx:1705
#define gROOT
Definition: TROOT.h:340
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:1818
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:2167
void ls(Option_t *option="") const
To list all objects of the application.
Definition: TROOT.cxx:1897
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
#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:1511
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:2295
Definition: Buttons.h:30
void Load()
Load all the DataMembers known to the interpreter for the scope 'fClass' into this collection...
TCollection * GetListOfFunctionOverloads(const char *name) const
Return the collection of functions named "name".
Definition: TROOT.cxx:1341
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:2374
TCollection * GetListOfGlobals(Bool_t load=kFALSE)
Return list containing the TGlobals currently defined.
Definition: TROOT.cxx:1457
TString fGitCommit
Definition: TROOT.h:107
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:558
TROOT * GetROOT1()
Definition: TROOT.cxx:351
TObject * GetGeometry(const char *name) const
Return pointer to Geometry with name.
Definition: TROOT.cxx:1416
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:2120
static const char * GetTutorialsDir()
Get the tutorials directory in the installation. Static utility function.
Definition: TROOT.cxx:2527
TListOfFunctions * GetGlobalFunctions()
Internal routine returning, and creating if necessary, the list of global function.
Definition: TROOT.cxx:1332
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:1198
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:2406
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:2142
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:436
Sequenceable collection abstract base class.
THashTable implements a hash table to store TObject'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
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:2348
const char * FindObjectClassName(const char *name) const
Returns class name of a ROOT object including CINT globals.
Definition: TROOT.cxx:1133
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
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
Definition: TROOT.cxx:2469
void EndOfProcessCleanups()
Execute the cleanups necessary at the end of the process, in particular those that must be executed b...
Definition: TROOT.cxx:948
static Bool_t fgRootInit
Definition: TROOT.h:89
virtual void AddAll(const TCollection *col)
Long_t ProcessLineSync(const char *line, Int_t *error=0)
Process interpreter command via TApplication::ProcessLine().
Definition: TROOT.cxx:2037
void Message(Int_t id, const TObject *obj)
Process message id called by obj.
Definition: TROOT.cxx:1997
virtual const char * Getenv(const char *env)
Get environment variable.
Definition: TSystem.cxx:1627
TCollection * GetListOfFunctionTemplates()
Definition: TROOT.cxx:1440
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:2315
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:1963
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:337
TSeqCollection * GetListOfGeometries() const
Definition: TROOT.h:228
Bool_t fEditHistograms
Definition: TROOT.h:114
const char Int_t const char TProof Int_t const char * workdir
Definition: TXSlave.cxx:46
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:824
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:2190
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:2128
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:805
virtual Bool_t Init()
Initialize the OS interface.
Definition: TSystem.cxx:186
void AddClassGenerator(TClassGenerator *gen)
Add a class generator.
Definition: TROOT.cxx:796
TString fDefCanvasName
Definition: TROOT.h:156
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
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:2327
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:494
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:2493
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:2076
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.
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:1829
Objects following this interface can be passed onto the TROOT object to implement a user customized w...
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
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:1629
#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:1300
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:2485
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:2017
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:1116
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...
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:1387
void SetReadingObject(Bool_t flag=kTRUE)
Definition: TROOT.cxx:2133
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:1958
TString fConfigOptions
Definition: TROOT.h:98
void InitThreads()
Load and initialize thread library.
Definition: TROOT.cxx:1694
void Unload()
Mark 'all func' 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
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
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:2177
TCanvas * MakeDefCanvas() const
Return a default canvas.
Definition: TROOT.cxx:1234
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:2054
void CloseFiles()
Close any files and sockets that gROOT knows about.
Definition: TROOT.cxx:870
virtual ~TROOT()
Clean up and free resources used by ROOT (files, network sockets, shared memory segments, etc.).
Definition: TROOT.cxx:661
#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:4156
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:2881
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:348
TCollection * fClassGenerators
Definition: TROOT.h:145
ClassImp(TROOT) TROOT
Default ctor.
Definition: TROOT.cxx:416
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:1579
static TClass * LoadClass(const char *requestedname, Bool_t silent)
Helper function used by TClass::GetClass().
Definition: TClass.cxx:5370
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:1153
static Int_t GetDirLevel()
return directory level
Definition: TROOT.cxx:2398
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at //root.
Definition: TROOT.cxx:1106
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:1354
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:2501
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
Definition: TROOT.cxx:2453
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:1531
TFile * GetFile() const
Definition: TROOT.h:244
Int_t fBuiltDate
Definition: TROOT.h:105
void Unload()
Mark 'all func' as being unloaded.
const char * GetDeclFileName() const
Definition: TClass.h:386
TFunctionTemplate * GetFunctionTemplate(const char *name)
Definition: TROOT.cxx:1287
TDataType * GetType(const char *name, Bool_t load=kFALSE) const
Return pointer to type with name.
Definition: TROOT.cxx:1242
void Load()
Load all the functions known to the interpreter for the scope 'fClass' 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:1216
TCollection * fFunctions
Definition: TROOT.h:136
static void SetMacroPath(const char *newpath)
Set or extend the macro search path.
Definition: TROOT.cxx:2440
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
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:1267
#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:1877
static GetROOTFun_t gGetROOT
Definition: TROOT.cxx:370
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2461
static void InitializeColors()
Initialize colors used by the TCanvas based graphics (via TColor objects).
Definition: TColor.cxx:1008
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:4579
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:1047
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:504
R__DLLEXPORT TInterpreter * CreateInterpreter(void *interpLibHandle)
Definition: TCling.cxx:575
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
TObject * obj
void Idle(UInt_t idleTimeInSec, const char *command=0)
Execute command when system has been idle for idleTimeInSec seconds.
Definition: TROOT.cxx:1543
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:1044
#define sym(otri1, otri2)
Definition: triangle.c:932
static TClass * R__GetClassIfKnown(const char *className)
Check whether className is a known class, and only autoload if we can.
Definition: TROOT.cxx:1558
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
virtual TObject * First() const =0
virtual TObject * Last() const =0
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...
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904