80 char *s =
new char[nch+1];
81 strlcpy(s,
name,nch+1);
82 char *
slash = (
char*)strrchr(s,
'/');
85 char *dot = (
char*)strchr(
slash,
'.');
181 if (opt ==
"Print") {
186 const char *cmd =
Form(
".x %s((TMacro*)0x%lx)",opt.
Data(),(
ULong_t)
this);
187 gROOT->ProcessLine(cmd);
204 const Int_t bufSize = 8192;
215 char *p = (
char *)
line.Data();
217 strlcpy((
char *)&buf[pos], p, len+1);
220 }
else if (left == len) {
221 strlcpy((
char *)&buf[pos], p, len+1);
222 md5->
Update(buf, bufSize);
226 strlcpy((
char *)&buf[pos], p, left+1);
227 md5->
Update(buf, bufSize);
232 strlcpy((
char *)&buf[pos], p, len+1);
251 std::stringstream ss;
256 ss << obj->
GetName() << std::endl;
272 if (error) *error = 1;
286 exec +=
"(" + p +
")";
295 Error(
"Exec",
"Macro does not contains function named %s.",
GetName());
296 if (error) *error = 1;
344 Error(
"ReadFile",
"Cannot open file: %s",filename);
347 char *
line =
new char[10000];
350 in.getline(
line,10000);
351 if (!in.good())
break;
366 out.open(filename, std::ios::out);
368 Printf(
"SaveSource cannot open file: %s",filename);
371 if (!
fLines) {out.close();
return;}
375 out<<obj->
GetName()<<std::endl;
385 if (!
fLines) {fclose(fp);
return;}
389 fprintf(fp,
"%s\n", obj->
GetName());
401 if (
gROOT->ClassSaved(TMacro::Class())) {
413 out<<
" macro->AddLine("<<quote<<s.
Data()<<quote<<
");"<<std::endl;
415 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
TString & ReplaceAll(const TString &s1, const TString &s2)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const