Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

intkeymacros.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #define KEYMACROS_H "$Id$\n"
  2. #ifdef ZODB_64BIT_INTS
  3. /* PY_LONG_LONG as key */
  4. #define NEED_LONG_LONG_SUPPORT
  5. #define NEED_LONG_LONG_KEYS
  6. #define KEY_TYPE PY_LONG_LONG
  7. #define KEY_CHECK longlong_check
  8. #define COPY_KEY_TO_OBJECT(O, K) O=longlong_as_object(K)
  9. #define COPY_KEY_FROM_ARG(TARGET, ARG, STATUS) \
  10. if (!longlong_convert((ARG), &TARGET)) \
  11. { \
  12. (STATUS)=0; (TARGET)=0; \
  13. }
  14. #else
  15. /* C int as key */
  16. #define KEY_TYPE int
  17. #define KEY_CHECK INT_CHECK
  18. #define COPY_KEY_TO_OBJECT(O, K) O=INT_FROM_LONG(K)
  19. #define COPY_KEY_FROM_ARG(TARGET, ARG, STATUS) \
  20. if (INT_CHECK(ARG)) { \
  21. long vcopy = INT_AS_LONG(ARG); \
  22. if (PyErr_Occurred()) { (STATUS)=0; (TARGET)=0; } \
  23. else if ((int)vcopy != vcopy) { \
  24. PyErr_SetString(PyExc_TypeError, "integer out of range"); \
  25. (STATUS)=0; (TARGET)=0; \
  26. } \
  27. else TARGET = vcopy; \
  28. } else { \
  29. PyErr_SetString(PyExc_TypeError, "expected integer key"); \
  30. (STATUS)=0; (TARGET)=0; }
  31. #endif
  32. #undef KEY_TYPE_IS_PYOBJECT
  33. #define TEST_KEY_SET_OR(V, K, T) if ( ( (V) = (((K) < (T)) ? -1 : (((K) > (T)) ? 1: 0)) ) , 0 )
  34. #define DECREF_KEY(KEY)
  35. #define INCREF_KEY(k)
  36. #define COPY_KEY(KEY, E) (KEY=(E))
  37. #define MULTI_INT_UNION 1