Changeset 573 in Sophya for trunk/SophyaProg


Ignore:
Timestamp:
Nov 10, 1999, 5:30:50 PM (26 years ago)
Author:
ansari
Message:

ajout de tests

Location:
trunk/SophyaProg/Tests
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/Tests/fitsioImage.cc

    r476 r573  
    1414  // A faire au debut de main()
    1515  PeidaInit();
    16   ImageI4  img(20, 10);
    17   int_4 compt=0;
     16  ImageR4  img(20, 10);
     17  r_4 compt=0;
    1818  for(int i=0; i<20; i++)
    1919    {
    2020      for(int j=0; j<10; j++)
    2121        {
    22           compt+=1;
    23           img(i,j) =compt;
     22          compt+=1.;
     23          img(i,j) =compt+0.6;
    2424    }
    2525    }
     
    2929  FitsIoServer fserv;
    3030  fserv.save(img,"image.fits");
    31   ImageR4  img2(20, 10);
     31  ImageI4  img2(20, 10);
    3232  fserv.load(img2,"image.fits");
    3333  img2.Print();
  • trunk/SophyaProg/Tests/piapp.cc

    r499 r573  
    11#include <stdlib.h>
    22#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"
    315
    416#include "pistdimgapp.h"
    5 #include "piacmd.h"
    6 #include "piversion.h"
    7 #include "piaversion.h"
    8 
    9 #include "timing.h"
    10 #include "outilsinit.h"
    11 
    1217
    1318
     
    1823{
    1924int ofa;
    20 int fgfpe, fgsegv, fgred, fgexec;
     25int fgsig, fgred;
    2126
    22 PeidaInit();
     27PeidaInteractiveInitiator piinit;
    2328   
    2429InitTim();
     
    3035    {
    3136    puts("\n piapp: Programme d'analyse interactive ");
    32     puts("Usage: piapp [-nored] [-nosig] [-nosigfpe] [-nosigsegv] [-help2tex] [-exec file [args]]");
    33     puts("  -nored : NoRedirect StdOut/StdErr");
    34     puts("  -nosig : Don't catch SigFPE, SigSEGV");
    35     puts("  -nosigfpe -nosigsegv: Don't catch SigFPE / SigSEGV");
    36     puts("  -help2tex: Create a LaTeX help file (piahelp.tex)");
    37     puts("  -exec file [args] : Execute command file \n");
     37    puts("Usage: piapp [-nored] [-nosig]");
    3838    exit(0);
    3939    }
     
    4141
    4242ofa = 1;
    43 fgred = fgfpe = fgsegv = true;
    44 fgexec = false;
    45 string exfc;
    46 // Pour fabriquer le help
    47 bool fgtexh = false;
    48 int ka;
    49 for(ka=1; ka<narg; ka++) {
    50   if (strcmp(arg[ka],"-nored") == 0)   fgred=false;
    51   else if (strcmp(arg[ka],"-nosig") == 0)   fgfpe=fgsegv=false;
    52   else if (strcmp(arg[ka],"-nosigfpe") == 0)   fgfpe=false;
    53   else if (strcmp(arg[ka],"-nosigsegv") == 0)   fgsegv=false;
    54   else if (strcmp(arg[ka],"-help2tex") == 0) { fgtexh=true; fgred=false; }
    55   else if (strcmp(arg[ka],"-exec") == 0) {
    56     if (ka < narg-1) {
    57       fgexec = true;
    58       exfc = "exec";
    59       for(int kaa=ka+1; kaa<narg; kaa++)  { exfc += ' ';  exfc +=  arg[kaa]; }
    60       }
    61     break;
    62     }
    63   }
     43fgred = fgsig = true;
     44if (  (narg > 1) && (strcmp(arg[1],"-nored") == 0) )  { fgred=false;  ofa = 2; }
     45if (  (narg > 1) && (strcmp(arg[1],"-nosig") == 0) )  { fgsig=false;  ofa = 2; }
     46if (  (narg > 2) && (strcmp(arg[2],"-nored") == 0) )  { fgred=false;  ofa = 3; }
     47if (  (narg > 2) && (strcmp(arg[2],"-nosig") == 0) )  { fgsig=false;  ofa = 3; }
    6448
    65 if (fgexec) printf(">>>>> Starting piapp , Executing %s \n", exfc.c_str());
    66 else printf(">>>>> Starting piapp <<<<< \n");
    67 printf("Version: piapp=%g  PI=%g  PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
    68               (double)PI_VERSIONNUMBER, (float)PeidaVersion());
    6949
    70 PIStdImgApp * app = new PIStdImgApp(narg, arg);
    71 
    72 // Gestion de redirection stdout/err et Signaux
    73 if (fgred) app->RedirectStdOutErr(true);
    74 else app->RedirectStdOutErr(false);
    75 app->CatchSignals(fgfpe, fgsegv);
    76 
    77 // S'il y a un fichier de commande a executer
    78 if (fgexec) app->CmdInterpreter()->Interpret(exfc);
    79 
    80 // S'il y a besoin de faire le fichier Help
    81 if (fgtexh) {
    82   string thf = "piahelp.tex";
    83   app->CmdInterpreter()->HelptoLaTex(thf);
    84   printf("piapp : Help file piahelp.tex created --> exit(0) \n");
    85   delete app;
    86   exit(0);
    87 }
     50PIStdImgApp * app = new PIStdImgApp(narg-ofa, arg+ofa);
     51if (!fgred) app->RedirectStdOutErr(false);
     52else app->RedirectStdOutErr(true);
     53if (fgsig)  app->CatchSignals(true);
    8854
    8955int rc = 0;
     
    9359  app->SetReady();
    9460  if (fgred) app->RedirectStdOutErr(true);
    95   try {
     61  TRY {
    9662  app->Run();
    97   }  catch ( PException exc ) {
     63  }  CATCH(merr) {
    9864     char ans[32],rep;
    9965     app->Stop();
     
    10268     cout << endl;
    10369     cerr << endl;
    104      cerr << "PIStdImg/main() Exception catched ! " << exc.Msg() << endl;
    105      cerr << " continue <CR> , Stop program S<CR> ? " << endl;  gets(ans);
    106      rc = 9;
     70     printf("PIStdImg/main() Exception catched ! = %ld (%s) \n", (long)merr, PeidaExc(merr));
     71     printf(" exit <CR> , continue c<CR> , close-windows, continue k<cr> ? ");  gets(ans);
     72     rc = merr;
    10773     rep = toupper(ans[0]); 
    108      if (rep == 'S')  {
    109        printf(" !!!! Stopping piapp !!!! \n");
    110        cont = false;
    111        }
    112      else {
    113        printf(" *** piapp - Continuing event loop *** \n");
    114        cont = true;
    115        }
    116 //     else { cont = true; if (rep == 'K') app->CloseAllWindows(); }
     74     if ((rep != 'C')||(rep != 'K'))  cont = false;
     75     else { cont = true; if (rep == 'K') app->CloseAllWindows(); }
    11776  } ENDTRY;
    11877}
    11978
    12079app->RedirectStdOutErr(false); 
    121 // On de-charge le module erospiamodule
    12280delete app;
    123 
    12481printf("piapp : Exiting .... Rc= %d \n", rc);
    12582exit(rc);
  • trunk/SophyaProg/Tests/tnt.cc

    r491 r573  
    3030
    3131printf("Ecriture NTuple ds nt.ppf ... \n");
    32 {
    33 // nt1.Write("nt.ppf");  c'etait du PEIDA
    34 POutPersist s("nt.ppf");
    35 s << nt1 ;
    36 }
     32nt1.Write("nt.ppf");
    3733
    3834printf("Lecture NTuple (nt2) ds nt.ppf ... \n");
     
    4642printf("ReLecture NTuple (nt1) ds nt.ppf ... \n");
    4743
    48 {
    49 //  nt1.Read("nt.ppf");   c'etait du PEIDA !
    50 PInPersist s("nt.ppf");
    51 s >> nt1;
    52 }
    53 
     44nt1.Read("nt.ppf");
    5445nt1.Show(cout);
    5546nt1.Print(0, 5);
     
    5748nt1.Print(94, 5);
    5849
    59 printf("Creation/Lecture Lecture NTuple (nt3) ds nt.ppf ... \n");
     50printf("Creation/Lecture Lecture NTuple (nt1) ds nt.ppf ... \n");
    6051NTuple nt3;
    61 {
    62 //  nt3.Read("nt.ppf");   c'etait du PEIDA !
    63 PInPersist s("nt.ppf");
    64 s >> nt3;
    65 }
    66 
     52nt3.Read("nt.ppf");
    6753nt3.Show(cout);
    6854nt3.Print(0, 5);
Note: See TracChangeset for help on using the changeset viewer.