2
0

sdir.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*-------------------------------------------------------------------------
  2. *
  3. * sdir.h
  4. * POSTGRES scan direction definitions.
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/access/sdir.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef SDIR_H
  15. #define SDIR_H
  16. /*
  17. * ScanDirection was an int8 for no apparent reason. I kept the original
  18. * values because I'm not sure if I'll break anything otherwise. -ay 2/95
  19. */
  20. typedef enum ScanDirection
  21. {
  22. BackwardScanDirection = -1,
  23. NoMovementScanDirection = 0,
  24. ForwardScanDirection = 1
  25. } ScanDirection;
  26. /*
  27. * ScanDirectionIsValid
  28. * True iff scan direction is valid.
  29. */
  30. #define ScanDirectionIsValid(direction) \
  31. ((bool) (BackwardScanDirection <= (direction) && \
  32. (direction) <= ForwardScanDirection))
  33. /*
  34. * ScanDirectionIsBackward
  35. * True iff scan direction is backward.
  36. */
  37. #define ScanDirectionIsBackward(direction) \
  38. ((bool) ((direction) == BackwardScanDirection))
  39. /*
  40. * ScanDirectionIsNoMovement
  41. * True iff scan direction indicates no movement.
  42. */
  43. #define ScanDirectionIsNoMovement(direction) \
  44. ((bool) ((direction) == NoMovementScanDirection))
  45. /*
  46. * ScanDirectionIsForward
  47. * True iff scan direction is forward.
  48. */
  49. #define ScanDirectionIsForward(direction) \
  50. ((bool) ((direction) == ForwardScanDirection))
  51. #endif /* SDIR_H */