Hi , I have a question for you. I am developing a application which requires constat monitoring of root commands. i.e runtime. Lets say i want to take each root command given on ROOT/Cint and parse it and store in some other file format than logfile and that too runtime. I am aware of root history file but i want to do this on the fly. Now i have created a small application which reads input and delegates the command to root by using TApplication processline() Its fine till here. Even i can execute some root commands from my command line. But when i try to execute any macro which involves graphics there is no disply unless i say TApplication obj->Run(). And when i do so the control never returns back to take other inputs from my command line. Could you give some pointers on how this can be done? I hope i am clear in what i am saying and i am able to convey what my problem is. thanks and regards, Mandar Following is the code what i am trying to do ******************************************************************** #include <stdio.h> #include <sys/types.h> #include "/home/mandar/root/include/TROOT.h" #include "/home/mandar/root/include/TRint.h" #include "/home/mandar/root/include/TString.h" #include "/home/mandar/root/include/TApplication.h" #include "/home/mandar/root/include/TGClient.h" #include "/home/mandar/root/include/TSystem.h" extern void InitGui(); VoidFuncPtr_t initFuncs[] = {InitGui,0}; static TROOT root("TROOT","TROOT",initFuncs); static Int_t session =0; int getline(TString *line) { int c,nch=0; fprintf(stderr,"ROOT :"); while((c = getchar()) != EOF) { if(c == '\n') break; line->Append(c); nch++; } if(c == EOF && nch == 0) return EOF; return nch; } void Process_Line(TString temp) { //parse and dump in file.. Int_t postion = temp.First('.'); TString filename; filename.Append("mylog.") ; filename+=session;//+ session; FILE *fp = fopen(filename,"a"); fprintf(fp,"%s\n",temp.Data()); fclose(fp); //execute the root command TApplication* app = gROOT->GetApplication(); app->SetReturnFromRun(true); if(app->ReturnFromRun()) { app->ProcessLine(temp.Data()); app->Show(); fprintf (stderr, "%s\r\n", temp.Data()); } // getchar(); // app->Run(); // gROOT->SetInterrupt(); // gSystem->ExitLoop(); // fclose(fp); } int main (int argc ,char **argv) { TString prompt; int done; session++; prompt = "root > "; done = 0; TApplication *theApp = new TApplication("ROOT example",&argc ,argv); while (!done) { TString temp; getline(&temp); /* Test for EOF. */ if (!temp) break;//exit (1); /* If there is anything on the line, print it and remember it. */ if (temp) { Process_Line(temp); } /* Check for `command' that we handle. */ if ((temp.CompareTo(".q") == 0)) done = 1; } }
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET