source: Sophya/trunk/SophyaPI/PIext/piapp.cc@ 165

Last change on this file since 165 was 165, checked in by ercodmgr, 27 years ago

Creation du module PIext en regroupant des fichiers de Drawer/Wdg pour
Objets ds PEIDA/Outils++, Images++, ... et des classes de ProgPI,
lie a piapp (PIStdImgApp, NamedObjMgr, ...) Reza 18/12/98

File size: 2.0 KB
Line 
1#include <stdlib.h>
2#include <stdio.h>
3#ifdef OSF1
4#include <dlfcn.h>
5#else
6#define C_NO_SHLIBS
7#endif
8
9#include <string>
10#include "psighand.h"
11#include "dynccd.h"
12
13#include "timing.h"
14#include "piinit.h"
15#ifndef SANS_StarReco
16#include "strecinit.h"
17#endif
18
19#include "pistdimgapp.h"
20
21
22
23/* ================================ MAIN() ================================= */
24
25int main(int narg, char *arg[])
26{
27int ofa;
28int fgsig, fgred;
29
30PeidaInteractiveInitiator piinit;
31#ifndef SANS_StarReco
32PeidaStarRecoInitiator strecinit;
33#endif
34
35InitTim();
36
37ofa = 1;
38if (narg > 1)
39 {
40 if (strcmp(arg[1],"-h") == 0)
41 {
42 puts("\n piapp: Programme d'analyse interactive ");
43 puts("Usage: piapp [-nored] [-nosig]");
44 exit(0);
45 }
46 }
47
48ofa = 1;
49fgred = fgsig = true;
50if ( (narg > 1) && (strcmp(arg[1],"-nored") == 0) ) { fgred=false; ofa = 2; }
51if ( (narg > 1) && (strcmp(arg[1],"-nosig") == 0) ) { fgsig=false; ofa = 2; }
52if ( (narg > 2) && (strcmp(arg[2],"-nored") == 0) ) { fgred=false; ofa = 3; }
53if ( (narg > 2) && (strcmp(arg[2],"-nosig") == 0) ) { fgsig=false; ofa = 3; }
54
55
56PIStdImgApp * app = new PIStdImgApp(narg-ofa, arg+ofa);
57if (!fgred) app->RedirectStdOutErr(false);
58else app->RedirectStdOutErr(true);
59if (fgsig) app->CatchSignals(true);
60
61int rc = 0;
62bool cont = true;
63while(cont) {
64 rc = 0; cont = false;
65 app->SetReady();
66 if (fgred) app->RedirectStdOutErr(true);
67 TRY {
68 app->Run();
69 } CATCH(merr) {
70 char ans[32],rep;
71 app->Stop();
72 app->RedirectStdOutErr(false);
73 fflush(stdout);
74 cout << endl;
75 cerr << endl;
76 printf("PIStdImg/main() Exception catched ! = %ld (%s) \n", (long)merr, PeidaExc(merr));
77 printf(" exit <CR> , continue c<CR> , close-windows, continue k<cr> ? "); gets(ans);
78 rc = merr;
79 rep = toupper(ans[0]);
80 if ((rep != 'C')||(rep != 'K')) cont = false;
81 else { cont = true; if (rep == 'K') app->CloseAllWindows(); }
82 } ENDTRY;
83}
84
85app->RedirectStdOutErr(false);
86delete app;
87printf("piapp : Exiting .... Rc= %d \n", rc);
88exit(rc);
89}
90
Note: See TracBrowser for help on using the repository browser.