BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//
// Class MyRint
//
// This is an example of how to make ones own ROOT Interactive
// Interpretor. This class preloads all the BRAT classes, so there is
// no need to call ".x Load.C" or ".x BratLoad.C"
//

// 
// $Id: BrRint.cxx,v 1.9 2001/11/16 16:49:12 cholm Exp $
//
// $Author: cholm $
// $Date: 2001/11/16 16:49:12 $
// $Copyright: Brahms Collaboration$
// 
// 
#ifndef __IOSTREAM__
#include <iostream>
#endif
#include <string.h>
#include <TROOT.h>
#include <TClass.h>
#include <TVirtualX.h>
#include <Getline.h>
#include <TStyle.h>
#include <TObjectTable.h>
#include <TClassTable.h>
#include <TStopwatch.h>
#include <TCanvas.h>
#include <TBenchmark.h>
#include <TRint.h>
#include <TSystem.h>
#include <TEnv.h>
#include <TSysEvtHandler.h>
#include <TError.h>
#include <TException.h>
#include <TInterpreter.h>
#include <TObjArray.h>
#include <TObjString.h>
#include <TMapFile.h>
#include <TTabCom.h>
#ifdef R__UNIX
#include <signal.h>
#endif
#include "BrRint.h"
#ifndef BRAT_BrPathManager
#include "BrPathManager.h"
#endif

//____________________________________________________________________
ClassImp(BrRint);

//____________________________________________________________________
 BrRint::BrRint(int*   argc,
	       char** argv)
  : TRint("BrRint",argc,argv)
{
  //
  // Initialize the interface. Load all BRAT classes. 
  //

#if defined(R__UNIX) && !defined(__sun)
  // Popdown X logo, only if started with -splash option
  Bool_t showSplash = kTRUE;
  for (int i = 0; i < Argc(); i++)
    if (!strcmp(Argv(i), "-l")) 
      showSplash = kFALSE;
  
  if (showSplash)
    fSplash = new BrSplash;
  else
    fSplash = 0;
#endif

  // Preset load paths
  PresetPaths();

  // Preset the html paths
  PresetHtmlSourceDir();

  // Some nifty stuff
  fPrompt       = "brat [%d] ";
  fVersion      = new BrVersion;
  
  // 
  // Set the prompt to be "brat [<x>]"!!!!
  // 
  SetPrompt(fPrompt);

  // 
  // Add our self to the list of special objects!
  TObject *obj = gROOT->GetListOfSpecials()->FindObject("bratroot");
  if (obj) delete obj;
  strcpy(fName,"bratroot");
  gROOT->GetListOfSpecials()->Add(this);
}

//____________________________________________________________________
BrRint* BrRint::fgInstance = 0;

//____________________________________________________________________
 BrRint* BrRint::Instance(int *argc, char** argv) 
{
  // Get the static instance 
  if (!fgInstance)
    fgInstance = new BrRint(argc,argv);

  return fgInstance;
}

//____________________________________________________________________
 Bool_t BrRint::PresetPaths() 
{
  // Set the BRAT library installation directory in the dynamic load
  // path, include directory in header path, and script in the "macro"
  // path. 
  BrPathManager* pm = BrPathManager::Instance();

#if 0
  Char_t* env1 = Form("%s.*.Root.DynamicPath", gSystem->GetName());
  TString p1(Form("%s:%s", gEnv->GetValue(env,"."), pm->GetLibraryDir()));
  gEnv->SetValue(env, p1.Data());
#endif 
#if ROOT_VERSION_CODE >= ROOT_VERSION(3,1,0)
  Char_t* env2  = Form("%s.*.Root.MacroPath", gSystem->GetName());
  TString p2(Form("%s:%s", gEnv->GetValue(env2,"."), pm->GetScriptDir()));
  gEnv->SetValue(env2, p2.Data());
  gROOT->SetMacroPath(0);
#endif
  G__add_ipath(pm->GetHeaderDir()); 

  return kTRUE;
}

//____________________________________________________________________
 void BrRint::PresetHtmlSourceDir(void) 
{
  // Currently doesn't do anything. 
}

//____________________________________________________________________
 void BrRint::Print(Option_t* option) const 
{
  // Print Information
  // Options:
  //     L     Print Logo (Default)
  //     S     Show splash and sleep for three seconds (not Solaris) 
  TString opt(option);
  opt.ToLower();
  if (opt.Contains("l")) {
    Printf(" ********************************************");
    Printf(" *                                          *");
    Printf(" *       W E L C O M E  to  B R A T         *");
    Printf(" *             Version %2d.%02d/%02d             *",
	   fVersion->GetMajor(), fVersion->GetMinor(),
	   fVersion->GetRevision());
    Printf(" *                                          *");
    Printf(" * All Classes preloaded                    *");
    Printf(" * Library, Header and Script paths set     *");
    Printf(" *                                          *");
    Printf(" ********************************************n");
  }
  if (opt.Contains("s")) {
#if !defined(R__UNIX)
    Warning("Print", "no splash screen on non-Unix architeture");
#elif defined(__sun) 
    Warning("Print", "no splash screen on Sun Solaris - missing XPM");
#else 
    BrSplash* splash = new BrSplash;
    gSystem->Sleep(3000);
    delete splash;
#endif
  }
}


//____________________________________________________________________
 void BrRint::PrintLogo(void) 
{
  // Print ASCII BRAT greeting on stdout.
  Print("l");
#if defined(R__UNIX) && !defined(__sun)
  // Popdown X logo, only if started with -splash option
  if (fSplash) {
    gSystem->Sleep(1000);
    delete fSplash;
  }
#endif
}

// $Log: BrRint.cxx,v $
// Revision 1.9  2001/11/16 16:49:12  cholm
// Some fixes for Solaris
//
// Revision 1.8  2001/08/24 18:46:32  cholm
// Fixed so that Root.MacroPath is used (set just before that).
//
// Revision 1.7  2001/08/20 21:41:22  cholm
// Fixed a problem with dyn path.
//
// Revision 1.6  2001/08/12 09:39:21  cholm
// Fixed a mistake in setting paths.
//
// Revision 1.5  2001/08/10 14:05:31  cholm
// Use gROOT->SetMacroPath to set macro path (thanks Brett).
//
// Revision 1.4  2001/07/18 09:46:09  cholm
// Removed message noin-const TRint::PrintLogo from BrRint::Print since
// that violates the ANSI/ISO C++ Standard.
//
// Revision 1.3  2001/06/28 16:30:26  cholm
// Better way of setting up the default paths and so on.  Took out the
// html path thing, 'cause it didn't really work in the first place.
// Splash screen stays up a bit longer.
//
// Revision 1.2  2001/06/26 12:10:04  cholm
// Fixed some problems with very long install paths and a mistake in
// checking return value of BrPathManager::GetDataDir();
//
// Revision 1.1.1.1  2001/06/21 14:55:21  hagel
// Initial revision of brat2
//
// Revision 1.7  2001/06/04 13:38:12  cholm
// Changes to use BrPathManager, BrVersion, and perpare to use BrFileTag.
//
// Revision 1.6  2001/05/03 21:39:57  cholm
// Updated to load/show libBrat_Trig.
//
// Revision 1.5  2001/05/01 17:23:38  videbaek
// Removed references to BrSplash in the bratroot for Solaris
// Checked out on rmine001.
//
// Revision 1.4  2001/01/21 17:44:45  cholm
// Corrected a bug in BrRint, caused a SIGSEGV if the user hadn't set
// the BRATHOME environment variable.
// Also added a test of the BrRunsDb and BrRunInfoManager classes, showing
// method of operation.
//
// Revision 1.3  2000/10/03 19:50:35  cholm
// Cleaned up TestBase.
// bratroot (BrRint) now loads _all_ libraries.
// brat-root vers bump to 1.11.3 as revisit of options and output
// (Please refer to brahms-soft-l archive)
// 						Christian Holm
//
// Revision 1.2  2000/09/19 11:26:07  cholm
// Updated Brahms_Logo.C for nicer output.
// Added Splash Screen to bratroot, via class BrSplash. Image from
// BrahmsLogo.C in brahms_logo.xpm and brahms_logo.xbm.
//
// Revision 1.1  2000/09/19 08:53:07  cholm
// Renamed files MyRint.cxx MyRint.h MyRintMain.cxx to BrRint.cxx
// BrRint.h BrRintMain.cxx and deleted files MyRintInc.h MyRintLinkDef.h
// MyRint.mk. Class MyRint renamed to BrRint. This is to prepare for the
// class BrBrat, which is supposed to be a general class for stamping
// files, programs, etc.
//
// Revision 1.5  2000/04/08 00:20:47  cholm
// Corrected bug that caused SIGSEGV.
//
// Revision 1.4  2000/04/06 20:26:28  cholm
// Modified the Makefile extensively.
// Updatet the BratInclude Macro
// The executable "brat" is renamed to "bratroot",
// and library, header, and html paths are set per default.
// Added the application TestGeantDig, which is similar to
// BraGD, that is a full-blown GBRAHMS digitizer with an easy
// user interface.
// brat-config moved to test sub-dir.
//
// Revision 1.3  2000/03/17 16:15:53  cholm
// Fixed a number of bugs in mybrat source files, and added some additional stuff to BratInclude.C. Notice, that mybrat now gets it's versioninfo from brat-config , rather then hard-coded in the source. Also an install arget is put into MyRint.mk.
//
// Revision 1.2  2000/03/06 15:15:10  hehi
// commit before database info posted
//
// Revision 1.1  1999/11/26 22:05:13  hehi
// Added example mybrat in test directory. A nice little tool - Christian Holm
//
// 


  

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS