IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2008, 4:03:31 PM (18 years ago)
Author:
eugene
Message:

update from changes on eam_branch_20080511 : adding photometry of fake sources, force photometry; major cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSim.c

    r17615 r18011  
    11# include "ppSim.h"
     2
     3int failure (pmConfig *config, psExit status, char *message) {
     4    ppSimRandomGaussianFree ();
     5    psErrorStackPrint(stderr, message);
     6    psFree(config);
     7    pmModelClassCleanup();
     8    psLibFinalize();
     9    exit (status);
     10}
    211
    312int main(int argc, char *argv[])
     
    817    pmConfig *config = pmConfigRead(&argc, argv, PPSIM_RECIPE); // Configuration
    918    if (!config) {
    10         psErrorStackPrint(stderr, "Unable to read configurations.");
    11         exit(PS_EXIT_CONFIG_ERROR);
     19        failure (config, PS_EXIT_CONFIG_ERROR, "Unable to read configurations.");
    1220    }
    1321
    14     ppSimArguments(argc, argv, config);
     22    if (!ppSimArguments(argc, argv, config)) {
     23        failure (config, PS_EXIT_CONFIG_ERROR, "Error parsing command-line arguments");
     24    }
    1525
    1626    if (!ppSimCreate(config)) {
    17         psErrorStackPrint(stderr, "Unable to create output file.");
    18         psFree(config);
    19         exit(PS_EXIT_CONFIG_ERROR);
     27        failure (config, PS_EXIT_CONFIG_ERROR, "Unable to create output file.");
    2028    }
    2129
    2230    if (!ppSimLoop(config)) {
    23         psErrorStackPrint(stderr, "Unable to generate data.");
    24         psFree(config);
    25         exit(PS_EXIT_SYS_ERROR);
     31        failure (config, PS_EXIT_SYS_ERROR, "Unable to generate data.");
    2632    }
    2733
     34    ppSimRandomGaussianFree ();
    2835    psFree(config);
    2936    pmModelClassCleanup();
     
    3239    psLibFinalize();
    3340
    34     return PS_EXIT_SUCCESS;
     41    exit (PS_EXIT_SUCCESS);
    3542}
Note: See TracChangeset for help on using the changeset viewer.