1 | /*------------------------------------------------------------------------- |
2 | * |
3 | * sdir.h |
4 | * POSTGRES scan direction definitions. |
5 | * |
6 | * |
7 | * Portions Copyright (c) 1996-2019, 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 | |
18 | /* |
19 | * ScanDirection was an int8 for no apparent reason. I kept the original |
20 | * values because I'm not sure if I'll break anything otherwise. -ay 2/95 |
21 | */ |
22 | typedef enum ScanDirection |
23 | { |
24 | BackwardScanDirection = -1, |
25 | NoMovementScanDirection = 0, |
26 | ForwardScanDirection = 1 |
27 | } ScanDirection; |
28 | |
29 | /* |
30 | * ScanDirectionIsValid |
31 | * True iff scan direction is valid. |
32 | */ |
33 | #define ScanDirectionIsValid(direction) \ |
34 | ((bool) (BackwardScanDirection <= (direction) && \ |
35 | (direction) <= ForwardScanDirection)) |
36 | |
37 | /* |
38 | * ScanDirectionIsBackward |
39 | * True iff scan direction is backward. |
40 | */ |
41 | #define ScanDirectionIsBackward(direction) \ |
42 | ((bool) ((direction) == BackwardScanDirection)) |
43 | |
44 | /* |
45 | * ScanDirectionIsNoMovement |
46 | * True iff scan direction indicates no movement. |
47 | */ |
48 | #define ScanDirectionIsNoMovement(direction) \ |
49 | ((bool) ((direction) == NoMovementScanDirection)) |
50 | |
51 | /* |
52 | * ScanDirectionIsForward |
53 | * True iff scan direction is forward. |
54 | */ |
55 | #define ScanDirectionIsForward(direction) \ |
56 | ((bool) ((direction) == ForwardScanDirection)) |
57 | |
58 | #endif /* SDIR_H */ |
59 | |