root
root copied to clipboard
[cling] some potentially useful CINT commands
Explain what you would like to see improved
Some legacy CINT commands are not available for Cling, but could be quite useful, like:
- [ ] "./keyword" search keyword in help information
- [ ] ".l" for printing list of local variables (".g" does exist already for printing the list of global variables)
Optional: share how it could be improved
Rescue from CINT the ones considered most useful.
Reminder:
- [ ] Update accordingly in TApplication.cxx and/or MetaSema.cpp help messages
- [ ] Update accordingly in https://github.com/root-project/web/blob/main/manual/cling/index.md
- [ ] Copy resulting output to https://github.com/root-project/web/blob/main/manual/first_steps_with_root/index.md
- [ ] https://github.com/root-project/NotebookPrimer/blob/master/notebooks/2-ROOT-Basics.ipynb
Setup
------------------------------------------------------------------
| Welcome to ROOT 6.27/01 https://root.cern |
| (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Jan 12 2022, 10:17:19 |
| From heads/master@v6-25-01-2870-gdac9b6398d |
| With c++ (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
Additional context
https://github.com/root-project/root/issues/10065 Here is the full list of ROOTv5.34:
Note1: Cint is not aimed to be a 100% ANSI/ISO compliant C/C++ language
processor. It rather is a portable script language environment which
is close enough to the standard C++.
Note2: Regulary check either of /tmp /usr/tmp /temp /windows/temp directory
and remove temp-files which are accidentally left by cint.
Note3: Cint reads source file on-the-fly from the file system. Do not change
the active source during cint run. Use -C option or C1 command otherwise.
Note4: In source code trace mode, cint sometimes displays extra-characters.
This is harmless. Please ignore.
CINT/ROOT C/C++ interpreter interface.
All commands must be preceded by a . (dot), except
for the evaluation statement { } and the ?.
===========================================================================
> [file] : output redirection to [file]
2> [file] : error redirection to [file]
>& [file] : output&error redirection to [file]
Help: ? : help
help : help
/[keyword] : search keyword in help information
Shell: ![shell] : execute shell command
Source: v <[line]>: view source code <around [line]>
V [stack] : view source code in function call stack
t : show function call stack
f [file] : select file to debug
T : turn on/off trace mode for all source
J [stat] : Set warning level [0-5]
A [1|0] : allowing automatic variable on/off
trace <classname> : turn on trace mode for class
deltrace <classname> : turn off trace mode for class
Evaluation: p [expr] : evaluate expression (no declaration/loop/condition)
Evaluation: s [expr] : step into expression (no declaration/loop/condition)
Evaluation: S [expr] : step over expression (no declaration/loop/condition)
{[statements]} : evaluate statement (any kind)
x [file] : load [file] and execute function [file](w/o extension)
xk [file] : keep [file] if already loaded else load it, and execute function [file](w/o extension)
X [file] : load [file] and execute function [file](w/o extension)
Xk [file] : keep [file] it already loaded else load it. and execute function [file](w/o extension)
E <[file]>: open editor and evaluate {statements} in the file
Load/Unload: L [file] : load [file]
Lk [file] : keep [file] if already loaded, else load it
La [file] : reload all files loaded after [file]
U [file] : unload [file]
C [1|0] : copy source to $TMPDIR (on/off)
undo : undo previous declarations
lang : local language (EUC,SJIS,EUROPEAN,UNKNOWN)
preproc : toggle preprocessing of interpreted files
Monitor: g <[var]> : list global variable
l <[var]> : list local variable
proto <[scope]::>[func] : show function prototype
class <[name]> : show class definition (one level)
Class <[name]> : show class definition (all level)
typedef <name> : show typedefs
function : show interpreted functions
macro : show macro functions
template : show templates
include : show include paths
file : show loaded files
where : show current file position
security : show security level
refcount : reference count control on/off
garbage : show garbage collection buffer
Garbage : Do garbage collection
cover [file] : save trace coverage
return [val] : return undefined symbol value
Run: S : step over function/loop
s : step into function/loop
i : ignore and step over
c <[line]>: continue <to [line]>
e : step out from function
f [file] : select file to debug
b [line] : set break point
db [line] : delete break point
a [assert]: break only if assertion is true
O [0~4] : Set bytecode compiler mode
debug : bytecode status display on/off
asmstep : bytecode step mode on/off
status : show bytecode exec flags
dasm : disassembler
except : toggle exception catching
Quit: q : quit cint
qqq : quit cint - mandatory
qqqqq : exit process immediately
qqqqqqq : abort process
save : call emergency routine to save important data
ROOT special commands.
===========================================================================
pwd : show current directory, pad and style
ls : list contents of current directory
which [file] : shows path of macro file
- [ ] "./keyword" search keyword in help information
IIUC, the intended use of this is to lookup documentation for a specific language keyword, as in, e.g. ./for should open a browser window pointing to https://en.cppreference.com/w/cpp/language/for?
- [ ] ".l" for printing list of local variables (".g" does exist already for printing the list of global variables)
Not sure whether this is useful, though.
IIUC, the intended use of this is to lookup documentation for a specific language keyword, as in, e.g.
./forshould open a browser window pointing to https://en.cppreference.com/w/cpp/language/for?
Nope, in CINT, it was acting rather as a 'search' keyword to match for predefined functions.
If I open ROOT 5.34/34, and I type ./for, I get:
root -b
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 5.34/34 2 October 2015 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
ROOT 5.34/34 (v5-34-34@v5-34-34, Oct 02 2015, 16:30:37 on linuxx8664gcc)
CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] ./for
size_t strftime(char *string,size_t maximum,char *format,struct tm*brokentime);
int fprintf(FILE *fp,char *format,arglist,...);
int printf(char *format,arglist,...);
int sprintf(char *string,char *format,arglist,...);
int fscanf(FILE *fp,char *format,arglist,...);
int scanf(char *format,arglist,...);
int sscanf(char *string,char *format,arglist,...);
(C++ compiled) class TClass public:TDictionary //Dictionary containing class information
(C++ compiled) class TBuffer public:TObject //Buffer base class used for serializing objects
(C++ compiled) class TMemberInspector //ABC for inspecting class data members
(C++ compiled) class TNamed public:TObject //The basis for a named object (name, title)
(C++ compiled) class TVirtualPerfStats public:TObject //ABC for collecting PROOF statistics
(C++ compiled) class THashList public:TList //Doubly linked list with hashtable for lookup
(C++ compiled) class TFileInfo public:TNamed //Describes generic file info including meta data information
(C++ compiled) class TVirtualMonitoringWriter public:TNamed //ABC for Sending Monitoring Information
(C++ compiled) class TVirtualMonitoringReader public:TNamed //ABC for Reading Monitoring Information
(C++ compiled) class TObjectSpy public:TObject //Spy object pointer for deletion
(C++ compiled) class TObjectRefSpy public:TObject //Spy object reference for deletion
(C++ compiled) class TMethod public:TFunction //Dictionary for a class member function (method)
(C++ compiled) class TQObject //Base class for object communication mechanism
(C++ compiled) class TFunction public:TDictionary //Dictionary for global function
(C++ compiled) class TPluginManager public:TObject //Manager for plugin handlers
(C++ compiled) class TPluginHandler public:TObject //Handler for plugin libraries
(C++ compiled) class TTask public:TNamed //Base class for tasks
(C++ compiled) class TQCommand public:TList public:TQObject //encapsulates the information for undo/redo a single action.
(C++ compiled) class TQUndoManager public:TQCommand //recorder of operations for undo and redo
(C++ compiled) class TSysEvtHandler public:TObject public:TQObject //ABC for handling system events
(C++ compiled) struct SysInfo_t //System information - OS, CPU, RAM.
(C++ compiled) struct CpuInfo_t //CPU load information.
(C++ compiled) struct MemInfo_t //Memory utilization information.
(C++ compiled) class TVirtualPad public:TObject public:TAttLine public:TAttFill public:TAttPad public:TQObject //Abstract base class for Pads and Canvases
(C++ compiled) class TPMERegexp protected:TPRegexp //Wrapper for Perl-like regular expression matching.
(C++ compiled) class TStringToken public:TString //String tokenizer using PCRE for finding next tokens.
(C++ compiled) class TClassGenerator public:TObject //interface for TClass generators
(C++ compiled) class TROOT public:TDirectory //Top level (or root) structure for all classes
(C++ compiled) class TVirtualStreamerInfo public:TNamed //Abstract Interface describing Streamer information for one class
(C++ compiled) class TStreamerElement public:TNamed //Base class for one element (data member) to be Streamed
(C++ compiled) class TVirtualFFT public:TObject //abstract interface for FFT calculations
(C++ compiled) class TVirtualPadEditor //Abstract interface for graphics pad editor
(C++ compiled) class TMethodArg public:TDictionary //Dictionary for a method argument
(C++ compiled) class TToggle public:TNamed //Facility for toggling datamembers on/off
(C++ compiled) class TVirtualPadPainter //Painter interface for pad.
(C++ compiled) class TVirtualGLPainter //Interface for OpenGL painter
(C++ compiled) class TVirtualGLManip //Interface for GL manipulator
(C++ compiled) class TGLManager public:TNamed //Interface for OpenGL manager
(C++ compiled) class TGLPaintDevice //Base class for GL widgets and GL off-screen rendering
(C++ compiled) class TGuiFactory public:TNamed //Abstract factory for GUI components
(C++ compiled) class TAttBBox //Helper for management of bounding-box information
(C++ compiled) class TDictAttributeMap public:TObject //Container for name/value pairs of TDictionary attributes
(C++ compiled) class TDataMember public:TDictionary //Dictionary for a class data member
(C++ compiled) class TStreamerBasicType public:TStreamerElement //Streamer element for a basic type
(C++ compiled) class TStreamerBasicPointer public:TStreamerElement //Streamer element for a pointer to a basic type
(C++ compiled) class TStreamerLoop public:TStreamerElement //Streamer element for a pointer to an array of objects
(C++ compiled) class TStreamerArtificial public:TStreamerElement //StreamerElement injected by a TSchemaRule. Transient only to preverse forward compatibility.
(C++ compiled) class TTabCom //Perform command line completion when hitting <TAB>
/opt/root/root_v5.34.34/lib/libMathCore.so -1 class ROOT::Math::MinimTransformFunction public:ROOT::Math::IGradientFunctionMultiDim
/opt/root/root_v5.34.34/lib/libMathCore.so -1 class ROOT::Math::MinimTransformVariable
/opt/root/root_v5.34.34/lib/libMathCore.so -1 class TVirtualFitter public:TNamed //Abstract interface for fitting
TMVA::VariableDecorrTransform
TMVA::VariableGaussTransform
TMVA::VariableIdentityTransform
TMVA::VariableNormalizeTransform
TMVA::VariablePCATransform
TMVA::VariableRearrangeTransform
TMVA::VariableTransformBase
TSpectrum2Transform
TSpectrumTransform
ROOT::Math::Transform3D
TGeoUniformMagField
class ROOT::Math::SinVariableTransformation
class ROOT::Math::SqrtLowVariableTransformation
class ROOT::Math::SqrtUpVariableTransformation
class auto_ptr<ROOT::Math::MinimizerVariableTransformation>
class vector<ROOT::Math::MinimTransformVariable,allocator<ROOT::Math::MinimTransformVariable> >
class reverse_iterator<vector<ROOT::Math::MinimTransformVariable,allocator<ROOT::Math::MinimTransformVariable> >::iterator>
(compiled) typedef void *ClassStreamerFunc_t //Streamer function for a class
(compiled) typedef void *MemberStreamerFunc_t //Streamer function for a data member
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef auto_ptr<ROOT::Math::MinimizerVariableTransformation> ROOT::Math::MinimTransformVariable::auto_ptr<MinimizerVariableTransformation>
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef ROOT::Math::IGradientFunctionMultiDim ROOT::Math::MinimTransformFunction::BaseGradFunc
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef ROOT::Math::IBaseFunctionMultiDim ROOT::Math::MinimTransformFunction::BaseFunc
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef vector<ROOT::Math::MinimTransformVariable,allocator<ROOT::Math::MinimTransformVariable> > vector<MinimTransformVariable>
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef reverse_iterator<vector<ROOT::Math::MinimTransformVariable,allocator<ROOT::Math::MinimTransformVariable> >::iterator> vector<ROOT::Math::MinimTransformVariable,allocator<ROOT::Math::MinimTransformVariable> >::reverse_iterator<const_iterator>
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef reverse_iterator<vector<ROOT::Math::MinimTransformVariable,allocator<ROOT::Math::MinimTransformVariable> >::iterator> vector<ROOT::Math::MinimTransformVariable,allocator<ROOT::Math::MinimTransformVariable> >::reverse_iterator<iterator>
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef vector<ROOT::Math::MinimTransformVariable,allocator<ROOT::Math::MinimTransformVariable> > vector<ROOT::Math::MinimTransformVariable>
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef ROOT::Math::IntegrationOneDim::Type ROOT::Math::IntegratorOneDim::Type //for the enumerations defining the types
/opt/root/root_v5.34.34/lib/libMathCore.so -1 typedef auto_ptr<ROOT::Math::IBaseFunctionOneDim> ROOT::Math::IntegratorOneDim::auto_ptr<IGenFunction> //for the enumerations defining the types
(compiled) 0:0 0 public: int snprintf(char* string,size_t length,const char* format ...);
A more useful example:
./Fill
(C++ compiled) class TVirtualPad public:TObject public:TAttLine public:TAttFill public:TAttPad public:TQObject //Abstract base class for Pads and Canvases
(C++ compiled) class TStyle public:TNamed public:TAttLine public:TAttFill public:TAttMarker public:TAttText //A collection of all graphics attributes
(C++ compiled) class TAttFill //Fill area attributes
(C++ compiled) class TVirtualPS public:TNamed public:TAttLine public:TAttFill public:TAttMarker public:TAttText //Abstract interface to a PostScript driver
(C++ compiled) class TVirtualX public:TNamed public:TAttLine public:TAttFill public:TAttText public:TAttMarker //ABC defining a generic interface to graphics system
TAttFillEditor
(compiled) 0xa623d0 const EGuiConstants kFillSolid=0
(compiled) 0xa62570 const EGuiConstants kFillTiled=1
(compiled) 0xa62710 const EGuiConstants kFillStippled=2
(compiled) 0xa628b0 const EGuiConstants kFillOpaqueStippled=3
(compiled) 0x7f16f7ae022c const Mask_t kGCFillStyle=256
(compiled) 0x7f16f7ae0228 const Mask_t kGCFillRule=512
for local variables: https://root-forum.cern.ch/t/mapping-local-variables-into-cint/1141
See also: https://its.cern.ch/jira/browse/ROOT-5843