IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2004, 1:31:44 PM (22 years ago)
Author:
gusciora
Message:

Parameter checking for the psCOord.c file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astronomy/psCoord.c

    r2212 r2221  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-27 20:07:17 $
     12*  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 23:31:43 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424#include "psCoord.h"
    2525#include "psMemory.h"
    26 #include "psAbort.h"
    2726#include "psTime.h"
    2827#include "psConstants.h"
     
    6968psPlaneTransform* psPlaneTransformAlloc(psS32 n1, psS32 n2)
    7069{
     70    PS_INT_CHECK_NON_NEGATIVE(n1, NULL);
     71    PS_INT_CHECK_NON_NEGATIVE(n2, NULL);
     72
    7173    psPlaneTransform *pt = psAlloc(sizeof(psPlaneTransform));
    7274    pt->x = psDPolynomial2DAlloc(n1, n2, PS_POLYNOMIAL_ORD);
     
    8284{
    8385    PS_PTR_CHECK_NULL(transform, NULL);
     86    PS_PTR_CHECK_NULL(transform->x, NULL);
     87    PS_PTR_CHECK_NULL(transform->y, NULL);
    8488    PS_PTR_CHECK_NULL(coords, NULL);
     89
    8590    if (out == NULL) {
    8691        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    99104psPlaneDistort* psPlaneDistortAlloc(psS32 n1, psS32 n2, psS32 n3, psS32 n4)
    100105{
     106    PS_INT_CHECK_NON_NEGATIVE(n1, NULL);
     107    PS_INT_CHECK_NON_NEGATIVE(n2, NULL);
     108    PS_INT_CHECK_NON_NEGATIVE(n3, NULL);
     109    PS_INT_CHECK_NON_NEGATIVE(n4, NULL);
     110
    101111    psPlaneDistort *pt = psAlloc(sizeof(psPlaneDistort));
    102112    pt->x = psDPolynomial4DAlloc(n1, n2, n3, n4, PS_POLYNOMIAL_ORD);
     
    118128{
    119129    PS_PTR_CHECK_NULL(transform, NULL);
     130    PS_PTR_CHECK_NULL(transform->x, NULL);
     131    PS_PTR_CHECK_NULL(transform->y, NULL);
    120132    PS_PTR_CHECK_NULL(coords, NULL);
     133
    121134    if (out == NULL) {
    122135        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    158171    PS_PTR_CHECK_NULL(transform, NULL);
    159172    PS_PTR_CHECK_NULL(coord, NULL);
     173
    160174    double sinY = 0.0;
    161175    double cosY = 0.0;
     
    186200psSphereTransform* psSphereTransformICRSToEcliptic(psTime time)
    187201{
     202    PS_PTR_CHECK_NULL(&time, NULL);
     203
    188204    struct tm *tmTime = psTimeToTM(&time);
    189205    double year = (double)(1900 + tmTime->tm_year);
     
    199215psSphereTransform* psSphereTransformEclipticToICRS(psTime time)
    200216{
     217    PS_PTR_CHECK_NULL(&time, NULL);
     218
    201219    struct tm *tmTime = psTimeToTM(&time);
    202220    double year = (double)(1900 + tmTime->tm_year);
     
    223241XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    224242XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    225 XXX: get rid of the psAborts
    226243 *****************************************************************************/
    227244psPlane* psProject(const psSphere* coord,
     
    261278
    262279    } else if (projection->type == PS_PROJ_PAR) {
    263         psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
     280        psError(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
    264281
    265282    } else if (projection->type == PS_PROJ_GLS) {
    266         psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");
     283        psError(__func__, "The projection type PS_PROJ_GLS is undefined.\n");
    267284    } else {
    268         psAbort(__func__, "Unknown projection type.\n");
     285        psError(__func__, "Unknown projection type.\n");
    269286    }
    270287
     
    275292XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    276293XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    277 XXX: get rid of the psAborts
    278294 *****************************************************************************/
    279295psSphere* psDeproject(const psPlane* coord,
     
    317333
    318334    } else if (projection->type == PS_PROJ_PAR) {
    319         psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
     335        psError(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
    320336
    321337    } else if (projection->type == PS_PROJ_GLS) {
    322         psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");
     338        psError(__func__, "The projection type PS_PROJ_GLG is undefined.\n");
    323339    } else {
    324         psAbort(__func__, "Unknown projection type.\n");
     340        psError(__func__, "Unknown projection type.\n");
    325341    }
    326342
     
    391407        } else if (unit == PS_RADIAN) {}
    392408        else {
    393             psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
     409            psError(__func__, "Unknown offset unit: 0x%x\n", unit);
    394410        }
    395411
    396412        return (tmp);
    397413    }
    398     psAbort(__func__, "Unrecognized offset mode\n");
     414
     415    psError(__func__, "Unrecognized offset mode\n");
    399416    return (NULL);
    400417}
     
    452469            tmpD = offset->d;
    453470        } else {
    454             psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
     471            psError(__func__, "Unknown offset unit: 0x%x\n", unit);
    455472        }
    456473
     
    465482        return (tmp);
    466483    }
    467     psAbort(__func__, "Unrecognized offset mode\n");
     484
     485    psError(__func__, "Unrecognized offset mode\n");
    468486    return (NULL);
    469487}
Note: See TracChangeset for help on using the changeset viewer.