79 char *s =
new char[nch+1];
80 strlcpy(s,
name,nch+1);
81 char *
slash = (
char*)strrchr(s,
'/');
84 char *dot = (
char*)strchr(
slash,
'.');
101 while (
auto obj = next())
127 while (
auto obj = next())
177 if (opt ==
"Print") {
194 return (
TMD5 *)
nullptr;
199 const Int_t bufSize = 8192;
209 const char *p =
line.Data();
211 strlcpy((
char *)&buf[pos], p, len+1);
214 }
else if (left == len) {
215 strlcpy((
char *)&buf[pos], p, len+1);
216 md5->
Update(buf, bufSize);
220 strlcpy((
char *)&buf[pos], p, left+1);
221 md5->
Update(buf, bufSize);
226 strlcpy((
char *)&buf[pos], p, len+1);
245 std::stringstream ss;
249 ss << obj->GetName() << std::endl;
265 if (error) *error = 1;
279 exec +=
"(" + p +
")";
288 Error(
"Exec",
"Macro does not contains function named %s.",
GetName());
289 if (error) *error = 1;
298 if (!
fLines)
return nullptr;
301 if (strstr(obj->GetName(),
text))
321 while (
auto obj = next())
322 printf(
"%s\n", obj->GetName());
334 Error(
"ReadFile",
"Cannot open file: %s",filename);
337 char *
line =
new char[10000];
340 in.getline(
line,10000);
341 if (!in.good())
break;
356 out.open(filename, std::ios::out);
358 Error(
"SaveSource",
"cannot open file: %s",filename);
362 while (
auto obj = next())
363 out << obj->GetName() << std::endl;
373 while (
auto obj = next())
374 fprintf(fp,
"%s\n", obj->GetName());
384 out,
Class(),
"macro",
388 while (
auto obj = next()) {
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
bool Bool_t
Boolean (0=false, 1=true) (bool).
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
Using a TBrowser one can browse all ROOT 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 ...
virtual TMD5 * Checksum()
Returns checksum of the current content.
void Print(Option_t *option="") const override
Print contents of this macro.
virtual Bool_t Load() const
Load the macro into the interpreter.
virtual ~TMacro()
Delete this macro.
virtual void SetParams(const char *params=nullptr)
Set default parameters to execute this macro.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save macro source on stream out.
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.
virtual Longptr_t Exec(const char *params=nullptr, Int_t *error=nullptr)
Execute this macro with params, if params is 0, default parameters (set via SetParams) are used.
TMacro()
Create an empty macro, use AddLine() or ReadFile() to fill this macro.
TMacro & operator=(const TMacro &)
Copy constructor.
TList * GetListOfLines() const
void Paint(Option_t *option="") override
Execute this macro (called by TPad::Paint).
void Browse(TBrowser *b) override
When clicking in the browser, the following action is performed on this macro, depending the content ...
virtual TObjString * GetLineWith(const char *text) const
Search the first line containing text.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Collectable string class.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const