76 Int_t nch = strlen(name);
77 char *s =
new char[nch+1];
78 strlcpy(s,name,nch+1);
79 char *
slash = (
char*)strrchr(s,
'/');
80 if (!slash) slash = s;
82 char *dot = (
char*)strchr(slash,
'.');
178 if (opt ==
"Print") {
183 const char *cmd =
Form(
".x %s((TMacro*)0x%lx)",opt.
Data(),(
ULong_t)
this);
184 gROOT->ProcessLine(cmd);
201 const Int_t bufSize = 8192;
212 char *p = (
char *) line.
Data();
214 strlcpy((
char *)&buf[pos], p, len+1);
217 }
else if (left == len) {
218 strlcpy((
char *)&buf[pos], p, len+1);
219 md5->
Update(buf, bufSize);
223 strlcpy((
char *)&buf[pos], p, left+1);
224 md5->
Update(buf, bufSize);
229 strlcpy((
char *)&buf[pos], p, len+1);
248 std::stringstream ss;
253 ss << obj->
GetName() << std::endl;
269 if (error) *error = 1;
283 exec +=
"(" + p +
")";
292 Error(
"Exec",
"Macro does not contains function named %s.",
GetName());
293 if (error) *error = 1;
341 Error(
"ReadFile",
"Cannot open file: %s",filename);
344 char *
line =
new char[10000];
347 in.getline(line,10000);
348 if (!in.good())
break;
363 out.open(filename, std::ios::out);
365 Printf(
"SaveSource cannot open file: %s",filename);
368 if (!
fLines) {out.close();
return;}
372 out<<obj->
GetName()<<std::endl;
382 if (!
fLines) {fclose(fp);
return;}
386 fprintf(fp,
"%s\n", obj->
GetName());
410 out<<
" macro->AddLine("<<quote<<s.
Data()<<quote<<
");"<<std::endl;
412 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.
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 Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
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.
TString GetString() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual TMD5 * Checksum()
Returns checksum of the current content.
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 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