Changeset 26982 for trunk/ppSub/src/ppSub.c
- Timestamp:
- Feb 17, 2010, 5:36:13 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSub.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSub.c
r26899 r26982 24 24 int main(int argc, char *argv[]) 25 25 { 26 27 # if 028 26 psLibInit(NULL); 29 pmVisualSetVisual(true);30 for (int order = 2; order < 11; order ++) {31 pmSubtractionDeconvolutionTest (order);32 }33 psLibFinalize();34 exit (1);35 # endif36 37 psExit exitValue = PS_EXIT_SUCCESS; // Exit value38 27 psTimerStart("ppSub"); 39 psLibInit(NULL);40 28 41 29 ppSubData *data = NULL; // Processing data 42 30 pmConfig *config = pmConfigRead(&argc, argv, PPSUB_RECIPE); // Configuration 43 31 if (!config) { 44 psErrorStackPrint(stderr, "Error reading configuration.");45 exitValue = PS_EXIT_CONFIG_ERROR;46 32 goto die; 47 33 } … … 50 36 51 37 if (!pmModelClassInit()) { 52 psErrorStackPrint(stderr, "Error initialising model classes.\n"); 53 exitValue = PS_EXIT_PROG_ERROR; 38 psError(PPSUB_ERR_PROG, false, "Unable to initialise model classes."); 54 39 psFree(config); 55 40 goto die; … … 57 42 58 43 if (!psphotInit()) { 59 psErrorStackPrint(stderr, "Error initialising psphot.\n"); 60 exitValue = PS_EXIT_PROG_ERROR; 44 psError(PPSUB_ERR_PROG, false, "Error initialising psphot."); 61 45 psFree(config); 62 46 goto die; … … 66 50 67 51 if (!ppSubArguments(argc, argv, data)) { 68 psErrorStackPrint(stderr, "Error reading arguments.\n"); 69 exitValue = PS_EXIT_CONFIG_ERROR; 52 psError(PPSUB_ERR_ARGUMENTS, false, "Error reading arguments."); 70 53 goto die; 71 54 } 72 55 73 56 if (!ppSubCamera(data)) { 74 psErrorStackPrint(stderr, "Error setting up camera.\n");75 exitValue = PS_EXIT_CONFIG_ERROR;76 57 goto die; 77 58 } 78 59 79 60 if (!ppSubLoop(data)) { 80 psErrorStackPrint(stderr, "Error performing subtraction.\n");81 exitValue = PS_EXIT_SYS_ERROR;82 61 goto die; 83 62 } … … 87 66 psTimerStop(); 88 67 89 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "-dumpconfig"); 90 if (dump_file) { 91 if (!pmConfigDump(data->config, dump_file)) { 92 psErrorStackPrint(stderr, "Unable to dump configuration.\n"); 93 exitValue = PS_EXIT_SYS_ERROR; 68 if (data) { 69 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "-dumpconfig"); 70 if (dump_file) { 71 if (!pmConfigDump(data->config, dump_file)) { 72 psError(PPSUB_ERR_IO, false, "Unable to dump configuration."); 73 } 94 74 } 75 psFree(data); 95 76 } 96 psFree(data);97 77 98 78 pmVisualClose(); //close plot windows, if -visual is set … … 101 81 psLibFinalize(); 102 82 83 psExit exitValue = PS_EXIT_SUCCESS; // Exit value for program 84 psErrorCode errorCode = psErrorCodeLast(); // Error code 85 if (errorCode != PS_ERR_NONE) { 86 psErrorStackPrint(stderr, "Unable to perform subtraction."); 87 switch (errorCode) { 88 case PPSUB_ERR_UNKNOWN: 89 case PS_ERR_UNKNOWN: 90 exitValue = PS_EXIT_UNKNOWN_ERROR; 91 break; 92 case PS_ERR_IO: 93 case PS_ERR_DB_CLIENT: 94 case PS_ERR_DB_SERVER: 95 case PS_ERR_BAD_FITS: 96 case PS_ERR_OS_CALL_FAILED: 97 case PPSUB_ERR_IO: 98 exitValue = PS_EXIT_SYS_ERROR; 99 break; 100 case PS_ERR_BAD_PARAMETER_VALUE: 101 case PS_ERR_BAD_PARAMETER_TYPE: 102 case PS_ERR_BAD_PARAMETER_NULL: 103 case PS_ERR_BAD_PARAMETER_SIZE: 104 case PPSUB_ERR_ARGUMENTS: 105 case PPSUB_ERR_CONFIG: 106 exitValue = PS_EXIT_CONFIG_ERROR; 107 break; 108 case PPSUB_ERR_DATA: 109 case PPSUB_ERR_NO_OVERLAP: 110 exitValue = PS_EXIT_DATA_ERROR; 111 break; 112 case PS_ERR_UNEXPECTED_NULL: 113 case PS_ERR_PROGRAMMING: 114 case PPSUB_ERR_NOT_IMPLEMENTED: 115 case PPSUB_ERR_PROG: 116 default: 117 // It's a programming error if we're not dealing with the error correctly 118 exitValue = PS_EXIT_PROG_ERROR; 119 break; 120 } 121 } 122 103 123 exit(exitValue); 104 124 }
Note:
See TracChangeset
for help on using the changeset viewer.
