Changeset 18011 for trunk/ppSim/src/ppSim.c
- Timestamp:
- Jun 8, 2008, 4:03:31 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSim.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSim.c
r17615 r18011 1 1 # include "ppSim.h" 2 3 int failure (pmConfig *config, psExit status, char *message) { 4 ppSimRandomGaussianFree (); 5 psErrorStackPrint(stderr, message); 6 psFree(config); 7 pmModelClassCleanup(); 8 psLibFinalize(); 9 exit (status); 10 } 2 11 3 12 int main(int argc, char *argv[]) … … 8 17 pmConfig *config = pmConfigRead(&argc, argv, PPSIM_RECIPE); // Configuration 9 18 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."); 12 20 } 13 21 14 ppSimArguments(argc, argv, config); 22 if (!ppSimArguments(argc, argv, config)) { 23 failure (config, PS_EXIT_CONFIG_ERROR, "Error parsing command-line arguments"); 24 } 15 25 16 26 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."); 20 28 } 21 29 22 30 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."); 26 32 } 27 33 34 ppSimRandomGaussianFree (); 28 35 psFree(config); 29 36 pmModelClassCleanup(); … … 32 39 psLibFinalize(); 33 40 34 return PS_EXIT_SUCCESS;41 exit (PS_EXIT_SUCCESS); 35 42 }
Note:
See TracChangeset
for help on using the changeset viewer.
