75 Int_t nch = strlen(name);
76 char *s =
new char[nch+1];
77 strlcpy(s,name,nch+1);
78 char *
slash = (
char*)strrchr(s,
'/');
79 if (!slash) slash = s;
81 char *
dot = (
char*)strchr(slash,
'.');
177 if (opt ==
"Print") {
182 const char *cmd =
Form(
".x %s((TMacro*)0x%lx)",opt.
Data(),(
ULong_t)
this);
183 gROOT->ProcessLine(cmd);
200 const Int_t bufSize = 8192;
211 char *p = (
char *) line.
Data();
213 strlcpy((
char *)&buf[pos], p, len+1);
216 }
else if (left == len) {
217 strlcpy((
char *)&buf[pos], p, len+1);
218 md5->
Update(buf, bufSize);
222 strlcpy((
char *)&buf[pos], p, left+1);
223 md5->
Update(buf, bufSize);
228 strlcpy((
char *)&buf[pos], p, len+1);
247 std::stringstream ss;
252 ss << obj->
GetName() << std::endl;
268 if (error) *error = 1;
282 exec +=
"(" + p +
")";
291 Error(
"Exec",
"Macro does not contains function named %s.",
GetName());
292 if (error) *error = 1;
340 Error(
"ReadFile",
"Cannot open file: %s",filename);
343 char *
line =
new char[10000];
346 in.getline(line,10000);
347 if (!in.good())
break;
364 Printf(
"SaveSource cannot open file: %s",filename);
367 if (!
fLines) {out.close();
return;}
371 out<<obj->
GetName()<<std::endl;
381 if (!
fLines) {fclose(fp);
return;}
385 fprintf(fp,
"%s\n", obj->
GetName());
409 out<<
" macro->AddLine("<<quote<<s.
Data()<<quote<<
");"<<std::endl;
411 out<<
" macro->Draw("<<quote<<option<<quote<<
");"<<std::endl;
const char * GetName() const
Returns name of object.
virtual const char * GetTitle() const
Returns title of object.
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 ...
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Collectable string class.
ClassImp(TMacro) TMacro
Create an empty macro, use AddLine() or ReadFile() to fill this macro.
virtual void Paint(Option_t *option="")
Execute this macro (called by TPad::Paint).
TString & ReplaceAll(const TString &s1, const TString &s2)
static const char * filename()
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 void Print(Option_t *option="") const
Print contents of this macro.
const char * Data() const
Double_t dot(const TVector2 &v1, const TVector2 &v2)
This code implements the MD5 message-digest algorithm.
The TNamed class is the base class for all named ROOT classes.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Using a TBrowser one can browse all ROOT objects.
virtual Bool_t Load() const
Load the macro into the interpreter.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
TString GetString() const
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 const char * ClassName() const
Returns name of class to which the object belongs.
TList * GetListOfLines() const
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.
virtual const char * GetName() const
Returns name of object.
virtual Int_t GetSize() const
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual TMD5 * Checksum()
Returns checksum of the current content.
virtual void Add(TObject *obj)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
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 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 TObjString * GetLineWith(const char *text) const
Search the first line containing text.