#include #include #ifdef OSF1 #include #else #define C_NO_SHLIBS #endif #include #include "psighand.h" #include "dynccd.h" #include "timing.h" #include "piinit.h" #ifndef SANS_StarReco #include "strecinit.h" #endif #include "pistdimgapp.h" /* ================================ MAIN() ================================= */ int main(int narg, char *arg[]) { int ofa; int fgsig, fgred; PeidaInteractiveInitiator piinit; #ifndef SANS_StarReco PeidaStarRecoInitiator strecinit; #endif InitTim(); ofa = 1; if (narg > 1) { if (strcmp(arg[1],"-h") == 0) { puts("\n piapp: Programme d'analyse interactive "); puts("Usage: piapp [-nored] [-nosig]"); exit(0); } } ofa = 1; fgred = fgsig = true; if ( (narg > 1) && (strcmp(arg[1],"-nored") == 0) ) { fgred=false; ofa = 2; } if ( (narg > 1) && (strcmp(arg[1],"-nosig") == 0) ) { fgsig=false; ofa = 2; } if ( (narg > 2) && (strcmp(arg[2],"-nored") == 0) ) { fgred=false; ofa = 3; } if ( (narg > 2) && (strcmp(arg[2],"-nosig") == 0) ) { fgsig=false; ofa = 3; } PIStdImgApp * app = new PIStdImgApp(narg-ofa, arg+ofa); if (!fgred) app->RedirectStdOutErr(false); else app->RedirectStdOutErr(true); if (fgsig) app->CatchSignals(true); int rc = 0; bool cont = true; while(cont) { rc = 0; cont = false; app->SetReady(); if (fgred) app->RedirectStdOutErr(true); TRY { app->Run(); } CATCH(merr) { char ans[32],rep; app->Stop(); app->RedirectStdOutErr(false); fflush(stdout); cout << endl; cerr << endl; printf("PIStdImg/main() Exception catched ! = %ld (%s) \n", (long)merr, PeidaExc(merr)); printf(" exit , continue c , close-windows, continue k ? "); gets(ans); rc = merr; rep = toupper(ans[0]); if ((rep != 'C')||(rep != 'K')) cont = false; else { cont = true; if (rep == 'K') app->CloseAllWindows(); } } ENDTRY; } app->RedirectStdOutErr(false); delete app; printf("piapp : Exiting .... Rc= %d \n", rc); exit(rc); }