IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12596


Ignore:
Timestamp:
Mar 27, 2007, 8:51:23 AM (19 years ago)
Author:
magnier
Message:

adding a generic PS_ASSERT macro to catch known programming errors

Location:
trunk/psLib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/psErrorCodes_en.dat

    r11320 r12596  
    2020BAD_FITS                       file doesn't obey FITS standard
    2121IEEE                           a NaN or Inf was detected
    22 DB_CLIENT                       Database error originated in the client library
    23 DB_SERVER                       Database error generated by the server
     22DB_CLIENT                      Database error originated in the client library
     23DB_SERVER                      Database error generated by the server
     24PROGRAMMING                    Known programming error
  • trunk/psLib/src/sys/psAssert.h

    r12433 r12596  
    1212#include "psError.h"
    1313#include "psLogMsg.h"
     14
     15// these two asserts can be used in the middle of a function to test for programming errors
     16#define PS_ASSERT(VAR, RVAL) \
     17if (!(VAR)) { \
     18    psError(PS_ERR_PROGRAMMING, false, "Error: %s is not true.", #VAR); \
     19    return(RVAL); \
     20}
    1421
    1522// Ensure this is a psLib pointer, by checking for the memblock bounds.
     
    3542}
    3643
     44#define PS_ASSERT_INT_UNEQUAL(NAME1, NAME2, RVAL) \
     45if ((NAME1) == (NAME2)) { \
     46    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
     47            "Error: %s and %s are equal.", \
     48            #NAME1, #NAME2); \
     49    return(RVAL); \
     50}
     51
    3752#define PS_ASSERT_INT_EQUAL(NAME1, NAME2, RVAL) \
    3853if ((NAME1) != (NAME2)) { \
Note: See TracChangeset for help on using the changeset viewer.