IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 19, 2005, 1:57:37 PM (21 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psConstants.h

    r3884 r3990  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-05-11 22:02:16 $
     8 *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-05-19 23:57:37 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1717 *  that we ensure that an argument which is expected to be output is
    1818 *  psFree'ed before reurning NULL.
     19 *
     20 *  XXX: The macros have a name similar to PS_CHECK_CONDITION() and generally
     21 *  throw a psError if the CONDITION is true.  However, some throw the error
     22 *  if the CONDITION is false.  This should be consistant.
    1923 *
    2024 */
     
    6872}
    6973
     74// Return an error if the arg is less than zero.
     75#define PS_INT_CHECK_NEGATIVE(NAME, RVAL) \
     76if (NAME < 0) { \
     77    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
     78            "Error: %s is less than 0.", #NAME); \
     79    return(RVAL); \
     80}
     81
     82// Return an error if the arg is less than zero.
     83// XXX: This naming scheme is opposite most other macros.  This should be
     84// corrected as soon as a fresh checkin/out can be performed.
    7085#define PS_INT_CHECK_NON_NEGATIVE(NAME, RVAL) \
    7186if (NAME < 0) { \
     
    7590}
    7691
     92// Return an error if the arg is less than or equal to zero.
     93// XXX: This naming scheme is opposite most other macros.  This should be
     94// corrected as soon as a fresh checkin/out can be performed.
    7795#define PS_INT_CHECK_POSITIVE(NAME, RVAL) \
    7896if (NAME < 1) { \
     
    82100}
    83101
     102// Return an error if the arg is not equal to zero.
     103#define PS_INT_CHECK_NON_ZERO(NAME, RVAL) \
     104if (NAME != 0) { \
     105    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
     106            "Error: %s is 0.", #NAME); \
     107    return(RVAL); \
     108}
     109
     110// Return an error if the arg is equal to zero.
    84111#define PS_INT_CHECK_ZERO(NAME, RVAL) \
    85 if (NAME < 1) { \
     112if (NAME == 0) { \
    86113    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
    87114            "Error: %s is 0.", #NAME); \
     
    89116}
    90117
     118// Return an error if the arg is lies outside the supplied range.
    91119#define PS_INT_CHECK_RANGE(NAME, LOWER, UPPER, RVAL) \
    92120if ((int)NAME < LOWER || (int)NAME > UPPER) { \
     
    106134}
    107135
    108 
    109136// Produce an error if ((NAME1 > NAME2)
    110137#define PS_FLOAT_COMPARE(NAME1, NAME2, RVAL) \
     
    116143}
    117144
     145// Generate an error if the two floats are equal.
     146// XXX: Inconsistent naming.
    118147#define PS_FLOAT_CHECK_NON_EQUAL(NAME1, NAME2, RVAL) \
    119148if (fabs(NAME2 - NAME1) < FLT_EPSILON) { \
     
    124153}
    125154
     155// Return an error if the arg is lies outside the supplied range.
    126156#define PS_FLOAT_CHECK_RANGE(NAME, LOWER, UPPER, RVAL) \
    127157if ((NAME) < (LOWER) || (NAME) > (UPPER)) { \
Note: See TracChangeset for help on using the changeset viewer.