77 Int_t nch = strlen(name);
78 char *
s =
new char[nch+1];
79 strlcpy(s,name,nch+1);
80 char *
slash = (
char*)strrchr(s,
'/');
81 if (!slash) slash =
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());
411 out<<
" macro->AddLine("<<quote<<s.
Data()<<quote<<
");"<<std::endl;
413 out<<
" macro->Draw("<<quote<<option<<quote<<
");"<<std::endl;
virtual const char * GetName() const
Returns name of object.
TList * GetListOfLines() const
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
void Final()
MD5 finalization, ends an MD5 message-digest operation, writing the the message digest and zeroizing ...
Collectable string class.
virtual void Paint(Option_t *option="")
Execute this macro (called by TPad::Paint).
TString & ReplaceAll(const TString &s1, const TString &s2)
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...
Class supporting a collection of lines with C++ code.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual TObjString * GetLineWith(const char *text) const
Search the first line containing text.
This code implements the MD5 message-digest algorithm.
The TNamed class is the base class for all named ROOT classes.
virtual void Print(Option_t *option="") const
Print contents of this macro.
virtual Bool_t Load() const
Load the macro into the interpreter.
const char * GetName() const
Returns name of object.
Using a TBrowser one can browse all ROOT objects.
const TString & GetString() const
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
void Update(const UChar_t *buf, UInt_t len)
Update TMD5 object to reflect the concatenation of another buffer full of bytes.
TMacro & operator=(const TMacro &)
Copy constructor.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
void SaveSource(FILE *fp)
Save macro source in file pointer fp.
virtual Int_t ReadFile(const char *filename)
Read lines in filename in this macro.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual TMD5 * Checksum()
Returns checksum of the current content.
static constexpr double s
TMacro()
Create an empty macro, use AddLine() or ReadFile() to fill this macro.
virtual void Add(TObject *obj)
virtual void Browse(TBrowser *b)
When clicking in the browser, the following action is performed on this macro, depending the content ...
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save macro source on stream out.
virtual Int_t GetSize() const
virtual void SetParams(const char *params=0)
Set default parameters to execute this macro.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
virtual TObjString * AddLine(const char *text)
Add line with text in the list of lines of this macro.
virtual ~TMacro()
Delete this macro.
virtual const char * GetTitle() const
Returns title of object.
const char * Data() const