IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25197


Ignore:
Timestamp:
Aug 25, 2009, 3:25:40 PM (17 years ago)
Author:
bills
Message:

change ppstampMakeStamp() to return a program exit code.
This allows us to set the correct error for the job

Location:
trunk/pstamp/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/src/ppstamp.c

    r16132 r25197  
    2929
    3030    // find the pixels that we need to copy, setup the output image
    31     if (ppstampMakeStamp(config, options)) {
    32         exitCode = 0;
    33     } else {
    34         exitCode = PS_EXIT_DATA_ERROR;
    35     }
     31    exitCode = ppstampMakeStamp(config, options);
    3632
    3733    psLogMsg ("ppstamp", 3, "Complete ppstamp run: %f sec\n", psTimerMark(TIMERNAME));
  • trunk/pstamp/src/ppstamp.h

    r16132 r25197  
    2020bool ppstampParseCamera(pmConfig *config);
    2121
    22 bool ppstampMakeStamp(pmConfig *config, ppstampOptions *);
     22int ppstampMakeStamp(pmConfig *config, ppstampOptions *);
    2323pmFPAfile * ppstampBuildMosaic(pmConfig *config, pmFPAfile *input, pmFPAview *view);
    2424
  • trunk/pstamp/src/ppstampMakeStamp.c

    r25136 r25197  
    174174static psImage *extractStamp(psImage *image, psRegion region, double value)
    175175{
    176     int width  = region.x1 - region.x0;
    177     int height = region.y1 - region.y0;
     176    int width  = region.x1 - region.x0 + 0.5;
     177    int height = region.y1 - region.y0 + 0.5;
    178178
    179179    if (width < 0) {
     
    252252// Build the postage stamp output file
    253253
    254 static bool makeStamp(pmConfig *config, ppstampOptions *options, pmFPAfile *input,
     254static int makeStamp(pmConfig *config, ppstampOptions *options, pmFPAfile *input,
    255255                pmChip *inChip, pmFPAview *view)
    256256{
     
    260260    if (!output) {
    261261        psError(PS_ERR_UNKNOWN, false, "Can't find output data\n");
    262         return false;
     262        return PS_EXIT_DATA_ERROR;
    263263    }
    264264    char *fpaName = psMetadataLookupStr(NULL, input->fpa->concepts, "FPA.OBS"); // Name of FPA
     
    284284        pmFPAfile *mosaic = ppstampBuildMosaic(config, input, view);
    285285        if (mosaic == NULL) {
    286             return false;
     286            return PS_EXIT_UNKNOWN_ERROR;
    287287        }
    288288        srcFile = mosaic;
     
    362362        status = copyMetadata(output, input, inChip, options);
    363363    }
    364     return status;
     364    return status ? PS_EXIT_SUCCESS : PS_EXIT_UNKNOWN_ERROR;
    365365}
    366366
     
    574574}
    575575
    576 bool ppstampMakeStamp (pmConfig *config, ppstampOptions *options)
     576int ppstampMakeStamp (pmConfig *config, ppstampOptions *options)
    577577{
    578578    bool        status = false;
    579     bool        returnval = false;;
     579    int        returnval = PS_EXIT_SUCCESS;;
    580580    bool        foundOverlap = false;
    581581
     
    583583    if (!status) {
    584584        psError(PS_ERR_UNKNOWN, true, "Can't find input file!\n");
    585         return false;
     585        return PS_EXIT_DATA_ERROR;
    586586    }
    587587
     
    591591    } else if (astrom->camera != input->camera) {
    592592        psError(PS_ERR_UNKNOWN, true, "Input camera and astrometry camera do not match");
    593         return false;
     593        return PS_EXIT_CONFIG_ERROR;
    594594    }
    595595
     
    600600        psError(PS_ERR_UNKNOWN, false, "Failed to load input.");
    601601        psFree (view);
    602         return false;
     602        return PS_EXIT_DATA_ERROR;
    603603    }
    604604    bool bilevelAstrometry  = false;
     
    614614            psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for input FPA.");
    615615            psFree(view);
    616             return false;
     616            return PS_EXIT_DATA_ERROR;
    617617        }
    618618    }
     
    647647            break;
    648648        case PSTAMP_ERROR:
    649             returnval = false;
     649            returnval = PS_EXIT_UNKNOWN_ERROR;
    650650            allDone = true;
    651651            break;
     
    667667    psFree(view);
    668668
    669     if (!foundOverlap) {
     669    if (!foundOverlap && (returnval == PS_EXIT_SUCCESS)) {
    670670        fprintf(stderr, "ROI not found in input\n");
     671        returnval = PSTAMP_NO_OVERLAP;
    671672    }
    672673
  • trunk/pstamp/src/pstamp.h

    r25077 r25197  
    4242        PSTAMP_NOT_AVAILABLE    = 25,
    4343        PSTAMP_GONE             = 26,
    44         PSTAMP_NO_JOBS_QUEUED   = 27
     44        PSTAMP_NO_JOBS_QUEUED   = 27,
     45        PSTAMP_NO_OVERLAP       = 28
    4546} pstampJobErrors;
    4647
Note: See TracChangeset for help on using the changeset viewer.