IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7766


Ignore:
Timestamp:
Jun 29, 2006, 4:20:43 PM (20 years ago)
Author:
Paul Price
Message:

Moved PS_ASSERT functions into appropriate places. Created psAssert.h for general PS_ASSERT functions. Vector-specific assertions went to psVector.h; image-specific assertions went to psImage.h, etc. psConstants.h remains, but only contains specific math constants and functions, as the name implies.

Location:
trunk/psLib/src
Files:
1 added
43 edited

Legend:

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

    r7079 r7766  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.119 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-05-06 03:34:21 $
     12*  @version $Revision: 1.120 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-06-30 02:20:06 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psMemory.h"
    2323#include "psTime.h"
    24 #include "psConstants.h"
     24#include "psAssert.h"
    2525#include "psError.h"
    2626#include "psLogMsg.h"
  • trunk/psLib/src/astro/psCoord.h

    r6874 r7766  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-04-17 22:00:03 $
     13 *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-30 02:20:06 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    456456);
    457457
     458#define PS_PRINT_PLANE_TRANSFORM(NAME) \
     459{ \
     460    printf("---------------------- Plane Transform ----------------------\n"); \
     461    printf("x:\n"); \
     462    PS_POLY_PRINT_2D(NAME->x); \
     463    printf("y:\n"); \
     464    PS_POLY_PRINT_2D(NAME->y); \
     465} \
     466
    458467/// @}
    459468
  • trunk/psLib/src/astro/psEarthOrientation.c

    r7118 r7766  
    88 *  @author Robert Daniel DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-05-16 01:08:57 $
     10 *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-06-30 02:20:06 $
    1212 *
    1313 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    2727#include "psMemory.h"
    2828#include "psCoord.h"
    29 #include "psConstants.h"
     29#include "psAssert.h"
    3030
    3131// Sun's Mass (src: Google's Calculator Service)
  • trunk/psLib/src/astro/psSphereOps.c

    r6534 r7766  
    88 *  @author Dave Robbins, MHPCC
    99 *
    10  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-03-07 01:53:24 $
     10 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-06-30 02:20:06 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2222#include "psMemory.h"
    2323#include "psTime.h"
    24 #include "psConstants.h"
     24#include "psAssert.h"
    2525#include "psError.h"
    2626#include "psLogMsg.h"
  • trunk/psLib/src/astro/psTime.c

    r7703 r7766  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.89 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-06-27 04:13:07 $
     12 *  @version $Revision: 1.90 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-06-30 02:20:06 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3232#include "psMetadataConfig.h"
    3333#include "psLookupTable.h"
    34 #include "psConstants.h"
     34#include "psAssert.h"
    3535#include "psErrorText.h"
    3636
  • trunk/psLib/src/db/psDB.c

    r7661 r7766  
    1212 *  @author Joshua Hoblitt
    1313 *
    14  *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-06-24 00:18:48 $
     14 *  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-06-30 02:20:06 $
    1616 *
    1717 *  Copyright 2005 Joshua Hoblitt, University of Hawaii
     
    3232#include "psDB.h"
    3333#include "psMemory.h"
     34#include "psAssert.h"
    3435#include "psAbort.h"
    3536#include "psError.h"
  • trunk/psLib/src/imageops/psImageBackground.c

    r7380 r7766  
    77#include "psStats.h"
    88#include "psType.h"
    9 #include "psConstants.h"
     9#include "psAssert.h"
    1010#include "psRandom.h"
    1111#include "psError.h"
  • trunk/psLib/src/imageops/psImageGeomManip.c

    r7524 r7766  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-06-12 20:44:04 $
     12 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-06-30 02:20:06 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929#include "psStats.h"
    3030#include "psMemory.h"
    31 #include "psConstants.h"
     31#include "psAssert.h"
    3232#include "psErrorText.h"
    3333#include "psCoord.h"
  • trunk/psLib/src/imageops/psImageMaskOps.c

    r5256 r7766  
    88 *  @author David Robbins, MHPCC
    99 *
    10  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-10-10 20:12:13 $
     10 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-06-30 02:20:06 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525#include "psStats.h"
    2626#include "psMemory.h"
    27 #include "psConstants.h"
     27#include "psAssert.h"
    2828#include "psErrorText.h"
    2929#include "psCoord.h"
  • trunk/psLib/src/imageops/psImagePixelManip.c

    r7380 r7766  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-06-07 03:22:06 $
     12 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-06-30 02:20:06 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2727#include "psStats.h"
    2828#include "psMemory.h"
    29 #include "psConstants.h"
     29#include "psAssert.h"
    3030#include "psErrorText.h"
    3131#include "psCoord.h"
  • trunk/psLib/src/imageops/psImageStats.c

    r7612 r7766  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.97 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-06-21 21:03:49 $
     11 *  @version $Revision: 1.98 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-06-30 02:20:06 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929#include "psPolynomial.h"
    3030#include "psImageStats.h"
    31 #include "psConstants.h"
     31#include "psAssert.h"
    3232#include "psErrorText.h"
    3333#include "psRegion.h"
     
    592592        return -1;
    593593    }/* else if (col0 == col1 && row0 == row1) {
    594                                     psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    595                                             "Invalid psRegion specified.  Region contains only 1 pixel.\n");
    596                                     return -1;
    597                                 }
    598                             */
     594                                        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     595                                                "Invalid psRegion specified.  Region contains only 1 pixel.\n");
     596                                        return -1;
     597                                    }
     598                                */
    599599    x0 = col0;
    600600    x1 = col1;
  • trunk/psLib/src/imageops/psImageUnbin.c

    r7381 r7766  
    33#include "psError.h"
    44#include "psImage.h"
    5 #include "psConstants.h"
     5#include "psAssert.h"
    66#include "psImageUnbin.h"
    77
  • trunk/psLib/src/jpeg/psImageJpeg.c

    r7736 r7766  
    99#include "psVector.h"
    1010#include "psError.h"
    11 #include "psConstants.h"
     11#include "psAssert.h"
    1212#include "psImageJpeg.h"
    1313
  • trunk/psLib/src/math/psBinaryOp.c

    r7192 r7766  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    32  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2006-05-24 03:10:14 $
     32 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2006-06-30 02:20:06 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4949#include "psScalar.h"
    5050#include "psLogMsg.h"
    51 #include "psConstants.h"
     51#include "psAssert.h"
    5252#include "psErrorText.h"
    5353
  • trunk/psLib/src/math/psConstants.h

    r7765 r7766  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-06-30 01:57:46 $
     8 *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-06-30 02:20:06 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4545
    4646/*****************************************************************************
    47  
    48 *****************************************************************************/
    49 
    50 #define PS_ASSERT_INT_UNEQUAL(NAME1, NAME2, RVAL) \
    51 if ((NAME1) == (NAME2)) { \
    52     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    53             "Error: %s and %s are equal.", \
    54             #NAME1, #NAME2); \
    55     return(RVAL); \
    56 }
    57 
    58 #define PS_ASSERT_INT_EQUAL(NAME1, NAME2, RVAL) \
    59 if ((NAME1) != (NAME2)) { \
    60     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    61             "Error: %s and %s are not equal.", \
    62             #NAME1, #NAME2); \
    63     return(RVAL); \
    64 }
    65 
    66 #define PS_ASSERT_INT_NONNEGATIVE(NAME, RVAL) \
    67 if ((NAME) < 0) { \
    68     psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: %s is less than 0.", #NAME); \
    69     return(RVAL); \
    70 }
    71 
    72 #define PS_ASSERT_INT_POSITIVE(NAME, RVAL) \
    73 if ((NAME) < 1) { \
    74     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    75             "Error: %s is 0 or less.", #NAME); \
    76     return(RVAL); \
    77 }
    78 
    79 #define PS_ASSERT_INT_ZERO(NAME, RVAL) \
    80 if ((NAME) != 0) { \
    81     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    82             "Error: %s is 0.", #NAME); \
    83     return(RVAL); \
    84 }
    85 
    86 #define PS_ASSERT_INT_NONZERO(NAME, RVAL) \
    87 if ((NAME) == 0) { \
    88     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    89             "Error: %s is 0.", #NAME); \
    90     return(RVAL); \
    91 }
    92 
    93 // XXX: Where did these int casts come from?
    94 #define PS_ASSERT_INT_WITHIN_RANGE(NAME, LOWER, UPPER, RVAL) \
    95 if ((int)(NAME) < LOWER || (int)(NAME) > UPPER) { \
    96     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    97             "Error: %s, %d, is out of range.  Must be between %d and %d.", \
    98             #NAME,(int)NAME,LOWER,UPPER); \
    99     return RVAL; \
    100 }
    101 
    102 #define PS_ASSERT_INT_LESS_THAN(VAR1, VAR2, RVAL) \
    103 if (!(VAR1 < VAR2)) { \
    104     psError(PS_ERR_UNKNOWN, true, \
    105             "Error: %s is not less than %s (%d, %d)", #VAR1, #VAR2, VAR1, VAR2); \
    106     return(RVAL); \
    107 }
    108 
    109 #define PS_ASSERT_INT_LESS_THAN_OR_EQUAL(VAR1, VAR2, RVAL) \
    110 if (!(VAR1 <= VAR2)) { \
    111     psError(PS_ERR_UNKNOWN, true, \
    112             "Error: %s is not less than %s (%d, %d)", #VAR1, #VAR2, VAR1, VAR2); \
    113     return(RVAL); \
    114 }
    115 
    116 #define PS_ASSERT_INT_LARGER_THAN(NAME1, NAME2, RVAL) \
    117 if (!((NAME1) > (NAME2))) { \
    118     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    119             "Error: !(%s > %s) (%d %d).", \
    120             #NAME1, #NAME2, NAME1, NAME2); \
    121     return(RVAL); \
    122 }
    123 
    124 #define PS_ASSERT_INT_LARGER_THAN_OR_EQUAL(NAME1, NAME2, RVAL) \
    125 if (!((NAME1) >= (NAME2))) { \
    126     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    127             "Error: !(%s >= %s) (%d %d).", \
    128             #NAME1, #NAME2, NAME1, NAME2); \
    129     return(RVAL); \
    130 }
    131 #define PS_ASSERT_FLOAT_LARGER_THAN(NAME1, NAME2, RVAL) \
    132 if (!((NAME1) > (NAME2))) { \
    133     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    134             "Error: !(%s > %s) (%f %f).", \
    135             #NAME1, #NAME2, NAME1, NAME2); \
    136     return(RVAL); \
    137 }
    138 
    139 #define PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(NAME1, NAME2, RVAL) \
    140 if (!((NAME1) >= (NAME2))) { \
    141     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    142             "Error: !(%s >= %s) (%f %f).", \
    143             #NAME1, #NAME2, NAME1, NAME2); \
    144     return(RVAL); \
    145 }
    146 
    147 #define PS_ASSERT_FLOAT_LESS_THAN(NAME1, NAME2, RVAL) \
    148 if (!((NAME1) < (NAME2))) { \
    149     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    150             "Error: !(%s < %s) (%f %f).", \
    151             #NAME1, #NAME2, NAME1, NAME2); \
    152     return(RVAL); \
    153 }
    154 
    155 #define PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(NAME1, NAME2, RVAL) \
    156 if (!((NAME1) <= (NAME2))) { \
    157     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    158             "Error: !(%s <= %s) (%f %f).", \
    159             #NAME1, #NAME2, NAME1, NAME2); \
    160     return(RVAL); \
    161 }
    162 
    163 #define PS_ASSERT_FLOAT_NON_EQUAL(NAME1, NAME2, RVAL) \
    164 if (fabs((NAME2) - (NAME1)) < FLT_EPSILON) { \
    165     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    166             "Error: %s and %s are equal.", \
    167             #NAME1, #NAME2); \
    168     return(RVAL); \
    169 }
    170 
    171 #define PS_ASSERT_FLOAT_EQUAL(NAME1, NAME2, RVAL) \
    172 if (fabs((NAME2) - (NAME1)) > FLT_EPSILON) { \
    173     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    174             "Error: %s and %s are not equal.", \
    175             #NAME1, #NAME2); \
    176     return(RVAL); \
    177 }
    178 
    179 // Return an error if the arg lies outside the supplied range.
    180 #define PS_ASSERT_FLOAT_WITHIN_RANGE(NAME, LOWER, UPPER, RVAL) \
    181 if ((NAME) < (LOWER) || (NAME) > (UPPER)) { \
    182     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    183             "Error: %s, %f, is out of range.  Must be between %f and %f.", \
    184             #NAME, NAME, LOWER, UPPER); \
    185     return RVAL; \
    186 }
    187 
    188 #define PS_ASSERT_DOUBLE_WITHIN_RANGE(NAME, LOWER, UPPER, RVAL) \
    189 if ((NAME) < (LOWER) || (NAME) > (UPPER)) { \
    190     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    191             "Error: %s, %lf, is out of range.  Must be between %lf and %lf.", \
    192             #NAME, NAME, LOWER, UPPER); \
    193     return RVAL; \
    194 }
    195 
    196 #define PS_ASSERT_LONG_WITHIN_RANGE(NAME, LOWER, UPPER, RVAL) \
    197 if ((NAME) < (LOWER) || (NAME) > (UPPER)) { \
    198     psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    199             "Error: %s, %lld, is out of range.", \
    200             #NAME, NAME, LOWER, UPPER); \
    201     return RVAL; \
    202 }
    203 
    204 /*****************************************************************************
    205 Macros which take a generic psLib type and determine if it is NULL, or has
    206 the wrong type.
    207 *****************************************************************************/
    208 #define PS_WARN_PTR_NON_NULL(NAME) \
    209 if ((NAME) == NULL) { \
    210     psLogMsg(__func__, PS_LOG_WARN, "WARNING: %s is NULL.", #NAME); \
    211 } \
    212 
    213 #define PS_ASSERT_PTR_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_PTR_NON_NULL(NAME, return RVAL)
    214 #define PS_ASSERT_GENERAL_PTR_NON_NULL(NAME, CLEANUP) \
    215 if ((NAME) == NULL) { \
    216     psError(PS_ERR_BAD_PARAMETER_NULL, true, \
    217             "Unallowable operation: %s is NULL.", \
    218             #NAME); \
    219     CLEANUP; \
    220 }
    221 
    222 #define PS_ASSERT_PTR_TYPE(NAME, TYPE, RVAL) \
    223 if ((NAME)->type.type != TYPE) { \
    224     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    225             "Unallowable operation: %s has incorrect type.", \
    226             #NAME); \
    227     return(RVAL); \
    228 }
    229 
    230 #define PS_ASSERT_PTR_DIMEN(NAME, DIMEN, RVAL) PS_ASSERT_GENERAL_PTR_DIMEN(NAME, DIMEN, return RVAL)
    231 #define PS_ASSERT_GENERAL_PTR_DIMEN(NAME, DIMEN, CLEANUP) \
    232 if ((NAME)->type.dimen != DIMEN) { \
    233     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    234             "Unallowable operation: %s has incorrect dimensionality.", \
    235             #NAME); \
    236     CLEANUP; \
    237 }
    238 
    239 #define PS_ASSERT_PTR_DIMEN_GENERAL_NOT(NAME, DIMEN, CLEANUP) \
    240 if ((NAME)->type.dimen == DIMEN) { \
    241     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    242             "Unallowable operation: %s has incorrect dimensionality.", \
    243             #NAME); \
    244     CLEANUP; \
    245 }
    246 
    247 
    248 #define PS_ASSERT_PTRS_SIZE_EQUAL(PTR1, PTR2, RVAL) \
    249 if (PTR1->n != PTR2->n) { \
    250     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    251             "ptr %s has size %d, ptr %s has size %d.", \
    252             #PTR1, PTR1->n, #PTR2, PTR2->n); \
    253     return(RVAL); \
    254 }
    255 
    256 #define PS_ASSERT_PTR_TYPE_EQUAL(PTR1, PTR2, RVAL) PS_ASSERT_PTRS_TYPE_EQUAL_GENERAL(PTR1, PTR2, return RVAL)
    257 #define PS_ASSERT_PTRS_TYPE_EQUAL_GENERAL(PTR1, PTR2, CLEANUP) \
    258 if (PTR1->type.type != PTR2->type.type) { \
    259     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    260             "ptr %s has type %d, ptr %s has type %d.", \
    261             #PTR1, PTR1->type.type, #PTR2, PTR2->type.type); \
    262     CLEANUP; \
    263 }
    264 
    265 
    266 /*****************************************************************************
    267     PS_VECTOR macros:
    268  *****************************************************************************/
    269 #define PS_ASSERT_VECTOR_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_VECTOR_NON_NULL(NAME, return RVAL)
    270 #define PS_ASSERT_GENERAL_VECTOR_NON_NULL(NAME, CLEANUP) \
    271 if ((NAME) == NULL || (NAME)->data.U8 == NULL) { \
    272     psError(PS_ERR_BAD_PARAMETER_NULL, true, \
    273             "Unallowable operation: psVector %s or its data is NULL.", \
    274             #NAME); \
    275     CLEANUP; \
    276 } \
    277 
    278 #define PS_ASSERT_VECTOR_NON_EMPTY(NAME, RVAL) PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(NAME, return RVAL)
    279 #define PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(NAME, CLEANUP) \
    280 if ((NAME)->n < 1) { \
    281     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    282             "Unallowable operation: psVector %s has no elements.", \
    283             #NAME); \
    284     CLEANUP; \
    285 } \
    286 
    287 #define PS_ASSERT_VECTOR_TYPE_F32_OR_F64(NAME, RVAL) \
    288 if (((NAME)->type.type != PS_TYPE_F32) && ((NAME)->type.type != PS_TYPE_F64)) { \
    289     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    290             "psVector %s: bad type(%d)", \
    291             #NAME, NAME->type.type); \
    292     return(RVAL); \
    293 } \
    294 
    295 #define PS_ASSERT_VECTOR_TYPE_S16_S32_F32(NAME, RVAL) \
    296 if (((NAME)->type.type != PS_TYPE_S16) && ((NAME)->type.type != PS_TYPE_S32) && ((NAME)->type.type != PS_TYPE_F32)) { \
    297     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    298             "psVector %s: bad type(%d)", \
    299             #NAME, NAME->type.type); \
    300     return(RVAL); \
    301 } \
    302 
    303 #define PS_ASSERT_VECTOR_TYPE(NAME, TYPE, RVAL) \
    304 if ((NAME)->type.type != TYPE) { \
    305     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    306             "Unallowable operation: psVector %s has incorrect type.", \
    307             #NAME); \
    308     return(RVAL); \
    309 }
    310 
    311 #define PS_ASSERT_VECTORS_SIZE_EQUAL(VEC1, VEC2, RVAL) \
    312 if (VEC1->n != VEC2->n) { \
    313     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    314             "psVector %s has size %d, psVector %s has size %d.", \
    315             #VEC1, VEC1->n, #VEC2, VEC2->n); \
    316     return(RVAL); \
    317 }
    318 
    319 #define PS_ASSERT_VECTOR_SIZE(VEC, SIZE, RVAL) \
    320 if (VEC->n != SIZE) { \
    321     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    322             "psVector %s has size %d, should be %d.", \
    323             #VEC, VEC->n, SIZE); \
    324     return(RVAL); \
    325 }
    326 
    327 #define PS_ASSERT_VECTOR_TYPE_EQUAL(VEC1, VEC2, RVAL) \
    328 if (VEC1->type.type != VEC2->type.type) { \
    329     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    330             "psVector %s has size %d, psVector %s has size %d.", \
    331             #VEC1, VEC1->type.type, #VEC2, VEC2->type.type); \
    332     return(RVAL); \
    333 }
    334 
    335 #define PS_VECTOR_PRINT_F32(NAME) \
    336 if (NAME != NULL) { \
    337     for (int my_i=0;my_i<(NAME)->n;my_i++) { \
    338         printf("%s->data.F32[%d] is %f\n", #NAME, my_i, (NAME)->data.F32[my_i]); \
    339     } \
    340     printf("\n"); \
    341 } else {\
    342     printf("MACRO WARNING: vector %s is NULL.\n", #NAME); \
    343 }\
    344 
    345 #define PS_VECTOR_PRINT_F64(NAME) \
    346 if (NAME != NULL) { \
    347     for (int my_i=0;my_i<(NAME)->n;my_i++) { \
    348         printf("%s->data.F64[%d] is %f\n", #NAME, my_i, (NAME)->data.F64[my_i]); \
    349     } \
    350     printf("\n"); \
    351 } else {\
    352     printf("MACRO WARNING: vector %s is NULL.\n", #NAME); \
    353 }\
    354 
    355 /*****************************************************************************
    356     PS_POLY macros:
    357 *****************************************************************************/
    358 #define PS_ASSERT_POLY1D(NAME, RVAL) \
    359 if (false == psMemCheckPolynomial1D(NAME)) { \
    360     psError(PS_ERR_BAD_PARAMETER_NULL, true, \
    361             "Unallowable operation: argument %s is not a psPolynomial1D struct.\n",\
    362             #NAME); \
    363     return(RVAL); \
    364 } \
    365 
    366 #define PS_ASSERT_POLY_NON_NULL(NAME, RVAL) \
    367 if ((NAME) == NULL || (NAME)->coeff == NULL) { \
    368     psError(PS_ERR_BAD_PARAMETER_NULL, true, \
    369             "Unallowable operation: polynomial %s or its coeffs is NULL.", \
    370             #NAME); \
    371     return(RVAL); \
    372 } \
    373 
    374 #define PS_ASSERT_POLY_TYPE(NAME, TYPE, RVAL) \
    375 if ((NAME)->type != TYPE) { \
    376     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    377             "Unallowable operation: polynomial %s has wrong type.", #NAME); \
    378     return(RVAL); \
    379 } \
    380 
    381 #define PS_POLY_PRINT_1D(NAME) \
    382 printf("Poly %s: (nX) is (%d)\n", #NAME, NAME->nX);\
    383 for (psS32 i = 0 ; i < NAME->nX+1 ; i++) {\
    384     printf("%s->coeff[%d] is %f\n", #NAME, i, NAME->coeff[i]); \
    385 }\
    386 
    387 #define PS_POLY_PRINT_2D(NAME) \
    388 printf("Poly %s: (nX, nY) is (%d, %d)\n", #NAME, NAME->nX, NAME->nY);\
    389 for (psS32 i = 0 ; i < NAME->nX+1 ; i++) {\
    390     for (psS32 j = 0 ; j < NAME->nY+1 ; j++) {\
    391         printf("%s->coeff[%d][%d] is %f\n", #NAME, i, j, NAME->coeff[i][j]); \
    392     }\
    393 }\
    394 
    395 #define PS_PRINT_PLANE_TRANSFORM(NAME) \
    396 { \
    397     printf("---------------------- Plane Transform ----------------------\n"); \
    398     printf("x:\n"); \
    399     PS_POLY_PRINT_2D(NAME->x); \
    400     printf("y:\n"); \
    401     PS_POLY_PRINT_2D(NAME->y); \
    402 } \
    403 
    404 
    405 /*****************************************************************************
    406     PS_SPLINE macros:
    407 *****************************************************************************/
    408 #define PS_ASSERT_SPLINE(NAME, RVAL) \
    409 if (false == psMemCheckSpline1D(NAME)) { \
    410     psError(PS_ERR_BAD_PARAMETER_NULL, true, \
    411             "Unallowable operation: argument %s is not a psSpline1D struct.\n",\
    412             #NAME); \
    413     return(RVAL); \
    414 } \
    415 
    416 #define PS_ASSERT_SPLINE_NON_NULL(NAME, RVAL) \
    417 if ((NAME) == NULL) { \
    418     psError(PS_ERR_BAD_PARAMETER_NULL, true, \
    419             "Unallowable operation: psSpline1D %s is NULL.", \
    420             #NAME); \
    421     return(RVAL); \
    422 } \
    423 
    424 /*****************************************************************************
    425     PS_IMAGE macros:
    426 *****************************************************************************/
    427 #define PS_ASSERT_IMAGE_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_IMAGE_NON_NULL(NAME, return RVAL)
    428 #define PS_ASSERT_GENERAL_IMAGE_NON_NULL(NAME, CLEANUP) \
    429 if ((NAME) == NULL || (NAME)->data.V == NULL) { \
    430     psError(PS_ERR_BAD_PARAMETER_NULL, true, \
    431             "Unallowable operation: psImage %s or its data is NULL.", \
    432             #NAME); \
    433     CLEANUP; \
    434 }
    435 
    436 #define PS_ASSERT_IMAGE_NON_EMPTY(NAME, RVAL) PS_ASSERT_GENERAL_IMAGE_NON_EMPTY(NAME, return RVAL)
    437 #define PS_ASSERT_GENERAL_IMAGE_NON_EMPTY(NAME, CLEANUP) \
    438 if ((NAME)->numCols < 1 || (NAME)->numRows < 1) { \
    439     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    440             "Unallowable operation: psImage %s has zero rows or columns (%dx%d).", \
    441             #NAME, (NAME)->numCols, (NAME)->numRows); \
    442     CLEANUP; \
    443 }
    444 
    445 #define PS_ASSERT_IMAGE_TYPE(NAME, TYPE, RVAL) \
    446 if ((NAME)->type.type != TYPE) { \
    447     psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
    448             "Unallowable operation: psImage %s has incorrect type.", \
    449             #NAME); \
    450     return(RVAL); \
    451 }
    452 
    453 #define PS_ASSERT_IMAGES_SIZE_EQUAL(NAME1, NAME2, RVAL) \
    454 if (((NAME1)->numCols != (NAME2)->numCols) || \
    455         ((NAME1)->numRows != (NAME2)->numRows)) { \
    456     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    457             "Unallowable operation: psImages %s and %s are not the same size.", \
    458             #NAME1, #NAME2); \
    459     return(RVAL); \
    460 }
    461 
    462 #define PS_ASSERT_IMAGE_SIZE(NAME1, NUM_COLS, NUM_ROWS, RVAL) \
    463 if (((NAME1)->numCols != NUM_COLS) || \
    464         ((NAME1)->numRows != NUM_ROWS)) { \
    465     psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
    466             "Unallowable operation: psImages %s is not the correct size.", \
    467             #NAME1); \
    468     return(RVAL); \
    469 }
    470 
    471 #define PS_IMAGE_PRINT_F32(NAME) \
    472 printf("======== printing %s ========\n", #NAME); \
    473 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    474     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    475         printf("%.2f ", (NAME)->data.F32[i][j]); \
    476     } \
    477     printf("\n"); \
    478 }\
    479 
    480 #define PS_IMAGE_PRINT_F64(NAME) \
    481 printf("======== printing %s ========\n", #NAME); \
    482 for (int i = 0 ; i < (NAME)->numRows ; i++) { \
    483     for (int j = 0 ; j < (NAME)->numCols ; j++) { \
    484         printf("%.2f ", (NAME)->data.F64[i][j]); \
    485     } \
    486     printf("\n"); \
    487 }\
    488 
    489 /*****************************************************************************
    49047    Misc. macros:
    49148*****************************************************************************/
     
    49956((A) * (A))
    50057
    501 # define PS_SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;}
     58#define PS_SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;}
  • trunk/psLib/src/math/psEllipse.c

    r7380 r7766  
    11#include <stdio.h>
    2 
    32#include "psConstants.h"
    43#include "psEllipse.h"
  • trunk/psLib/src/math/psMathUtils.c

    r7132 r7766  
    33 *  This file contains standard math routines.
    44 *
    5  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-05-18 01:20:51 $
     5 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-06-30 02:20:06 $
    77 *
    88 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2424#include "psPolynomial.h"
    2525#include "psMathUtils.h"
     26#include "psAssert.h"
    2627#include "psConstants.h"
    2728#include "psErrorText.h"
  • trunk/psLib/src/math/psMatrix.c

    r7325 r7766  
    2121 *  @author Robert DeSonia, MHPCC
    2222 *
    23  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    24  *  @date $Date: 2006-06-03 03:55:12 $
     23 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2006-06-30 02:20:06 $
    2525 *
    2626 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4242#include "psVector.h"
    4343#include "psMatrix.h"
    44 #include "psConstants.h"
     44#include "psAssert.h"
    4545#include "psErrorText.h"
    4646#include "psTrace.h"
  • trunk/psLib/src/math/psMinimizeLMM.c

    r7325 r7766  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-06-03 03:55:12 $
     12 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-06-30 02:20:06 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2424
    2525#include "psAbort.h"
     26#include "psAssert.h"
    2627#include "psMinimizeLMM.h"
    2728#include "psImage.h"
  • trunk/psLib/src/math/psMinimizeLMM.h

    r7102 r7766  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-05-10 00:49:38 $
     10 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-06-30 02:20:06 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3737#include "psError.h"
    3838#include "psConstants.h"
     39
     40#define PS_DETERMINE_BRACKET_STEP_SIZE 0.10
     41#define PS_MAX_LMM_ITERATIONS 100
     42#define PS_MAX_MINIMIZE_ITERATIONS 100
    3943
    4044/** A data structure for minimization routines.
  • trunk/psLib/src/math/psMinimizePolyFit.c

    r7753 r7766  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-06-29 20:37:51 $
     12 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-06-30 02:20:06 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929
    3030#include "psMinimizePolyFit.h"
     31#include "psAssert.h"
    3132#include "psMinimizeLMM.h"  // For Gauss-Jordan routines
    3233#include "psStats.h"
  • trunk/psLib/src/math/psMinimizePowell.c

    r7764 r7766  
    1111 *  NOTE: XXX: The SDR is silent about data types.  F32 is implemented here.
    1212 *
    13  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-06-30 01:56:22 $
     13 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-30 02:20:06 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525
    2626#include "psMinimizePowell.h"
     27#include "psAssert.h"
    2728#include "psStats.h"
    2829#include "psImage.h"
  • trunk/psLib/src/math/psPolynomial.c

    r6500 r7766  
    77*  polynomials.  It also contains a Gaussian functions.
    88*
    9 *  @version $Revision: 1.145 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-02-28 02:53:02 $
     9*  @version $Revision: 1.146 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-06-30 02:20:06 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3131#include "psLogMsg.h"
    3232#include "psPolynomial.h"
    33 #include "psConstants.h"
     33#include "psAssert.h"
    3434#include "psErrorText.h"
    3535
  • trunk/psLib/src/math/psPolynomial.h

    r6348 r7766  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-02-07 23:36:15 $
     13 *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-30 02:20:06 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    307307
    308308
     309/*****************************************************************************
     310    PS_POLY macros:
     311*****************************************************************************/
     312#define PS_ASSERT_POLY1D(NAME, RVAL) \
     313if (false == psMemCheckPolynomial1D(NAME)) { \
     314    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
     315            "Unallowable operation: argument %s is not a psPolynomial1D struct.\n",\
     316            #NAME); \
     317    return(RVAL); \
     318} \
     319
     320#define PS_ASSERT_POLY_NON_NULL(NAME, RVAL) \
     321if ((NAME) == NULL || (NAME)->coeff == NULL) { \
     322    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
     323            "Unallowable operation: polynomial %s or its coeffs is NULL.", \
     324            #NAME); \
     325    return(RVAL); \
     326} \
     327
     328#define PS_ASSERT_POLY_TYPE(NAME, TYPE, RVAL) \
     329if ((NAME)->type != TYPE) { \
     330    psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
     331            "Unallowable operation: polynomial %s has wrong type.", #NAME); \
     332    return(RVAL); \
     333} \
     334
     335#define PS_POLY_PRINT_1D(NAME) \
     336printf("Poly %s: (nX) is (%d)\n", #NAME, NAME->nX);\
     337for (psS32 i = 0 ; i < NAME->nX+1 ; i++) {\
     338    printf("%s->coeff[%d] is %f\n", #NAME, i, NAME->coeff[i]); \
     339}\
     340
     341#define PS_POLY_PRINT_2D(NAME) \
     342printf("Poly %s: (nX, nY) is (%d, %d)\n", #NAME, NAME->nX, NAME->nY);\
     343for (psS32 i = 0 ; i < NAME->nX+1 ; i++) {\
     344    for (psS32 j = 0 ; j < NAME->nY+1 ; j++) {\
     345        printf("%s->coeff[%d][%d] is %f\n", #NAME, i, j, NAME->coeff[i][j]); \
     346    }\
     347}\
    309348
    310349/** \} */ // End of MathGroup Functions
  • trunk/psLib/src/math/psPolynomialUtils.c

    r7541 r7766  
    77#include "psBinaryOp.h"
    88#include "psStats.h"
    9 #include "psConstants.h"
     9#include "psAssert.h"
    1010#include "psPolynomial.h"
    1111#include "psMinimizePolyFit.h"
  • trunk/psLib/src/math/psRandom.c

    r4857 r7766  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-08-23 23:23:05 $
     12*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-06-30 02:20:06 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3030#include "psTrace.h"
    3131#include "psLogMsg.h"
    32 #include "psConstants.h"
     32#include "psAssert.h"
    3333#include "psErrorText.h"
    3434
  • trunk/psLib/src/math/psSparse.c

    r7550 r7766  
    99#include "psLogMsg.h"
    1010#include "psVector.h"
     11#include "psAssert.h"
    1112#include "psConstants.h"
    1213#include "psSparse.h"
  • trunk/psLib/src/math/psSpline.c

    r6788 r7766  
    66*  This file contains the routines that allocate, free, and evaluate splines.
    77*
    8 *  @version $Revision: 1.148 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2006-04-05 02:19:00 $
     8*  @version $Revision: 1.149 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2006-06-30 02:20:06 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2727#include "psPolynomial.h"
    2828#include "psSpline.h"
    29 #include "psConstants.h"
     29#include "psAssert.h"
    3030#include "psErrorText.h"
    3131#include "psMathUtils.h"
     
    131131    //
    132132    // The second derivatives at the endpoints, undefined in the SDR,
    133     // are set in psConstants.h: PS_LEFT_SPLINE_DERIV, PS_RIGHT_SPLINE_DERIV.
     133    // are set in psAssert.h: PS_LEFT_SPLINE_DERIV, PS_RIGHT_SPLINE_DERIV.
    134134    //
    135135    derivs2[0] = -0.5;
  • trunk/psLib/src/math/psSpline.h

    r6305 r7766  
    1212 *  @author GLG, MHPCC
    1313 *
    14  *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-02-02 21:09:08 $
     14 *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-06-30 02:20:06 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2929#include "psScalar.h"
    3030#include "psPolynomial.h"
     31
     32#define PS_LEFT_SPLINE_DERIV 0.0
     33#define PS_RIGHT_SPLINE_DERIV 0.0
    3134
    3235/** \addtogroup GROUP00
     
    9295);
    9396
     97/*****************************************************************************
     98    PS_SPLINE macros:
     99*****************************************************************************/
     100#define PS_ASSERT_SPLINE(NAME, RVAL) \
     101if (false == psMemCheckSpline1D(NAME)) { \
     102    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
     103            "Unallowable operation: argument %s is not a psSpline1D struct.\n",\
     104            #NAME); \
     105    return(RVAL); \
     106} \
     107
     108#define PS_ASSERT_SPLINE_NON_NULL(NAME, RVAL) \
     109if ((NAME) == NULL) { \
     110    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
     111            "Unallowable operation: psSpline1D %s is NULL.", \
     112            #NAME); \
     113    return(RVAL); \
     114} \
     115
     116
    94117/** \} */ // End of MathGroup Functions
    95118
  • trunk/psLib/src/math/psStats.c

    r7167 r7766  
    1616 * use ->min and ->max (PS_STAT_USE_RANGE)
    1717 *
    18  *  @version $Revision: 1.175 $ $Name: not supported by cvs2svn $
    19  *  @date $Date: 2006-05-22 23:08:22 $
     18 *  @version $Revision: 1.176 $ $Name: not supported by cvs2svn $
     19 *  @date $Date: 2006-06-30 02:20:06 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4343#include "psMinimizePolyFit.h"
    4444#include "psPolynomial.h"
    45 #include "psConstants.h"
     45#include "psAssert.h"
    4646#include "psMathUtils.h"
    4747
  • trunk/psLib/src/math/psUnaryOp.c

    r7193 r7766  
    3030 *  @author Robert DeSonia, MHPCC
    3131 *
    32  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2006-05-24 03:25:14 $
     32 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2006-06-30 02:20:06 $
    3434 *
    3535 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5050#include "psScalar.h"
    5151#include "psLogMsg.h"
    52 #include "psConstants.h"
     52#include "psAssert.h"
    5353#include "psErrorText.h"
    5454
  • trunk/psLib/src/math/psVectorSmooth.c

    r7380 r7766  
    1010#include "psVector.h"
    1111#include "psVectorSmooth.h"
    12 #include "psConstants.h"
     12#include "psAssert.h"
    1313
    1414
  • trunk/psLib/src/mathtypes/psImage.c

    r7663 r7766  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.110 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-06-24 00:22:54 $
     11 *  @version $Revision: 1.111 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-06-30 02:20:06 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "psMemory.h"
    2424#include "psError.h"
    25 //#include "psAbort.h"
     25#include "psAssert.h"
    2626#include "psImage.h"
    2727#include "psString.h"
  • trunk/psLib/src/mathtypes/psImage.h

    r7579 r7766  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.79 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-06-15 02:29:12 $
     13 *  @version $Revision: 1.80 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-30 02:20:06 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    242242#undef PIXEL_INTERPOLATE_FCNS
    243243
     244/*****************************************************************************
     245    PS_IMAGE macros:
     246*****************************************************************************/
     247#define PS_ASSERT_IMAGE_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_IMAGE_NON_NULL(NAME, return RVAL)
     248#define PS_ASSERT_GENERAL_IMAGE_NON_NULL(NAME, CLEANUP) \
     249if ((NAME) == NULL || (NAME)->data.V == NULL) { \
     250    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
     251            "Unallowable operation: psImage %s or its data is NULL.", \
     252            #NAME); \
     253    CLEANUP; \
     254}
     255
     256#define PS_ASSERT_IMAGE_NON_EMPTY(NAME, RVAL) PS_ASSERT_GENERAL_IMAGE_NON_EMPTY(NAME, return RVAL)
     257#define PS_ASSERT_GENERAL_IMAGE_NON_EMPTY(NAME, CLEANUP) \
     258if ((NAME)->numCols < 1 || (NAME)->numRows < 1) { \
     259    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
     260            "Unallowable operation: psImage %s has zero rows or columns (%dx%d).", \
     261            #NAME, (NAME)->numCols, (NAME)->numRows); \
     262    CLEANUP; \
     263}
     264
     265#define PS_ASSERT_IMAGE_TYPE(NAME, TYPE, RVAL) \
     266if ((NAME)->type.type != TYPE) { \
     267    psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
     268            "Unallowable operation: psImage %s has incorrect type.", \
     269            #NAME); \
     270    return(RVAL); \
     271}
     272
     273#define PS_ASSERT_IMAGES_SIZE_EQUAL(NAME1, NAME2, RVAL) \
     274if (((NAME1)->numCols != (NAME2)->numCols) || \
     275        ((NAME1)->numRows != (NAME2)->numRows)) { \
     276    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
     277            "Unallowable operation: psImages %s and %s are not the same size.", \
     278            #NAME1, #NAME2); \
     279    return(RVAL); \
     280}
     281
     282#define PS_ASSERT_IMAGE_SIZE(NAME1, NUM_COLS, NUM_ROWS, RVAL) \
     283if (((NAME1)->numCols != NUM_COLS) || \
     284        ((NAME1)->numRows != NUM_ROWS)) { \
     285    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
     286            "Unallowable operation: psImages %s is not the correct size.", \
     287            #NAME1); \
     288    return(RVAL); \
     289}
     290
     291#define PS_IMAGE_PRINT_F32(NAME) \
     292printf("======== printing %s ========\n", #NAME); \
     293for (int i = 0 ; i < (NAME)->numRows ; i++) { \
     294    for (int j = 0 ; j < (NAME)->numCols ; j++) { \
     295        printf("%.2f ", (NAME)->data.F32[i][j]); \
     296    } \
     297    printf("\n"); \
     298}\
     299
     300#define PS_IMAGE_PRINT_F64(NAME) \
     301printf("======== printing %s ========\n", #NAME); \
     302for (int i = 0 ; i < (NAME)->numRows ; i++) { \
     303    for (int j = 0 ; j < (NAME)->numCols ; j++) { \
     304        printf("%.2f ", (NAME)->data.F64[i][j]); \
     305    } \
     306    printf("\n"); \
     307}\
     308
    244309/// @}
    245310
  • trunk/psLib/src/mathtypes/psVector.h

    r7579 r7766  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-06-15 02:29:12 $
     13 *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-30 02:20:06 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    269269
    270270
     271/*****************************************************************************
     272    PS_VECTOR macros:
     273 *****************************************************************************/
     274
     275#define PS_ASSERT_VECTOR_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_VECTOR_NON_NULL(NAME, return RVAL)
     276#define PS_ASSERT_GENERAL_VECTOR_NON_NULL(NAME, CLEANUP) \
     277if ((NAME) == NULL || (NAME)->data.U8 == NULL) { \
     278    psError(PS_ERR_BAD_PARAMETER_NULL, true, \
     279            "Unallowable operation: psVector %s or its data is NULL.", \
     280            #NAME); \
     281    CLEANUP; \
     282} \
     283
     284#define PS_ASSERT_VECTOR_NON_EMPTY(NAME, RVAL) PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(NAME, return RVAL)
     285#define PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(NAME, CLEANUP) \
     286if ((NAME)->n < 1) { \
     287    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
     288            "Unallowable operation: psVector %s has no elements.", \
     289            #NAME); \
     290    CLEANUP; \
     291} \
     292
     293#define PS_ASSERT_VECTOR_TYPE_F32_OR_F64(NAME, RVAL) \
     294if (((NAME)->type.type != PS_TYPE_F32) && ((NAME)->type.type != PS_TYPE_F64)) { \
     295    psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
     296            "psVector %s: bad type(%d)", \
     297            #NAME, NAME->type.type); \
     298    return(RVAL); \
     299} \
     300
     301#define PS_ASSERT_VECTOR_TYPE_S16_S32_F32(NAME, RVAL) \
     302if (((NAME)->type.type != PS_TYPE_S16) && ((NAME)->type.type != PS_TYPE_S32) && ((NAME)->type.type != PS_TYPE_F32)) { \
     303    psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
     304            "psVector %s: bad type(%d)", \
     305            #NAME, NAME->type.type); \
     306    return(RVAL); \
     307} \
     308
     309#define PS_ASSERT_VECTOR_TYPE(NAME, TYPE, RVAL) \
     310if ((NAME)->type.type != TYPE) { \
     311    psError(PS_ERR_BAD_PARAMETER_TYPE, true, \
     312            "Unallowable operation: psVector %s has incorrect type.", \
     313            #NAME); \
     314    return(RVAL); \
     315}
     316
     317#define PS_ASSERT_VECTORS_SIZE_EQUAL(VEC1, VEC2, RVAL) \
     318if (VEC1->n != VEC2->n) { \
     319    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
     320            "psVector %s has size %d, psVector %s has size %d.", \
     321            #VEC1, VEC1->n, #VEC2, VEC2->n); \
     322    return(RVAL); \
     323}
     324
     325#define PS_ASSERT_VECTOR_SIZE(VEC, SIZE, RVAL) \
     326if (VEC->n != SIZE) { \
     327    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
     328            "psVector %s has size %d, should be %d.", \
     329            #VEC, VEC->n, SIZE); \
     330    return(RVAL); \
     331}
     332
     333#define PS_ASSERT_VECTOR_TYPE_EQUAL(VEC1, VEC2, RVAL) \
     334if (VEC1->type.type != VEC2->type.type) { \
     335    psError(PS_ERR_BAD_PARAMETER_SIZE, true, \
     336            "psVector %s has size %d, psVector %s has size %d.", \
     337            #VEC1, VEC1->type.type, #VEC2, VEC2->type.type); \
     338    return(RVAL); \
     339}
     340
     341#define PS_VECTOR_PRINT_F32(NAME) \
     342if (NAME != NULL) { \
     343    for (int my_i=0;my_i<(NAME)->n;my_i++) { \
     344        printf("%s->data.F32[%d] is %f\n", #NAME, my_i, (NAME)->data.F32[my_i]); \
     345    } \
     346    printf("\n"); \
     347} else {\
     348    printf("MACRO WARNING: vector %s is NULL.\n", #NAME); \
     349}\
     350
     351#define PS_VECTOR_PRINT_F64(NAME) \
     352if (NAME != NULL) { \
     353    for (int my_i=0;my_i<(NAME)->n;my_i++) { \
     354        printf("%s->data.F64[%d] is %f\n", #NAME, my_i, (NAME)->data.F64[my_i]); \
     355    } \
     356    printf("\n"); \
     357} else {\
     358    printf("MACRO WARNING: vector %s is NULL.\n", #NAME); \
     359}\
     360
    271361/// @}
    272362
  • trunk/psLib/src/sys/Makefile.am

    r7380 r7766  
    3030pslibinclude_HEADERS = \
    3131        psAbort.h \
     32        psAssert.h \
    3233        psConfigure.h  \
    3334        psError.h      \
  • trunk/psLib/src/sys/psString.c

    r7653 r7766  
    1313 *  @author David Robbins, MHPCC
    1414 *
    15  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2006-06-23 20:29:39 $
     15 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-06-30 02:20:06 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525#include "psMemory.h"
    2626#include "psError.h"
    27 #include "psConstants.h"
     27#include "psAssert.h"
    2828
    2929#include "psErrorText.h"
  • trunk/psLib/src/types/psHash.c

    r4898 r7766  
    1212*  @author GLG, MHPCC
    1313*
    14 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-08-30 01:14:13 $
     14*  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     15*  @date $Date: 2006-06-30 02:20:06 $
    1616*
    1717*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525#include "psTrace.h"
    2626#include "psError.h"
    27 #include "psConstants.h"
     27#include "psAssert.h"
    2828
    2929#include "psErrorText.h"
  • trunk/psLib/src/types/psLookupTable.c

    r7545 r7766  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-06-13 23:54:57 $
     9*  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-06-30 02:20:06 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    2626#include "psLookupTable.h"
    2727#include "psErrorText.h"
    28 #include "psConstants.h"
     28#include "psAssert.h"
    2929
    3030/******************************************************************************/
  • trunk/psLib/src/types/psMetadata.c

    r7699 r7766  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.114 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2006-06-27 03:42:01 $
     14 *  @version $Revision: 1.115 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2006-06-30 02:20:06 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3737#include "psString.h"
    3838#include "psErrorText.h"
    39 #include "psConstants.h"
     39#include "psAssert.h"
    4040#include "psLogMsg.h"
    4141#include "psTrace.h"
  • trunk/psLib/src/types/psMetadataConfig.c

    r7472 r7766  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-06-10 02:28:17 $
     12*  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-06-30 02:20:06 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3131#include "psMetadata.h"
    3232#include "psMetadataConfig.h"
    33 #include "psConstants.h"
     33#include "psAssert.h"
    3434#include "psErrorText.h"
    3535
  • trunk/psLib/src/types/psMetadataItemParse.c

    r7380 r7766  
    44
    55#include "psMemory.h"
     6#include "psAssert.h"
    67#include "psError.h"
    78#include "psMetadata.h"
  • trunk/psLib/src/xml/psXML.c

    r5841 r7766  
    1010*  @author David Robbins, MHPCC
    1111*
    12 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-12-24 00:33:22 $
     12*  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-06-30 02:20:06 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1717
    1818#include "psXML.h"
     19#include "psAssert.h"
    1920#include <unistd.h>
    2021#include <fcntl.h>
Note: See TracChangeset for help on using the changeset viewer.