IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15216 for trunk/psastro


Ignore:
Timestamp:
Oct 4, 2007, 9:55:03 AM (19 years ago)
Author:
eugene
Message:

clean up error handling on pmFPAfileIO

Location:
trunk/psastro/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroDataLoad.c

    r12806 r15216  
    55// into the correct fpa structure locations (readout.analysis:PSPHOT.SOURCES)
    66
     7# define ESCAPE { \
     8  psError(PS_ERR_UNKNOWN, false, "Failure in psastroDataSave"); \
     9  psFree (view); \
     10  return false; \
     11}
     12 
    713// all of the different astrometry analysis modes use the same data load loop
    814bool psastroDataLoad (pmConfig *config) {
     
    3339
    3440    // files associated with the science image
    35     pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
     41    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    3642
    3743    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    3844        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3945        if (!chip->process || !chip->file_exists) { continue; }
    40         pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
     46        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    4147
    4248        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    4349            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    4450            if (!cell->process || !cell->file_exists) { continue; }
    45             pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
     51            if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    4652
    4753            // process each of the readouts
    4854            while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
    49                 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
    50                 if (! readout->data_exists) { continue; }
     55                if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
     56                if (!readout->data_exists) { continue; }
    5157
    52                 psastroConvertReadout (readout, recipe);
     58                if (!psastroConvertReadout (readout, recipe)) ESCAPE;
    5359
    54                 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     60                if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    5561            }
    56             pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     62            if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    5763        }
    58         pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     64        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    5965    }
    60     pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     66    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
     67
    6168    psFree (view);
    6269    return true;
  • trunk/psastro/src/psastroDataSave.c

    r12806 r15216  
    22// XXX leak free 2006.04.27
    33
     4# define ESCAPE { \
     5  psError(PS_ERR_UNKNOWN, false, "Failure in psastroDataSave"); \
     6  psFree (view); \
     7  return false; \
     8}
     9 
    410// this loop saves the photometry/astrometry data files
    511bool psastroDataSave (pmConfig *config) {
     
    3036
    3137    // open/load files as needed
    32     pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
     38    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    3339
    3440    while ((chip = pmFPAviewNextChip (view, output->fpa, 1)) != NULL) {
    3541        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3642        if (!chip->process || !chip->file_exists) { continue; }
    37         pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
     43        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    3844
    3945        while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) {
    4046            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    4147            if (!cell->process || !cell->file_exists) { continue; }
    42             pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
     48            if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    4349
    4450            // process each of the readouts
    4551            while ((readout = pmFPAviewNextReadout (view, output->fpa, 1)) != NULL) {
    46                 pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
    47                 if (! readout->data_exists) { continue; }
     52                if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
     53                if (!readout->data_exists) { continue; }
    4854
    49                 pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     55                if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    5056            }
    51             pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     57            if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    5258        }
    53         pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     59        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    5460    }
    55     pmFPAfileIOChecks (config, view, PM_FPA_AFTER);
     61    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
    5662
    5763    // activate all files except PSASTRO.OUTPUT
    58     pmFPAfileActivate (config->files, true, NULL);
    59     pmFPAfileActivate (config->files, false, "PSASTRO.OUTPUT");
     64    if (!pmFPAfileActivate (config->files, true, NULL)) ESCAPE;
     65    if (!pmFPAfileActivate (config->files, false, "PSASTRO.OUTPUT")) ESCAPE;
    6066
    6167    psFree (view);
Note: See TracChangeset for help on using the changeset viewer.