Changeset 3990 for trunk/psLib/src/dataManip/psConstants.h
- Timestamp:
- May 19, 2005, 1:57:37 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/dataManip/psConstants.h (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psConstants.h
r3884 r3990 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.6 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-05-1 1 22:02:16$8 * @version $Revision: 1.67 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-05-19 23:57:37 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 17 17 * that we ensure that an argument which is expected to be output is 18 18 * 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. 19 23 * 20 24 */ … … 68 72 } 69 73 74 // Return an error if the arg is less than zero. 75 #define PS_INT_CHECK_NEGATIVE(NAME, RVAL) \ 76 if (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. 70 85 #define PS_INT_CHECK_NON_NEGATIVE(NAME, RVAL) \ 71 86 if (NAME < 0) { \ … … 75 90 } 76 91 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. 77 95 #define PS_INT_CHECK_POSITIVE(NAME, RVAL) \ 78 96 if (NAME < 1) { \ … … 82 100 } 83 101 102 // Return an error if the arg is not equal to zero. 103 #define PS_INT_CHECK_NON_ZERO(NAME, RVAL) \ 104 if (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. 84 111 #define PS_INT_CHECK_ZERO(NAME, RVAL) \ 85 if (NAME < 1) { \112 if (NAME == 0) { \ 86 113 psError(PS_ERR_BAD_PARAMETER_VALUE, true, \ 87 114 "Error: %s is 0.", #NAME); \ … … 89 116 } 90 117 118 // Return an error if the arg is lies outside the supplied range. 91 119 #define PS_INT_CHECK_RANGE(NAME, LOWER, UPPER, RVAL) \ 92 120 if ((int)NAME < LOWER || (int)NAME > UPPER) { \ … … 106 134 } 107 135 108 109 136 // Produce an error if ((NAME1 > NAME2) 110 137 #define PS_FLOAT_COMPARE(NAME1, NAME2, RVAL) \ … … 116 143 } 117 144 145 // Generate an error if the two floats are equal. 146 // XXX: Inconsistent naming. 118 147 #define PS_FLOAT_CHECK_NON_EQUAL(NAME1, NAME2, RVAL) \ 119 148 if (fabs(NAME2 - NAME1) < FLT_EPSILON) { \ … … 124 153 } 125 154 155 // Return an error if the arg is lies outside the supplied range. 126 156 #define PS_FLOAT_CHECK_RANGE(NAME, LOWER, UPPER, RVAL) \ 127 157 if ((NAME) < (LOWER) || (NAME) > (UPPER)) { \
Note:
See TracChangeset
for help on using the changeset viewer.
