103 Break(
"TInterruptHandler::Notify",
"keyboard interrupt");
144 if (
argc !=
nullptr) {
180 for (
auto n = 1;
n < *
argc;
n++) {
181 std::cerr <<
"root: unrecognized option '" <<
argv[
n] <<
"'\n";
183 std::cerr <<
"Try 'root --help' for more information.\n";
219 code =
"#include <iostream>\n"
220 "#include <string>\n"
221 "#include <DllImport.h>\n";
223 code +=
"#include <vector>\n"
224 "#include <utility>";
282 "bold blue",
"magenta",
"bold green",
"bold red underlined",
"default"
285 "yellow",
"magenta",
"bold green",
"bold red underlined",
"default"
399 TObject *
w =
gROOT->GetListOfBrowsables()->FindObject(
"workdir");
402 if (
lnk->GetObject() ==
w) {
450 Printf(
"Processing %s...", (
const char*)file->
String());
517 std::vector<TString> lines;
519 lines.emplace_back(
TString::Format(
"Welcome to ROOT %s%%shttps://root.cern",
520 gROOT->GetVersion()));
521 lines.emplace_back(
TString::Format(
"(c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers%%s"));
524 static const char *
months[] = {
"January",
"February",
"March",
"April",
"May",
525 "June",
"July",
"August",
"September",
"October",
526 "November",
"December"};
533 gROOT->GetGitBranch(),
539 gROOT->GetGitBranch(),
540 gROOT->GetGitCommit()));
544 lines.emplace_back(
TString(
"Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'%s"));
547 auto itLongest = std::max_element(lines.begin(), lines.end(),
549 return left.Length() < right.Length(); });
554 for (
const auto&
line: lines) {
596 Error(
"SetPrompt",
"newPrompt too long (> 55 characters)");
650 catch (std::exception&
e) {
667 Error(
"HandleTermInput()",
"Exception caught!");
683 if (!
sline.BeginsWith(
".reset"))
798 SetPrompt(
"root (cont'ed, cancel with .@) [%d]");
803 std::string_view
sv(
line);
R__EXTERN TApplication * gApplication
R__EXTERN TBenchmark * gBenchmark
R__EXTERN TClassTable * gClassTable
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Break(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
R__EXTERN ExceptionContext_t * gException
R__EXTERN void Throw(int code)
If an exception context has been set (using the TRY and RETRY macros) jump back to where it was set.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char mode
R__EXTERN TInterpreter * gCling
static void ResetTermAtExit()
Restore terminal to non-raw mode.
static Int_t Key_Pressed(Int_t key)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
R__EXTERN TSystem * gSystem
R__EXTERN TTabCom * gTabCom
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
virtual void KeyPressed(Int_t key)
Emit signal when console keyboard key was pressed.
virtual Longptr_t ProcessLine(const char *line, Bool_t sync=kFALSE, Int_t *error=nullptr)
Process a single command line, either a C++ statement or an interpreter command starting with a "....
virtual Bool_t HandleTermInput()
TObjArray * InputFiles() const
virtual void LineProcessed(const char *line)
Emit signal when a line has been processed.
void ClearInputFiles()
Clear list containing macro files passed as program arguments.
Bool_t ReturnFromRun() const
virtual void Run(Bool_t retrn=kFALSE)
Main application eventloop. Calls system dependent eventloop via gSystem.
virtual void HandleException(Int_t sig)
Handle exceptions (kSigBus, kSigSegmentationViolation, kSigIllegalInstruction and kSigFloatingExcepti...
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
virtual const char * ApplicationName() const
virtual Longptr_t ProcessFile(const char *file, Int_t *error=nullptr, Bool_t keep=kFALSE)
Process a file containing a C++ macro.
virtual void ReturnPressed(char *text)
Emit signal when return key was pressed.
const char * WorkingDirectory() const
virtual Longptr_t ProcessRemote(const char *line, Int_t *error=nullptr)
Process the content of a line starting with ".R" (already stripped-off) The format is.
TApplication * fAppRemote
void SetSignalHandler(TSignalHandler *sh)
This class is a ROOT utility to help benchmarking applications.
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
void Remove() override
Remove file event handler from system file handler list.
void Add() override
Add file event handler to system file handler list.
virtual char * GetPrompt()=0
virtual void SaveGlobalsContext()=0
virtual void EndOfLineAction()=0
virtual void SetGetline(const char *(*getlineFunc)(const char *prompt), void(*histaddFunc)(const char *line))=0
virtual void SaveContext()=0
virtual Int_t GetMore() const =0
Returns whether the interpreter is waiting for more input, i.e.
Bool_t Notify() override
TRint interrupt handler.
The TNamed class is the base class for all named ROOT classes.
Wrapper around a TObject so it can be stored in a TList.
Collectable string class.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static const char * GetMacroPath()
Get macro search path. Static utility function.
static Bool_t Initialized()
Return kTRUE if the TROOT object has been initialized.
static const std::vector< std::string > & AddExtraInterpreterArgs(const std::vector< std::string > &args)
Provide command line arguments to the interpreter construction.
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
void SetEchoMode(Bool_t mode) override
Set console mode:
Bool_t HandleTermInput() override
Handle input coming from terminal.
void Run(Bool_t retrn=kFALSE) override
Main application eventloop.
Longptr_t ProcessLineNr(const char *filestem, const char *line, Int_t *error=nullptr)
Calls TRint::ProcessLine() possibly prepending a #line directive for better diagnostics.
virtual const char * SetPrompt(const char *newPrompt)
Set a new default prompt.
virtual void Terminate(int status) override
Terminate the application.
Int_t TabCompletionHook(char *buf, int *pLoc, std::ostream &out) override
Forward tab completion request to our TTabCom::Hook().
virtual char * GetPrompt()
Get prompt from interpreter. Either "root [n]" or "end with '}'".
void HandleException(Int_t sig) override
Handle signals (kSigBus, kSigSegmentationViolation, kSigIllegalInstruction and kSigFloatingException)...
virtual ~TRint()
Destructor.
virtual void PrintLogo(Bool_t lite=kFALSE)
Print the ROOT logo on standard output.
void ExecLogon()
Execute logon macro's.
Longptr_t ProcessRemote(const char *line, Int_t *error=nullptr) override
Process the content of a line starting with ".R" (already stripped-off) The format is [user@]host[:di...
Bool_t fBackslashContinue
TString fNonContinuePrompt
TRint(const TRint &)=delete
TFileHandler * fInputHandler
ESignals GetSignal() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
void Clear()
Clear string without changing its capacity.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Prepend(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void DeActivate()
De-activate a system event handler.
void Activate()
Activate a system event handler.
Describes an Operating System directory for the browser.
void Beep(Int_t freq=-1, Int_t duration=-1, Bool_t setDefault=kFALSE)
Beep for duration milliseconds with a tone of frequency freq.
virtual const char * Getenv(const char *env)
Get environment variable.
virtual char * ConcatFileName(const char *dir, const char *name)
Concatenate a directory and a file name. User must delete returned string.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual void ExitLoop()
Exit from event loop.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual const char * GetBuildCompilerVersionStr() const
Return the build compiler version identifier string.
virtual const char * WorkingDirectory()
Return working directory.
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual const char * GetBuildArch() const
Return the build architecture.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.
Int_t Hook(char *buf, int *pLoc, std::ostream &out)
[private]
void ClearAll()
clears all lists except for user names and system include files.
R__EXTERN void * gMmallocDesc
char * DemangleTypeIdName(const std::type_info &ti, int &errorCode)
Demangle in a portable way the type id name.