#include "global.h"
#include <stdlib.h>
Go to the source code of this file.
|
| #define | STACK(TYPE) |
| |
| #define | FULL_STACK(S) |
| |
| #define | EMPTY_STACK(S) |
| |
| #define | SIZE_STACK(S) |
| |
| #define | CAPACITY_STACK(S) |
| |
| #define | INIT_STACK(S) |
| |
| #define | TOP_STACK(S) |
| |
| #define | PEEK_STACK(S, N) |
| |
| #define | POKE_STACK(S, N, E) |
| |
| #define | POP_STACK(S) |
| |
| #define | PUSH_STACK(S, E) |
| |
| #define | BEGIN_STACK(S) |
| |
| #define | END_STACK(S) |
| |
| #define | CLEAR_STACK(S) |
| |
| #define | RESIZE_STACK(S, NEW_SIZE) |
| |
| #define | SET_END_OF_STACK(S, P) |
| |
| #define | RELEASE_STACK(S) |
| |
| #define | REMOVE_STACK(T, S, E) |
| |
| #define | all_stack(T, E, S) |
| |
| #define | all_pointers(T, E, S) |
| |
|
| typedef | STACK (char) chars |
| |
| typedef | STACK (int) ints |
| |
| typedef | STACK (size_t) sizes |
| |
| typedef | STACK (unsigned) unsigneds |
| |
◆ all_pointers
| #define all_pointers |
( |
| T, |
|
|
| E, |
|
|
| S ) |
Value:
E##_PTR != E##_END && (E = *E##_PTR, true); \
++E##_PTR
Definition at line 99 of file stack.h.
99#define all_pointers(T, E, S) \
100 T *E, *const *E##_PTR = BEGIN_STACK (S), \
101 *const *const E##_END = END_STACK (S); \
102 E##_PTR != E##_END && (E = *E##_PTR, true); \
103 ++E##_PTR
◆ all_stack
| #define all_stack |
( |
| T, |
|
|
| E, |
|
|
| S ) |
Value:
E##_PTR != E##_END && (E = *E##_PTR, true); \
++E##_PTR
Definition at line 94 of file stack.h.
94#define all_stack(T, E, S) \
95 T E, *E##_PTR = BEGIN_STACK (S), *const E##_END = END_STACK (S); \
96 E##_PTR != E##_END && (E = *E##_PTR, true); \
97 ++E##_PTR
◆ BEGIN_STACK
Value:
Definition at line 46 of file stack.h.
◆ CAPACITY_STACK
| #define CAPACITY_STACK |
( |
| S | ) |
|
Value:((size_t) ((S).allocated - (S).begin))
Definition at line 20 of file stack.h.
◆ CLEAR_STACK
Value: do { \
(S).end = (S).begin; \
} while (0)
Definition at line 50 of file stack.h.
50#define CLEAR_STACK(S) \
51 do { \
52 (S).end = (S).begin; \
53 } while (0)
◆ EMPTY_STACK
Value:
Definition at line 18 of file stack.h.
◆ END_STACK
Value:
Definition at line 48 of file stack.h.
◆ FULL_STACK
Value:((S).end == (S).allocated)
Definition at line 17 of file stack.h.
◆ INIT_STACK
Value: do { \
(S).begin = (S).end = (S).allocated = 0; \
} while (0)
Definition at line 22 of file stack.h.
22#define INIT_STACK(S) \
23 do { \
24 (S).begin = (S).end = (S).allocated = 0; \
25 } while (0)
◆ PEEK_STACK
| #define PEEK_STACK |
( |
| S, |
|
|
| N ) |
Value:
#define CADICAL_assert(ignore)
Definition at line 29 of file stack.h.
29#define PEEK_STACK(S, N) \
30 (BEGIN_STACK (S)[CADICAL_assert ((N) < SIZE_STACK (S)), (N)])
◆ POKE_STACK
| #define POKE_STACK |
( |
| S, |
|
|
| N, |
|
|
| E ) |
Value: do { \
PEEK_STACK (S, N) = (E); \
} while (0)
Definition at line 32 of file stack.h.
32#define POKE_STACK(S, N, E) \
33 do { \
34 PEEK_STACK (S, N) = (E); \
35 } while (0)
◆ POP_STACK
Value:
Definition at line 37 of file stack.h.
◆ PUSH_STACK
| #define PUSH_STACK |
( |
| S, |
|
|
| E ) |
Value: do { \
ENLARGE_STACK (S); \
*(S).end++ = (E); \
} while (0)
Definition at line 39 of file stack.h.
39#define PUSH_STACK(S, E) \
40 do { \
41 if (FULL_STACK (S)) \
42 ENLARGE_STACK (S); \
43 *(S).end++ = (E); \
44 } while (0)
◆ RELEASE_STACK
| #define RELEASE_STACK |
( |
| S | ) |
|
Value: do { \
INIT_STACK (S); \
} while (0)
#define CAPACITY_STACK(S)
Definition at line 71 of file stack.h.
71#define RELEASE_STACK(S) \
72 do { \
73 DEALLOC ((S).begin, CAPACITY_STACK (S)); \
74 INIT_STACK (S); \
75 } while (0)
◆ REMOVE_STACK
| #define REMOVE_STACK |
( |
| T, |
|
|
| S, |
|
|
| E ) |
Value: do { \
while (*P_REMOVE_STACK != (E)) { \
P_REMOVE_STACK++; \
CADICAL_assert (P_REMOVE_STACK != END_REMOVE_STACK); \
} \
P_REMOVE_STACK++; \
while (P_REMOVE_STACK != END_REMOVE_STACK) { \
P_REMOVE_STACK[-1] = *P_REMOVE_STACK; \
P_REMOVE_STACK++; \
} \
(S).end--; \
} while (0)
Definition at line 77 of file stack.h.
77#define REMOVE_STACK(T, S, E) \
78 do { \
79 CADICAL_assert (!EMPTY_STACK (S)); \
80 T *END_REMOVE_STACK = END_STACK (S); \
81 T *P_REMOVE_STACK = BEGIN_STACK (S); \
82 while (*P_REMOVE_STACK != (E)) { \
83 P_REMOVE_STACK++; \
84 CADICAL_assert (P_REMOVE_STACK != END_REMOVE_STACK); \
85 } \
86 P_REMOVE_STACK++; \
87 while (P_REMOVE_STACK != END_REMOVE_STACK) { \
88 P_REMOVE_STACK[-1] = *P_REMOVE_STACK; \
89 P_REMOVE_STACK++; \
90 } \
91 (S).end--; \
92 } while (0)
◆ RESIZE_STACK
| #define RESIZE_STACK |
( |
| S, |
|
|
| NEW_SIZE ) |
Value: do { \
const size_t TMP_NEW_SIZE = (NEW_SIZE); \
CADICAL_assert (TMP_NEW_SIZE <=
SIZE_STACK (S)); \
(S).end = (S).begin + TMP_NEW_SIZE; \
} while (0)
Definition at line 55 of file stack.h.
55#define RESIZE_STACK(S, NEW_SIZE) \
56 do { \
57 const size_t TMP_NEW_SIZE = (NEW_SIZE); \
58 CADICAL_assert (TMP_NEW_SIZE <= SIZE_STACK (S)); \
59 (S).end = (S).begin + TMP_NEW_SIZE; \
60 } while (0)
◆ SET_END_OF_STACK
| #define SET_END_OF_STACK |
( |
| S, |
|
|
| P ) |
Value: do { \
break; \
(S).end = (P); \
} while (0)
Definition at line 62 of file stack.h.
62#define SET_END_OF_STACK(S, P) \
63 do { \
64 CADICAL_assert (BEGIN_STACK (S) <= (P)); \
65 CADICAL_assert ((P) <= END_STACK (S)); \
66 if ((P) == END_STACK (S)) \
67 break; \
68 (S).end = (P); \
69 } while (0)
◆ SIZE_STACK
Value:((size_t) ((S).end - (S).begin))
Definition at line 19 of file stack.h.
◆ STACK
Value:
Definition at line 10 of file stack.h.
10#define STACK(TYPE) \
11 struct { \
12 TYPE *begin; \
13 TYPE *end; \
14 TYPE *allocated; \
15 }
◆ TOP_STACK
Value:
Definition at line 27 of file stack.h.
◆ STACK() [1/4]
◆ STACK() [2/4]
◆ STACK() [3/4]
◆ STACK() [4/4]
| typedef STACK |
( |
unsigned | | ) |
|
Definition at line 89 of file cadical_kitten.c.
94 {
95 unsigned level;
96 unsigned reason;
97};