ROOT logo
// @(#)root/base:$Id: TApplication.cxx 27949 2009-03-26 16:32:02Z rdm $
// Author: Fons Rademakers   22/12/95

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TApplication                                                         //
//                                                                      //
// This class creates the ROOT Application Environment that interfaces  //
// to the windowing system eventloop and eventhandlers.                 //
// This class must be instantiated exactly once in any given            //
// application. Normally the specific application class inherits from   //
// TApplication (see TRint).                                            //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "RConfigure.h"
#include "Riostream.h"
#include "TApplication.h"
#include "TException.h"
#include "TGuiFactory.h"
#include "TVirtualX.h"
#include "TROOT.h"
#include "TSystem.h"
#include "TString.h"
#include "TError.h"
#include "TObjArray.h"
#include "TObjString.h"
#include "TTimer.h"
#include "TInterpreter.h"
#include "TStyle.h"
#include "TVirtualPad.h"
#include "TEnv.h"
#include "TColor.h"
#include "TClassTable.h"
#include "TPluginManager.h"
#include "TClassTable.h"
#include "TBrowser.h"
#include "TUrl.h"

TApplication *gApplication = 0;
Bool_t TApplication::fgGraphNeeded = kFALSE;
Bool_t TApplication::fgGraphInit = kFALSE;
TList *TApplication::fgApplications = 0;  // List of available applications

//______________________________________________________________________________
class TIdleTimer : public TTimer {
public:
   TIdleTimer(Long_t ms) : TTimer(ms, kTRUE) { }
   Bool_t Notify();
};

//______________________________________________________________________________
Bool_t TIdleTimer::Notify()
{
   // Notify handler.
   gApplication->HandleIdleTimer();
   Reset();
   return kFALSE;
}


ClassImp(TApplication)

//______________________________________________________________________________
TApplication::TApplication()
{
   // Default ctor. Can be used by classes deriving from TApplication.

   fArgc          = 0;
   fArgv          = 0;
   fAppImp        = 0;
   fAppRemote     = 0;
   fIsRunning     = kFALSE;
   fReturnFromRun = kFALSE;
   fNoLog         = kFALSE;
   fNoLogo        = kFALSE;
   fQuit          = kFALSE;
   fFiles         = 0;
   fIdleTimer     = 0;
   fSigHandler    = 0;
   ResetBit(kProcessRemotely);
}

//______________________________________________________________________________
TApplication::TApplication(const char *appClassName,
                           Int_t *argc, char **argv, void *options,
                           Int_t numOptions)
{
   // Create an application environment. The application environment
   // provides an interface to the graphics system and eventloop
   // (be it X, Windoze, MacOS or BeOS). After creating the application
   // object start the eventloop by calling its Run() method. The command
   // line options recogized by TApplication are described in the GetOptions()
   // method. The recognized options are removed from the argument array.
   // The original list of argument options can be retrieved via the Argc()
   // and Argv() methods. The appClassName "proofserv" is reserved for the
   // PROOF system. The "options" and "numOptions" arguments are not used,
   // except if you want to by-pass the argv processing by GetOptions()
   // in which case you should specify numOptions<0. All options will
   // still be available via the Argv() method for later use.

   if (gApplication && gApplication->TestBit(kDefaultApplication)) {
      // allow default TApplication to be replaced by a "real" TApplication
      delete gApplication;
      gApplication = 0;
      gROOT->SetBatch(kFALSE);
      fgGraphInit = kFALSE;
   }

   if (gApplication) {
      Error("TApplication", "only one instance of TApplication allowed");
      return;
   }

   if (!gROOT)
      ::Fatal("TApplication::TApplication", "ROOT system not initialized");

   if (!gSystem)
      ::Fatal("TApplication::TApplication", "gSystem not initialized");

   gApplication = this;
   gROOT->SetApplication(this);
   gROOT->SetName(appClassName);

   // Create the list of applications the first time
   if (!fgApplications)
      fgApplications = new TList;
   fgApplications->Add(this);

   if (options) { }  // use unused argument

   // copy command line arguments, can be later accessed via Argc() and Argv()
   if (argc && *argc > 0) {
      fArgc = *argc;
      fArgv = (char **)new char*[fArgc];
   } else {
      fArgc = 0;
      fArgv = 0;
   }

   for (int i = 0; i < fArgc; i++)
      fArgv[i] = StrDup(argv[i]);

   fNoLog         = kFALSE;
   fNoLogo        = kFALSE;
   fQuit          = kFALSE;
   fAppImp        = 0;

   if (numOptions >= 0)
      GetOptions(argc, argv);

   if (fArgv)
      gSystem->SetProgname(fArgv[0]);

   // Tell TSystem the TApplication has been created
   gSystem->NotifyApplicationCreated();

   fIdleTimer     = 0;
   fSigHandler    = 0;
   fIsRunning     = kFALSE;
   fReturnFromRun = kFALSE;
   fAppImp        = gGuiFactory->CreateApplicationImp(appClassName, argc, argv);
   fAppRemote     = 0;
   ResetBit(kProcessRemotely);

   // Enable autoloading
   gInterpreter->EnableAutoLoading();

   // Initialize the graphics environment
   if (gClassTable->GetDict("TPad")) {
      fgGraphNeeded = kTRUE;
      InitializeGraphics();
   }

   // Make sure all registered dictionaries have been initialized
   // and that all types have been loaded
   gInterpreter->InitializeDictionaries();
   gInterpreter->UpdateListOfTypes();

   // Save current interpreter context
   gInterpreter->SaveContext();
   gInterpreter->SaveGlobalsContext();

   // to allow user to interact with TCanvas's under WIN32
   gROOT->SetLineHasBeenProcessed();
}

//______________________________________________________________________________
TApplication::~TApplication()
{
   // TApplication dtor.

   for (int i = 0; i < fArgc; i++)
      if (fArgv[i]) delete [] fArgv[i];
   delete [] fArgv;
   SafeDelete(fAppImp);
   if (fgApplications)
      fgApplications->Remove(this);
}

//______________________________________________________________________________
void TApplication::NeedGraphicsLibs()
{
   // Static method. This method should be called from static library
   // initializers if the library needs the low level graphics system.

   fgGraphNeeded = kTRUE;
}

//______________________________________________________________________________
void TApplication::InitializeGraphics()
{
   // Initialize the graphics environment.

   if (fgGraphInit || !fgGraphNeeded)
      return;

   fgGraphInit = kTRUE;

   // Load the graphics related libraries
   LoadGraphicsLibs();

   // Try to load TrueType font renderer. Only try to load if not in batch
   // mode and Root.UseTTFonts is true and Root.TTFontPath exists. Abort silently
   // if libttf or libGX11TTF are not found in $ROOTSYS/lib or $ROOTSYS/ttf/lib.
   const char *ttpath = gEnv->GetValue("Root.TTFontPath",
#ifdef TTFFONTDIR
                                       TTFFONTDIR);
#else
                                       "$(ROOTSYS)/fonts");
#endif
   char *ttfont = gSystem->Which(ttpath, "arialbd.ttf", kReadPermission);
   // Check for use of DFSG - fonts
   if (!ttfont)
      ttfont = gSystem->Which(ttpath, "FreeSansBold.ttf", kReadPermission);

#if !defined(R__WIN32)
   if (!gROOT->IsBatch() && !strcmp(gVirtualX->GetName(), "X11") &&
       ttfont && gEnv->GetValue("Root.UseTTFonts", 1)) {
      if (gClassTable->GetDict("TGX11TTF")) {
         // in principle we should not have linked anything against libGX11TTF
         // but with ACLiC this can happen, initialize TGX11TTF by hand
         // (normally this is done by the static library initializer)
         ProcessLine("TGX11TTF::Activate();");
      } else {
         TPluginHandler *h;
         if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualX", "x11ttf")))
            h->LoadPlugin();
      }
   }
#endif
   delete [] ttfont;

   // Create WM dependent application environment
   if (fAppImp)
      delete fAppImp;
   fAppImp = gGuiFactory->CreateApplicationImp(gROOT->GetName(), &fArgc, fArgv);
   if (!fAppImp) {
      MakeBatch();
      fAppImp = gGuiFactory->CreateApplicationImp(gROOT->GetName(), &fArgc, fArgv);
   }

   // Create the canvas colors early so they are allocated before
   // any color table expensive bitmaps get allocated in GUI routines (like
   // creation of XPM bitmaps).
   TColor::InitializeColors();

   // Hook for further initializing the WM dependent application environment
   Init();

   // Set default screen factor (if not disabled in rc file)
   if (gEnv->GetValue("Canvas.UseScreenFactor", 1)) {
      Int_t  x, y;
      UInt_t w, h;
      if (gVirtualX) {
         gVirtualX->GetGeometry(-1, x, y, w, h);
         if (h > 0 && h < 1000) gStyle->SetScreenFactor(0.0011*h);
      }
   }
}

//______________________________________________________________________________
void TApplication::ClearInputFiles()
{
   // Clear list containing macro files passed as program arguments.
   // This method is called from TRint::Run() to ensure that the macro
   // files are only executed the first time Run() is called.

   if (fFiles) {
      fFiles->Delete();
      SafeDelete(fFiles);
   }
}

//______________________________________________________________________________
char *TApplication::Argv(Int_t index) const
{
   // Return specified argument.

   if (fArgv) {
      if (index >= fArgc) {
         Error("Argv", "index (%d) >= number of arguments (%d)", index, fArgc);
         return 0;
      }
      return fArgv[index];
   }
   return 0;
}

//______________________________________________________________________________
void TApplication::GetOptions(Int_t *argc, char **argv)
{
   // Get and handle command line options. Arguments handled are removed
   // from the argument array. The following arguments are handled:
   //    -b : run in batch mode without graphics
   //    -n : do not execute logon and logoff macros as specified in .rootrc
   //    -q : exit after processing command line macro files
   //    -l : do not show splash screen
   // The last three options are only relevant in conjunction with TRint.
   // The following help and info arguments are supported:
   //    -?      : print usage
   //    -h      : print usage
   //    --help  : print usage
   //    -config : print ./configure options
   // In addition to the above options the arguments that are not options,
   // i.e. they don't start with - or + are treated as follows:
   //   <file>.root are considered ROOT files and added to the InputFiles() list
   //   <macro>.C   are considered ROOT macros and also added to the InputFiles() list
   //   <dir>       is considered the desired working directory and available
   //               via WorkingDirectory(), if more than one dir is specified the
   //               last one will prevail
   // In TRint we set the working directory to the <dir>, the ROOT files are
   // connected, and the macros are executed. If your main TApplication is not
   // TRint you have to decide yourself what to do whith these options.

   static char null[1] = { "" };

   fNoLog = kFALSE;
   fQuit  = kFALSE;
   fFiles = 0;

   if (!argc)
      return;

   int i, j;
   TString pwd;

   for (i = 1; i < *argc; i++) {
      if (!strcmp(argv[i], "-?") || !strncmp(argv[i], "-h", 2) ||
          !strncmp(argv[i], "--help", 6)) {
         fprintf(stderr, "Usage: %s [-l] [-b] [-n] [-q] [dir] [[file:]data.root] [file1.C ... fileN.C]\n", argv[0]);
         fprintf(stderr, "Options:\n");
         fprintf(stderr, "  -b : run in batch mode without graphics\n");
         fprintf(stderr, "  -n : do not execute logon and logoff macros as specified in .rootrc\n");
         fprintf(stderr, "  -q : exit after processing command line macro files\n");
         fprintf(stderr, "  -l : do not show splash screen\n");
         fprintf(stderr, " dir : if dir is a valid directory cd to it before executing\n");
         fprintf(stderr, "\n");
         fprintf(stderr, "  -?      : print usage\n");
         fprintf(stderr, "  -h      : print usage\n");
         fprintf(stderr, "  --help  : print usage\n");
         fprintf(stderr, "  -config : print ./configure options\n");
         fprintf(stderr, "\n");
         Terminate(0);
      } else if (!strcmp(argv[i], "-config")) {
         fprintf(stderr, "ROOT ./configure options:\n%s\n", gROOT->GetConfigOptions());
         Terminate(0);
      } else if (!strcmp(argv[i], "-b")) {
         MakeBatch();
         argv[i] = null;
      } else if (!strcmp(argv[i], "-n")) {
         fNoLog = kTRUE;
         argv[i] = null;
      } else if (!strcmp(argv[i], "-q")) {
         fQuit = kTRUE;
         argv[i] = null;
      } else if (!strcmp(argv[i], "-l")) {
         // used by front-end program to not display splash screen
         fNoLogo = kTRUE;
         argv[i] = null;
      } else if (!strcmp(argv[i], "-splash")) {
         // used when started by front-end program to signal that
         // splash screen can be popped down (TRint::PrintLogo())
         argv[i] = null;
      } else if (argv[i][0] != '-' && argv[i][0] != '+') {
         Long64_t size;
         Long_t id, flags, modtime;
         char *arg = strchr(argv[i], '(');
         if (arg) *arg = '\0';
         char *dir = gSystem->ExpandPathName(argv[i]);
         if (arg) *arg = '(';
         if (!gSystem->GetPathInfo(dir, &id, &size, &flags, &modtime)) {
            if ((flags & 2)) {
               // if directory set it in fWorkDir
               if (pwd == "") {
                  pwd = gSystem->WorkingDirectory();
                  fWorkDir = dir;
                  gSystem->ChangeDirectory(dir);
                  argv[i] = null;
               } else if (!strcmp(gROOT->GetName(), "Rint")) {
                  Warning("GetOptions", "only one directory argument can be specified (%s)", dir);
               }
            } else if (flags == 0 || flags == 1) {
               // if file add to list of files to be processed
               if (!fFiles) fFiles = new TObjArray;
               fFiles->Add(new TObjString(argv[i]));
               argv[i] = null;
            }
         } else {
            if (TString(dir).EndsWith(".root") && !strcmp(gROOT->GetName(), "Rint")) {
               // file ending on .root but does not exist, likely a typo, warn user...
               Warning("GetOptions", "file %s not found", dir);
            } else {
               char *mac, *s = Strip(dir, '+');
               if ((mac = gSystem->Which(TROOT::GetMacroPath(), s,
                                         kReadPermission))) {
                  // if file add to list of files to be processed
                  if (!fFiles) fFiles = new TObjArray;
                  fFiles->Add(new TObjString(argv[i]));
                  argv[i] = null;
                  delete [] mac;
               } else {
                  // only warn if we're plain root,
                  // other progs might have their own params
                  if (!strcmp(gROOT->GetName(), "Rint"))
                     Warning("GetOptions", "macro %s not found", s);
               }
               delete [] s;
            }
         }
         delete [] dir;
      }
      // ignore unknown options
   }

   // go back to startup directory
   if (pwd != "")
      gSystem->ChangeDirectory(pwd);

   // remove handled arguments from argument array
   j = 0;
   for (i = 0; i < *argc; i++) {
      if (strcmp(argv[i], "")) {
         argv[j] = argv[i];
         j++;
      }
   }

   *argc = j;
}

//______________________________________________________________________________
void TApplication::HandleIdleTimer()
{
   // Handle idle timeout. When this timer expires the registered idle command
   // will be executed by this routine and a signal will be emitted.

   if (!fIdleCommand.IsNull())
      ProcessLine(GetIdleCommand());

   Emit("HandleIdleTimer()");
}

//______________________________________________________________________________
void TApplication::HandleException(Int_t sig)
{
   // Handle exceptions (kSigBus, kSigSegmentationViolation,
   // kSigIllegalInstruction and kSigFloatingException) trapped in TSystem.
   // Specific TApplication implementations may want something different here.

   if (TROOT::Initialized()) {
      if (gException) {
         gInterpreter->RewindDictionary();
         gInterpreter->ClearFileBusy();
      }
      Throw(sig);
   }
   gSystem->Exit(sig);
}

//______________________________________________________________________________
void TApplication::Help(const char *line)
{
   // Print help on interpreter.

   gInterpreter->ProcessLine(line);

   Printf("\nROOT special commands.");
   Printf("===========================================================================");
   Printf("             pwd          : show current directory, pad and style");
   Printf("             ls           : list contents of current directory");
   Printf("             which [file] : shows path of macro file");
}

//______________________________________________________________________________
void TApplication::LoadGraphicsLibs()
{
   // Load shared libs neccesary for graphics. These libraries are only
   // loaded when gROOT->IsBatch() is kFALSE.

   if (gROOT->IsBatch()) return;

   TPluginHandler *h;
   if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualPad")))
      h->LoadPlugin();

   TString name;
   TString title1 = "ROOT interface to ";
   TString nativex, title;
   TString nativeg = "root";
#ifndef R__WIN32
   nativex = "x11";
   name    = "X11";
   title   = title1 + "X11";
#else
   nativex = "win32gdk";
   name    = "Win32gdk";
   title   = title1 + "Win32gdk";
#endif

   TString guiBackend(gEnv->GetValue("Gui.Backend", "native"));
   guiBackend.ToLower();
   if (guiBackend == "native") {
      guiBackend = nativex;
   } else {
      name  = guiBackend;
      title = title1 + guiBackend;
   }
   TString guiFactory(gEnv->GetValue("Gui.Factory", "native"));
   guiFactory.ToLower();
   if (guiFactory == "native")
      guiFactory = nativeg;

   if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualX", guiBackend))) {
      if (h->LoadPlugin() == -1)
         return;
      gVirtualX = (TVirtualX *) h->ExecPlugin(2, name.Data(), title.Data());
   }
   if ((h = gROOT->GetPluginManager()->FindHandler("TGuiFactory", guiFactory))) {
      if (h->LoadPlugin() == -1)
         return;
      gGuiFactory = (TGuiFactory *) h->ExecPlugin(0);
   }
}

//______________________________________________________________________________
void TApplication::MakeBatch()
{
   // Switch to batch mode.

   gROOT->SetBatch();
   if (gGuiFactory != gBatchGuiFactory) delete gGuiFactory;
   gGuiFactory = gBatchGuiFactory;
#ifndef R__WIN32
   if (gVirtualX != gGXBatch) delete gVirtualX;
#endif
   gVirtualX = gGXBatch;
}

//______________________________________________________________________________
Int_t TApplication::ParseRemoteLine(const char *ln,
                                   TString &hostdir, TString &user,
                                   Int_t &dbg, TString &script)
{
   // Parse the content of a line starting with ".R" (already stripped-off)
   // The format is
   //      [user@]host[:dir] [-l user] [-d dbg] [script]
   // The variable 'dir' is the remote directory to be used as working dir.
   // The username can be specified in two ways, "-l" having the priority
   // (as in ssh).
   // A 'dbg' value > 0 gives increasing verbosity.
   // The last argument 'script' allows to specify an alternative script to
   // be executed remotely to startup the session.

   if (!ln || strlen(ln) <= 0)
      return 0;

   Int_t rc = 0;
   Bool_t isHostDir = kTRUE;
   Bool_t isScript = kFALSE;
   Bool_t isUser = kFALSE;
   Bool_t isDbg = kFALSE;

   TString line(ln);
   TString tkn;
   Int_t from = 0;
   while (line.Tokenize(tkn, from, " ")) {
      if (tkn == "-l") {
         // Next is a user name
         isUser = kTRUE;
      } else if (tkn == "-d") {
         isDbg = kTRUE;
      } else if (tkn == "-close") {
         rc = 1;
      } else if (tkn.BeginsWith("-")) {
         ::Warning("TApplication::ParseRemoteLine","unknown option: %s", tkn.Data());
      } else {
         if (isUser) {
            user = tkn;
            isUser = kFALSE;
         } else if (isDbg) {
            dbg = tkn.Atoi();
            isDbg = kFALSE;
         } else if (isHostDir) {
            hostdir = tkn;
            hostdir.ReplaceAll(":","/");
            isHostDir = kFALSE;
            isScript = kTRUE;
         } else if (isScript) {
            // Add everything left
            script = tkn;
            script.Insert(0, "\"");
            script += "\"";
            isScript = kFALSE;
            break;
         } else {
            ::Warning("TApplication::ParseRemoteLine",
                      "inconsistent input line %s", line.Data());
         }
      }
   }

   // Done
   return rc;
}

//______________________________________________________________________________
Long_t TApplication::ProcessRemote(const char *line, Int_t *)
{
   // Process the content of a line starting with ".R" (already stripped-off)
   // The format is
   //      [user@]host[:dir] [-l user] [-d dbg] [script] | [host] -close
   // The variable 'dir' is the remote directory to be used as working dir.
   // The username can be specified in two ways, "-l" having the priority
   // (as in ssh).
   // A 'dbg' value > 0 gives increasing verbosity.
   // The last argument 'script' allows to specify an alternative script to
   // be executed remotely to startup the session.

   if (!line) return 0;

   if (!strncmp(line, "-?", 2) || !strncmp(line, "-h", 2) ||
       !strncmp(line, "--help", 6)) {
      Info("ProcessRemote", "remote session help:");
      Printf(".R [user@]host[:dir] [-l user] [-d dbg] [[<]script] | [host] -close");
      Printf("Create a ROOT session on the specified remote host.");
      Printf("The variable \"dir\" is the remote directory to be used as working dir.");
      Printf("The username can be specified in two ways, \"-l\" having the priority");
      Printf("(as in ssh). A \"dbg\" value > 0 gives increasing verbosity.");
      Printf("The last argument \"script\" allows to specify an alternative script to");
      Printf("be executed remotely to startup the session, \"roots\" being");
      Printf("the default. If the script is preceeded by a \"<\" the script will be");
      Printf("sourced, after which \"roots\" is executed. The sourced script can be ");
      Printf("used to change the PATH and other variables, allowing an alternative");
      Printf("\"roots\" script to be found.");
      Printf("To close down a session do \".R host -close\".");
      Printf("To switch between sessions do \".R host\", to switch to the local");
      Printf("session do \".R\".");
      Printf("To list all open sessions do \"gApplication->GetApplications()->Print()\".");
      return 0;
   }

   TString hostdir, user, script;
   Int_t dbg = 0;
   Int_t rc = ParseRemoteLine(line, hostdir, user, dbg, script);
   if (hostdir.Length() <= 0) {
      // Close the remote application if required
      if (rc == 1) {
         TApplication::Close(fAppRemote);
         delete fAppRemote;
      }
      // Return to local run
      fAppRemote = 0;
      // Done
      return 1;
   } else if (rc == 1) {
      // close an existing remote application
      TApplication *ap = TApplication::Open(hostdir, 0, 0);
      if (ap) {
         TApplication::Close(ap);
         delete ap;
      }
   }
   // Attach or start a remote application
   if (user.Length() > 0)
      hostdir.Insert(0,Form("%s@", user.Data()));
   const char *sc = (script.Length() > 0) ? script.Data() : 0;
   TApplication *ap = TApplication::Open(hostdir, dbg, sc);
   if (ap) {
      fAppRemote = ap;
   }

   // Done
   return 1;
}

//______________________________________________________________________________
Long_t TApplication::ProcessLine(const char *line, Bool_t sync, Int_t *err)
{
   // Process a single command line, either a C++ statement or an interpreter
   // command starting with a ".".
   // Return the return value of the command casted to a long.

   if (!line || !*line) return 0;

   // If we are asked to go remote do it
   if (!strncmp(line, ".R", 2)) {
      Int_t n = 2;
      while (*(line+n) == ' ')
         n++;
      return ProcessRemote(line+n, err);
   }

   // Redirect, if requested
   if (fAppRemote && TestBit(kProcessRemotely)) {
      ResetBit(kProcessRemotely);
      return fAppRemote->ProcessLine(line, err);
   }

   if (!strncasecmp(line, ".qqqqqqq", 7)) {
      gSystem->Abort();
   } else if (!strncasecmp(line, ".qqqqq", 5)) {
      Info("ProcessLine", "Bye... (try '.qqqqqqq' if still running)");
      gSystem->Exit(1);
   } else if (!strncasecmp(line, ".exit", 4) || !strncasecmp(line, ".quit", 2)) {
      gInterpreter->ResetGlobals();
      Terminate(0);
      return 0;
   }

   if (!strncmp(line, "?", 1)) {
      Help(line);
      return 1;
   }

   if (!strncmp(line, ".pwd", 4)) {
      if (gDirectory)
         Printf("Current directory: %s", gDirectory->GetPath());
      if (gPad)
         Printf("Current pad:       %s", gPad->GetName());
      if (gStyle)
         Printf("Current style:     %s", gStyle->GetName());
      return 1;
   }

   if (!strncmp(line, ".ls", 3)) {
      const char *opt = 0;
      if (line[3]) opt = &line[3];
      if (gDirectory) gDirectory->ls(opt);
      return 1;
   }

   if (!strncmp(line, ".which", 6)) {
      char *fn  = Strip(line+7);
      char *s   = strtok(fn, "+(");
      char *mac = gSystem->Which(TROOT::GetMacroPath(), s, kReadPermission);
      if (!mac)
         Printf("No macro %s in path %s", s, TROOT::GetMacroPath());
      else
         Printf("%s", mac);
      delete [] fn;
      delete [] mac;
      return mac ? 1 : 0;
   }

   if (!strncmp(line, ".L", 2) || !strncmp(line, ".U", 2)) {
      TString aclicMode;
      TString arguments;
      TString io;
      TString fname = gSystem->SplitAclicMode(line+3, aclicMode, arguments, io);

      char *mac = gSystem->Which(TROOT::GetMacroPath(), fname, kReadPermission);
      if (arguments.Length()) {
         Warning("ProcessLine", "argument(s) \"%s\" ignored with .%c", arguments.Data(),
                 line[1]);
      }
      Long_t retval = 0;
      if (!mac)
         Error("ProcessLine", "macro %s not found in path %s", fname.Data(),
               TROOT::GetMacroPath());
      else {
         TString cmd(line+1);
         Ssiz_t posSpace = cmd.Index(' ');
         if (posSpace == -1) cmd.Remove(1);
         else cmd.Remove(posSpace);
         static TString tempbuf;
         if (sync) {
            tempbuf.Form(".%s %s%s%s", cmd.Data(), mac, aclicMode.Data(),io.Data());
            retval = gInterpreter->ProcessLineSynch(tempbuf,
                                                   (TInterpreter::EErrorCode*)err);
         } else {
            tempbuf.Form(".%s %s%s%s", cmd.Data(), mac, aclicMode.Data(),io.Data());
            retval = gInterpreter->ProcessLine(tempbuf,
                                              (TInterpreter::EErrorCode*)err);
         }
      }

      delete [] mac;

      InitializeGraphics();

      return retval;
   }

   if (!strncmp(line, ".X", 2) || !strncmp(line, ".x", 2)) {
      return ProcessFile(line+3, err, line[2] == 'k');
   }

   if (!strcmp(line, ".reset")) {
      // Do nothing, .reset disabled in CINT because too many side effects
      Printf("*** .reset not allowed, please use gROOT->Reset() ***");
      return 0;

#if 0
      // delete the ROOT dictionary since CINT will destroy all objects
      // referenced by the dictionary classes (TClass et. al.)
      gROOT->GetListOfClasses()->Delete();
      // fall through
#endif
   }

   if (sync)
      return gInterpreter->ProcessLineSynch(line, (TInterpreter::EErrorCode*)err);
   else
      return gInterpreter->ProcessLine(line, (TInterpreter::EErrorCode*)err);
}

//______________________________________________________________________________
Long_t TApplication::ProcessFile(const char *file, Int_t *error, Bool_t keep)
{
   // Process a file containing a C++ macro.

   return ExecuteFile(file, error, keep);
}

//______________________________________________________________________________
Long_t TApplication::ExecuteFile(const char *file, Int_t *error, Bool_t keep)
{
   // Execute a file containing a C++ macro (static method). Can be used
   // while TApplication is not yet created.

   const Int_t kBufSize = 1024;

   if (!file || !*file) return 0;

   TString aclicMode;
   TString arguments;
   TString io;
   TString fname = gSystem->SplitAclicMode(file, aclicMode, arguments, io);

   char *exnam = gSystem->Which(TROOT::GetMacroPath(), fname, kReadPermission);
   if (!exnam) {
      ::Error("TApplication::ExecuteFile", "macro %s not found in path %s", fname.Data(),
              TROOT::GetMacroPath());
      delete [] exnam;
      return 0;
   }

   ::ifstream macro(exnam, ios::in);
   if (!macro.good()) {
      ::Error("TApplication::ExecuteFile", "%s no such file", exnam);
      delete [] exnam;
      return 0;
   }

   char currentline[kBufSize];
   int tempfile = 0;
   int comment  = 0;
   int ifndefc  = 0;
   int ifdef    = 0;
   char *s      = 0;
   Bool_t execute = kFALSE;
   Long_t retval = 0;

   while (1) {
      macro.getline(currentline, kBufSize);
      if (macro.eof()) break;
      s = currentline;
      while (s && (*s == ' ' || *s == '\t')) s++;   // strip-off leading blanks

      // very simple minded pre-processor parsing, only works in case macro file
      // starts with "#ifndef __CINT__". In that case everything till next
      // "#else" or "#endif" will be skipped.
      if (*s == '#') {
         char *cs = Compress(currentline);
         if (strstr(cs, "#ifndef__CINT__") ||
             strstr(cs, "#if!defined(__CINT__)"))
            ifndefc = 1;
         else if (ifndefc && (strstr(cs, "#ifdef") || strstr(cs, "#ifndef") ||
                  strstr(cs, "#ifdefined") || strstr(cs, "#if!defined")))
            ifdef++;
         else if (ifndefc && strstr(cs, "#endif")) {
            if (ifdef)
               ifdef--;
            else
               ifndefc = 0;
         } else if (ifndefc && !ifdef && strstr(cs, "#else"))
            ifndefc = 0;
         delete [] cs;
      }
      if (!*s || *s == '#' || ifndefc || !strncmp(s, "//", 2)) continue;

      if (!strncmp(s, ".X", 2) || !strncmp(s, ".x", 2)) {
         retval = ExecuteFile(s+3);
         execute = kTRUE;
         continue;
      }

      if (!strncmp(s, "/*", 2)) comment = 1;
      if (comment) {
         // handle slightly more complex cases like: /*  */  /*
again:
         s = strstr(s, "*/");
         if (s) {
            comment = 0;
            s += 2;

            while (s && (*s == ' ' || *s == '\t')) s++; // strip-off leading blanks
            if (!*s) continue;
            if (!strncmp(s, "//", 2)) continue;
            if (!strncmp(s, "/*", 2)) {
               comment = 1;
               goto again;
            }
         }
      }
      if (!comment && *s == '{') tempfile = 1;
      if (!comment) break;
   }
   macro.close();

   if (!execute) {
      TString exname = exnam;
      if (!tempfile) {
         // We have a script that does NOT contain an unamed macro,
         // so we can call the script compiler on it.
         exname += aclicMode;
      }
      exname += arguments;
      exname += io;

      static TString tempbuf;
      if (tempfile) {
         tempbuf.Form(".x %s", exname.Data());
      } else {
         tempbuf.Form(".X%s %s", keep ? "k" : " ", exname.Data());
      }
      retval = gInterpreter->ProcessLineSynch(tempbuf,(TInterpreter::EErrorCode*)error);
   }

   delete [] exnam;
   return retval;
}

//______________________________________________________________________________
void TApplication::Run(Bool_t retrn)
{
   // Main application eventloop. Calls system dependent eventloop via gSystem.

   SetReturnFromRun(retrn);

   fIsRunning = kTRUE;

   gSystem->Run();

   fIsRunning = kFALSE;
}

//______________________________________________________________________________
void TApplication::SetIdleTimer(UInt_t idleTimeInSec, const char *command)
{
   // Set the command to be executed after the system has been idle for
   // idleTimeInSec seconds. Normally called via TROOT::Idle(...).

   if (fIdleTimer) RemoveIdleTimer();
   fIdleCommand = command;
   fIdleTimer = new TIdleTimer(idleTimeInSec*1000);
   gSystem->AddTimer(fIdleTimer);
}

//______________________________________________________________________________
void TApplication::RemoveIdleTimer()
{
   // Remove idle timer. Normally called via TROOT::Idle(0).

   if (fIdleTimer) {
      // timers are removed from the gSystem timer list by their dtor
      SafeDelete(fIdleTimer);
   }
}

//______________________________________________________________________________
void TApplication::StartIdleing()
{
   // Called when system starts idleing.

   if (fIdleTimer) {
      fIdleTimer->Reset();
      gSystem->AddTimer(fIdleTimer);
   }
}

//______________________________________________________________________________
void TApplication::StopIdleing()
{
   // Called when system stops idleing.

   if (fIdleTimer)
      gSystem->RemoveTimer(fIdleTimer);
}

//______________________________________________________________________________
void TApplication::Terminate(Int_t status)
{
   // Terminate the application by call TSystem::Exit() unless application has
   // been told to return from Run(), by a call to SetReturnFromRun().

   Emit("Terminate(Int_t)", status);

   if (fReturnFromRun)
      gSystem->ExitLoop();
   else
      gSystem->Exit(status);
}

//______________________________________________________________________________
void TApplication::LineProcessed(const char *line)
{
   // Emit signal when a line has been processed.

   Emit("LineProcessed(const char*)", line);
}

//______________________________________________________________________________
void TApplication::KeyPressed(Int_t key)
{
   // Emit signal when console keyboard key was pressed.

   Emit("KeyPressed(Int_t)", key);
}

//______________________________________________________________________________
void TApplication::ReturnPressed(char *text )
{
   // Emit signal when return key was pressed.

   Emit("ReturnPressed(char*)", text);
}

//______________________________________________________________________________
void TApplication::SetEchoMode(Bool_t)
{
   // Set console echo mode:
   //
   //  mode = kTRUE  - echo input symbols
   //  mode = kFALSE - noecho input symbols
}

//______________________________________________________________________________
void TApplication::CreateApplication()
{
   // Static function used to create a default application environment.

   if (!gApplication) {
      char *a = StrDup("RootApp");
      char *b = StrDup("-b");
      char *argv[2];
      Int_t argc = 2;
      argv[0] = a;
      argv[1] = b;
      new TApplication("RootApp", &argc, argv, 0, 0);
      if (gDebug > 0)
         Printf("<TApplication::CreateApplication>: "
                "created default TApplication");
      delete [] a; delete [] b;
      gApplication->SetBit(kDefaultApplication);
   }
}

//______________________________________________________________________________
TApplication *TApplication::Open(const char *url,
                                  Int_t debug, const char *script)
{
   // Static function used to attach to an existing remote application
   // or to start one.

   TApplication *ap = 0;
   TUrl nu(url);
   Int_t nnew = 0;

   // Look among the existing ones
   if (fgApplications) {
      TIter nxa(fgApplications);
      while ((ap = (TApplication *) nxa())) {
         TString apn(ap->ApplicationName());
         if (apn == url) {
            // Found matching application
            return ap;
         } else {
            // Check if same machine and user
            TUrl au(apn);
            if (strlen(au.GetUser()) > 0 && strlen(nu.GetUser()) > 0 &&
                !strcmp(au.GetUser(), nu.GetUser())) {
               if (!strncmp(au.GetHost(), nu.GetHost(), strlen(nu.GetHost())))
                  // New session on a known machine
                  nnew++;
            }
         }
      }
   } else {
      ::Error("TApplication::Open", "list of applications undefined - protocol error");
      return ap;
   }

   // If new session on a known machine pass the number as option
   if (nnew > 0) {
      nnew++;
      nu.SetOptions(Form("%d", nnew));
   }

   // Instantiate the TApplication object to be run
   TPluginHandler *h = 0;
   if ((h = gROOT->GetPluginManager()->FindHandler("TApplication","remote"))) {
      if (h->LoadPlugin() == 0) {
         ap = (TApplication *) h->ExecPlugin(3, nu.GetUrl(), debug, script);
      } else {
         ::Error("TApplication::Open", "failed to load plugin for TApplicationRemote");
      }
   } else {
      ::Error("TApplication::Open", "failed to find plugin for TApplicationRemote");
   }

   // Add to the list
   if (ap && !(ap->TestBit(kInvalidObject))) {
      fgApplications->Add(ap);
      gROOT->GetListOfBrowsables()->Add(ap, ap->ApplicationName());
      TIter next(gROOT->GetListOfBrowsers());
      TBrowser *b;
      while ((b = (TBrowser*) next()))
         b->Add(ap, ap->ApplicationName());
      gROOT->RefreshBrowsers();
   } else {
      SafeDelete(ap);
      ::Error("TApplication::Open",
              "TApplicationRemote for %s could not be instantiated", url);
   }

   // Done
   return ap;
}

//______________________________________________________________________________
void TApplication::Close(TApplication *app)
{
   // Static function used to close a remote application

   if (app) {
      app->Terminate(0);
      fgApplications->Remove(app);
      gROOT->GetListOfBrowsables()->RecursiveRemove(app);
      TIter next(gROOT->GetListOfBrowsers());
      TBrowser *b;
      while ((b = (TBrowser*) next()))
         b->RecursiveRemove(app);
      gROOT->RefreshBrowsers();
   }
}

//______________________________________________________________________________
void TApplication::ls(Option_t *opt) const
{
   // Show available sessions

   if (fgApplications) {
      TIter nxa(fgApplications);
      TApplication *a = 0;
      while ((a = (TApplication *) nxa())) {
         a->Print(opt);
      }
   } else {
      Print(opt);
   }
}

//______________________________________________________________________________
TList *TApplication::GetApplications()
{
   // Static method returning the list of available applications

   return fgApplications;
}
 TApplication.cxx:1
 TApplication.cxx:2
 TApplication.cxx:3
 TApplication.cxx:4
 TApplication.cxx:5
 TApplication.cxx:6
 TApplication.cxx:7
 TApplication.cxx:8
 TApplication.cxx:9
 TApplication.cxx:10
 TApplication.cxx:11
 TApplication.cxx:12
 TApplication.cxx:13
 TApplication.cxx:14
 TApplication.cxx:15
 TApplication.cxx:16
 TApplication.cxx:17
 TApplication.cxx:18
 TApplication.cxx:19
 TApplication.cxx:20
 TApplication.cxx:21
 TApplication.cxx:22
 TApplication.cxx:23
 TApplication.cxx:24
 TApplication.cxx:25
 TApplication.cxx:26
 TApplication.cxx:27
 TApplication.cxx:28
 TApplication.cxx:29
 TApplication.cxx:30
 TApplication.cxx:31
 TApplication.cxx:32
 TApplication.cxx:33
 TApplication.cxx:34
 TApplication.cxx:35
 TApplication.cxx:36
 TApplication.cxx:37
 TApplication.cxx:38
 TApplication.cxx:39
 TApplication.cxx:40
 TApplication.cxx:41
 TApplication.cxx:42
 TApplication.cxx:43
 TApplication.cxx:44
 TApplication.cxx:45
 TApplication.cxx:46
 TApplication.cxx:47
 TApplication.cxx:48
 TApplication.cxx:49
 TApplication.cxx:50
 TApplication.cxx:51
 TApplication.cxx:52
 TApplication.cxx:53
 TApplication.cxx:54
 TApplication.cxx:55
 TApplication.cxx:56
 TApplication.cxx:57
 TApplication.cxx:58
 TApplication.cxx:59
 TApplication.cxx:60
 TApplication.cxx:61
 TApplication.cxx:62
 TApplication.cxx:63
 TApplication.cxx:64
 TApplication.cxx:65
 TApplication.cxx:66
 TApplication.cxx:67
 TApplication.cxx:68
 TApplication.cxx:69
 TApplication.cxx:70
 TApplication.cxx:71
 TApplication.cxx:72
 TApplication.cxx:73
 TApplication.cxx:74
 TApplication.cxx:75
 TApplication.cxx:76
 TApplication.cxx:77
 TApplication.cxx:78
 TApplication.cxx:79
 TApplication.cxx:80
 TApplication.cxx:81
 TApplication.cxx:82
 TApplication.cxx:83
 TApplication.cxx:84
 TApplication.cxx:85
 TApplication.cxx:86
 TApplication.cxx:87
 TApplication.cxx:88
 TApplication.cxx:89
 TApplication.cxx:90
 TApplication.cxx:91
 TApplication.cxx:92
 TApplication.cxx:93
 TApplication.cxx:94
 TApplication.cxx:95
 TApplication.cxx:96
 TApplication.cxx:97
 TApplication.cxx:98
 TApplication.cxx:99
 TApplication.cxx:100
 TApplication.cxx:101
 TApplication.cxx:102
 TApplication.cxx:103
 TApplication.cxx:104
 TApplication.cxx:105
 TApplication.cxx:106
 TApplication.cxx:107
 TApplication.cxx:108
 TApplication.cxx:109
 TApplication.cxx:110
 TApplication.cxx:111
 TApplication.cxx:112
 TApplication.cxx:113
 TApplication.cxx:114
 TApplication.cxx:115
 TApplication.cxx:116
 TApplication.cxx:117
 TApplication.cxx:118
 TApplication.cxx:119
 TApplication.cxx:120
 TApplication.cxx:121
 TApplication.cxx:122
 TApplication.cxx:123
 TApplication.cxx:124
 TApplication.cxx:125
 TApplication.cxx:126
 TApplication.cxx:127
 TApplication.cxx:128
 TApplication.cxx:129
 TApplication.cxx:130
 TApplication.cxx:131
 TApplication.cxx:132
 TApplication.cxx:133
 TApplication.cxx:134
 TApplication.cxx:135
 TApplication.cxx:136
 TApplication.cxx:137
 TApplication.cxx:138
 TApplication.cxx:139
 TApplication.cxx:140
 TApplication.cxx:141
 TApplication.cxx:142
 TApplication.cxx:143
 TApplication.cxx:144
 TApplication.cxx:145
 TApplication.cxx:146
 TApplication.cxx:147
 TApplication.cxx:148
 TApplication.cxx:149
 TApplication.cxx:150
 TApplication.cxx:151
 TApplication.cxx:152
 TApplication.cxx:153
 TApplication.cxx:154
 TApplication.cxx:155
 TApplication.cxx:156
 TApplication.cxx:157
 TApplication.cxx:158
 TApplication.cxx:159
 TApplication.cxx:160
 TApplication.cxx:161
 TApplication.cxx:162
 TApplication.cxx:163
 TApplication.cxx:164
 TApplication.cxx:165
 TApplication.cxx:166
 TApplication.cxx:167
 TApplication.cxx:168
 TApplication.cxx:169
 TApplication.cxx:170
 TApplication.cxx:171
 TApplication.cxx:172
 TApplication.cxx:173
 TApplication.cxx:174
 TApplication.cxx:175
 TApplication.cxx:176
 TApplication.cxx:177
 TApplication.cxx:178
 TApplication.cxx:179
 TApplication.cxx:180
 TApplication.cxx:181
 TApplication.cxx:182
 TApplication.cxx:183
 TApplication.cxx:184
 TApplication.cxx:185
 TApplication.cxx:186
 TApplication.cxx:187
 TApplication.cxx:188
 TApplication.cxx:189
 TApplication.cxx:190
 TApplication.cxx:191
 TApplication.cxx:192
 TApplication.cxx:193
 TApplication.cxx:194
 TApplication.cxx:195
 TApplication.cxx:196
 TApplication.cxx:197
 TApplication.cxx:198
 TApplication.cxx:199
 TApplication.cxx:200
 TApplication.cxx:201
 TApplication.cxx:202
 TApplication.cxx:203
 TApplication.cxx:204
 TApplication.cxx:205
 TApplication.cxx:206
 TApplication.cxx:207
 TApplication.cxx:208
 TApplication.cxx:209
 TApplication.cxx:210
 TApplication.cxx:211
 TApplication.cxx:212
 TApplication.cxx:213
 TApplication.cxx:214
 TApplication.cxx:215
 TApplication.cxx:216
 TApplication.cxx:217
 TApplication.cxx:218
 TApplication.cxx:219
 TApplication.cxx:220
 TApplication.cxx:221
 TApplication.cxx:222
 TApplication.cxx:223
 TApplication.cxx:224
 TApplication.cxx:225
 TApplication.cxx:226
 TApplication.cxx:227
 TApplication.cxx:228
 TApplication.cxx:229
 TApplication.cxx:230
 TApplication.cxx:231
 TApplication.cxx:232
 TApplication.cxx:233
 TApplication.cxx:234
 TApplication.cxx:235
 TApplication.cxx:236
 TApplication.cxx:237
 TApplication.cxx:238
 TApplication.cxx:239
 TApplication.cxx:240
 TApplication.cxx:241
 TApplication.cxx:242
 TApplication.cxx:243
 TApplication.cxx:244
 TApplication.cxx:245
 TApplication.cxx:246
 TApplication.cxx:247
 TApplication.cxx:248
 TApplication.cxx:249
 TApplication.cxx:250
 TApplication.cxx:251
 TApplication.cxx:252
 TApplication.cxx:253
 TApplication.cxx:254
 TApplication.cxx:255
 TApplication.cxx:256
 TApplication.cxx:257
 TApplication.cxx:258
 TApplication.cxx:259
 TApplication.cxx:260
 TApplication.cxx:261
 TApplication.cxx:262
 TApplication.cxx:263
 TApplication.cxx:264
 TApplication.cxx:265
 TApplication.cxx:266
 TApplication.cxx:267
 TApplication.cxx:268
 TApplication.cxx:269
 TApplication.cxx:270
 TApplication.cxx:271
 TApplication.cxx:272
 TApplication.cxx:273
 TApplication.cxx:274
 TApplication.cxx:275
 TApplication.cxx:276
 TApplication.cxx:277
 TApplication.cxx:278
 TApplication.cxx:279
 TApplication.cxx:280
 TApplication.cxx:281
 TApplication.cxx:282
 TApplication.cxx:283
 TApplication.cxx:284
 TApplication.cxx:285
 TApplication.cxx:286
 TApplication.cxx:287
 TApplication.cxx:288
 TApplication.cxx:289
 TApplication.cxx:290
 TApplication.cxx:291
 TApplication.cxx:292
 TApplication.cxx:293
 TApplication.cxx:294
 TApplication.cxx:295
 TApplication.cxx:296
 TApplication.cxx:297
 TApplication.cxx:298
 TApplication.cxx:299
 TApplication.cxx:300
 TApplication.cxx:301
 TApplication.cxx:302
 TApplication.cxx:303
 TApplication.cxx:304
 TApplication.cxx:305
 TApplication.cxx:306
 TApplication.cxx:307
 TApplication.cxx:308
 TApplication.cxx:309
 TApplication.cxx:310
 TApplication.cxx:311
 TApplication.cxx:312
 TApplication.cxx:313
 TApplication.cxx:314
 TApplication.cxx:315
 TApplication.cxx:316
 TApplication.cxx:317
 TApplication.cxx:318
 TApplication.cxx:319
 TApplication.cxx:320
 TApplication.cxx:321
 TApplication.cxx:322
 TApplication.cxx:323
 TApplication.cxx:324
 TApplication.cxx:325
 TApplication.cxx:326
 TApplication.cxx:327
 TApplication.cxx:328
 TApplication.cxx:329
 TApplication.cxx:330
 TApplication.cxx:331
 TApplication.cxx:332
 TApplication.cxx:333
 TApplication.cxx:334
 TApplication.cxx:335
 TApplication.cxx:336
 TApplication.cxx:337
 TApplication.cxx:338
 TApplication.cxx:339
 TApplication.cxx:340
 TApplication.cxx:341
 TApplication.cxx:342
 TApplication.cxx:343
 TApplication.cxx:344
 TApplication.cxx:345
 TApplication.cxx:346
 TApplication.cxx:347
 TApplication.cxx:348
 TApplication.cxx:349
 TApplication.cxx:350
 TApplication.cxx:351
 TApplication.cxx:352
 TApplication.cxx:353
 TApplication.cxx:354
 TApplication.cxx:355
 TApplication.cxx:356
 TApplication.cxx:357
 TApplication.cxx:358
 TApplication.cxx:359
 TApplication.cxx:360
 TApplication.cxx:361
 TApplication.cxx:362
 TApplication.cxx:363
 TApplication.cxx:364
 TApplication.cxx:365
 TApplication.cxx:366
 TApplication.cxx:367
 TApplication.cxx:368
 TApplication.cxx:369
 TApplication.cxx:370
 TApplication.cxx:371
 TApplication.cxx:372
 TApplication.cxx:373
 TApplication.cxx:374
 TApplication.cxx:375
 TApplication.cxx:376
 TApplication.cxx:377
 TApplication.cxx:378
 TApplication.cxx:379
 TApplication.cxx:380
 TApplication.cxx:381
 TApplication.cxx:382
 TApplication.cxx:383
 TApplication.cxx:384
 TApplication.cxx:385
 TApplication.cxx:386
 TApplication.cxx:387
 TApplication.cxx:388
 TApplication.cxx:389
 TApplication.cxx:390
 TApplication.cxx:391
 TApplication.cxx:392
 TApplication.cxx:393
 TApplication.cxx:394
 TApplication.cxx:395
 TApplication.cxx:396
 TApplication.cxx:397
 TApplication.cxx:398
 TApplication.cxx:399
 TApplication.cxx:400
 TApplication.cxx:401
 TApplication.cxx:402
 TApplication.cxx:403
 TApplication.cxx:404
 TApplication.cxx:405
 TApplication.cxx:406
 TApplication.cxx:407
 TApplication.cxx:408
 TApplication.cxx:409
 TApplication.cxx:410
 TApplication.cxx:411
 TApplication.cxx:412
 TApplication.cxx:413
 TApplication.cxx:414
 TApplication.cxx:415
 TApplication.cxx:416
 TApplication.cxx:417
 TApplication.cxx:418
 TApplication.cxx:419
 TApplication.cxx:420
 TApplication.cxx:421
 TApplication.cxx:422
 TApplication.cxx:423
 TApplication.cxx:424
 TApplication.cxx:425
 TApplication.cxx:426
 TApplication.cxx:427
 TApplication.cxx:428
 TApplication.cxx:429
 TApplication.cxx:430
 TApplication.cxx:431
 TApplication.cxx:432
 TApplication.cxx:433
 TApplication.cxx:434
 TApplication.cxx:435
 TApplication.cxx:436
 TApplication.cxx:437
 TApplication.cxx:438
 TApplication.cxx:439
 TApplication.cxx:440
 TApplication.cxx:441
 TApplication.cxx:442
 TApplication.cxx:443
 TApplication.cxx:444
 TApplication.cxx:445
 TApplication.cxx:446
 TApplication.cxx:447
 TApplication.cxx:448
 TApplication.cxx:449
 TApplication.cxx:450
 TApplication.cxx:451
 TApplication.cxx:452
 TApplication.cxx:453
 TApplication.cxx:454
 TApplication.cxx:455
 TApplication.cxx:456
 TApplication.cxx:457
 TApplication.cxx:458
 TApplication.cxx:459
 TApplication.cxx:460
 TApplication.cxx:461
 TApplication.cxx:462
 TApplication.cxx:463
 TApplication.cxx:464
 TApplication.cxx:465
 TApplication.cxx:466
 TApplication.cxx:467
 TApplication.cxx:468
 TApplication.cxx:469
 TApplication.cxx:470
 TApplication.cxx:471
 TApplication.cxx:472
 TApplication.cxx:473
 TApplication.cxx:474
 TApplication.cxx:475
 TApplication.cxx:476
 TApplication.cxx:477
 TApplication.cxx:478
 TApplication.cxx:479
 TApplication.cxx:480
 TApplication.cxx:481
 TApplication.cxx:482
 TApplication.cxx:483
 TApplication.cxx:484
 TApplication.cxx:485
 TApplication.cxx:486
 TApplication.cxx:487
 TApplication.cxx:488
 TApplication.cxx:489
 TApplication.cxx:490
 TApplication.cxx:491
 TApplication.cxx:492
 TApplication.cxx:493
 TApplication.cxx:494
 TApplication.cxx:495
 TApplication.cxx:496
 TApplication.cxx:497
 TApplication.cxx:498
 TApplication.cxx:499
 TApplication.cxx:500
 TApplication.cxx:501
 TApplication.cxx:502
 TApplication.cxx:503
 TApplication.cxx:504
 TApplication.cxx:505
 TApplication.cxx:506
 TApplication.cxx:507
 TApplication.cxx:508
 TApplication.cxx:509
 TApplication.cxx:510
 TApplication.cxx:511
 TApplication.cxx:512
 TApplication.cxx:513
 TApplication.cxx:514
 TApplication.cxx:515
 TApplication.cxx:516
 TApplication.cxx:517
 TApplication.cxx:518
 TApplication.cxx:519
 TApplication.cxx:520
 TApplication.cxx:521
 TApplication.cxx:522
 TApplication.cxx:523
 TApplication.cxx:524
 TApplication.cxx:525
 TApplication.cxx:526
 TApplication.cxx:527
 TApplication.cxx:528
 TApplication.cxx:529
 TApplication.cxx:530
 TApplication.cxx:531
 TApplication.cxx:532
 TApplication.cxx:533
 TApplication.cxx:534
 TApplication.cxx:535
 TApplication.cxx:536
 TApplication.cxx:537
 TApplication.cxx:538
 TApplication.cxx:539
 TApplication.cxx:540
 TApplication.cxx:541
 TApplication.cxx:542
 TApplication.cxx:543
 TApplication.cxx:544
 TApplication.cxx:545
 TApplication.cxx:546
 TApplication.cxx:547
 TApplication.cxx:548
 TApplication.cxx:549
 TApplication.cxx:550
 TApplication.cxx:551
 TApplication.cxx:552
 TApplication.cxx:553
 TApplication.cxx:554
 TApplication.cxx:555
 TApplication.cxx:556
 TApplication.cxx:557
 TApplication.cxx:558
 TApplication.cxx:559
 TApplication.cxx:560
 TApplication.cxx:561
 TApplication.cxx:562
 TApplication.cxx:563
 TApplication.cxx:564
 TApplication.cxx:565
 TApplication.cxx:566
 TApplication.cxx:567
 TApplication.cxx:568
 TApplication.cxx:569
 TApplication.cxx:570
 TApplication.cxx:571
 TApplication.cxx:572
 TApplication.cxx:573
 TApplication.cxx:574
 TApplication.cxx:575
 TApplication.cxx:576
 TApplication.cxx:577
 TApplication.cxx:578
 TApplication.cxx:579
 TApplication.cxx:580
 TApplication.cxx:581
 TApplication.cxx:582
 TApplication.cxx:583
 TApplication.cxx:584
 TApplication.cxx:585
 TApplication.cxx:586
 TApplication.cxx:587
 TApplication.cxx:588
 TApplication.cxx:589
 TApplication.cxx:590
 TApplication.cxx:591
 TApplication.cxx:592
 TApplication.cxx:593
 TApplication.cxx:594
 TApplication.cxx:595
 TApplication.cxx:596
 TApplication.cxx:597
 TApplication.cxx:598
 TApplication.cxx:599
 TApplication.cxx:600
 TApplication.cxx:601
 TApplication.cxx:602
 TApplication.cxx:603
 TApplication.cxx:604
 TApplication.cxx:605
 TApplication.cxx:606
 TApplication.cxx:607
 TApplication.cxx:608
 TApplication.cxx:609
 TApplication.cxx:610
 TApplication.cxx:611
 TApplication.cxx:612
 TApplication.cxx:613
 TApplication.cxx:614
 TApplication.cxx:615
 TApplication.cxx:616
 TApplication.cxx:617
 TApplication.cxx:618
 TApplication.cxx:619
 TApplication.cxx:620
 TApplication.cxx:621
 TApplication.cxx:622
 TApplication.cxx:623
 TApplication.cxx:624
 TApplication.cxx:625
 TApplication.cxx:626
 TApplication.cxx:627
 TApplication.cxx:628
 TApplication.cxx:629
 TApplication.cxx:630
 TApplication.cxx:631
 TApplication.cxx:632
 TApplication.cxx:633
 TApplication.cxx:634
 TApplication.cxx:635
 TApplication.cxx:636
 TApplication.cxx:637
 TApplication.cxx:638
 TApplication.cxx:639
 TApplication.cxx:640
 TApplication.cxx:641
 TApplication.cxx:642
 TApplication.cxx:643
 TApplication.cxx:644
 TApplication.cxx:645
 TApplication.cxx:646
 TApplication.cxx:647
 TApplication.cxx:648
 TApplication.cxx:649
 TApplication.cxx:650
 TApplication.cxx:651
 TApplication.cxx:652
 TApplication.cxx:653
 TApplication.cxx:654
 TApplication.cxx:655
 TApplication.cxx:656
 TApplication.cxx:657
 TApplication.cxx:658
 TApplication.cxx:659
 TApplication.cxx:660
 TApplication.cxx:661
 TApplication.cxx:662
 TApplication.cxx:663
 TApplication.cxx:664
 TApplication.cxx:665
 TApplication.cxx:666
 TApplication.cxx:667
 TApplication.cxx:668
 TApplication.cxx:669
 TApplication.cxx:670
 TApplication.cxx:671
 TApplication.cxx:672
 TApplication.cxx:673
 TApplication.cxx:674
 TApplication.cxx:675
 TApplication.cxx:676
 TApplication.cxx:677
 TApplication.cxx:678
 TApplication.cxx:679
 TApplication.cxx:680
 TApplication.cxx:681
 TApplication.cxx:682
 TApplication.cxx:683
 TApplication.cxx:684
 TApplication.cxx:685
 TApplication.cxx:686
 TApplication.cxx:687
 TApplication.cxx:688
 TApplication.cxx:689
 TApplication.cxx:690
 TApplication.cxx:691
 TApplication.cxx:692
 TApplication.cxx:693
 TApplication.cxx:694
 TApplication.cxx:695
 TApplication.cxx:696
 TApplication.cxx:697
 TApplication.cxx:698
 TApplication.cxx:699
 TApplication.cxx:700
 TApplication.cxx:701
 TApplication.cxx:702
 TApplication.cxx:703
 TApplication.cxx:704
 TApplication.cxx:705
 TApplication.cxx:706
 TApplication.cxx:707
 TApplication.cxx:708
 TApplication.cxx:709
 TApplication.cxx:710
 TApplication.cxx:711
 TApplication.cxx:712
 TApplication.cxx:713
 TApplication.cxx:714
 TApplication.cxx:715
 TApplication.cxx:716
 TApplication.cxx:717
 TApplication.cxx:718
 TApplication.cxx:719
 TApplication.cxx:720
 TApplication.cxx:721
 TApplication.cxx:722
 TApplication.cxx:723
 TApplication.cxx:724
 TApplication.cxx:725
 TApplication.cxx:726
 TApplication.cxx:727
 TApplication.cxx:728
 TApplication.cxx:729
 TApplication.cxx:730
 TApplication.cxx:731
 TApplication.cxx:732
 TApplication.cxx:733
 TApplication.cxx:734
 TApplication.cxx:735
 TApplication.cxx:736
 TApplication.cxx:737
 TApplication.cxx:738
 TApplication.cxx:739
 TApplication.cxx:740
 TApplication.cxx:741
 TApplication.cxx:742
 TApplication.cxx:743
 TApplication.cxx:744
 TApplication.cxx:745
 TApplication.cxx:746
 TApplication.cxx:747
 TApplication.cxx:748
 TApplication.cxx:749
 TApplication.cxx:750
 TApplication.cxx:751
 TApplication.cxx:752
 TApplication.cxx:753
 TApplication.cxx:754
 TApplication.cxx:755
 TApplication.cxx:756
 TApplication.cxx:757
 TApplication.cxx:758
 TApplication.cxx:759
 TApplication.cxx:760
 TApplication.cxx:761
 TApplication.cxx:762
 TApplication.cxx:763
 TApplication.cxx:764
 TApplication.cxx:765
 TApplication.cxx:766
 TApplication.cxx:767
 TApplication.cxx:768
 TApplication.cxx:769
 TApplication.cxx:770
 TApplication.cxx:771
 TApplication.cxx:772
 TApplication.cxx:773
 TApplication.cxx:774
 TApplication.cxx:775
 TApplication.cxx:776
 TApplication.cxx:777
 TApplication.cxx:778
 TApplication.cxx:779
 TApplication.cxx:780
 TApplication.cxx:781
 TApplication.cxx:782
 TApplication.cxx:783
 TApplication.cxx:784
 TApplication.cxx:785
 TApplication.cxx:786
 TApplication.cxx:787
 TApplication.cxx:788
 TApplication.cxx:789
 TApplication.cxx:790
 TApplication.cxx:791
 TApplication.cxx:792
 TApplication.cxx:793
 TApplication.cxx:794
 TApplication.cxx:795
 TApplication.cxx:796
 TApplication.cxx:797
 TApplication.cxx:798
 TApplication.cxx:799
 TApplication.cxx:800
 TApplication.cxx:801
 TApplication.cxx:802
 TApplication.cxx:803
 TApplication.cxx:804
 TApplication.cxx:805
 TApplication.cxx:806
 TApplication.cxx:807
 TApplication.cxx:808
 TApplication.cxx:809
 TApplication.cxx:810
 TApplication.cxx:811
 TApplication.cxx:812
 TApplication.cxx:813
 TApplication.cxx:814
 TApplication.cxx:815
 TApplication.cxx:816
 TApplication.cxx:817
 TApplication.cxx:818
 TApplication.cxx:819
 TApplication.cxx:820
 TApplication.cxx:821
 TApplication.cxx:822
 TApplication.cxx:823
 TApplication.cxx:824
 TApplication.cxx:825
 TApplication.cxx:826
 TApplication.cxx:827
 TApplication.cxx:828
 TApplication.cxx:829
 TApplication.cxx:830
 TApplication.cxx:831
 TApplication.cxx:832
 TApplication.cxx:833
 TApplication.cxx:834
 TApplication.cxx:835
 TApplication.cxx:836
 TApplication.cxx:837
 TApplication.cxx:838
 TApplication.cxx:839
 TApplication.cxx:840
 TApplication.cxx:841
 TApplication.cxx:842
 TApplication.cxx:843
 TApplication.cxx:844
 TApplication.cxx:845
 TApplication.cxx:846
 TApplication.cxx:847
 TApplication.cxx:848
 TApplication.cxx:849
 TApplication.cxx:850
 TApplication.cxx:851
 TApplication.cxx:852
 TApplication.cxx:853
 TApplication.cxx:854
 TApplication.cxx:855
 TApplication.cxx:856
 TApplication.cxx:857
 TApplication.cxx:858
 TApplication.cxx:859
 TApplication.cxx:860
 TApplication.cxx:861
 TApplication.cxx:862
 TApplication.cxx:863
 TApplication.cxx:864
 TApplication.cxx:865
 TApplication.cxx:866
 TApplication.cxx:867
 TApplication.cxx:868
 TApplication.cxx:869
 TApplication.cxx:870
 TApplication.cxx:871
 TApplication.cxx:872
 TApplication.cxx:873
 TApplication.cxx:874
 TApplication.cxx:875
 TApplication.cxx:876
 TApplication.cxx:877
 TApplication.cxx:878
 TApplication.cxx:879
 TApplication.cxx:880
 TApplication.cxx:881
 TApplication.cxx:882
 TApplication.cxx:883
 TApplication.cxx:884
 TApplication.cxx:885
 TApplication.cxx:886
 TApplication.cxx:887
 TApplication.cxx:888
 TApplication.cxx:889
 TApplication.cxx:890
 TApplication.cxx:891
 TApplication.cxx:892
 TApplication.cxx:893
 TApplication.cxx:894
 TApplication.cxx:895
 TApplication.cxx:896
 TApplication.cxx:897
 TApplication.cxx:898
 TApplication.cxx:899
 TApplication.cxx:900
 TApplication.cxx:901
 TApplication.cxx:902
 TApplication.cxx:903
 TApplication.cxx:904
 TApplication.cxx:905
 TApplication.cxx:906
 TApplication.cxx:907
 TApplication.cxx:908
 TApplication.cxx:909
 TApplication.cxx:910
 TApplication.cxx:911
 TApplication.cxx:912
 TApplication.cxx:913
 TApplication.cxx:914
 TApplication.cxx:915
 TApplication.cxx:916
 TApplication.cxx:917
 TApplication.cxx:918
 TApplication.cxx:919
 TApplication.cxx:920
 TApplication.cxx:921
 TApplication.cxx:922
 TApplication.cxx:923
 TApplication.cxx:924
 TApplication.cxx:925
 TApplication.cxx:926
 TApplication.cxx:927
 TApplication.cxx:928
 TApplication.cxx:929
 TApplication.cxx:930
 TApplication.cxx:931
 TApplication.cxx:932
 TApplication.cxx:933
 TApplication.cxx:934
 TApplication.cxx:935
 TApplication.cxx:936
 TApplication.cxx:937
 TApplication.cxx:938
 TApplication.cxx:939
 TApplication.cxx:940
 TApplication.cxx:941
 TApplication.cxx:942
 TApplication.cxx:943
 TApplication.cxx:944
 TApplication.cxx:945
 TApplication.cxx:946
 TApplication.cxx:947
 TApplication.cxx:948
 TApplication.cxx:949
 TApplication.cxx:950
 TApplication.cxx:951
 TApplication.cxx:952
 TApplication.cxx:953
 TApplication.cxx:954
 TApplication.cxx:955
 TApplication.cxx:956
 TApplication.cxx:957
 TApplication.cxx:958
 TApplication.cxx:959
 TApplication.cxx:960
 TApplication.cxx:961
 TApplication.cxx:962
 TApplication.cxx:963
 TApplication.cxx:964
 TApplication.cxx:965
 TApplication.cxx:966
 TApplication.cxx:967
 TApplication.cxx:968
 TApplication.cxx:969
 TApplication.cxx:970
 TApplication.cxx:971
 TApplication.cxx:972
 TApplication.cxx:973
 TApplication.cxx:974
 TApplication.cxx:975
 TApplication.cxx:976
 TApplication.cxx:977
 TApplication.cxx:978
 TApplication.cxx:979
 TApplication.cxx:980
 TApplication.cxx:981
 TApplication.cxx:982
 TApplication.cxx:983
 TApplication.cxx:984
 TApplication.cxx:985
 TApplication.cxx:986
 TApplication.cxx:987
 TApplication.cxx:988
 TApplication.cxx:989
 TApplication.cxx:990
 TApplication.cxx:991
 TApplication.cxx:992
 TApplication.cxx:993
 TApplication.cxx:994
 TApplication.cxx:995
 TApplication.cxx:996
 TApplication.cxx:997
 TApplication.cxx:998
 TApplication.cxx:999
 TApplication.cxx:1000
 TApplication.cxx:1001
 TApplication.cxx:1002
 TApplication.cxx:1003
 TApplication.cxx:1004
 TApplication.cxx:1005
 TApplication.cxx:1006
 TApplication.cxx:1007
 TApplication.cxx:1008
 TApplication.cxx:1009
 TApplication.cxx:1010
 TApplication.cxx:1011
 TApplication.cxx:1012
 TApplication.cxx:1013
 TApplication.cxx:1014
 TApplication.cxx:1015
 TApplication.cxx:1016
 TApplication.cxx:1017
 TApplication.cxx:1018
 TApplication.cxx:1019
 TApplication.cxx:1020
 TApplication.cxx:1021
 TApplication.cxx:1022
 TApplication.cxx:1023
 TApplication.cxx:1024
 TApplication.cxx:1025
 TApplication.cxx:1026
 TApplication.cxx:1027
 TApplication.cxx:1028
 TApplication.cxx:1029
 TApplication.cxx:1030
 TApplication.cxx:1031
 TApplication.cxx:1032
 TApplication.cxx:1033
 TApplication.cxx:1034
 TApplication.cxx:1035
 TApplication.cxx:1036
 TApplication.cxx:1037
 TApplication.cxx:1038
 TApplication.cxx:1039
 TApplication.cxx:1040
 TApplication.cxx:1041
 TApplication.cxx:1042
 TApplication.cxx:1043
 TApplication.cxx:1044
 TApplication.cxx:1045
 TApplication.cxx:1046
 TApplication.cxx:1047
 TApplication.cxx:1048
 TApplication.cxx:1049
 TApplication.cxx:1050
 TApplication.cxx:1051
 TApplication.cxx:1052
 TApplication.cxx:1053
 TApplication.cxx:1054
 TApplication.cxx:1055
 TApplication.cxx:1056
 TApplication.cxx:1057
 TApplication.cxx:1058
 TApplication.cxx:1059
 TApplication.cxx:1060
 TApplication.cxx:1061
 TApplication.cxx:1062
 TApplication.cxx:1063
 TApplication.cxx:1064
 TApplication.cxx:1065
 TApplication.cxx:1066
 TApplication.cxx:1067
 TApplication.cxx:1068
 TApplication.cxx:1069
 TApplication.cxx:1070
 TApplication.cxx:1071
 TApplication.cxx:1072
 TApplication.cxx:1073
 TApplication.cxx:1074
 TApplication.cxx:1075
 TApplication.cxx:1076
 TApplication.cxx:1077
 TApplication.cxx:1078
 TApplication.cxx:1079
 TApplication.cxx:1080
 TApplication.cxx:1081
 TApplication.cxx:1082
 TApplication.cxx:1083
 TApplication.cxx:1084
 TApplication.cxx:1085
 TApplication.cxx:1086
 TApplication.cxx:1087
 TApplication.cxx:1088
 TApplication.cxx:1089
 TApplication.cxx:1090
 TApplication.cxx:1091
 TApplication.cxx:1092
 TApplication.cxx:1093
 TApplication.cxx:1094
 TApplication.cxx:1095
 TApplication.cxx:1096
 TApplication.cxx:1097
 TApplication.cxx:1098
 TApplication.cxx:1099
 TApplication.cxx:1100
 TApplication.cxx:1101
 TApplication.cxx:1102
 TApplication.cxx:1103
 TApplication.cxx:1104
 TApplication.cxx:1105
 TApplication.cxx:1106
 TApplication.cxx:1107
 TApplication.cxx:1108
 TApplication.cxx:1109
 TApplication.cxx:1110
 TApplication.cxx:1111
 TApplication.cxx:1112
 TApplication.cxx:1113
 TApplication.cxx:1114
 TApplication.cxx:1115
 TApplication.cxx:1116
 TApplication.cxx:1117
 TApplication.cxx:1118
 TApplication.cxx:1119
 TApplication.cxx:1120
 TApplication.cxx:1121
 TApplication.cxx:1122
 TApplication.cxx:1123
 TApplication.cxx:1124
 TApplication.cxx:1125
 TApplication.cxx:1126
 TApplication.cxx:1127
 TApplication.cxx:1128
 TApplication.cxx:1129
 TApplication.cxx:1130
 TApplication.cxx:1131
 TApplication.cxx:1132
 TApplication.cxx:1133
 TApplication.cxx:1134
 TApplication.cxx:1135
 TApplication.cxx:1136
 TApplication.cxx:1137
 TApplication.cxx:1138
 TApplication.cxx:1139
 TApplication.cxx:1140
 TApplication.cxx:1141
 TApplication.cxx:1142
 TApplication.cxx:1143
 TApplication.cxx:1144
 TApplication.cxx:1145
 TApplication.cxx:1146
 TApplication.cxx:1147
 TApplication.cxx:1148
 TApplication.cxx:1149
 TApplication.cxx:1150
 TApplication.cxx:1151
 TApplication.cxx:1152
 TApplication.cxx:1153
 TApplication.cxx:1154
 TApplication.cxx:1155
 TApplication.cxx:1156
 TApplication.cxx:1157
 TApplication.cxx:1158
 TApplication.cxx:1159
 TApplication.cxx:1160
 TApplication.cxx:1161
 TApplication.cxx:1162
 TApplication.cxx:1163
 TApplication.cxx:1164
 TApplication.cxx:1165
 TApplication.cxx:1166
 TApplication.cxx:1167
 TApplication.cxx:1168
 TApplication.cxx:1169
 TApplication.cxx:1170
 TApplication.cxx:1171
 TApplication.cxx:1172
 TApplication.cxx:1173
 TApplication.cxx:1174
 TApplication.cxx:1175
 TApplication.cxx:1176
 TApplication.cxx:1177
 TApplication.cxx:1178
 TApplication.cxx:1179
 TApplication.cxx:1180
 TApplication.cxx:1181
 TApplication.cxx:1182
 TApplication.cxx:1183
 TApplication.cxx:1184
 TApplication.cxx:1185
 TApplication.cxx:1186
 TApplication.cxx:1187
 TApplication.cxx:1188
 TApplication.cxx:1189
 TApplication.cxx:1190
 TApplication.cxx:1191
 TApplication.cxx:1192
 TApplication.cxx:1193
 TApplication.cxx:1194
 TApplication.cxx:1195
 TApplication.cxx:1196
 TApplication.cxx:1197
 TApplication.cxx:1198
 TApplication.cxx:1199