Changeset 1440 in Sophya
- Timestamp:
- Mar 14, 2001, 5:24:23 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/ProgPI/piapp.cc
r722 r1440 11 11 #include "skyinit.h" 12 12 13 #include "xntuple.h" // Pour faire le SetTmpDir() 14 13 15 14 16 // ---- Pour charger automatiquement le module sopiamodule … … 18 20 } 19 21 22 /*! 23 \defgroup ProgPI ProgPI module 24 This module contains programs for interactive data analysis and 25 visualisation, based on SOPHYA class libray and PI (GUI framework) 26 and PIext (Interactive data analysis framework). 27 */ 28 29 /*! 30 \ingroup ProgPI 31 \file piapp.cc 32 \brief \b (s)piapp: Starts the piapp interactive data analysis program. 33 34 The current version of the program has a single execution thread. This 35 creates few limitations (GUI can not be used when computing is being 36 done, ...). Also the command file executed during start-up (-exec) 37 cannot contain display (graphic) commands. 38 39 \verbatim 40 csh> spiapp -h 41 SOPHYA Version 1.1 Revision 0 (V_Fev2001) -- Mar 9 2001 15:45:31 cxx 42 43 piapp: Interactive data analysis and visualisation program 44 Usage: piapp [-nored] [-nosig] [-nosigfpe] [-nosigsegv] 45 [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]] 46 -nored : NoRedirect StdOut/StdErr 47 -nosig : Don't catch SigFPE, SigSEGV 48 -nosigfpe -nosigsegv: Don t catch SigFPE / SigSEGV 49 -tmpdir TmpDirectory: defines TMDIR for temporary files 50 -help2tex: Create a LaTeX help file (piahelp.tex) 51 -exec file [args] : Execute command file 52 53 \endverbatim 54 55 */ 56 57 void Usage(bool fgerr) 58 { 59 if (fgerr) { 60 cout << " piapp : Argument Error ! piapp -h for Usage" << endl; 61 exit(1); 62 } 63 else { 64 cout << "\n piapp: Interactive data analysis and visualisation program \n" 65 << " Usage: piapp [-nored] [-nosig] [-nosigfpe] [-nosigsegv] \n" 66 << " [-tmpdir TmpDirectory] [-help2tex] [-exec file [args]] \n" 67 << " -nored : NoRedirect StdOut/StdErr \n" 68 << " -nosig : Don't catch SigFPE, SigSEGV \n" 69 << " -nosigfpe -nosigsegv: Don t catch SigFPE / SigSEGV \n" 70 << " -tmpdir TmpDirectory: defines TMDIR for temporary files \n" 71 << " -help2tex: Create a LaTeX help file (piahelp.tex)\n" 72 << " -exec file [args] : Execute command file \n" 73 << endl; 74 exit(0); 75 } 76 } 20 77 21 78 /* ================================ MAIN() ================================= */ … … 30 87 InitTim(); 31 88 32 ofa = 1; 33 if (narg > 1) 34 { 35 if (strcmp(arg[1],"-h") == 0) 36 { 37 puts("\n piapp: Programme d'analyse interactive "); 38 puts("Usage: piapp [-nored] [-nosig] [-nosigfpe] [-nosigsegv] [-help2tex] [-exec file [args]]"); 39 puts(" -nored : NoRedirect StdOut/StdErr"); 40 puts(" -nosig : Don't catch SigFPE, SigSEGV"); 41 puts(" -nosigfpe -nosigsegv: Don't catch SigFPE / SigSEGV"); 42 puts(" -help2tex: Create a LaTeX help file (piahelp.tex)"); 43 puts(" -exec file [args] : Execute command file \n"); 44 exit(0); 45 } 46 } 89 90 if ( (narg > 1) && (strcmp(arg[1],"-h") == 0) ) Usage(false); 47 91 48 92 ofa = 1; 49 93 fgred = fgfpe = fgsegv = true; 50 94 fgexec = false; 95 bool fgtmp = false; 96 string tmpdir; 51 97 string exfc; 52 98 // Pour fabriquer le help … … 59 105 else if (strcmp(arg[ka],"-nosigsegv") == 0) fgsegv=false; 60 106 else if (strcmp(arg[ka],"-help2tex") == 0) { fgtexh=true; fgred=false; } 107 else if (strcmp(arg[ka],"-tmpdir") == 0) { 108 if (ka == narg-1) Usage(true); 109 fgtmp = true; ka++; 110 tmpdir = arg[ka]; 111 } 61 112 else if (strcmp(arg[ka],"-exec") == 0) { 62 113 if (ka < narg-1) { … … 69 120 } 70 121 122 71 123 if (fgexec) printf(">>>>> Starting piapp , Executing %s \n", exfc.c_str()); 72 124 else printf(">>>>> Starting piapp <<<<< \n"); … … 74 126 (double)PI_VERSIONNUMBER, (double)skyinit.Version()); 75 127 128 char *vcmds; 129 if (fgtmp) { 130 if (tmpdir[tmpdir.length()-1] != '/') tmpdir += '/'; // Necessaire pour SetSwapPath 131 string vcmd = "TMPDIR=" + tmpdir; 132 vcmds = new char[vcmd.length()+1]; 133 strcpy(vcmds, vcmd.c_str()); 134 putenv(vcmds); 135 } 136 137 // cout << " DBG-TMPDIR= " << getenv("TMPDIR") << endl; 138 76 139 PIStdImgApp * app = new PIStdImgApp(narg, arg); 140 // cout << " DBG-2 " << app->ObjMgr()->GetTmpDir() << endl; 141 if (fgtmp) { // Changement de tmpdir 142 cout << " NamedObjMgr::SetTmpDir()+XNTuple::SetSwapPath() " << tmpdir << endl; 143 app->ObjMgr()->SetTmpDir(tmpdir); 144 XNTuple::SetSwapPath(const_cast<char *>(tmpdir.c_str())); 145 } 146 77 147 78 148 // Gestion de redirection stdout/err et Signaux … … 160 230 sopiamodule_end(); 161 231 delete app; 232 if (fgtmp) delete[] vcmds; 162 233 163 234 cout << "\n------------------------------------------------ \n"
Note:
See TracChangeset
for help on using the changeset viewer.