Changeset 41413 for branches/eam_branches/gDiff.20200202/src/gDiff.c
- Timestamp:
- Sep 10, 2020, 9:40:15 AM (6 years ago)
- File:
-
- 1 edited
-
branches/eam_branches/gDiff.20200202/src/gDiff.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/gDiff.20200202/src/gDiff.c
r41260 r41413 18 18 psphotErrorRegister(); 19 19 20 psExit exitValue = PS_EXIT_SUCCESS; // default value 21 20 22 gDiffData *data = NULL; // Processing data 21 23 pmConfig *config = pmConfigRead(&argc, argv, GDIFF_RECIPE); // Configuration … … 26 28 psphotInit(); // cannot return false 27 29 30 // the 'data' container carries pointers to all data structures used by gDiff 28 31 data = gDiffDataAlloc(config); 29 32 33 // parse the command-line options 30 34 if (!gDiffArguments(argc, argv, data)) { 31 35 psError(psErrorCodeLast(), false, "Error reading arguments."); … … 33 37 } 34 38 35 // determine the camera and setup the I/O file handles39 // determine the camera and setup the (many) I/O file handles 36 40 if (!gDiffCamera(data)) goto die; 37 41 … … 40 44 41 45 die: 42 { 43 psExit exitValue = gDiffExitCode(PS_EXIT_SUCCESS); // Exit code 46 exitValue = gDiffExitCode(exitValue); // Exit code 44 47 45 if (data && data->stats && data->statsFile) {46 psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_DIFF", 0, "Total time (sec)", psTimerMark("gDiff"));47 psString stats = psMetadataConfigFormat(data->stats); // Statistics to output48 if (!stats || strlen(stats) == 0) {49 psError(GDIFF_ERR_IO, false, "Unable to format statistics file");50 } else if (fprintf(data->statsFile, "%s", stats) != strlen(stats)) {51 psError(GDIFF_ERR_IO, true, "Unable to write statistics file");52 }53 psFree(stats);54 if (fclose(data->statsFile) == EOF) {55 psError(GDIFF_ERR_IO, true, "Unable to close statistics file");56 }57 data->statsFile = NULL;58 pmConfigRunFilenameAddWrite(data->config, "STATS", data->statsName);59 exitValue = gDiffExitCode(exitValue);60 }48 if (data && data->stats && data->statsFile) { 49 psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_DIFF", 0, "Total time (sec)", psTimerMark("gDiff")); 50 psString stats = psMetadataConfigFormat(data->stats); // Statistics to output 51 if (!stats || strlen(stats) == 0) { 52 psError(GDIFF_ERR_IO, false, "Unable to format statistics file"); 53 } else if (fprintf(data->statsFile, "%s", stats) != strlen(stats)) { 54 psError(GDIFF_ERR_IO, true, "Unable to write statistics file"); 55 } 56 psFree(stats); 57 if (fclose(data->statsFile) == EOF) { 58 psError(GDIFF_ERR_IO, true, "Unable to close statistics file"); 59 } 60 data->statsFile = NULL; 61 pmConfigRunFilenameAddWrite(data->config, "STATS", data->statsName); 62 exitValue = gDiffExitCode(exitValue); 63 } 61 64 62 if (config && !gDiffFilesIterateUp(config, GDIFF_FILES_ALL)) {63 psError(psErrorCodeLast(), false, "Unable to close files.");64 exitValue = gDiffExitCode(exitValue);65 pmFPAfileFreeSetStrict(false);66 }65 if (config && !gDiffFilesIterateUp(config, GDIFF_FILES_ALL)) { 66 psError(psErrorCodeLast(), false, "Unable to close files."); 67 exitValue = gDiffExitCode(exitValue); 68 pmFPAfileFreeSetStrict(false); 69 } 67 70 68 if (data) {69 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "DUMP_CONFIG");70 if (dump_file) {71 if (!pmConfigDump(data->config, dump_file)) {72 psError(GDIFF_ERR_IO, false, "Unable to dump configuration.");73 exitValue = gDiffExitCode(exitValue);74 }75 }76 psFree(data);77 }71 if (data) { 72 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "DUMP_CONFIG"); 73 if (dump_file) { 74 if (!pmConfigDump(data->config, dump_file)) { 75 psError(GDIFF_ERR_IO, false, "Unable to dump configuration."); 76 exitValue = gDiffExitCode(exitValue); 77 } 78 } 79 psFree(data); 80 } 78 81 79 psTrace("gDiff", 1, "Finished at %f sec\n", psTimerMark("gDiff"));80 psLogMsg("gDiff", PS_LOG_INFO, "Complete gDiff run: %f sec\n", psTimerMark("gDiff"));81 psTimerStop();82 psTrace("gDiff", 1, "Finished at %f sec\n", psTimerMark("gDiff")); 83 psLogMsg("gDiff", PS_LOG_INFO, "Complete gDiff run: %f sec\n", psTimerMark("gDiff")); 84 psTimerStop(); 82 85 83 pmVisualClose(); // close plot windows, if -visual is set84 pmModelClassCleanup();85 pmConfigDone();86 pmVisualCleanup ();87 psLibFinalize();86 pmVisualClose(); // close plot windows, if -visual is set 87 pmModelClassCleanup(); 88 pmConfigDone(); 89 pmVisualCleanup (); 90 psLibFinalize(); 88 91 89 fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "gDiff"); 90 exitValue = gDiffExitCode(exitValue); 91 exit(exitValue); 92 } 92 fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "gDiff"); 93 exitValue = gDiffExitCode(exitValue); 94 exit(exitValue); 93 95 }
Note:
See TracChangeset
for help on using the changeset viewer.
