54 class TMsgList : 
public TNamed {
 
   62       TObjString fStrCounter; 
 
   66       TMsgList(
const char* name = 
"log", Int_t limit = 1000) :
 
   67          TNamed(name,
"list of log messages"),
 
   74          fMsgs.SetOwner(kTRUE);
 
   81          fCounter = ((Long64_t) TDatime().Get()) * 1000;
 
   84       virtual ~TMsgList() { fMsgs.Clear(); }
 
   86       void AddMsg(
const char* msg)
 
   92          while (fMsgs.GetSize() >= fLimit) {
 
   93             TObject* last = fMsgs.Last();
 
   99          fMsgs.AddFirst(
new TObjString(msg));
 
  103       TList* Select(Int_t max = 0, Long64_t 
id = 0)
 
  111          Long64_t curr = fCounter;
 
  114          if (max == 0) max = fMsgs.GetLast()+1;
 
  117          fStrCounter.SetString(TString::LLtoa(fCounter, 10));
 
  118          fSelect.Add(&fStrCounter);
 
  120          while (((obj = iter()) != 0) && (--curr >= 
id) && (--max>=0)) fSelect.Add(obj);
 
  125    ClassDef(TMsgList, 1); 
 
  131    TMsgList* log = 
new TMsgList(
"log", 200);
 
  133    if ((TMsgList::Class()->GetMethodAllAny(
"Select") == 0) || (strcmp(log->ClassName(), 
"TMsgList")!=0)) {
 
  134       printf(
"Most probably, macro runs in interpreter mode\n");
 
  135       printf(
"To access new methods from TMsgList class,\n");
 
  136       printf(
"one should run macro with ACLiC like:\n");
 
  137       printf(
"   shell> root -b httpextlog.C+\n");
 
  141    if (gSystem->AccessPathName(
"httptextlog.js")!=0) {
 
  142       printf(
"Please start macro from directory where httptextlog.js is available\n");
 
  143       printf(
"Only in this case web interface can work\n");
 
  148    TH1D *hpx = 
new TH1D(
"hpx",
"This is the px distribution",100,-4,4);
 
  149    hpx->SetFillColor(48);
 
  150    hpx->SetDirectory(0);
 
  151    TH2F *hpxpy = 
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
 
  152    hpxpy->SetDirectory(0);
 
  155    THttpServer* serv = 
new THttpServer(
"http:8080");
 
  162    serv->GetSniffer()->SetAutoLoad(
"currentdir/httptextlog.js");
 
  165    serv->Register(
"/", hpx);
 
  166    serv->Register(
"/", hpxpy);
 
  169    serv->Register(
"/", log);
 
  172    serv->Restrict(
"/log", 
"allow_method=Select,GetTitle");
 
  175    serv->RegisterCommand(
"/Stop",
"bRun=kFALSE;", 
"rootsys/icons/ed_delete.png");
 
  176    serv->RegisterCommand(
"/ExitRoot",
"gSystem->Exit(1);", 
"rootsys/icons/ed_delete.png");
 
  181    const Long_t kUPDATE = 1000;
 
  184       random.Rannor(px,py);
 
  189       if (cnt++ % kUPDATE == 0) {
 
  190          if (gSystem->ProcessEvents()) 
break;
 
  192          Long_t loop = cnt / kUPDATE;
 
  195          if (loop % 1000 == 0) {
 
  197             int shift = loop % 40;
 
  199             log->AddMsg(TString::Format(
"%*s Message %ld", shift, 
"", loop));