IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 10, 2010, 8:17:41 AM (15 years ago)
Author:
eugene
Message:

re-organize ppStackLoop to make the steps clearer: add separate functions for UpdateHeader, JPEGs, Stats; move cluttered includes into ppStack.h; push DIE section of ppStack.c into ppStackCleanup (like ppImageCleanup); rename old ppStackCleanup to ppStackCleanupFiles; consolidate file cleanup block in ppStackLoop (for unconvolved outputs) into ppStackCleanupFiles; add options for stack type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/ppStack/src/ppStackFinish.c

    r30009 r30015  
    1 #ifdef HAVE_CONFIG_H
    2 #include <config.h>
    3 #endif
    4 
    5 #include <stdio.h>
    6 #include <unistd.h>
    7 #include <pslib.h>
    8 #include <psmodules.h>
    9 #include <psphot.h>
    10 
    111#include "ppStack.h"
    12 #include "ppStackLoop.h"
    132
    143// this function unlinks the temporary files (if desired)
     
    5746
    5847    psErrorCode errorCode = psErrorCodeLast(); // Error code
    59     if (errorCode != PS_ERR_NONE) {
    60         psErrorStackPrint(stderr, "Unable to perform stack.");
    61         pmFPAfileFreeSetStrict(false);
    62         switch (errorCode) {
    63           case PPSTACK_ERR_UNKNOWN:
    64           case PS_ERR_UNKNOWN:
    65             psLogMsg("ppStack", PS_LOG_WARN, "Unknown error code: %x", errorCode);
    66             exitValue = PS_EXIT_UNKNOWN_ERROR;
    67             break;
    68           case PS_ERR_IO:
    69           case PS_ERR_DB_CLIENT:
    70           case PS_ERR_DB_SERVER:
    71           case PS_ERR_BAD_FITS:
    72           case PS_ERR_OS_CALL_FAILED:
    73           case PM_ERR_SYS:
    74           case PPSTACK_ERR_IO:
    75             psLogMsg("ppStack", PS_LOG_WARN, "I/O error code: %x", errorCode);
    76             exitValue = PS_EXIT_SYS_ERROR;
    77             break;
    78           case PS_ERR_BAD_PARAMETER_VALUE:
    79           case PS_ERR_BAD_PARAMETER_TYPE:
    80           case PS_ERR_BAD_PARAMETER_NULL:
    81           case PS_ERR_BAD_PARAMETER_SIZE:
    82           case PPSTACK_ERR_ARGUMENTS:
    83           case PPSTACK_ERR_CONFIG:
    84             psLogMsg("ppStack", PS_LOG_WARN, "Configuration error code: %x", errorCode);
    85             exitValue = PS_EXIT_CONFIG_ERROR;
    86             break;
    87           case PPSTACK_ERR_PSF:
    88           case PSPHOT_ERR_PSF:
    89           case PM_ERR_STAMPS:
    90           case PM_ERR_SMALL_AREA:
    91           case PPSTACK_ERR_REJECTED:
    92           case PPSTACK_ERR_DATA:
    93             psLogMsg("ppStack", PS_LOG_WARN, "Data error code: %x", errorCode);
    94             exitValue = PS_EXIT_DATA_ERROR;
    95             break;
    96           case PS_ERR_UNEXPECTED_NULL:
    97           case PS_ERR_PROGRAMMING:
    98           case PPSTACK_ERR_NOT_IMPLEMENTED:
    99           case PPSTACK_ERR_PROG:
    100             psLogMsg("ppStack", PS_LOG_WARN, "Programming error code: %x", errorCode);
    101             exitValue = PS_EXIT_PROG_ERROR;
    102             break;
    103           default:
    104             // It's a programming error if we're not dealing with the error correctly
    105             psLogMsg("ppStack", PS_LOG_WARN, "Unrecognised error code: %x", errorCode);
    106             exitValue = PS_EXIT_PROG_ERROR;
    107             break;
    108         }
     48    if (errorCode == PS_ERR_NONE) {
     49        return exitValue;
     50    }
     51
     52    psErrorStackPrint(stderr, "Unable to perform stack.");
     53    pmFPAfileFreeSetStrict(false);
     54    switch (errorCode) {
     55      case PPSTACK_ERR_UNKNOWN:
     56      case PS_ERR_UNKNOWN:
     57        psLogMsg("ppStack", PS_LOG_WARN, "Unknown error code: %x", errorCode);
     58        exitValue = PS_EXIT_UNKNOWN_ERROR;
     59        break;
     60      case PS_ERR_IO:
     61      case PS_ERR_DB_CLIENT:
     62      case PS_ERR_DB_SERVER:
     63      case PS_ERR_BAD_FITS:
     64      case PS_ERR_OS_CALL_FAILED:
     65      case PM_ERR_SYS:
     66      case PPSTACK_ERR_IO:
     67        psLogMsg("ppStack", PS_LOG_WARN, "I/O error code: %x", errorCode);
     68        exitValue = PS_EXIT_SYS_ERROR;
     69        break;
     70      case PS_ERR_BAD_PARAMETER_VALUE:
     71      case PS_ERR_BAD_PARAMETER_TYPE:
     72      case PS_ERR_BAD_PARAMETER_NULL:
     73      case PS_ERR_BAD_PARAMETER_SIZE:
     74      case PPSTACK_ERR_ARGUMENTS:
     75      case PPSTACK_ERR_CONFIG:
     76        psLogMsg("ppStack", PS_LOG_WARN, "Configuration error code: %x", errorCode);
     77        exitValue = PS_EXIT_CONFIG_ERROR;
     78        break;
     79      case PPSTACK_ERR_PSF:
     80      case PSPHOT_ERR_PSF:
     81      case PM_ERR_STAMPS:
     82      case PM_ERR_SMALL_AREA:
     83      case PPSTACK_ERR_REJECTED:
     84      case PPSTACK_ERR_DATA:
     85        psLogMsg("ppStack", PS_LOG_WARN, "Data error code: %x", errorCode);
     86        exitValue = PS_EXIT_DATA_ERROR;
     87        break;
     88      case PS_ERR_UNEXPECTED_NULL:
     89      case PS_ERR_PROGRAMMING:
     90      case PPSTACK_ERR_NOT_IMPLEMENTED:
     91      case PPSTACK_ERR_PROG:
     92        psLogMsg("ppStack", PS_LOG_WARN, "Programming error code: %x", errorCode);
     93        exitValue = PS_EXIT_PROG_ERROR;
     94        break;
     95      default:
     96        // It's a programming error if we're not dealing with the error correctly
     97        psLogMsg("ppStack", PS_LOG_WARN, "Unrecognised error code: %x", errorCode);
     98        exitValue = PS_EXIT_PROG_ERROR;
     99        break;
    109100    }
    110101    return exitValue;
Note: See TracChangeset for help on using the changeset viewer.