78 char *
s =
new char[nch+1];
79 strlcpy(
s,
name,nch+1);
80 char *
slash = (
char*)strrchr(
s,
'/');
83 char *dot = (
char*)strchr(
slash,
'.');
179 if (opt ==
"Print") {
184 const char *cmd =
Form(
".x %s((TMacro*)0x%lx)",opt.
Data(),(
ULong_t)
this);
185 gROOT->ProcessLine(cmd);
202 const Int_t bufSize = 8192;
213 char *p = (
char *)
line.Data();
215 strlcpy((
char *)&buf[pos], p, len+1);
218 }
else if (left == len) {
219 strlcpy((
char *)&buf[pos], p, len+1);
220 md5->
Update(buf, bufSize);
224 strlcpy((
char *)&buf[pos], p, left+1);
225 md5->
Update(buf, bufSize);
230 strlcpy((
char *)&buf[pos], p, len+1);
249 std::stringstream ss;
254 ss << obj->
GetName() << std::endl;
270 if (error) *error = 1;
284 exec +=
"(" + p +
")";
293 Error(
"Exec",
"Macro does not contains function named %s.",
GetName());
294 if (error) *error = 1;
342 Error(
"ReadFile",
"Cannot open file: %s",filename);
345 char *
line =
new char[10000];
348 in.getline(
line,10000);
349 if (!in.good())
break;
364 out.open(filename, std::ios::out);
366 Printf(
"SaveSource cannot open file: %s",filename);
369 if (!
fLines) {out.close();
return;}
373 out<<obj->
GetName()<<std::endl;
383 if (!
fLines) {fclose(fp);
return;}
387 fprintf(fp,
"%s\n", obj->
GetName());
410 s.ReplaceAll(
"\"",
"\\\"");
411 out<<
" macro->AddLine("<<quote<<
s.Data()<<quote<<
");"<<std::endl;
413 out<<
" macro->Draw("<<quote<<option<<quote<<
");"<<std::endl;
char * Form(const char *fmt,...)
void Printf(const char *fmt,...)
Using a TBrowser one can browse all ROOT objects.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual void Add(TObject *obj)
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
This code implements the MD5 message-digest algorithm.
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
Class supporting a collection of lines with C++ code.
virtual Long_t Exec(const char *params=0, Int_t *error=0)
Execute this macro with params, if params is 0, default parameters (set via SetParams) are used.
virtual TMD5 * Checksum()
Returns checksum of the current content.
virtual Bool_t Load() const
Load the macro into the interpreter.
virtual ~TMacro()
Delete this macro.
virtual void Paint(Option_t *option="")
Execute this macro (called by TPad::Paint).
virtual TObjString * AddLine(const char *text)
Add line with text in the list of lines of this macro.
virtual Int_t ReadFile(const char *filename)
Read lines in filename in this macro.
void SaveSource(FILE *fp)
Save macro source in file pointer fp.
TMacro()
Create an empty macro, use AddLine() or ReadFile() to fill this macro.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save macro source on stream out.
virtual void Browse(TBrowser *b)
When clicking in the browser, the following action is performed on this macro, depending the content ...
TMacro & operator=(const TMacro &)
Copy constructor.
virtual void SetParams(const char *params=0)
Set default parameters to execute this macro.
TList * GetListOfLines() const
virtual TObjString * GetLineWith(const char *text) const
Search the first line containing text.
virtual void Print(Option_t *option="") const
Print contents of this macro.
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetTitle() const
Returns title of object.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
virtual const char * GetName() const
Returns name of object.
Collectable string class.
const char * GetName() const
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
static constexpr double s