ROOT
v6-36
Reference Guide
Loading...
Searching...
No Matches
rootalias.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_legacy
3
/// Defines aliases:
4
/// - `ls(path)`
5
/// - `edit(filename)`
6
/// - `dir(path)`
7
/// - `pwd()`
8
/// - `cd(path)`
9
///
10
/// \macro_code
11
///
12
/// \author Rene Brun
13
14
//______________________________________________________________________________
15
void
edit
(
char
*file)
16
{
17
char
s[64], *
e
;
18
if
(!
strcmp
(
gSystem
->
GetName
(),
"WinNT"
)) {
19
if
((
e
=
getenv
(
"EDITOR"
)))
20
sprintf
(s,
"start %s %s"
,
e
, file);
21
else
22
sprintf
(s,
"start notepad %s"
, file);
23
}
else
{
24
if
((
e
=
getenv
(
"EDITOR"
)))
25
sprintf
(s,
"%s %s"
,
e
, file);
26
else
27
sprintf
(s,
"xterm -e vi %s &"
, file);
28
}
29
gSystem
->
Exec
(s);
30
}
31
32
//______________________________________________________________________________
33
void
ls(
char
*path=0)
34
{
35
char
s[256];
36
strcpy
(s, (!
strcmp
(
gSystem
->
GetName
(),
"WinNT"
)) ?
"dir /w "
:
"ls "
);
37
if
(path)
strcat
(s,path);
38
gSystem
->
Exec
(s);
39
}
40
41
//______________________________________________________________________________
42
void
dir(
char
*path=0)
43
{
44
char
s[256];
45
strcpy
(s,(!
strcmp
(
gSystem
->
GetName
(),
"WinNT"
)) ?
"dir "
:
"ls -l "
);
46
if
(path)
strcat
(s,path);
47
gSystem
->
Exec
(s);
48
}
49
50
//______________________________________________________________________________
51
const
char
*pwd()
52
{
53
return
gSystem
->
WorkingDirectory
();
54
}
55
56
//______________________________________________________________________________
57
const
char
*
cd
(
char
*path=0)
58
{
59
if
(path)
60
gSystem
->
ChangeDirectory
(path);
61
return
pwd();
62
}
63
64
TCanvas
*
bench
= 0;
65
//______________________________________________________________________________
66
void
bexec2
(
char
*
macro
)
67
{
68
printf
(
"in bexec dir=%s\n"
,pwd());
69
if
(
gROOT
->IsBatch())
printf
(
"Processing benchmark: %s\n"
,
macro
);
70
TPaveText
*
summary
= (
TPaveText
*)
bench
->GetPrimitive(
"TPave"
);
71
TText
*
tmacro
=
summary
->GetLineWith(
macro
);
72
if
(
tmacro
)
tmacro
->SetTextColor(4);
73
bench
->Modified();
bench
->Update();
74
75
gROOT
->Macro(
macro
);
76
77
TPaveText
*
summary2
= (
TPaveText
*)
bench
->GetPrimitive(
"TPave"
);
78
TText
*
tmacro2
=
summary2
->GetLineWith(
macro
);
79
if
(
tmacro2
)
tmacro2
->SetTextColor(2);
80
bench
->Modified();
bench
->Update();
81
}
e
#define e(i)
Definition
RSha256.hxx:103
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
cd
void cd(Int_t id=-1)
gROOT
#define gROOT
Definition
TROOT.h:414
gSystem
R__EXTERN TSystem * gSystem
Definition
TSystem.h:572
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TNamed::GetName
const char * GetName() const override
Returns name of object.
Definition
TNamed.h:49
TPaveText
A Pave (see TPave) with text, lines or/and boxes inside.
Definition
TPaveText.h:21
TSystem::Exec
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition
TSystem.cxx:653
TSystem::ChangeDirectory
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition
TSystem.cxx:874
TSystem::WorkingDirectory
virtual const char * WorkingDirectory()
Return working directory.
Definition
TSystem.cxx:883
TText
Base class for several text objects.
Definition
TText.h:22
tutorials
legacy
rootalias.C
ROOT v6-36 - Reference Guide Generated on Thu Aug 21 2025 04:30:47 (GVA Time) using Doxygen 1.10.0