#include "TCint.h"
#include "TROOT.h"
#include "TApplication.h"
#include "TGlobal.h"
#include "TDataType.h"
#include "TClass.h"
#include "TClassEdit.h"
#include "TBaseClass.h"
#include "TDataMember.h"
#include "TMethod.h"
#include "TMethodArg.h"
#include "TObjArray.h"
#include "TObjString.h"
#include "TString.h"
#include "THashList.h"
#include "TOrdCollection.h"
#include "TVirtualPad.h"
#include "TSystem.h"
#include "TVirtualMutex.h"
#include "TError.h"
#include "TEnv.h"
#include "THashTable.h"
#include "RConfigure.h"
#include "compiledata.h"
#include <vector>
#include <set>
#include <string>
using namespace std;
R__EXTERN int optind;
R__EXTERN TInterpreter* (*gInterpreterFactory)(const char* name, const char* title);
extern "C" int ScriptCompiler(const char *filename, const char *opt) {
return gSystem->CompileMacro(filename, opt);
}
extern "C" int IgnoreInclude(const char *fname, const char *expandedfname) {
return gROOT->IgnoreInclude(fname,expandedfname);
}
extern "C" void TCint_UpdateClassInfo(char *c, Long_t l) {
TCint::UpdateClassInfo(c, l);
}
extern "C" int TCint_AutoLoadCallback(char *c, char *l) {
ULong_t varp = G__getgvp();
G__setgvp((Long_t)G__PVOID);
string cls(c);
int result = TCint::AutoLoadCallback(cls.c_str(), l);
G__setgvp(varp);
return result;
}
extern "C" void *TCint_FindSpecialObject(char *c, G__ClassInfo *ci, void **p1, void **p2) {
return TCint::FindSpecialObject(c, ci, p1, p2);
}
TInterpreter* TCint_Factory(const char* name, const char* title) {
return new TCint(name, title);
}
int TCint_GenerateDictionary(const std::string &className,
const std::vector<std::string> &headers )
{
TString fileName = "AutoDict_";
std::string::const_iterator sIt;
for( sIt = className.begin(); sIt != className.end(); sIt++ ) {
if (*sIt == '<' || *sIt == '>' ||
*sIt == ' ' || *sIt == '*' ||
*sIt == ',' || *sIt == '&')
fileName += '_';
else
fileName += *sIt;
}
fileName += ".cxx";
if( gSystem->AccessPathName(fileName) != 0 ) {
std::vector<std::string>::const_iterator it;
std::string fileContent ("");
for( it = headers.begin(); it < headers.end(); it++ )
fileContent += "#include \"" + *it + "\"\n";
fileContent += "#ifdef __CINT__ \n";
fileContent += "#pragma link off all class;\n";
fileContent += "#pragma link off all function;\n";
fileContent += "#pragma link off all global;\n";
fileContent += "#pragma link off all typedef;\n";
fileContent += "#pragma link C++ nestedclasses;\n";
fileContent += "#pragma link C++ class ";
fileContent += className + "+;\n" ;
fileContent += "#endif\n";
FILE *filePointer;
filePointer = fopen( fileName, "w" );
if( filePointer == NULL ) {
return 1;
}
fprintf( filePointer, fileContent.c_str() );
fclose( filePointer );
}
Int_t oldErrorIgnoreLevel = gErrorIgnoreLevel;
gErrorIgnoreLevel = kWarning;
Int_t ret = gSystem->CompileMacro( fileName, "k" );
gErrorIgnoreLevel = oldErrorIgnoreLevel;
if( ret == 0 )
return 2;
return 0;
}
namespace {
static class TInitCintFactory {
public:
TInitCintFactory() {
gInterpreterFactory = TCint_Factory;
}
} gInitCintFactory;
}
const char *fantomline = "TRint::EndOfLineAction();";
void* TCint::fgSetOfSpecials = 0;
ClassImp(TCint)
TCint::TCint(const char *name, const char *title) : TInterpreter(name, title)
{
fMore = 0;
fPrompt[0] = 0;
fMapfile = 0;
fRootmapFiles = 0;
fLockProcessLine = kTRUE;
G__RegisterScriptCompiler(&ScriptCompiler);
G__set_ignoreinclude(&IgnoreInclude);
G__InitUpdateClassInfo(&TCint_UpdateClassInfo);
G__InitGetSpecialObject(&TCint_FindSpecialObject);
TString pathString = "$(PATH)";
gSystem->ExpandPathName(pathString);
char* path = gSystem->Which(pathString, gSystem->BaseName( COMPILER ));
if (path && path[0]) {
G__InitGenerateDictionary( &TCint_GenerateDictionary );
}
delete[] path;
fDictPos.ptype = 0;
fDictPosGlobals.ptype = 0;
ResetAll();
#ifndef R__WIN32
optind = 1;
#endif
#if defined(G__NOSTUBS)
# if defined(G__NOSTUBSTEST)
EnableWrappers(gEnv->GetValue("Cint.EnableWrappers",1));
# else
EnableWrappers(0);
# endif
#else
EnableWrappers(1);
#endif
G__LockCpp();
}
TCint::~TCint()
{
if (fMore != -1) {
G__close_inputfiles();
}
free(fDictPos.ptype);
free(fDictPosGlobals.ptype);
delete fMapfile;
delete fRootmapFiles;
gCint = 0;
}
void TCint::ClearFileBusy()
{
R__LOCKGUARD(gCINTMutex);
G__clearfilebusy(0);
}
void TCint::ClearStack()
{
R__LOCKGUARD(gCINTMutex);
G__clearstack();
}
Int_t TCint::InitializeDictionaries()
{
R__LOCKGUARD(gCINTMutex);
return G__call_setup_funcs();
}
void TCint::EnableWrappers(bool value)
{
G__enable_wrappers((int) value);
}
void TCint::EnableAutoLoading()
{
R__LOCKGUARD(gCINTMutex);
G__set_class_autoloading_callback(&TCint_AutoLoadCallback);
LoadLibraryMap();
}
void TCint::EndOfLineAction()
{
ProcessLineSynch(fantomline);
}
Bool_t TCint::IsLoaded(const char* filename) const
{
R__LOCKGUARD(gCINTMutex);
G__SourceFileInfo file(filename);
if (file.IsValid()) { return kTRUE; };
char *next = gSystem->Which(TROOT::GetMacroPath(), filename, kReadPermission);
if (next) {
file.Init(next);
delete [] next;
if (file.IsValid()) { return kTRUE; };
}
TString incPath = gSystem->GetIncludePath();
incPath.Append(":").Prepend(" ");
incPath.ReplaceAll(" -I",":");
while ( incPath.Index(" :") != -1 ) {
incPath.ReplaceAll(" :",":");
}
incPath.Prepend(".:");
# ifdef CINTINCDIR
TString cintdir = CINTINCDIR;
# else
TString cintdir = "$(ROOTSYS)/cint";
# endif
incPath.Append(":");
incPath.Append(cintdir);
incPath.Append("/include:");
incPath.Append(cintdir);
incPath.Append("/stl");
next = gSystem->Which(incPath, filename, kReadPermission);
if (next) {
file.Init(next);
delete [] next;
if (file.IsValid()) { return kTRUE; };
}
next = gSystem->DynamicPathName(filename,kTRUE);
if (next) {
file.Init(next);
delete [] next;
if (file.IsValid()) { return kTRUE; };
}
return kFALSE;
}
Int_t TCint::Load(const char *filename, Bool_t system)
{
R__LOCKGUARD2(gCINTMutex);
int i;
if (!system)
i = G__loadfile(filename);
else
i = G__loadsystemfile(filename);
UpdateListOfTypes();
return i;
}
void TCint::LoadMacro(const char *filename, EErrorCode *error)
{
ProcessLine(Form(".L %s", filename), error);
}
Long_t TCint::ProcessLine(const char *line, EErrorCode *error)
{
Long_t ret = 0;
if (gApplication) {
if (gApplication->IsCmdThread()) {
if (gGlobalMutex && !gCINTMutex && fLockProcessLine) {
gGlobalMutex->Lock();
if (!gCINTMutex)
gCINTMutex = gGlobalMutex->Factory(kTRUE);
gGlobalMutex->UnLock();
}
R__LOCKGUARD(fLockProcessLine ? gCINTMutex : 0);
gROOT->SetLineIsProcessing();
G__value local_res;
G__setnull(&local_res);
if (strstr(line,fantomline)) {
G__free_tempobject();
TCint::UpdateAllCanvases();
} else {
int local_error = 0;
int prerun = G__getPrerun();
G__setPrerun(0);
ret = G__process_cmd((char *)line, fPrompt, &fMore, &local_error, &local_res);
G__setPrerun(prerun);
if (local_error == 0 && G__get_return(&fExitCode) == G__RETURN_EXIT2) {
ResetGlobals();
gApplication->Terminate(fExitCode);
}
if (error)
*error = (EErrorCode)local_error;
}
if (ret == 0) ret = G__int_cast(local_res);
gROOT->SetLineHasBeenProcessed();
} else {
ret = ProcessLineAsynch(line, error);
}
} else {
if (gGlobalMutex && !gCINTMutex && fLockProcessLine) {
gGlobalMutex->Lock();
if (!gCINTMutex)
gCINTMutex = gGlobalMutex->Factory(kTRUE);
gGlobalMutex->UnLock();
}
R__LOCKGUARD(fLockProcessLine ? gCINTMutex : 0);
gROOT->SetLineIsProcessing();
G__value local_res;
G__setnull(&local_res);
int local_error = 0;
int prerun = G__getPrerun();
G__setPrerun(0);
ret = G__process_cmd((char *)line, fPrompt, &fMore, &local_error, &local_res);
G__setPrerun(prerun);
if (local_error == 0 && G__get_return(&fExitCode) == G__RETURN_EXIT2) {
ResetGlobals();
exit(fExitCode);
}
if (error)
*error = (EErrorCode)local_error;
if (ret == 0) ret = G__int_cast(local_res);
gROOT->SetLineHasBeenProcessed();
}
return ret;
}
Long_t TCint::ProcessLineAsynch(const char *line, EErrorCode *error)
{
return ProcessLine(line, error);
}
Long_t TCint::ProcessLineSynch(const char *line, EErrorCode *error)
{
R__LOCKGUARD(fLockProcessLine ? gCINTMutex : 0);
if (gApplication) {
if (gApplication->IsCmdThread())
return ProcessLine(line, error);
return 0;
}
return ProcessLine(line, error);
}
Long_t TCint::Calc(const char *line, EErrorCode *error)
{
Long_t result;
#ifdef R__WIN32
if (gApplication && gApplication->GetApplicationImp()) {
while (gROOT->IsLineProcessing() && !gApplication) {
Warning("Calc", "waiting for CINT thread to free");
gSystem->Sleep(500);
}
gROOT->SetLineIsProcessing();
}
#endif
R__LOCKGUARD2(gCINTMutex);
result = (Long_t) G__int_cast(G__calc((char *)line));
if (error) *error = (EErrorCode)G__lasterror();
#ifdef R__WIN32
if (gApplication && gApplication->GetApplicationImp())
gROOT->SetLineHasBeenProcessed();
#endif
return result;
}
void TCint::PrintIntro()
{
Printf("\nCINT/ROOT C/C++ Interpreter version %s", G__cint_version());
Printf("Type ? for help. Commands must be C++ statements.");
Printf("Enclose multiple statements between { }.");
}
void TCint::RecursiveRemove(TObject *obj)
{
R__LOCKGUARD(gCINTMutex);
if (obj->IsOnHeap() && fgSetOfSpecials && !((std::set<TObject*>*)fgSetOfSpecials)->empty()) {
std::set<TObject*>::iterator iSpecial = ((std::set<TObject*>*)fgSetOfSpecials)->find(obj);
if (iSpecial != ((std::set<TObject*>*)fgSetOfSpecials)->end()) {
DeleteGlobal(obj);
((std::set<TObject*>*)fgSetOfSpecials)->erase(iSpecial);
}
}
}
void TCint::Reset()
{
R__LOCKGUARD(gCINTMutex);
G__scratch_upto(&fDictPos);
}
void TCint::ResetAll()
{
R__LOCKGUARD(gCINTMutex);
G__init_cint("cint +V");
G__init_process_cmd();
}
void TCint::ResetGlobals()
{
R__LOCKGUARD(gCINTMutex);
G__scratch_globals_upto(&fDictPosGlobals);
}
void TCint::RewindDictionary()
{
R__LOCKGUARD(gCINTMutex);
G__rewinddictionary();
}
Int_t TCint::DeleteGlobal(void *obj)
{
R__LOCKGUARD(gCINTMutex);
return G__deleteglobal(obj);
}
void TCint::SaveContext()
{
R__LOCKGUARD(gCINTMutex);
G__store_dictposition(&fDictPos);
}
void TCint::SaveGlobalsContext()
{
R__LOCKGUARD(gCINTMutex);
G__store_dictposition(&fDictPosGlobals);
}
void TCint::UpdateListOfGlobals()
{
R__LOCKGUARD2(gCINTMutex);
G__DataMemberInfo t, *a;
while (t.Next()) {
if (t.IsValid() && t.Name()) {
TGlobal *g = (TGlobal *)gROOT->fGlobals->FindObject(t.Name());
if (g) {
gROOT->fGlobals->Remove(g);
delete g;
}
a = new G__DataMemberInfo(t);
gROOT->fGlobals->Add(new TGlobal(a));
}
}
}
void TCint::UpdateListOfGlobalFunctions()
{
R__LOCKGUARD2(gCINTMutex);
G__MethodInfo t, *a;
void* vt =0;
while (t.Next()) {
if (t.IsValid() && t.Name()) {
Bool_t needToAdd = kTRUE;
TList* listFuncs = ((THashTable*)(gROOT->fGlobalFunctions))->GetListForObject(t.Name());
if (listFuncs && (vt = (void*)t.InterfaceMethod())) {
Long_t prop = -1;
TIter iFunc(listFuncs);
TFunction* f = 0;
Bool_t foundStart = kFALSE;
while (needToAdd && (f = (TFunction*)iFunc())) {
if (strcmp(f->GetName(),t.Name())) {
if (foundStart) break;
continue;
}
foundStart = kTRUE;
if (vt == f->InterfaceMethod()) {
if (prop == -1)
prop = t.Property();
needToAdd = !((prop & G__BIT_ISCOMPILED)
|| t.GetMangledName() == f->GetMangledName());
}
}
}
if (needToAdd) {
a = new G__MethodInfo(t);
gROOT->fGlobalFunctions->Add(new TFunction(a));
}
}
}
}
void TCint::UpdateListOfTypes()
{
R__LOCKGUARD2(gCINTMutex);
static int last_typenum = -1;
static int last_scratch_count = 0;
int this_scratch_count = G__scratch_upto(0);
if (this_scratch_count != last_scratch_count) {
last_scratch_count = this_scratch_count;
last_typenum = -1;
}
G__TypedefInfo t (last_typenum);
while (t.Next()) {
const char* name = t.Name();
if (gROOT && gROOT->fTypes && t.IsValid() && name) {
TDataType *d = (TDataType *)gROOT->fTypes->FindObject(name);
if (!d) {
gROOT->fTypes->Add(new TDataType(new G__TypedefInfo(t)));
}
last_typenum = t.Typenum();
}
}
}
void TCint::SetClassInfo(TClass *cl, Bool_t reload)
{
R__LOCKGUARD2(gCINTMutex);
if (!cl->fClassInfo || reload) {
delete (G__ClassInfo*)cl->fClassInfo;
cl->fClassInfo = 0;
if (CheckClassInfo(cl->GetName())) {
G__ClassInfo *info = new G__ClassInfo(cl->GetName());
cl->fClassInfo = info;
Bool_t zombieCandidate = kFALSE;
if (info->IsValid() &&
!(info->Property() & (kIsClass|kIsStruct|kIsNamespace))) {
zombieCandidate = kTRUE;
}
if (!info->IsLoaded()) {
if (info->Property() & (kIsNamespace)) {
zombieCandidate = kTRUE;
}
delete info;
cl->fClassInfo = 0;
}
if (zombieCandidate && !TClassEdit::IsSTLCont(cl->GetName())) {
cl->MakeZombie();
}
}
}
}
Bool_t TCint::CheckClassInfo(const char *name)
{
R__LOCKGUARD(gCINTMutex);
char *classname = new char[strlen(name)*2];
strcpy(classname,name);
char *current = classname;
while (*current) {
while (*current && *current != ':' && *current != '<')
current++;
if (!*current) break;
if (*current == '<') {
int level = 1;
current++;
while (*current && level > 0) {
if (*current == '<') level++;
if (*current == '>') level--;
current++;
}
continue;
}
if (*(current+1) != ':') {
Error("CheckClassInfo", "unexpected token : in %s", classname);
delete [] classname;
return kFALSE;
}
*current = '\0';
G__ClassInfo info(classname);
if (!info.IsValid()) {
delete [] classname;
return kFALSE;
}
*current = ':';
current += 2;
}
strcpy(classname,name);
Int_t tagnum = G__defined_tagname(classname, 2);
if (tagnum >= 0) {
delete [] classname;
return kTRUE;
}
G__TypedefInfo t(name);
if (t.IsValid() && !(t.Property()&G__BIT_ISFUNDAMENTAL)) {
delete [] classname;
return kTRUE;
}
delete [] classname;
return kFALSE;
}
void TCint::CreateListOfBaseClasses(TClass *cl)
{
R__LOCKGUARD2(gCINTMutex);
if (!cl->fBase) {
cl->fBase = new TList;
G__BaseClassInfo t(*(G__ClassInfo *)cl->GetClassInfo()), *a;
while (t.Next()) {
if (t.IsValid() && t.Name()) {
a = new G__BaseClassInfo(t);
cl->fBase->Add(new TBaseClass(a, cl));
}
}
}
}
void TCint::CreateListOfDataMembers(TClass *cl)
{
R__LOCKGUARD2(gCINTMutex);
if (!cl->fData) {
cl->fData = new TList;
G__DataMemberInfo t(*(G__ClassInfo*)cl->GetClassInfo()), *a;
while (t.Next()) {
if (t.IsValid() && t.Name() && strcmp(t.Name(), "G__virtualinfo")) {
a = new G__DataMemberInfo(t);
cl->fData->Add(new TDataMember(a, cl));
}
}
}
}
void TCint::CreateListOfMethods(TClass *cl)
{
R__LOCKGUARD2(gCINTMutex);
if (!cl->fMethod) {
cl->fMethod = new TList;
G__MethodInfo *a;
G__MethodInfo t(*(G__ClassInfo*)cl->GetClassInfo());
while (t.Next()) {
if (t.IsValid() && t.Name()) {
a = new G__MethodInfo(t);
cl->fMethod->Add(new TMethod(a, cl));
}
}
}
}
void TCint::UpdateListOfMethods(TClass *cl)
{
if (cl->fMethod) {
R__LOCKGUARD2(gCINTMutex);
G__ClassInfo *info = (G__ClassInfo*)cl->GetClassInfo();
if (!info || cl->fMethod->GetEntries() == info->NMethods()) {
return;
}
delete cl->fMethod;
cl->fMethod = 0;
}
CreateListOfMethods(cl);
}
void TCint::CreateListOfMethodArgs(TFunction *m)
{
R__LOCKGUARD2(gCINTMutex);
if (!m->fMethodArgs) {
m->fMethodArgs = new TList;
G__MethodArgInfo t(*(G__MethodInfo *)m->fInfo), *a;
while (t.Next()) {
if (t.IsValid() && t.Type()) {
a = new G__MethodArgInfo(t);
m->fMethodArgs->Add(new TMethodArg(a, m));
}
}
}
}
TString TCint::GetMangledName(TClass *cl, const char *method,
const char *params)
{
R__LOCKGUARD2(gCINTMutex);
G__CallFunc func;
Long_t offset;
if (cl)
func.SetFunc((G__ClassInfo*)cl->GetClassInfo(), method, params, &offset);
else {
G__ClassInfo gcl;
func.SetFunc(&gcl, method, params, &offset);
}
return func.GetMethodInfo().GetMangledName();
}
TString TCint::GetMangledNameWithPrototype(TClass *cl, const char *method,
const char *proto)
{
R__LOCKGUARD2(gCINTMutex);
Long_t offset;
if (cl)
return ((G__ClassInfo*)cl->GetClassInfo())->GetMethod(method, proto, &offset).GetMangledName();
G__ClassInfo gcl;
return gcl.GetMethod(method, proto, &offset).GetMangledName();
}
void *TCint::GetInterfaceMethod(TClass *cl, const char *method,
const char *params)
{
R__LOCKGUARD2(gCINTMutex);
G__CallFunc func;
Long_t offset;
if (cl)
func.SetFunc((G__ClassInfo*)cl->GetClassInfo(), method, params, &offset);
else {
G__ClassInfo gcl;
func.SetFunc(&gcl, method, params, &offset);
}
return (void *)func.InterfaceMethod();
}
void *TCint::GetInterfaceMethodWithPrototype(TClass *cl, const char *method,
const char *proto)
{
R__LOCKGUARD2(gCINTMutex);
G__InterfaceMethod f;
Long_t offset;
if (cl)
f = ((G__ClassInfo*)cl->GetClassInfo())->GetMethod(method, proto, &offset).InterfaceMethod();
else {
G__ClassInfo gcl;
f = gcl.GetMethod(method, proto, &offset).InterfaceMethod();
}
return (void *)f;
}
const char *TCint::GetInterpreterTypeName(const char *name, Bool_t full)
{
R__LOCKGUARD(gCINTMutex);
if (!gInterpreter->CheckClassInfo(name)) return 0;
G__ClassInfo cl(name);
if (cl.IsValid()) {
if (full) return cl.Fullname();
else return cl.Name();
}
else return 0;
}
void TCint::Execute(const char *function, const char *params, int *error)
{
R__LOCKGUARD2(gCINTMutex);
G__CallFunc func;
G__ClassInfo cl;
Long_t offset;
func.SetFunc(&cl, function, params, &offset);
func.Exec(0);
if (error) *error = G__lasterror();
}
void TCint::Execute(TObject *obj, TClass *cl, const char *method,
const char *params, int *error)
{
R__LOCKGUARD2(gCINTMutex);
void *address;
Long_t offset;
G__CallFunc func;
void *addr = cl->DynamicCast( TObject::Class(), obj, kFALSE);
func.SetFunc((G__ClassInfo*)cl->GetClassInfo(), method, params, &offset);
address = (void*)((Long_t)addr + offset);
func.Exec(address);
if (error) *error = G__lasterror();
}
void TCint::Execute(TObject *obj, TClass *cl, TMethod *method, TObjArray *params,
int *error)
{
if (!method) {
Error("Execute","No method was defined");
return;
}
TList *argList = method->GetListOfMethodArgs();
Int_t nparms = argList->LastIndex()+1;
Int_t argc = params ? params->LastIndex()+1:0;
if (nparms != argc) {
Error("Execute","Wrong number of the parameters");
return;
}
const char *listpar = "";
TString complete(10);
if (params)
{
TIter next(params);
for (Int_t i = 0; i < argc; i ++)
{
TMethodArg *arg = (TMethodArg *) argList->At( i );
G__TypeInfo type( arg->GetFullTypeName() );
TObjString *nxtpar = (TObjString *)next();
if (i) complete += ',';
if (strstr( type.TrueName(), "char" )) {
TString chpar('\"');
chpar += (nxtpar->String()).ReplaceAll("\"","\\\"");
complete += chpar;
complete += '\"';
}
else
complete += nxtpar->String();
}
listpar = complete.Data();
}
Execute(obj, cl, (char *)method->GetName(), (char *)listpar, error);
}
Long_t TCint::ExecuteMacro(const char *filename, EErrorCode *error)
{
R__LOCKGUARD(gCINTMutex);
return TApplication::ExecuteFile(filename, (int*)error);
}
const char *TCint::GetTopLevelMacroName() const
{
G__SourceFileInfo srcfile(G__get_ifile()->filenum);
while (srcfile.IncludedFrom().IsValid())
srcfile = srcfile.IncludedFrom();
return srcfile.Name();
}
const char *TCint::GetCurrentMacroName() const
{
/* -->
<span style="color:#ffffff;background-color:#7777ff;padding-left:0.3em;padding-right:0.3em">inclfile.h</span>
<!--div style="border:solid 1px #ffff77;background-color: #ffffdd;float:left;padding:0.5em;margin-bottom:0.7em;"-->
<div class="code">
<pre style="margin:0pt">#include <iostream>
void inclfunc() {
std::cout << "In inclfile.h" << std::endl;
std::cout << " TCint::GetCurrentMacroName() returns " <<
TCint::GetCurrentMacroName() << std::endl;
std::cout << " TCint::GetTopLevelMacroName() returns " <<
TCint::GetTopLevelMacroName() << std::endl;
}</pre></div>
<div style="clear:both"></div>
<span style="color:#ffffff;background-color:#7777ff;padding-left:0.3em;padding-right:0.3em">mymacro.C</span>
<div style="border:solid 1px #ffff77;background-color: #ffffdd;float:left;padding:0.5em;margin-bottom:0.7em;">
<pre style="margin:0pt">#include <iostream>
#include "inclfile.h"
void mymacro() {
std::cout << "In mymacro.C" << std::endl;
std::cout << " TCint::GetCurrentMacroName() returns " <<
TCint::GetCurrentMacroName() << std::endl;
std::cout << " TCint::GetTopLevelMacroName() returns " <<
TCint::GetTopLevelMacroName() << std::endl;
std::cout << " Now calling inclfunc..." << std::endl;
inclfunc();
}</pre></div>
<div style="clear:both"></div>
<!-- */
// --> END_HTML
return G__get_ifile()->name;
}
const char *TCint::TypeName(const char *typeDesc)
{
static char t[1024];
char *s, *template_start;
if (!strstr(typeDesc, "(*)(")) {
s = (char*)strchr(typeDesc, ' ');
template_start = (char*)strchr(typeDesc, '<');
if (!strcmp(typeDesc, "long long"))
strcpy(t, typeDesc);
else if (!strncmp(typeDesc,"unsigned ",s+1-typeDesc))
strcpy(t, typeDesc);
else if (s && (template_start==0 || (s < template_start)) )
strcpy(t, s+1);
else
strcpy(t, typeDesc);
}
int l = strlen(t);
while (l > 0 && (t[l-1] == '*' || t[l-1] == '&') ) t[--l] = 0;
return t;
}
Int_t TCint::LoadLibraryMap(const char *rootmapfile)
{
R__LOCKGUARD(gCINTMutex);
if (!fMapfile) {
fMapfile = new TEnv(".rootmap");
fMapfile->IgnoreDuplicates(kTRUE);
fRootmapFiles = new TObjArray;
fRootmapFiles->SetOwner();
}
TString ldpath = gSystem->GetDynamicPath();
if (ldpath != fRootmapLoadPath) {
fRootmapLoadPath = ldpath;
#ifdef WIN32
TObjArray *paths = ldpath.Tokenize(";");
#else
TObjArray *paths = ldpath.Tokenize(":");
#endif
TString d;
for (Int_t i = 0; i < paths->GetEntriesFast(); i++) {
d = ((TObjString*)paths->At(i))->GetString();
Int_t skip = 0;
for (Int_t j = 0; j < i; j++) {
TString pd = ((TObjString*)paths->At(j))->GetString();
if (pd == d) {
skip++;
break;
}
}
if (!skip) {
void *dirp = gSystem->OpenDirectory(d);
if (dirp) {
if (gDebug > 3)
Info("LoadLibraryMap", "%s", d.Data());
const char *f1;
while ((f1 = gSystem->GetDirEntry(dirp))) {
TString f = f1;
if (f.EndsWith(".rootmap")) {
TString p;
p = d + "/" + f;
if (!gSystem->AccessPathName(p, kReadPermission)) {
if (gDebug > 4)
Info("LoadLibraryMap", " rootmap file: %s", p.Data());
fMapfile->ReadFile(p, kEnvGlobal);
fRootmapFiles->Add(new TObjString(p));
}
}
if (f.BeginsWith("rootmap")) {
TString p;
p = d + "/" + f;
FileStat_t stat;
if (gSystem->GetPathInfo(p, stat) == 0 && R_ISREG(stat.fMode))
Warning("LoadLibraryMap", "please rename %s to end with \".rootmap\"", p.Data());
}
}
}
gSystem->FreeDirectory(dirp);
}
}
delete paths;
if (!fMapfile->GetTable()->GetEntries()) {
return -1;
}
}
if (rootmapfile && *rootmapfile) {
Bool_t ignore = fMapfile->IgnoreDuplicates(kFALSE);
fMapfile->ReadFile(rootmapfile, kEnvGlobal);
fRootmapFiles->Add(new TObjString(rootmapfile));
fMapfile->IgnoreDuplicates(ignore);
}
TEnvRec *rec;
TIter next(fMapfile->GetTable());
while ((rec = (TEnvRec*) next())) {
TString cls = rec->GetName();
if (!strncmp(cls.Data(), "Library.", 8) && cls.Length() > 8) {
TString libs = rec->GetValue();
if (libs == "") continue;
TString delim(" ");
TObjArray *tokens = libs.Tokenize(delim);
char *lib = (char *)((TObjString*)tokens->At(0))->GetName();
cls.Remove(0,8);
cls.ReplaceAll("@@", "::");
cls.ReplaceAll("-", " ");
if (cls.Contains(":")) {
int slen = cls.Length();
for (int k = 0; k < slen; k++) {
if (cls[k] == ':') {
if (k+1 >= slen || cls[k+1] != ':') {
break;
}
if (k) {
TString base = cls(0, k);
if (base == "std") {
break;
} else {
const char* baselib = G__get_class_autoloading_table((char*)base.Data());
if ((!baselib || !baselib[0]) && !rec->FindObject(base))
G__set_class_autoloading_table((char*)base.Data(), (char*)"");
}
++k;
}
} else if (cls[k] == '<') {
break;
}
}
}
G__set_class_autoloading_table((char*)cls.Data(), lib);
G__security_recover(stderr);
if (gDebug > 6) {
const char *wlib = gSystem->Which(gSystem->GetDynamicPath(), lib);
Info("LoadLibraryMap", "class %s in %s", cls.Data(), wlib);
delete [] wlib;
}
delete tokens;
}
}
return 0;
}
Int_t TCint::RescanLibraryMap()
{
UnloadAllSharedLibraryMaps();
LoadLibraryMap();
return 0;
}
Int_t TCint::ReloadAllSharedLibraryMaps()
{
const TString sharedLibLStr = GetSharedLibs();
const TObjArray *sharedLibL = sharedLibLStr.Tokenize(" ");
const Int_t nrSharedLibs = sharedLibL->GetEntriesFast();
for (Int_t ilib = 0; ilib < nrSharedLibs; ilib++) {
const TString sharedLibStr = ((TObjString *)sharedLibL->At(ilib))->GetString();
const TString sharedLibBaseStr = gSystem->BaseName(sharedLibStr);
const Int_t ret = UnloadLibraryMap(sharedLibBaseStr);
if (ret < 0) continue;
TString rootMapBaseStr = sharedLibBaseStr;
if (sharedLibBaseStr.EndsWith(".dll"))
rootMapBaseStr.ReplaceAll(".dll","");
else if (sharedLibBaseStr.EndsWith(".DLL"))
rootMapBaseStr.ReplaceAll(".DLL","");
else if (sharedLibBaseStr.EndsWith(".so"))
rootMapBaseStr.ReplaceAll(".so","");
else if (sharedLibBaseStr.EndsWith(".sl"))
rootMapBaseStr.ReplaceAll(".sl","");
else if (sharedLibBaseStr.EndsWith(".dl"))
rootMapBaseStr.ReplaceAll(".dl","");
else if (sharedLibBaseStr.EndsWith(".a"))
rootMapBaseStr.ReplaceAll(".a","");
else {
Error("ReloadAllSharedLibraryMaps","Unknown library type %s",sharedLibBaseStr.Data());
delete sharedLibL;
return -1;
}
rootMapBaseStr += ".rootmap";
const char *rootMap = gSystem->Which(gSystem->GetDynamicPath(),rootMapBaseStr);
if (!rootMap) {
Error("ReloadAllSharedLibraryMaps","Could not find rootmap %s in path",rootMap);
delete [] rootMap;
delete sharedLibL;
return -1;
}
const Int_t status = LoadLibraryMap(rootMap);
if (status < 0) {
Error("ReloadAllSharedLibraryMaps","Error loading map %s",rootMap);
delete [] rootMap;
delete sharedLibL;
return -1;
}
delete [] rootMap;
}
delete sharedLibL;
return 0;
}
Int_t TCint::UnloadAllSharedLibraryMaps()
{
const TString sharedLibLStr = GetSharedLibs();
const TObjArray *sharedLibL = sharedLibLStr.Tokenize(" ");
for (Int_t ilib = 0; ilib < sharedLibL->GetEntriesFast(); ilib++) {
const TString sharedLibStr = ((TObjString *)sharedLibL->At(ilib))->GetString();
const TString sharedLibBaseStr = gSystem->BaseName(sharedLibStr);
UnloadLibraryMap(sharedLibBaseStr);
}
delete sharedLibL;
return 0;
}
Int_t TCint::UnloadLibraryMap(const char *library)
{
if (!fMapfile || !library || !*library)
return 0;
TEnvRec *rec;
TIter next(fMapfile->GetTable());
R__LOCKGUARD(gCINTMutex);
Int_t ret = 0;
while ((rec = (TEnvRec*) next())) {
TString cls = rec->GetName();
if (!strncmp(cls.Data(), "Library.", 8) && cls.Length() > 8) {
TString libs = rec->GetValue();
if (libs == "") continue;
TString delim(" ");
TObjArray *tokens = libs.Tokenize(delim);
const char *lib = ((TObjString*)tokens->At(0))->GetName();
cls.Remove(0,8);
cls.ReplaceAll("@@", "::");
cls.ReplaceAll("-", " ");
if (cls.Contains(":")) {
int slen = cls.Length();
for (int k = 0; k < slen; k++) {
if (cls[k] == ':') {
if (k+1 >= slen || cls[k+1] != ':') {
break;
}
if (k) {
TString base = cls(0, k);
if (base == "std") {
break;
} else {
}
++k;
}
} else if (cls[k] == '<') {
break;
}
}
}
if (!strcmp(library, lib)) {
if (fMapfile->GetTable()->Remove(rec) == 0) {
Error("UnloadLibraryMap", "entry for <%s,%s> not found in library map table", cls.Data(), lib);
ret = -1;
}
G__set_class_autoloading_table((char*)cls.Data(), (char*)-1);
G__security_recover(stderr);
}
delete tokens;
}
}
return ret;
}
Int_t TCint::AutoLoad(const char *cls)
{
R__LOCKGUARD(gCINTMutex);
Int_t status = 0;
if (!gROOT || !gInterpreter) return status;
Int_t oldvalue = G__set_class_autoloading(0);
TString deplibs = gInterpreter->GetClassSharedLibs(cls);
if (!deplibs.IsNull()) {
TString delim(" ");
TObjArray *tokens = deplibs.Tokenize(delim);
for (Int_t i = tokens->GetEntriesFast()-1; i > 0; i--) {
const char *deplib = ((TObjString*)tokens->At(i))->GetName();
if (gROOT->LoadClass(cls, deplib) == 0) {
if (gDebug > 0)
::Info("TCint::AutoLoad", "loaded dependent library %s for class %s",
deplib, cls);
} else
::Error("TCint::AutoLoad", "failure loading dependent library %s for class %s",
deplib, cls);
}
const char *lib = ((TObjString*)tokens->At(0))->GetName();
if (lib[0]) {
if (gROOT->LoadClass(cls, lib) == 0) {
if (gDebug > 0)
::Info("TCint::AutoLoad", "loaded library %s for class %s",
lib, cls);
status = 1;
} else
::Error("TCint::AutoLoad", "failure loading library %s for class %s",
lib, cls);
}
delete tokens;
}
G__set_class_autoloading(oldvalue);
return status;
}
Int_t TCint::AutoLoadCallback(const char *cls, const char *lib)
{
R__LOCKGUARD(gCINTMutex);
if (!gROOT || !gInterpreter || !cls || !lib) return 0;
if (strstr(lib, "libCore")) return 1;
TString deplibs = gInterpreter->GetClassSharedLibs(cls);
if (!deplibs.IsNull()) {
if (gDebug > 0 && gDebug <= 4)
::Info("TCint::AutoLoadCallback", "loaded dependent library %s for class %s",
deplibs.Data(), cls);
TString delim(" ");
TObjArray *tokens = deplibs.Tokenize(delim);
for (Int_t i = tokens->GetEntriesFast()-1; i > 0; i--) {
const char *deplib = ((TObjString*)tokens->At(i))->GetName();
if (gROOT->LoadClass(cls, deplib) == 0) {
if (gDebug > 4)
::Info("TCint::AutoLoadCallback", "loaded dependent library %s for class %s",
deplib, cls);
} else {
::Error("TCint::AutoLoadCallback", "failure loading dependent library %s for class %s",
deplib, cls);
}
}
delete tokens;
}
if (lib[0]) {
if (gROOT->LoadClass(cls, lib) == 0) {
if (gDebug > 0)
::Info("TCint::AutoLoadCallback", "loaded library %s for class %s",
lib, cls);
return 1;
} else {
::Error("TCint::AutoLoadCallback", "failure loading library %s for class %s",
lib, cls);
}
}
return 0;
}
void *TCint::FindSpecialObject(const char *item, G__ClassInfo *type,
void **prevObj, void **assocPtr)
{
if (!*prevObj || *assocPtr != gDirectory) {
*prevObj = gROOT->FindSpecialObject(item, *assocPtr);
if (!fgSetOfSpecials) fgSetOfSpecials = new std::set<TObject*>;
if (*prevObj) ((std::set<TObject*>*)fgSetOfSpecials)->insert((TObject*)*prevObj);
}
if (*prevObj) type->Init(((TObject *)*prevObj)->ClassName());
return *prevObj;
}
namespace {
class TInfoNode {
private:
string fName;
Long_t fTagnum;
public:
TInfoNode(const char *item, Long_t tagnum)
: fName(item),fTagnum(tagnum)
{}
void Update() {
TCint::UpdateClassInfoWork(fName.c_str(),fTagnum);
}
};
}
void TCint::UpdateClassInfo(char *item, Long_t tagnum)
{
R__LOCKGUARD(gCINTMutex);
if (gROOT && gROOT->GetListOfClasses()) {
static Bool_t entered = kFALSE;
static vector<TInfoNode> updateList;
Bool_t topLevel;
if (entered) topLevel = kFALSE;
else {
entered = kTRUE;
topLevel = kTRUE;
}
if (topLevel) {
UpdateClassInfoWork(item,tagnum);
} else {
updateList.push_back(TInfoNode(item,tagnum));
}
if (topLevel) {
while (!updateList.empty()) {
TInfoNode current( updateList.back() );
updateList.pop_back();
current.Update();
}
entered = kFALSE;
}
}
}
void TCint::UpdateClassInfoWork(const char *item, Long_t tagnum)
{
Bool_t load = kFALSE;
if (strchr(item,'<') && TClass::fgClassShortTypedefHash) {
TString resolvedItem(
TClassEdit::ResolveTypedef(TClassEdit::ShortType(item,
TClassEdit::kDropStlDefault).c_str(), kTRUE) );
if (resolvedItem != item) {
TClass* cl= (TClass*)gROOT->GetListOfClasses()->FindObject(resolvedItem);
if (cl)
load = kTRUE;
}
if (!load) {
TIter next(TClass::fgClassShortTypedefHash->GetListForObject(resolvedItem));
while ( TClass::TNameMapNode* htmp =
static_cast<TClass::TNameMapNode*> (next()) ) {
if (resolvedItem == htmp->String()) {
TClass* cl = gROOT->GetClass (htmp->fOrigName, kFALSE);
if (cl) {
load = kTRUE;
break;
}
}
}
}
}
TClass *cl = gROOT->GetClass(item, load);
if (cl) cl->ResetClassInfo(tagnum);
}
void TCint::UpdateAllCanvases()
{
TIter next(gROOT->GetListOfCanvases());
TVirtualPad *canvas;
while ((canvas = (TVirtualPad *)next()))
canvas->Update();
}
const char* TCint::GetSharedLibs()
{
fSharedLibs = "";
G__SourceFileInfo cursor(0);
while (cursor.IsValid()) {
const char *filename = cursor.Name();
if (filename==0) continue;
Int_t len = strlen(filename);
const char *end = filename+len;
Bool_t needToSkip = kFALSE;
if ( len>5 && ( (strcmp(end-4,".dll") == 0 ) || (strstr(filename,"Dict.")!=0) || (strstr(filename,"MetaTCint")!=0) ) ) {
static const char *excludelist [] = {
"stdfunc.dll","stdcxxfunc.dll","posix.dll","ipc.dll","posix.dll"
"string.dll","vector.dll","vectorbool.dll","list.dll","deque.dll",
"map.dll", "map2.dll","set.dll","multimap.dll","multimap2.dll",
"multiset.dll","stack.dll","queue.dll","valarray.dll",
"exception.dll","stdexcept.dll","complex.dll","climits.dll",
"libvectorDict.","libvectorboolDict.","liblistDict.","libdequeDict.",
"libmapDict.", "libmap2Dict.","libsetDict.","libmultimapDict.","libmultimap2Dict.",
"libmultisetDict.","libstackDict.","libqueueDict.","libvalarrayDict.",
"libMetaTCint.","libMetaTCint7."
};
static const unsigned int excludelistsize = sizeof(excludelist)/sizeof(excludelist[0]);
static int excludelen[excludelistsize] = {-1};
if (excludelen[0] == -1) {
for (unsigned int i = 0; i < excludelistsize; ++i)
excludelen[i] = strlen(excludelist[i]);
}
const char* basename = gSystem->BaseName(filename);
for (unsigned int i = 0; !needToSkip && i < excludelistsize; ++i)
needToSkip = (!strncmp(basename, excludelist[i], excludelen[i]));
}
if (!needToSkip &&
((len>3 && strcmp(end-2,".a") == 0) ||
(len>4 && (strcmp(end-3,".sl") == 0 ||
strcmp(end-3,".dl") == 0 ||
strcmp(end-3,".so") == 0)) ||
(len>5 && (strcasecmp(end-4,".dll") == 0)))) {
if (!fSharedLibs.IsNull())
fSharedLibs.Append(" ");
fSharedLibs.Append(filename);
}
cursor.Next();
}
return fSharedLibs;
}
const char *TCint::GetClassSharedLibs(const char *cls)
{
if (!cls || !*cls)
return 0;
if (fMapfile) {
TString c = TString("Library.") + cls;
c.ReplaceAll("::", "@@");
c.ReplaceAll(" ", "-");
const char *libs = fMapfile->GetValue(c, "");
return (*libs) ? libs : 0;
}
return 0;
}
const char *TCint::GetSharedLibDeps(const char *lib)
{
if (!fMapfile || !lib || !lib[0])
return 0;
TString libname(lib);
Ssiz_t idx = libname.Last('.');
if (idx != kNPOS) {
libname.Remove(idx);
}
TEnvRec *rec;
TIter next(fMapfile->GetTable());
size_t len = libname.Length();
while ((rec = (TEnvRec*) next())) {
const char *libs = rec->GetValue();
if (!strncmp(libs, libname.Data(), len) && strlen(libs) >= len
&& (!libs[len] || libs[len] == ' ' || libs[len] == '.')) {
return libs;
}
}
return 0;
}
Bool_t TCint::IsErrorMessagesEnabled() const
{
return !G__const_whatnoerror();
}
Bool_t TCint::SetErrorMessages(Bool_t enable)
{
if (enable)
G__const_resetnoerror();
else
G__const_setnoerror();
return !G__const_whatnoerror();
}
void TCint::AddIncludePath(const char *path)
{
R__LOCKGUARD(gCINTMutex);
char *incpath = gSystem->ExpandPathName(path);
G__add_ipath(incpath);
delete [] incpath;
}
const char *TCint::GetIncludePath()
{
R__LOCKGUARD(gCINTMutex);
fIncludePath = "";
G__IncludePathInfo path;
while (path.Next()) {
const char *pathname = path.Name();
fIncludePath.Append(" -I\"").Append(pathname).Append("\" ");
}
#ifdef ROOTINCDIR
fIncludePath.Append(" -I\"").Append(ROOTINCDIR);
#else
fIncludePath.Append(" -I\"").Append(gRootDir).Append("/include");
#endif
#ifdef R__BUILDING_CINT7
fIncludePath.Append("/cint7\" ");
#else
fIncludePath.Append("/cint\" ");
#endif
return fIncludePath;
}
const char *TCint::GetSTLIncludePath() const
{
static TString stldir;
if (!stldir.Length()) {
#ifdef CINTINCDIR
stldir = CINTINCDIR;
#else
stldir = gRootDir; stldir += "/cint";
#endif
if (!stldir.EndsWith("/"))
stldir += '/';
#ifdef R__BUILDING_CINT7
stldir += "cint7/stl";
#else
stldir += "cint/stl";
#endif
}
return stldir;
}
int TCint::DisplayClass(FILE *fout,char *name,int base,int start) const
{
return G__display_class(fout,name,base,start);
}
int TCint::DisplayIncludePath(FILE *fout) const
{
return G__display_includepath(fout);
}
void *TCint::FindSym(const char *entry) const
{
return G__findsym(entry);
}
void TCint::GenericError(const char *error) const
{
G__genericerror(error);
}
Long_t TCint::GetExecByteCode() const
{
return (Long_t)G__exec_bytecode;
}
Long_t TCint::Getgvp() const
{
return (Long_t)G__getgvp();
}
const char *TCint::Getp2f2funcname(void *receiver) const
{
return G__p2f2funcname(receiver);
}
int TCint::GetSecurityError() const
{
return G__get_security_error();
}
int TCint::LoadFile(const char *path) const
{
return G__loadfile(path);
}
void TCint::LoadText(const char *text) const
{
G__load_text(text);
}
const char *TCint::MapCppName(const char *name) const
{
return G__map_cpp_name(name);
}
void TCint::SetAlloclockfunc(void (*p)()) const
{
G__set_alloclockfunc(p);
}
void TCint::SetAllocunlockfunc(void (*p)()) const
{
G__set_allocunlockfunc(p);
}
int TCint::SetClassAutoloading(int autoload) const
{
return G__set_class_autoloading(autoload);
}
void TCint::SetErrmsgcallback(void *p) const
{
G__set_errmsgcallback(p);
}
void TCint::Setgvp(Long_t gvp) const
{
G__setgvp(gvp);
}
void TCint::SetRTLD_NOW() const
{
G__Set_RTLD_NOW();
}
void TCint::SetRTLD_LAZY() const
{
G__Set_RTLD_LAZY();
}
void TCint::SetTempLevel(int val) const
{
G__settemplevel(val);
}
int TCint::UnloadFile(const char *path) const
{
return G__unloadfile(path);
}
void TCint::CallFunc_Delete(CallFunc_t *func) const
{
G__CallFunc *f = (G__CallFunc*)func;
delete f;
}
void TCint::CallFunc_Exec(CallFunc_t *func, void *address) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->Exec(address);
}
Long_t TCint::CallFunc_ExecInt(CallFunc_t *func, void *address) const
{
G__CallFunc *f = (G__CallFunc*)func;
return f->ExecInt(address);
}
Long_t TCint::CallFunc_ExecInt64(CallFunc_t *func, void *address) const
{
G__CallFunc *f = (G__CallFunc*)func;
return f->ExecInt64(address);
}
Double_t TCint::CallFunc_ExecDouble(CallFunc_t *func, void *address) const
{
G__CallFunc *f = (G__CallFunc*)func;
return f->ExecDouble(address);
}
CallFunc_t *TCint::CallFunc_Factory() const
{
G__CallFunc *f = new G__CallFunc();
return f;
}
CallFunc_t *TCint::CallFunc_FactoryCopy(CallFunc_t *func) const
{
G__CallFunc *f1 = (G__CallFunc*)func;
G__CallFunc *f = new G__CallFunc(*f1);
return f;
}
MethodInfo_t *TCint::CallFunc_FactoryMethod(CallFunc_t *func) const
{
G__CallFunc *f = (G__CallFunc*)func;
G__MethodInfo *info = new G__MethodInfo((*f).GetMethodInfo());
return info;
}
void TCint::CallFunc_Init(CallFunc_t *func) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->Init();
}
bool TCint::CallFunc_IsValid(CallFunc_t *func) const
{
G__CallFunc *f = (G__CallFunc*)func;
return f->IsValid();
}
void TCint::CallFunc_ResetArg(CallFunc_t *func) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->ResetArg();
}
void TCint::CallFunc_SetArg(CallFunc_t *func, Long_t param) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->SetArg(param);
}
void TCint::CallFunc_SetArg(CallFunc_t *func, Double_t param) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->SetArg(param);
}
void TCint::CallFunc_SetArg(CallFunc_t *func, Long64_t param) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->SetArg(param);
}
void TCint::CallFunc_SetArg(CallFunc_t *func, ULong64_t param) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->SetArg(param);
}
void TCint::CallFunc_SetArgArray(CallFunc_t *func, Long_t *paramArr, Int_t nparam) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->SetArgArray(paramArr,nparam);
}
void TCint::CallFunc_SetArgs(CallFunc_t *func, const char *param) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->SetArgs(param);
}
void TCint::CallFunc_SetFunc(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *params, Long_t *offset) const
{
G__CallFunc *f = (G__CallFunc*)func;
f->SetFunc((G__ClassInfo*)info,method,params,offset);
}
void TCint::CallFunc_SetFunc(CallFunc_t *func, MethodInfo_t *info) const
{
G__CallFunc *f = (G__CallFunc*)func;
G__MethodInfo *minfo = (G__MethodInfo*)info;
f->SetFunc(*minfo);
}
void TCint::CallFunc_SetFuncProto(CallFunc_t *func, ClassInfo_t *info, const char *method, const char *proto, Long_t *offset) const
{
G__CallFunc *f = (G__CallFunc*)func;
G__ClassInfo *cinfo = (G__ClassInfo*)info;
f->SetFuncProto(cinfo,method,proto,offset);
}
Long_t TCint::ClassInfo_ClassProperty(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->ClassProperty();
}
void TCint::ClassInfo_Delete(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
delete info;
}
void TCint::ClassInfo_Delete(ClassInfo_t *cinfo, void *arena) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
info->Delete(arena);
}
void TCint::ClassInfo_DeleteArray(ClassInfo_t *cinfo, void *arena, bool dtorOnly) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
info->DeleteArray(arena,dtorOnly);
}
void TCint::ClassInfo_Destruct(ClassInfo_t *cinfo, void *arena) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
info->Destruct(arena);
}
ClassInfo_t *TCint::ClassInfo_Factory() const
{
return new G__ClassInfo();
}
ClassInfo_t *TCint::ClassInfo_Factory(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return new G__ClassInfo(*info);
}
ClassInfo_t *TCint::ClassInfo_Factory(const char *name) const
{
return new G__ClassInfo(name);
}
ClassInfo_t *TCint::ClassInfo_Factory(G__value *pvalue) const
{
return new G__ClassInfo(*pvalue);
}
int TCint::ClassInfo_GetMethodNArg(ClassInfo_t *cinfo, const char *method,const char *proto) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
G__MethodInfo meth;
if (info) {
Long_t offset;
meth = info->GetMethod(method,proto,&offset);
}
if (meth.IsValid()) return meth.NArg();
return -1;
}
bool TCint::ClassInfo_HasDefaultConstructor(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->HasDefaultConstructor();
}
bool TCint::ClassInfo_HasMethod(ClassInfo_t *cinfo, const char *name) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->HasMethod(name);
}
void TCint::ClassInfo_Init(ClassInfo_t *cinfo, const char *funcname) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
info->Init(funcname);
}
void TCint::ClassInfo_Init(ClassInfo_t *cinfo, int tagnum) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
info->Init(tagnum);
}
bool TCint::ClassInfo_IsBase(ClassInfo_t *cinfo, const char*name) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->IsBase(name);
}
bool TCint::ClassInfo_IsEnum(const char*name) const
{
G__ClassInfo info(name);
if (info.IsValid() && info.Property()&G__BIT_ISENUM) return kTRUE;
return kFALSE;
}
bool TCint::ClassInfo_IsLoaded(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->IsLoaded();
}
bool TCint::ClassInfo_IsValid(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->IsValid();
}
bool TCint::ClassInfo_IsValidMethod(ClassInfo_t *cinfo, const char *method,const char *proto, Long_t *offset) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->GetMethod(method,proto,offset).IsValid();
}
int TCint::ClassInfo_Next(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->Next();
}
void *TCint::ClassInfo_New(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->New();
}
void *TCint::ClassInfo_New(ClassInfo_t *cinfo, int n) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->New(n);
}
void *TCint::ClassInfo_New(ClassInfo_t *cinfo, int n, void *arena) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->New(n,arena);
}
void *TCint::ClassInfo_New(ClassInfo_t *cinfo, void *arena) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->New(arena);
}
Long_t TCint::ClassInfo_Property(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->Property();
}
int TCint::ClassInfo_RootFlag(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->RootFlag();
}
int TCint::ClassInfo_Size(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->Size();
}
Long_t TCint::ClassInfo_Tagnum(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->Tagnum();
}
const char *TCint::ClassInfo_FileName(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->FileName();
}
const char *TCint::ClassInfo_FullName(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->Fullname();
}
const char *TCint::ClassInfo_Name(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->Name();
}
const char *TCint::ClassInfo_Title(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->Title();
}
const char *TCint::ClassInfo_TmpltName(ClassInfo_t *cinfo) const
{
G__ClassInfo *info = (G__ClassInfo*)cinfo;
return info->TmpltName();
}
void TCint::BaseClassInfo_Delete(BaseClassInfo_t *bcinfo) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
delete info;
}
BaseClassInfo_t *TCint::BaseClassInfo_Factory(ClassInfo_t *cinfo) const
{
G__ClassInfo *cinfo1 = (G__ClassInfo*)cinfo;
G__BaseClassInfo *info = new G__BaseClassInfo(*cinfo1);
return info;
}
int TCint::BaseClassInfo_Next(BaseClassInfo_t *bcinfo) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
return info->Next();
}
int TCint::BaseClassInfo_Next(BaseClassInfo_t *bcinfo, int onlyDirect) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
return info->Next(onlyDirect);
}
Long_t TCint::BaseClassInfo_Offset(BaseClassInfo_t *bcinfo) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
return info->Offset();
}
Long_t TCint::BaseClassInfo_Property(BaseClassInfo_t *bcinfo) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
return info->Property();
}
Long_t TCint::BaseClassInfo_Tagnum(BaseClassInfo_t *bcinfo) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
return info->Tagnum();
}
const char *TCint::BaseClassInfo_FullName(BaseClassInfo_t *bcinfo) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
return info->Fullname();
}
const char *TCint::BaseClassInfo_Name(BaseClassInfo_t *bcinfo) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
return info->Name();
}
const char *TCint::BaseClassInfo_TmpltName(BaseClassInfo_t *bcinfo) const
{
G__BaseClassInfo *info = (G__BaseClassInfo*)bcinfo;
return info->TmpltName();
}
int TCint::DataMemberInfo_ArrayDim(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->ArrayDim();
}
void TCint::DataMemberInfo_Delete(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
delete info;
}
DataMemberInfo_t *TCint::DataMemberInfo_Factory(ClassInfo_t* clinfo ) const
{
G__ClassInfo* clinfo1 = (G__ClassInfo*) clinfo;
if (clinfo1)
return new G__DataMemberInfo(*clinfo1);
return new G__DataMemberInfo();
}
DataMemberInfo_t *TCint::DataMemberInfo_FactoryCopy(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info1 = (G__DataMemberInfo*)dminfo;
G__DataMemberInfo *info = new G__DataMemberInfo(*info1);
return info;
}
bool TCint::DataMemberInfo_IsValid(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->IsValid();
}
int TCint::DataMemberInfo_MaxIndex(DataMemberInfo_t *dminfo, Int_t dim) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->MaxIndex(dim);
}
int TCint::DataMemberInfo_Next(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Next();
}
Long_t TCint::DataMemberInfo_Offset(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Offset();
}
Long_t TCint::DataMemberInfo_Property(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Property();
}
Long_t TCint::DataMemberInfo_TypeProperty(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Type()->Property();
}
int TCint::DataMemberInfo_TypeSize(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Type()->Size();
}
const char *TCint::DataMemberInfo_TypeName(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Type()->Name();
}
const char *TCint::DataMemberInfo_TypeTrueName(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Type()->TrueName();
}
const char *TCint::DataMemberInfo_Name(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Name();
}
const char *TCint::DataMemberInfo_Title(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->Title();
}
const char *TCint::DataMemberInfo_ValidArrayIndex(DataMemberInfo_t *dminfo) const
{
G__DataMemberInfo *info = (G__DataMemberInfo*)dminfo;
return info->ValidArrayIndex();
}
void TCint::MethodInfo_Delete(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
delete info;
}
void TCint::MethodInfo_CreateSignature(MethodInfo_t *minfo, TString &signature) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
G__MethodArgInfo arg(*info);
int ifirst = 0;
signature = "(";
while (arg.Next()) {
if (ifirst) signature += ", ";
if (arg.Type() == 0) break;
signature += arg.Type()->Name();
if (arg.Name() && strlen(arg.Name())) {
signature += " ";
signature += arg.Name();
}
if (arg.DefaultValue()) {
signature += " = ";
signature += arg.DefaultValue();
}
ifirst++;
}
signature += ")";
}
MethodInfo_t *TCint::MethodInfo_Factory() const
{
G__MethodInfo *info = new G__MethodInfo();
return info;
}
MethodInfo_t *TCint::MethodInfo_FactoryCopy(MethodInfo_t *minfo) const
{
G__MethodInfo *info1 = (G__MethodInfo*)minfo;
G__MethodInfo *info = new G__MethodInfo(*info1);
return info;
}
void *TCint::MethodInfo_InterfaceMethod(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
G__InterfaceMethod pfunc = info->InterfaceMethod();
if (!pfunc) {
struct G__bytecodefunc *bytecode = info->GetBytecode();
if(bytecode) pfunc = (G__InterfaceMethod)G__exec_bytecode;
else {
pfunc = (G__InterfaceMethod)NULL;
}
}
return (void*)pfunc;
}
bool TCint::MethodInfo_IsValid(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->IsValid();
}
int TCint::MethodInfo_NArg(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->NArg();
}
int TCint::MethodInfo_NDefaultArg(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->NDefaultArg();
}
int TCint::MethodInfo_Next(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->Next();
}
Long_t TCint::MethodInfo_Property(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->Property();
}
void *TCint::MethodInfo_Type(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->Type();
}
const char *TCint::MethodInfo_GetMangledName(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->GetMangledName();
}
const char *TCint::MethodInfo_GetPrototype(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->GetPrototype();
}
const char *TCint::MethodInfo_Name(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->Name();
}
const char *TCint::MethodInfo_TypeName(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->Type()->Name();
}
const char *TCint::MethodInfo_Title(MethodInfo_t *minfo) const
{
G__MethodInfo *info = (G__MethodInfo*)minfo;
return info->Title();
}
void TCint::MethodArgInfo_Delete(MethodArgInfo_t *marginfo) const
{
G__MethodArgInfo *info = (G__MethodArgInfo*)marginfo;
delete info;
}
MethodArgInfo_t *TCint::MethodArgInfo_Factory() const
{
G__MethodArgInfo *info = new G__MethodArgInfo();
return info;
}
MethodArgInfo_t *TCint::MethodArgInfo_FactoryCopy(MethodArgInfo_t *marginfo) const
{
G__MethodArgInfo *info1 = (G__MethodArgInfo*)marginfo;
G__MethodArgInfo *info = new G__MethodArgInfo(*info1);
return info;
}
bool TCint::MethodArgInfo_IsValid(MethodArgInfo_t *marginfo) const
{
G__MethodArgInfo *info = (G__MethodArgInfo*)marginfo;
return info->IsValid();
}
int TCint::MethodArgInfo_Next(MethodArgInfo_t *marginfo) const
{
G__MethodArgInfo *info = (G__MethodArgInfo*)marginfo;
return info->Next();
}
Long_t TCint::MethodArgInfo_Property(MethodArgInfo_t *marginfo) const
{
G__MethodArgInfo *info = (G__MethodArgInfo*)marginfo;
return info->Property();
}
const char *TCint::MethodArgInfo_DefaultValue(MethodArgInfo_t *marginfo) const
{
G__MethodArgInfo *info = (G__MethodArgInfo*)marginfo;
return info->DefaultValue();;
}
const char *TCint::MethodArgInfo_Name(MethodArgInfo_t *marginfo) const
{
G__MethodArgInfo *info = (G__MethodArgInfo*)marginfo;
return info->Name();
}
const char *TCint::MethodArgInfo_TypeName(MethodArgInfo_t *marginfo) const
{
G__MethodArgInfo *info = (G__MethodArgInfo*)marginfo;
return info->Type()->Name();
}
void TCint::TypeInfo_Delete(TypeInfo_t *tinfo) const
{
G__TypeInfo *info = (G__TypeInfo*)tinfo;
delete info;
}
TypeInfo_t *TCint::TypeInfo_Factory() const
{
G__TypeInfo *info = new G__TypeInfo();
return info;
}
TypeInfo_t *TCint::TypeInfo_Factory(G__value *pvalue) const
{
G__TypeInfo *info = new G__TypeInfo(*pvalue);
return info;
}
TypeInfo_t *TCint::TypeInfo_FactoryCopy(TypeInfo_t *tinfo) const
{
G__TypeInfo *info = new G__TypeInfo(*(G__TypeInfo*)tinfo);
return info;
}
void TCint::TypeInfo_Init(TypeInfo_t *tinfo, const char *funcname) const
{
G__TypeInfo *info = (G__TypeInfo*)tinfo;
info->Init(funcname);
}
bool TCint::TypeInfo_IsValid(TypeInfo_t *tinfo) const
{
G__TypeInfo *info = (G__TypeInfo*)tinfo;
return info->IsValid();
}
const char *TCint::TypeInfo_Name(TypeInfo_t *tinfo) const
{
G__TypeInfo *info = (G__TypeInfo*)tinfo;
return info->Name();
}
Long_t TCint::TypeInfo_Property(TypeInfo_t *tinfo) const
{
G__TypeInfo *info = (G__TypeInfo*)tinfo;
return info->Property();
}
int TCint::TypeInfo_RefType(TypeInfo_t *tinfo) const
{
G__TypeInfo *info = (G__TypeInfo*)tinfo;
return info->Reftype();
}
int TCint::TypeInfo_Size(TypeInfo_t *tinfo) const
{
G__TypeInfo *info = (G__TypeInfo*)tinfo;
return info->Size();
}
const char *TCint::TypeInfo_TrueName(TypeInfo_t *tinfo) const
{
G__TypeInfo *info = (G__TypeInfo*)tinfo;
return info->TrueName();
}
void TCint::TypedefInfo_Delete(TypedefInfo_t *tinfo) const
{
G__TypedefInfo *info = (G__TypedefInfo*)tinfo;
delete info;
}
TypedefInfo_t *TCint::TypedefInfo_Factory() const
{
G__TypedefInfo *info = new G__TypedefInfo();
return info;
}
TypedefInfo_t *TCint::TypedefInfo_FactoryCopy(TypedefInfo_t *tinfo) const
{
G__TypedefInfo *info = new G__TypedefInfo(*(G__TypedefInfo*)tinfo);
return info;
}
TypedefInfo_t TCint::TypedefInfo_Init(TypedefInfo_t *tinfo, const char *funcname) const
{
G__TypedefInfo *info = (G__TypedefInfo*)tinfo;
info->Init(funcname);
}
bool TCint::TypedefInfo_IsValid(TypedefInfo_t *tinfo) const
{
G__TypedefInfo *info = (G__TypedefInfo*)tinfo;
return info->IsValid();
}
Long_t TCint::TypedefInfo_Property(TypedefInfo_t *tinfo) const
{
G__TypedefInfo *info = (G__TypedefInfo*)tinfo;
return info->Property();
}
int TCint::TypedefInfo_Size(TypedefInfo_t *tinfo) const
{
G__TypedefInfo *info = (G__TypedefInfo*)tinfo;
return info->Size();
}
const char *TCint::TypedefInfo_TrueName(TypedefInfo_t *tinfo) const
{
G__TypedefInfo *info = (G__TypedefInfo*)tinfo;
return info->TrueName();
}
const char *TCint::TypedefInfo_Name(TypedefInfo_t *tinfo) const
{
G__TypedefInfo *info = (G__TypedefInfo*)tinfo;
return info->Name();
}
const char *TCint::TypedefInfo_Title(TypedefInfo_t *tinfo) const
{
G__TypedefInfo *info = (G__TypedefInfo*)tinfo;
return info->Title();
}
Last change: Mon Dec 15 13:02:51 2008
Last generated: 2008-12-15 13:02
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.