Changeset 3370 in Sophya


Ignore:
Timestamp:
Oct 31, 2007, 11:49:04 PM (18 years ago)
Author:
ansari
Message:

Adaptation pour redirection stdout/err a travers un fichier ds PIATmpxxx/, Reza 31/10/2007

Location:
trunk/SophyaPI/PIext
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r3366 r3370  
    162162m[5] = new PIMenu(Menubar(),"Special");
    163163m[5]->AppendItem("CloseAll", 10601);
    164 m[5]->AppendCheckItem("Red.Out/Err", 10602);
     164// m[5]->AppendCheckItem("Red.Out/Err", 10602);
    165165m[5]->AppendCheckItem("Catch SigFPE", 10603);
    166166m[5]->AppendCheckItem("Catch SigSEGV", 10604);
     
    257257mCons->AcceptCmd(true, 50);
    258258consolecont->Show();
    259 redirecout = false;
    260 // RedirectStdOutErr(true);  pas par defaut
     259redirecout = NORED_OE;
     260RedirectStdOutErr(NORED_OE);  // pas de redirect par defaut
    261261
    262262mFgScSz = sfgsz;
     
    17391739
    17401740/* --Methode-- */
    1741 void PIStdImgApp::RedirectStdOutErr(bool fg)
    1742 {
    1743 if (fg) {
    1744   RedirectOutStream(mCons);
    1745   RedirectErrStream(mCons);
    1746   m[5]->SetStateMsg(10602, true);
    1747   redirecout = true;
    1748   }
    1749 else {
    1750   RedirectOutStream(NULL);
    1751   RedirectErrStream(NULL);
    1752   m[5]->SetStateMsg(10602, false);
    1753   redirecout = false;
    1754   }
     1741void PIStdImgApp::RedirectStdOutErr(RED_OUTERR_FLG redflg)
     1742{
     1743if (redflg == redirecout) return;
     1744string fnout = ObjMgr()->GetTmpDir() + "/sout.log";
     1745string fnerr = ObjMgr()->GetTmpDir() + "/serr.log";
     1746bool drfg = false;
     1747PIConsole* pcons = NULL;
     1748switch (redflg) {
     1749  case NORED_OE :
     1750    pcons = NULL;
     1751    break;
     1752  case CONSRED_OE :
     1753    pcons = mCons;
     1754    drfg = false;
     1755    break;
     1756  case DOUBLERED_OE:
     1757    pcons = mCons;
     1758    drfg = true;
     1759    break;
     1760}
     1761
     1762char piva =  PIVA_Def;
     1763RedirectOutStream(pcons, fnout, drfg, piva);
     1764// ancienne maniere redirect, avec pipe : RedirectOutStream(pcons, piva);
     1765piva = PIVA_Red;
     1766RedirectErrStream(pcons, fnerr, drfg, piva);
     1767// ancienne maniere redirect, avec pipe : RedirectErrStream(pcons, piva);
     1768 
     1769//  m[5]->SetStateMsg(10602, false);
     1770redirecout = redflg;
    17551771return;
    17561772}
     
    23162332    CloseAllWindows();
    23172333    break;
    2318   case 10602:
     2334    /*
     2335 case 10602:
    23192336    RedirectStdOutErr(*((bool*)data));
    23202337    break;
     2338    */
    23212339  case 10603:
    23222340  case 10604:
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r3366 r3370  
    3939
    4040enum DispWinEnum {Disp_Default, Disp_Next, Disp_Win, Disp_Same, Disp_Stack, Disp_Inset};
     41// Flag de redirection stdout/stderr 
     42enum RED_OUTERR_FLG { NORED_OE, CONSRED_OE, DOUBLERED_OE }; 
     43
    4144
    4245typedef map<long, PIWindow*, less<long> > WindMList;
     
    150153
    151154// Redirection ou Non de StdOut/StdErr
    152      void  RedirectStdOutErr(bool fg = true);
    153      inline bool HasRedirectedStdOutErr() { return(redirecout); }
     155     void  RedirectStdOutErr(RED_OUTERR_FLG redflg=CONSRED_OE);
     156     inline RED_OUTERR_FLG HasRedirectedStdOutErr() { return(redirecout); }
    154157// Gestion des signaux
    155158     void  CatchSignals(bool fgfpe=true, bool fgsegv=true);
     
    213216    PIContainer* consolecont;    // Container pour la PIConsole
    214217    PIConsole* mCons;
    215     bool redirecout;    // true if stdout/err redirected to mCons;
     218    RED_OUTERR_FLG redirecout;    // flag de redirection vers  mCons, ou NORED ou vers mCons+terminal;
    216219
    217220    WindMList mWList;
  • trunk/SophyaPI/PIext/servnobjm.cc

    r3279 r3370  
    999999for(i=0; i<10; i++) xnt[i] = 0.;
    10001000
    1001 
    1002 // $CHECK$ A virer des que possible  - Pb blocage application quand trop d'impression
    1003 // redirige -    On redirige la sortie sur le terminal
    1004 bool red = mImgapp->HasRedirectedStdOutErr();
    1005 mImgapp->RedirectStdOutErr(false);
    1006 
    10071001int_8 k1,k2,dk;
    10081002k1 = 0;  k2 = objnt->NbLines();  dk = 1;
     
    10421036if (adel) delete objnt;   // Delete de l'objet NTupleInterface si necessaire
    10431037CloseDLL();
    1044 
    1045 // $CHECK$ A virer des que possible  On redirige la sortie sur la fenetre PIConsole
    1046 mImgapp->RedirectStdOutErr(red);
    10471038
    10481039if (fgnnt) MyObjMgr()->AddObj(nt, nomnt);
Note: See TracChangeset for help on using the changeset viewer.