IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2212


Ignore:
Timestamp:
Oct 27, 2004, 10:07:17 AM (22 years ago)
Author:
gusciora
Message:

I've been unifying the naming conventions for various macros that check
functions parameters for type, size, non-NULL ...

Location:
trunk/psLib/src
Files:
11 edited

Legend:

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

    r2206 r2212  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-27 01:15:47 $
     12*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 20:07:17 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8181                               const psPlane* coords)
    8282{
    83     PS_CHECK_NULL_PTR(transform, NULL);
    84     PS_CHECK_NULL_PTR(coords, NULL);
     83    PS_PTR_CHECK_NULL(transform, NULL);
     84    PS_PTR_CHECK_NULL(coords, NULL);
    8585    if (out == NULL) {
    8686        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    117117                             float magnitude)
    118118{
    119     PS_CHECK_NULL_PTR(transform, NULL);
    120     PS_CHECK_NULL_PTR(coords, NULL);
     119    PS_PTR_CHECK_NULL(transform, NULL);
     120    PS_PTR_CHECK_NULL(coords, NULL);
    121121    if (out == NULL) {
    122122        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    156156                                 const psSphere* coord)
    157157{
    158     PS_CHECK_NULL_PTR(transform, NULL);
    159     PS_CHECK_NULL_PTR(coord, NULL);
     158    PS_PTR_CHECK_NULL(transform, NULL);
     159    PS_PTR_CHECK_NULL(coord, NULL);
    160160    double sinY = 0.0;
    161161    double cosY = 0.0;
     
    228228                   const psProjection* projection)
    229229{
    230     PS_CHECK_NULL_PTR(coord, NULL);
    231     PS_CHECK_NULL_PTR(projection, NULL);
     230    PS_PTR_CHECK_NULL(coord, NULL);
     231    PS_PTR_CHECK_NULL(projection, NULL);
    232232
    233233    float R = 0.0;
     
    280280                      const psProjection* projection)
    281281{
    282     PS_CHECK_NULL_PTR(coord, NULL);
    283     PS_CHECK_NULL_PTR(projection, NULL);
     282    PS_PTR_CHECK_NULL(coord, NULL);
     283    PS_PTR_CHECK_NULL(projection, NULL);
    284284
    285285    float R = 0.0;
     
    348348                            psSphereOffsetUnit unit)
    349349{
    350     PS_CHECK_NULL_PTR(position1, NULL);
    351     PS_CHECK_NULL_PTR(position2, NULL);
     350    PS_PTR_CHECK_NULL(position1, NULL);
     351    PS_PTR_CHECK_NULL(position2, NULL);
    352352
    353353    psPlane* lin;
     
    416416                            psSphereOffsetUnit unit)
    417417{
    418     PS_CHECK_NULL_PTR(position, NULL);
    419     PS_CHECK_NULL_PTR(offset, NULL);
     418    PS_PTR_CHECK_NULL(position, NULL);
     419    PS_PTR_CHECK_NULL(offset, NULL);
    420420
    421421    psPlane lin;
  • trunk/psLib/src/astronomy/psAstrometry.c

    r2211 r2212  
    88 *  @author George Gusciora, MHPCC
    99 *
    10  *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-27 19:58:54 $
     10 *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-27 20:07:17 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959{
    6060    int i = 0;
    61     PS_CHECK_NULL_PTR(transform, 0);
     61    PS_PTR_CHECK_NULL(transform, 0);
    6262
    6363    for (i=2;i<(transform->x->nX);i++) {
     
    114114    double F = transform->y->coeff[0][1];
    115115
    116     PS_CHECK_NULL_PTR(transform, NULL);
     116    PS_PTR_CHECK_NULL(transform, NULL);
    117117    psPlaneTransform *out = psAlloc(sizeof(psPlaneTransform));
    118118
     
    286286                            const psObservatory* observatory)
    287287{
    288     PS_CHECK_NULL_PTR(observatory, NULL);
     288    PS_PTR_CHECK_NULL(observatory, NULL);
    289289    psExposure* exp = psAlloc(sizeof(psExposure));
    290290
     
    463463psGrommit* psGrommitAlloc(const psExposure* exp)
    464464{
    465     PS_CHECK_NULL_PTR(exp, NULL);
     465    PS_PTR_CHECK_NULL(exp, NULL);
    466466
    467467    double date = psTimeToMJD(exp->time);
     
    493493                    const psFPA* FPA)
    494494{
    495     PS_CHECK_NULL_PTR(fpaCoord, NULL);
    496     PS_CHECK_NULL_PTR(FPA, NULL);
     495    PS_PTR_CHECK_NULL(fpaCoord, NULL);
     496    PS_PTR_CHECK_NULL(FPA, NULL);
    497497    psChip* tmpChip = NULL;
    498498    psPlane chipCoord;
     
    517517                    const psFPA* FPA)
    518518{
    519     PS_CHECK_NULL_PTR(fpaCoord, NULL);
    520     PS_CHECK_NULL_PTR(FPA, NULL);
    521     PS_CHECK_NULL_PTR(FPA->chips, NULL);
     519    PS_PTR_CHECK_NULL(fpaCoord, NULL);
     520    PS_PTR_CHECK_NULL(FPA, NULL);
     521    PS_PTR_CHECK_NULL(FPA->chips, NULL);
    522522    psArray* chips = FPA->chips;
    523523    psS32 nChips = chips->n;
     
    545545                     const psChip* chip)
    546546{
    547     PS_CHECK_NULL_PTR(chipCoord, NULL);
    548     PS_CHECK_NULL_PTR(chip, NULL);
     547    PS_PTR_CHECK_NULL(chipCoord, NULL);
     548    PS_PTR_CHECK_NULL(chip, NULL);
    549549
    550550    psPlane cellCoord;
     
    588588                           const psCell* cell)
    589589{
    590     PS_CHECK_NULL_PTR(inCoord, NULL);
    591     PS_CHECK_NULL_PTR(cell, NULL);
     590    PS_PTR_CHECK_NULL(inCoord, NULL);
     591    PS_PTR_CHECK_NULL(cell, NULL);
    592592
    593593    return (psPlaneTransformApply(outCoord, cell->toChip, inCoord));
     
    598598                          const psChip* chip)
    599599{
    600     PS_CHECK_NULL_PTR(inCoord, NULL);
    601     PS_CHECK_NULL_PTR(chip, NULL);
     600    PS_PTR_CHECK_NULL(inCoord, NULL);
     601    PS_PTR_CHECK_NULL(chip, NULL);
    602602
    603603    return (psPlaneTransformApply(outCoord, chip->toFPA, inCoord));
     
    610610                        const psFPA* fpa)
    611611{
    612     PS_CHECK_NULL_PTR(inCoord, NULL);
    613     PS_CHECK_NULL_PTR(fpa, NULL);
     612    PS_PTR_CHECK_NULL(inCoord, NULL);
     613    PS_PTR_CHECK_NULL(fpa, NULL);
    614614
    615615    return(psPlaneDistortApply(outCoord, fpa->toTangentPlane, inCoord,
     
    624624                         const psGrommit* grommit)
    625625{
    626     PS_CHECK_NULL_PTR(tpCoord, NULL);
    627     PS_CHECK_NULL_PTR(grommit, NULL);
     626    PS_PTR_CHECK_NULL(tpCoord, NULL);
     627    PS_PTR_CHECK_NULL(grommit, NULL);
    628628
    629629    double AOB = 0.0;
     
    644644                          const psCell* cell)
    645645{
    646     PS_CHECK_NULL_PTR(cellCoord, NULL);
    647     PS_CHECK_NULL_PTR(cell, NULL);
     646    PS_PTR_CHECK_NULL(cellCoord, NULL);
     647    PS_PTR_CHECK_NULL(cell, NULL);
    648648
    649649    return (psPlaneTransformApply(fpaCoord, cell->toFPA, cellCoord));
     
    656656                           const psCell* cell)
    657657{
    658     PS_CHECK_NULL_PTR(cellCoord, NULL);
    659     PS_CHECK_NULL_PTR(cell, NULL);
     658    PS_PTR_CHECK_NULL(cellCoord, NULL);
     659    PS_PTR_CHECK_NULL(cell, NULL);
    660660
    661661    psPlane* fpaCoord = NULL;
     
    688688                                const psCell* cell)
    689689{
    690     PS_CHECK_NULL_PTR(cellCoord, NULL);
    691     PS_CHECK_NULL_PTR(cell, NULL);
     690    PS_PTR_CHECK_NULL(cellCoord, NULL);
     691    PS_PTR_CHECK_NULL(cell, NULL);
    692692
    693693    psPlane *tpCoord = NULL;
     
    724724                        const psGrommit* grommit)
    725725{
    726     PS_CHECK_NULL_PTR(in, NULL);
    727     PS_CHECK_NULL_PTR(grommit, NULL);
     726    PS_PTR_CHECK_NULL(in, NULL);
     727    PS_PTR_CHECK_NULL(grommit, NULL);
    728728
    729729    char* type = "RA";
     
    745745                        const psFPA* fpa)
    746746{
    747     PS_CHECK_NULL_PTR(tpCoord, NULL);
    748     PS_CHECK_NULL_PTR(fpa, NULL);
     747    PS_PTR_CHECK_NULL(tpCoord, NULL);
     748    PS_PTR_CHECK_NULL(fpa, NULL);
    749749
    750750    return (psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane,
     
    756756                          const psChip* chip)
    757757{
    758     PS_CHECK_NULL_PTR(fpaCoord, NULL);
    759     PS_CHECK_NULL_PTR(chip, NULL);
    760     PS_CHECK_NULL_PTR(chip->parent, NULL);
     758    PS_PTR_CHECK_NULL(fpaCoord, NULL);
     759    PS_PTR_CHECK_NULL(chip, NULL);
     760    PS_PTR_CHECK_NULL(chip->parent, NULL);
    761761
    762762    chipCoord = psPlaneTransformApply(chipCoord, chip->fromFPA, fpaCoord);
     
    768768                           const psCell* cell)
    769769{
    770     PS_CHECK_NULL_PTR(chipCoord, NULL);
    771     PS_CHECK_NULL_PTR(cell, NULL);
    772     PS_CHECK_NULL_PTR(cell->parent, NULL);
     770    PS_PTR_CHECK_NULL(chipCoord, NULL);
     771    PS_PTR_CHECK_NULL(cell, NULL);
     772    PS_PTR_CHECK_NULL(cell->parent, NULL);
    773773
    774774    cellCoord = psPlaneTransformApply(cellCoord, cell->fromChip, chipCoord);
     
    782782                          const psCell* cell)
    783783{
    784     PS_CHECK_NULL_PTR(skyCoord, NULL);
    785     PS_CHECK_NULL_PTR(cell, NULL);
     784    PS_PTR_CHECK_NULL(skyCoord, NULL);
     785    PS_PTR_CHECK_NULL(cell, NULL);
    786786
    787787    psChip *parChip = cell->parent;
     
    813813                               const psCell* cell)
    814814{
    815     PS_CHECK_NULL_PTR(skyCoord, NULL);
    816     PS_CHECK_NULL_PTR(cell, NULL);
     815    PS_PTR_CHECK_NULL(skyCoord, NULL);
     816    PS_PTR_CHECK_NULL(cell, NULL);
    817817
    818818    psPlane *tpCoord = NULL;
  • trunk/psLib/src/astronomy/psCoord.c

    r2206 r2212  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-10-27 01:15:47 $
     12*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-10-27 20:07:17 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8181                               const psPlane* coords)
    8282{
    83     PS_CHECK_NULL_PTR(transform, NULL);
    84     PS_CHECK_NULL_PTR(coords, NULL);
     83    PS_PTR_CHECK_NULL(transform, NULL);
     84    PS_PTR_CHECK_NULL(coords, NULL);
    8585    if (out == NULL) {
    8686        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    117117                             float magnitude)
    118118{
    119     PS_CHECK_NULL_PTR(transform, NULL);
    120     PS_CHECK_NULL_PTR(coords, NULL);
     119    PS_PTR_CHECK_NULL(transform, NULL);
     120    PS_PTR_CHECK_NULL(coords, NULL);
    121121    if (out == NULL) {
    122122        out = (psPlane* ) psAlloc(sizeof(psPlane));
     
    156156                                 const psSphere* coord)
    157157{
    158     PS_CHECK_NULL_PTR(transform, NULL);
    159     PS_CHECK_NULL_PTR(coord, NULL);
     158    PS_PTR_CHECK_NULL(transform, NULL);
     159    PS_PTR_CHECK_NULL(coord, NULL);
    160160    double sinY = 0.0;
    161161    double cosY = 0.0;
     
    228228                   const psProjection* projection)
    229229{
    230     PS_CHECK_NULL_PTR(coord, NULL);
    231     PS_CHECK_NULL_PTR(projection, NULL);
     230    PS_PTR_CHECK_NULL(coord, NULL);
     231    PS_PTR_CHECK_NULL(projection, NULL);
    232232
    233233    float R = 0.0;
     
    280280                      const psProjection* projection)
    281281{
    282     PS_CHECK_NULL_PTR(coord, NULL);
    283     PS_CHECK_NULL_PTR(projection, NULL);
     282    PS_PTR_CHECK_NULL(coord, NULL);
     283    PS_PTR_CHECK_NULL(projection, NULL);
    284284
    285285    float R = 0.0;
     
    348348                            psSphereOffsetUnit unit)
    349349{
    350     PS_CHECK_NULL_PTR(position1, NULL);
    351     PS_CHECK_NULL_PTR(position2, NULL);
     350    PS_PTR_CHECK_NULL(position1, NULL);
     351    PS_PTR_CHECK_NULL(position2, NULL);
    352352
    353353    psPlane* lin;
     
    416416                            psSphereOffsetUnit unit)
    417417{
    418     PS_CHECK_NULL_PTR(position, NULL);
    419     PS_CHECK_NULL_PTR(offset, NULL);
     418    PS_PTR_CHECK_NULL(position, NULL);
     419    PS_PTR_CHECK_NULL(offset, NULL);
    420420
    421421    psPlane lin;
  • trunk/psLib/src/dataManip/psConstants.h

    r2211 r2212  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 19:58:54 $
     8 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 20:07:17 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9595
    9696/*****************************************************************************
    97  
     97Macros which take a generic psLib type and determine if it is NULL, or has
     98the wrong type.
    9899*****************************************************************************/
    99 #define PS_CHECK_NULL_PTR(NAME, RVAL) \
     100#define PS_PTR_CHECK_NULL(NAME, RVAL) \
    100101if (NAME == NULL) { \
    101102    psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
     
    103104}
    104105
    105 /*****************************************************************************
    106  
    107  *****************************************************************************/
    108 #define VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
     106#define PS_PTR_CHECK_TYPE(NAME, TYPE, RVAL) \
     107if (NAME->type.type != TYPE) { \
     108    psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
     109    return(RVAL); \
     110}
     111/*****************************************************************************
     112 
     113 *****************************************************************************/
     114#define PS_VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
    109115if ((VEC->type.type != PS_TYPE_F32) && (VEC->type.type != PS_TYPE_F64)) { \
    110116    psAbort(__func__, "Bad type for VEC (%d)", VEC->type.type); \
  • trunk/psLib/src/dataManip/psMinimize.c

    r2211 r2212  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 19:58:54 $
     11 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 20:07:17 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    252252    static psVector *yErr32Static = NULL;
    253253
    254     PS_CHECK_NULL_PTR(mySpline, NULL);
    255     PS_CHECK_NULL_PTR(y, NULL);
    256     VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
     254    PS_PTR_CHECK_NULL(mySpline, NULL);
     255    PS_PTR_CHECK_NULL(y, NULL);
     256    PS_VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
    257257    CONVERT_VECTOR_F64_TO_F32(y, y32, y32Static);
    258258
     
    262262        yErr32 = yErr32Static;
    263263    } else {
    264         VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
     264        PS_VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
    265265        CONVERT_VECTOR_F64_TO_F32(yErr, yErr32, yErr32Static);
    266266    }
     
    271271        x32 = x32Static;
    272272    } else {
    273         VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
     273        PS_VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
    274274        CONVERT_VECTOR_F64_TO_F32(x, x32, x32Static);
    275275    }
     
    425425                        psMinimizeLMChi2Func func)
    426426{
    427     PS_CHECK_NULL_PTR(min, NULL);
     427    PS_PTR_CHECK_NULL(min, NULL);
    428428    PS_CHECK_NULL_VECTOR(params, NULL);
    429429    PS_CHECK_EMPTY_VECTOR(params, NULL);
    430     PS_CHECK_NULL_PTR(x, NULL);
     430    PS_PTR_CHECK_NULL(x, NULL);
    431431    PS_CHECK_NULL_VECTOR(y, NULL);
    432432    PS_CHECK_EMPTY_VECTOR(y, NULL);
     
    865865    static psVector *yErr64Static = NULL;
    866866
    867     VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
     867    PS_VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
    868868    CONVERT_VECTOR_F32_TO_F64(y, y64, y64Static);
    869869
     
    873873        yErr64 = yErr64Static;
    874874    } else {
    875         VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
     875        PS_VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
    876876        CONVERT_VECTOR_F32_TO_F64(yErr, yErr64, yErr64Static);
    877877    }
     
    885885        x64 = x64Static;
    886886    } else {
    887         VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
     887        PS_VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
    888888        CONVERT_VECTOR_F32_TO_F64(x, x64, x64Static);
    889889    }
     
    13211321    PS_CHECK_NULL_VECTOR(params, NULL);
    13221322    PS_CHECK_EMPTY_VECTOR(params, NULL);
    1323     PS_CHECK_NULL_PTR(min, NULL);
    1324     PS_CHECK_NULL_PTR(coords, NULL);
    1325     PS_CHECK_NULL_PTR(func, NULL);
     1323    PS_PTR_CHECK_NULL(min, NULL);
     1324    PS_PTR_CHECK_NULL(coords, NULL);
     1325    PS_PTR_CHECK_NULL(func, NULL);
    13261326
    13271327    psS32 numDims = params->n;
  • trunk/psLib/src/dataManip/psStats.c

    r2208 r2212  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 01:21:01 $
     11 *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 20:07:17 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    17331733        return(stats);
    17341734    }
    1735     PS_CHECK_NULL_PTR(stats, NULL);
     1735    PS_PTR_CHECK_NULL(stats, NULL);
    17361736
    17371737    inF32 = p_psConvertToF32((psVector *) in);
  • trunk/psLib/src/image/psImageStats.c

    r2206 r2212  
    99*  @author GLG, MHPCC
    1010*
    11 *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-27 01:15:47 $
     11*  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 20:07:17 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    112112
    113113    // NOTE: Verify this action.
    114     PS_CHECK_NULL_PTR(out, NULL);
    115     PS_CHECK_NULL_PTR(in, NULL);
     114    PS_PTR_CHECK_NULL(out, NULL);
     115    PS_PTR_CHECK_NULL(in, NULL);
    116116
    117117    junkData = psAlloc(sizeof(psVector));
  • trunk/psLib/src/imageops/psImageStats.c

    r2206 r2212  
    99*  @author GLG, MHPCC
    1010*
    11 *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-27 01:15:47 $
     11*  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 20:07:17 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    112112
    113113    // NOTE: Verify this action.
    114     PS_CHECK_NULL_PTR(out, NULL);
    115     PS_CHECK_NULL_PTR(in, NULL);
     114    PS_PTR_CHECK_NULL(out, NULL);
     115    PS_PTR_CHECK_NULL(in, NULL);
    116116
    117117    junkData = psAlloc(sizeof(psVector));
  • trunk/psLib/src/math/psConstants.h

    r2211 r2212  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 19:58:54 $
     8 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-10-27 20:07:17 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9595
    9696/*****************************************************************************
    97  
     97Macros which take a generic psLib type and determine if it is NULL, or has
     98the wrong type.
    9899*****************************************************************************/
    99 #define PS_CHECK_NULL_PTR(NAME, RVAL) \
     100#define PS_PTR_CHECK_NULL(NAME, RVAL) \
    100101if (NAME == NULL) { \
    101102    psError(__func__,"Unallowable operation: %s is NULL.", #NAME); \
     
    103104}
    104105
    105 /*****************************************************************************
    106  
    107  *****************************************************************************/
    108 #define VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
     106#define PS_PTR_CHECK_TYPE(NAME, TYPE, RVAL) \
     107if (NAME->type.type != TYPE) { \
     108    psError(__func__,"Unallowable operation: %s has incorrect type.", #NAME); \
     109    return(RVAL); \
     110}
     111/*****************************************************************************
     112 
     113 *****************************************************************************/
     114#define PS_VECTOR_CHECK_TYPE_F32_OR_F64(VEC, RVAL) \
    109115if ((VEC->type.type != PS_TYPE_F32) && (VEC->type.type != PS_TYPE_F64)) { \
    110116    psAbort(__func__, "Bad type for VEC (%d)", VEC->type.type); \
  • trunk/psLib/src/math/psMinimize.c

    r2211 r2212  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 19:58:54 $
     11 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 20:07:17 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    252252    static psVector *yErr32Static = NULL;
    253253
    254     PS_CHECK_NULL_PTR(mySpline, NULL);
    255     PS_CHECK_NULL_PTR(y, NULL);
    256     VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
     254    PS_PTR_CHECK_NULL(mySpline, NULL);
     255    PS_PTR_CHECK_NULL(y, NULL);
     256    PS_VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
    257257    CONVERT_VECTOR_F64_TO_F32(y, y32, y32Static);
    258258
     
    262262        yErr32 = yErr32Static;
    263263    } else {
    264         VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
     264        PS_VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
    265265        CONVERT_VECTOR_F64_TO_F32(yErr, yErr32, yErr32Static);
    266266    }
     
    271271        x32 = x32Static;
    272272    } else {
    273         VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
     273        PS_VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
    274274        CONVERT_VECTOR_F64_TO_F32(x, x32, x32Static);
    275275    }
     
    425425                        psMinimizeLMChi2Func func)
    426426{
    427     PS_CHECK_NULL_PTR(min, NULL);
     427    PS_PTR_CHECK_NULL(min, NULL);
    428428    PS_CHECK_NULL_VECTOR(params, NULL);
    429429    PS_CHECK_EMPTY_VECTOR(params, NULL);
    430     PS_CHECK_NULL_PTR(x, NULL);
     430    PS_PTR_CHECK_NULL(x, NULL);
    431431    PS_CHECK_NULL_VECTOR(y, NULL);
    432432    PS_CHECK_EMPTY_VECTOR(y, NULL);
     
    865865    static psVector *yErr64Static = NULL;
    866866
    867     VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
     867    PS_VECTOR_CHECK_TYPE_F32_OR_F64(y, NULL);
    868868    CONVERT_VECTOR_F32_TO_F64(y, y64, y64Static);
    869869
     
    873873        yErr64 = yErr64Static;
    874874    } else {
    875         VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
     875        PS_VECTOR_CHECK_TYPE_F32_OR_F64(yErr, NULL);
    876876        CONVERT_VECTOR_F32_TO_F64(yErr, yErr64, yErr64Static);
    877877    }
     
    885885        x64 = x64Static;
    886886    } else {
    887         VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
     887        PS_VECTOR_CHECK_TYPE_F32_OR_F64(x, NULL);
    888888        CONVERT_VECTOR_F32_TO_F64(x, x64, x64Static);
    889889    }
     
    13211321    PS_CHECK_NULL_VECTOR(params, NULL);
    13221322    PS_CHECK_EMPTY_VECTOR(params, NULL);
    1323     PS_CHECK_NULL_PTR(min, NULL);
    1324     PS_CHECK_NULL_PTR(coords, NULL);
    1325     PS_CHECK_NULL_PTR(func, NULL);
     1323    PS_PTR_CHECK_NULL(min, NULL);
     1324    PS_PTR_CHECK_NULL(coords, NULL);
     1325    PS_PTR_CHECK_NULL(func, NULL);
    13261326
    13271327    psS32 numDims = params->n;
  • trunk/psLib/src/math/psStats.c

    r2208 r2212  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-27 01:21:01 $
     11 *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 20:07:17 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    17331733        return(stats);
    17341734    }
    1735     PS_CHECK_NULL_PTR(stats, NULL);
     1735    PS_PTR_CHECK_NULL(stats, NULL);
    17361736
    17371737    inF32 = p_psConvertToF32((psVector *) in);
Note: See TracChangeset for help on using the changeset viewer.