r102: fixed mpi bug
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 19 Jun 2000 17:58:13 +0000 (17:58 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 19 Jun 2000 17:58:13 +0000 (17:58 +0000)
src/ctrec.cpp
src/if-1.cpp
src/if-2.cpp
src/if2img.cpp
src/ifinfo.cpp
src/phm2if.cpp
src/phm2pj.cpp
src/pj2if.cpp

index 42dadc0ca9310632c665eefc34465e26c9ad75b2..2d94be905dfe2f61a1c75e88740bdc74144233f1 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ctrec.cpp,v 1.11 2000/06/18 10:27:11 kevin Exp $
+**  $Id: ctrec.cpp,v 1.12 2000/06/19 17:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -176,11 +176,11 @@ ctrec_main (int argc, char * argv[])
          break;
         case O_VERSION:
 #ifdef VERSION
          break;
         case O_VERSION:
 #ifdef VERSION
-       cout <<  "Version " <<  VERSION << endl;
+         cout <<  "Version " <<  VERSION << endl;
 #else
 #else
-        cout << "Unknown version number" << endl;
+          cout << "Unknown version number" << endl;
 #endif
 #endif
-         exit(0);
+         return (0);
        case O_HELP:
        case '?':
          ctrec_usage(argv[0]);
        case O_HELP:
        case '?':
          ctrec_usage(argv[0]);
@@ -370,7 +370,17 @@ ReduceImageMPI (MPIWorld& mpiWorld, ImageFile* imLocal, ImageFile* imGlobal)
 int 
 main (int argc, char* argv[])
 {
 int 
 main (int argc, char* argv[])
 {
-  return (ctrec_main(argc, argv));
+  int retval = 1;
+
+  try {
+    retval = ctrec_main(argc, argv);
+  } catch (exception e) {
+    cerr << "Exception: " << e.what() << endl;
+  } catch (...) {
+    cerr << "Unknown exception" << endl;
+  }
+
+  return (retval);
 }
 #endif
 
 }
 #endif
 
index f85a269176bcfd981eb369adbffca8beca75b4e2..07359a0323c88e21e6c1f7dfa0ba1b9daf84134a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if-1.cpp,v 1.7 2000/06/18 10:27:11 kevin Exp $
+**  $Id: if-1.cpp,v 1.8 2000/06/19 17:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -189,7 +189,17 @@ if1_main (int argc, char *const argv[])
 int 
 main (int argc, char *const argv[])
 {
 int 
 main (int argc, char *const argv[])
 {
-  return (if1_main(argc, argv));
+  int retval = 1;
+
+  try {
+    retval = if1_main(argc, argv);
+  } catch (exception e) {
+    cerr << "Exception: " << e.what() << endl;
+  } catch (...) {
+    cerr << "Unknown exception" << endl;
+  }
+
+  return (retval);
 }
 #endif
 
 }
 #endif
 
index 89e6cc811d0528f11485c0b8a652abf93305c156..0d35a125b57cf203cc640ea71250436fbac9ae83 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if-2.cpp,v 1.5 2000/06/18 10:27:11 kevin Exp $
+**  $Id: if-2.cpp,v 1.6 2000/06/19 17:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -216,7 +216,17 @@ if2_main (int argc, char *const argv[])
 int 
 main (int argc, char *const argv[])
 {
 int 
 main (int argc, char *const argv[])
 {
-  return (if2_main(argc, argv));
+  int retval = 1;
+
+  try {
+    retval = if2_main(argc, argv);
+  } catch (exception e) {
+    cerr << "Exception: " << e.what() << endl;
+  } catch (...) {
+    cerr << "Unknown exception" << endl;
+  }
+
+  return (retval);
 }
 #endif
 
 }
 #endif
 
index 018e504abf6027fc741ce9fe555d8ea47475515b..c3a4bfe801ab80d56c42cd8afc4055db9faaaaec 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if2img.cpp,v 1.6 2000/06/18 10:27:11 kevin Exp $
+**  $Id: if2img.cpp,v 1.7 2000/06/19 17:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -255,7 +255,7 @@ if2img_main (int argc, char *const argv[])
 #else
           cout << "Unknown version number" << endl;
 #endif
 #else
           cout << "Unknown version number" << endl;
 #endif
-         exit(0);
+         return (0);
        case O_HELP:
        case '?':
          if2img_usage(argv[0]);
        case O_HELP:
        case '?':
          if2img_usage(argv[0]);
@@ -282,7 +282,7 @@ if2img_main (int argc, char *const argv[])
   pim = new ImageFile (in_file);
   ImageFile& im = *pim;
   if (! im.fileRead()) {
   pim = new ImageFile (in_file);
   ImageFile& im = *pim;
   if (! im.fileRead()) {
-    sys_error (ERR_SEVERE, "File %s does not exist", in_file);
+    sys_error (ERR_FATAL, "File %s does not exist", in_file);
     return (1);
   }
 
     return (1);
   }
 
@@ -631,8 +631,8 @@ sdf2d_to_gif (ImageFile& im, char *outfile, int nxcell, int nycell, double densm
   delete rowp;
 
   if ((out = fopen(outfile,"w")) == NULL) {
   delete rowp;
 
   if ((out = fopen(outfile,"w")) == NULL) {
-    sys_error(ERR_SEVERE,"Error opening output file %s for writing", outfile);
-    exit(1);
+    sys_error(ERR_FATAL, "Error opening output file %s for writing", outfile);
+    return (1);
   }
   gdImageGif(gif,out);
   fclose(out);
   }
   gdImageGif(gif,out);
   fclose(out);
@@ -646,6 +646,16 @@ sdf2d_to_gif (ImageFile& im, char *outfile, int nxcell, int nycell, double densm
 int 
 main (int argc, char *const argv[])
 {
 int 
 main (int argc, char *const argv[])
 {
-  return (if2img_main(argc, argv));
+  int retval = 1;
+
+  try {
+    retval = if2img_main(argc, argv);
+  } catch (exception e) {
+    cerr << "Exception: " << e.what() << endl;
+  } catch (...) {
+    cerr << "Unknown exception" << endl;
+  }
+
+  return (retval);
 }
 #endif
 }
 #endif
index f0a475d8fcd84442c469f22b43d4e8ab2d7977c4..c911aa5c80948c37d7535b6dddf0a95244e9076c 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ifinfo.cpp,v 1.8 2000/06/18 10:27:11 kevin Exp $
+**  $Id: ifinfo.cpp,v 1.9 2000/06/19 17:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -236,6 +236,16 @@ ifinfo_main (int argc, char *const argv[])
 int 
 main (int argc, char *const argv[])
 {
 int 
 main (int argc, char *const argv[])
 {
-  return (ifinfo_main(argc, argv));
+  int retval = 1;
+
+  try {
+    retval = ifinfo_main(argc, argv);
+  } catch (exception e) {
+    cerr << "Exception: " << e.what() << endl;
+  } catch (...) {
+    cerr << "Unknown exception" << endl;
+  }
+
+  return (retval);
 }
 #endif
 }
 #endif
index 573cb7c697525de4790f1143c8fd8b5d72b4adff..0eb5c9e1ebc544c765b6788db92e2cccf4b5ce5e 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phm2if.cpp,v 1.10 2000/06/18 10:27:11 kevin Exp $
+**  $Id: phm2if.cpp,v 1.11 2000/06/19 17:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -270,7 +270,7 @@ phm2if_main (int argc, char* argv[])
 #endif
 
 #ifdef HAVE_MPI
 #endif
 
 #ifdef HAVE_MPI
-  TimerMPI timerBcast (mpiWorld.getComm());
+  TimerCollectiveMPI timerBcast (mpiWorld.getComm());
   mpiWorld.getComm().Bcast (&opt_verbose, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_debug, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_trace, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_verbose, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_debug, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_trace, 1, MPI::INT, 0);
@@ -305,7 +305,7 @@ phm2if_main (int argc, char* argv[])
   else {
     if (mpiWorld.getRank() == 0)
       cerr << "phmnum < 0" << endl;
   else {
     if (mpiWorld.getRank() == 0)
       cerr << "phmnum < 0" << endl;
-    exit(1);
+    return (1);
   }
 #endif
 
   }
 #endif
 
@@ -323,12 +323,12 @@ phm2if_main (int argc, char* argv[])
       image_filter_response (*imGlobal, opt_filter_domain, opt_filter_bw, opt_filter, opt_filter_param, opt_trace);
     }
   } else {
       image_filter_response (*imGlobal, opt_filter_domain, opt_filter_bw, opt_filter, opt_filter_param, opt_trace);
     }
   } else {
-    TimerMPI timerRasterize (mpiWorld.getComm());
+    TimerCollectiveMPI timerRasterize (mpiWorld.getComm());
     phm_to_imagefile (phm, *imLocal, mpiWorld.getMyStartWorkUnit(),  mpiWorld.getMyLocalWorkUnits(), opt_nsample, opt_trace);
     if (opt_verbose)
       timerRasterize.timerEndAndReport ("Time to rasterize phantom");
 
     phm_to_imagefile (phm, *imLocal, mpiWorld.getMyStartWorkUnit(),  mpiWorld.getMyLocalWorkUnits(), opt_nsample, opt_trace);
     if (opt_verbose)
       timerRasterize.timerEndAndReport ("Time to rasterize phantom");
 
-    TimerMPI timerGather (mpiWorld.getComm());
+    TimerCollectiveMPI timerGather (mpiWorld.getComm());
     mpi_gather_image (mpiWorld, imGlobal, imLocal, opt_debug);
     if (opt_verbose)
       timerGather.timerEndAndReport ("Time to gather image");
     mpi_gather_image (mpiWorld, imGlobal, imLocal, opt_debug);
     if (opt_verbose)
       timerGather.timerEndAndReport ("Time to gather image");
@@ -405,6 +405,16 @@ void mpi_gather_image (MPIWorld& mpiWorld, ImageFile* imGlobal, ImageFile* imLoc
 int 
 main (int argc, char* argv[])
 {
 int 
 main (int argc, char* argv[])
 {
-  return (phm2if_main(argc, argv));
+  int retval = 1;
+
+  try {
+    retval = phm2if_main(argc, argv);
+  } catch (exception e) {
+    cerr << "Exception: " << e.what() << endl;
+  } catch (...) {
+    cerr << "Unknown exception" << endl;
+  }
+
+  return (retval);
 }
 #endif
 }
 #endif
index fe831548437ad183353f8882e7d3f3479df79443..fa8d0a98dc1e82ad9d3614e3bd40e221eca47df0 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phm2pj.cpp,v 1.1 2000/06/17 20:12:15 kevin Exp $
+**  $Id: phm2pj.cpp,v 1.2 2000/06/19 17:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -91,10 +91,11 @@ phm2pj_main (int argc, char* argv[])
   char *opt_outfile = NULL;
   string opt_desc;
   string opt_phmfilename;
   char *opt_outfile = NULL;
   string opt_desc;
   string opt_phmfilename;
-  int opt_ndet, opt_nview;
+  int opt_ndet;
+  int opt_nview;
   int opt_nray = 1;
   int opt_trace = 0;
   int opt_nray = 1;
   int opt_trace = 0;
-  int opt_phmnum = -1;
+  int optPhmNum = -1;
   int opt_verbose = 0;
   int opt_debug = 0;
   double opt_rotangle = 1;
   int opt_verbose = 0;
   int opt_debug = 0;
   double opt_rotangle = 1;
@@ -118,11 +119,11 @@ phm2pj_main (int argc, char* argv[])
       
       switch (c) {
       case O_PHANTOM:
       
       switch (c) {
       case O_PHANTOM:
-       if ((opt_phmnum = opt_set_phantom (optarg)) < 0) {
+       if ((optPhmNum = opt_set_phantom (optarg)) < 0) {
          phm2pj_usage(argv[0]);
          return (1);
        }
          phm2pj_usage(argv[0]);
          return (1);
        }
-       phm.create (opt_phmnum);
+       phm.create (optPhmNum);
        break;
       case O_PHMFILE:
 #ifdef HAVE_MPI
        break;
       case O_PHMFILE:
 #ifdef HAVE_MPI
@@ -169,11 +170,11 @@ phm2pj_main (int argc, char* argv[])
        break;
         case O_VERSION:
 #ifdef VERSION
        break;
         case O_VERSION:
 #ifdef VERSION
-       cout << "Version: " << VERSION << endl;
+         cout << "Version: " << VERSION << endl;
 #else
 #else
-        cout << "Unknown version number" << endl;
+          cout << "Unknown version number" << endl;
 #endif
 #endif
-         exit(0);
+         return (0);
       case O_HELP:
       case '?':
        phm2pj_usage(argv[0]);
       case O_HELP:
       case '?':
        phm2pj_usage(argv[0]);
@@ -214,8 +215,8 @@ phm2pj_main (int argc, char* argv[])
     desc << "Raysum_Collect: NDet=" << opt_ndet << ", Nview=" << opt_nview << ", NRay=" << opt_nray << ", RotAngle=" << opt_rotangle << ", ";
     if (opt_phmfilename.length()) {
       desc << "PhantomFile=" << opt_phmfilename;
     desc << "Raysum_Collect: NDet=" << opt_ndet << ", Nview=" << opt_nview << ", NRay=" << opt_nray << ", RotAngle=" << opt_rotangle << ", ";
     if (opt_phmfilename.length()) {
       desc << "PhantomFile=" << opt_phmfilename;
-    } else if (opt_phmnum != -1) {
-      desc << "Phantom=" << name_of_phantom(opt_phmnum);
+    } else if (optPhmNum != -1) {
+      desc << "Phantom=" << name_of_phantom(optPhmNum);
     }
     if (opt_desc.length()) {
       desc << ": " << opt_desc;
     }
     if (opt_desc.length()) {
       desc << ": " << opt_desc;
@@ -226,17 +227,19 @@ phm2pj_main (int argc, char* argv[])
 #endif
 
 #ifdef HAVE_MPI
 #endif
 
 #ifdef HAVE_MPI
+  TimerCollectiveMPI timerBcast(mpiWorld.getComm());
   mpiWorld.getComm().Bcast (&opt_rotangle, 1, MPI::DOUBLE, 0);
   mpiWorld.getComm().Bcast (&opt_nview, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_ndet, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_nray, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_rotangle, 1, MPI::DOUBLE, 0);
   mpiWorld.getComm().Bcast (&opt_nview, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_ndet, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_nray, 1, MPI::INT, 0);
-  mpiWorld.getComm().Bcast (&opt_phmnum, 1, MPI::INT, 0);
+  mpiWorld.getComm().Bcast (&optPhmNum, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_verbose, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_debug, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_trace, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_verbose, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_debug, 1, MPI::INT, 0);
   mpiWorld.getComm().Bcast (&opt_trace, 1, MPI::INT, 0);
+  timerBcast.timerEndAndReport ("Time to broadcast variables");
 
 
-  if (mpiWorld.getRank() > 0 && opt_phmnum >= 0)
-    phm.create (opt_phmnum);
+  if (mpiWorld.getRank() > 0 && optPhmNum >= 0)
+    phm.create (optPhmNum);
 #endif
 
   opt_rotangle *= PI;
 #endif
 
   opt_rotangle *= PI;
@@ -246,24 +249,28 @@ phm2pj_main (int argc, char* argv[])
   mpiWorld.setTotalWorkUnits (opt_nview);
 
   Projections pjGlobal;
   mpiWorld.setTotalWorkUnits (opt_nview);
 
   Projections pjGlobal;
-  if (mpiWorld.getRank() == 0) {
-    pjGlobal = Projections (scanner);
-  }
+  if (mpiWorld.getRank() == 0)
+    pjGlobal.initFromScanner (scanner);
   
   
-  Scanner localScanner (phm, opt_geometry, opt_ndet, mpiWorld.getMyLocalWorkUnits(), opt_nray, opt_rotangle);
-  Projections pjLocal (localScanner);
+  if (opt_verbose)
+    pjGlobal.printScanInfo();
+
+  Projections pjLocal (scanner);
+  pjLocal.setNView (mpiWorld.getMyLocalWorkUnits());
+
   if (opt_debug)
     cout << "pjLocal->nview = " << pjLocal.nView() << " (process " << mpiWorld.getRank() << ")" << endl;;
 
   if (opt_debug)
     cout << "pjLocal->nview = " << pjLocal.nView() << " (process " << mpiWorld.getRank() << ")" << endl;;
 
-  TimerMPI timerProject (mpiWorld.getComm());
-  localScanner.collectProjections (pjLocal, phm, mpiWorld.getMyStartWorkUnit(), opt_trace);
+  TimerCollectiveMPI timerProject (mpiWorld.getComm());
+  scanner.collectProjections (pjLocal, phm, mpiWorld.getMyStartWorkUnit(), opt_trace);
   if (opt_verbose)
     timerProject.timerEndAndReport ("Time to collect projections");
 
   if (opt_verbose)
     timerProject.timerEndAndReport ("Time to collect projections");
 
-  TimerMPI timerGather (mpiWorld.getComm());
+  TimerCollectiveMPI timerGather (mpiWorld.getComm());
   GatherProjectionsMPI (mpiWorld, pjGlobal, pjLocal, opt_debug);
   GatherProjectionsMPI (mpiWorld, pjGlobal, pjLocal, opt_debug);
-  if (opt_verbose)
-    timerGather.timerEndAndReport ("Time to gather projections");
+  if (opt_verbose) 
+     timerGather.timerEndAndReport ("Time to gather projections");
+
 #else
   Projections pjGlobal (scanner);
   scanner.collectProjections (pjGlobal, phm, 0, opt_trace);
 #else
   Projections pjGlobal (scanner);
   scanner.collectProjections (pjGlobal, phm, 0, opt_trace);
@@ -281,7 +288,7 @@ phm2pj_main (int argc, char* argv[])
        cout << endl;
        pjGlobal.printScanInfo();
        cout << endl;
        cout << endl;
        pjGlobal.printScanInfo();
        cout << endl;
-       cout << "Remark: " << pjGlobal.remark() << endl;
+       cout << "  Remark: " << pjGlobal.remark() << endl;
        cout << "Run time: " << pjGlobal.calcTime() << " seconds" << endl;
       }
     }
        cout << "Run time: " << pjGlobal.calcTime() << " seconds" << endl;
       }
     }
@@ -317,7 +324,7 @@ void GatherProjectionsMPI (MPIWorld& mpiWorld, Projections& pjGlobal, Projection
        MPI::Status status;
        double viewAngle;
        int nDet;
        MPI::Status status;
        double viewAngle;
        int nDet;
-       DetectorArray detArray = pjGlobal.getDetectorArray(iw);
+       DetectorArray& detArray = pjGlobal.getDetectorArray(iw);
        DetectorValue* detval = detArray.detValues();
 
        mpiWorld.getComm().Recv(&viewAngle, 1, MPI::DOUBLE, iProc, 0, status);
        DetectorValue* detval = detArray.detValues();
 
        mpiWorld.getComm().Recv(&viewAngle, 1, MPI::DOUBLE, iProc, 0, status);
@@ -327,7 +334,6 @@ void GatherProjectionsMPI (MPIWorld& mpiWorld, Projections& pjGlobal, Projection
       }
     }
   }
       }
     }
   }
-
 }
 #endif
 
 }
 #endif
 
@@ -336,7 +342,17 @@ void GatherProjectionsMPI (MPIWorld& mpiWorld, Projections& pjGlobal, Projection
 int 
 main (int argc, char* argv[])
 {
 int 
 main (int argc, char* argv[])
 {
-  return (phm2pj_main(argc, argv));
+  int retval = 1;
+
+  try {
+    retval = phm2pj_main(argc, argv);
+  } catch (exception e) {
+    cerr << "Exception: " << e.what() << endl;
+  } catch (...) {
+    cerr << "Unknown exception" << endl;
+  }
+
+  return (retval);
 }
 #endif
 
 }
 #endif
 
index 530f23be1537bf1fe6eeffbcb5fea650eec0ef67..26c537620002eb36e81a9bc14148e1c60ccaeae5 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: pj2if.cpp,v 1.2 2000/06/18 10:27:11 kevin Exp $
+**  $Id: pj2if.cpp,v 1.3 2000/06/19 17:58:13 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -140,6 +140,16 @@ pj2if_main (const int argc, char *const argv[])
 int 
 main (const int argc, char *const argv[])
 {
 int 
 main (const int argc, char *const argv[])
 {
-  return (pj2if_main(argc, argv));
+  int retval = 1;
+
+  try {
+    retval = pj2if_main(argc, argv);
+  } catch (exception e) {
+    cerr << "Exception: " << e.what() << endl;
+  } catch (...) {
+    cerr << "Unknown exception" << endl;
+  }
+
+  return (retval);
 }
 #endif
 }
 #endif