ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
stack.h File Reference
#include "global.h"
#include <stdlib.h>
Include dependency graph for stack.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#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)
 

Functions

typedef STACK (char) chars
 
typedef STACK (int) ints
 
typedef STACK (size_t) sizes
 
typedef STACK (unsigned) unsigneds
 

Macro Definition Documentation

◆ all_pointers

#define all_pointers ( T,
E,
S )
Value:
T *E, *const *E##_PTR = BEGIN_STACK (S), \
*const *const E##_END = END_STACK (S); \
E##_PTR != E##_END && (E = *E##_PTR, true); \
++E##_PTR
#define BEGIN_STACK(S)
Definition stack.h:46
#define END_STACK(S)
Definition stack.h:48

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:
T E, *E##_PTR = BEGIN_STACK (S), *const E##_END = END_STACK (S); \
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

#define BEGIN_STACK ( S)
Value:
(S).begin

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

#define CLEAR_STACK ( S)
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

#define EMPTY_STACK ( S)
Value:
((S).begin == (S).end)

Definition at line 18 of file stack.h.

◆ END_STACK

#define END_STACK ( S)
Value:
(S).end

Definition at line 48 of file stack.h.

◆ FULL_STACK

#define FULL_STACK ( S)
Value:
((S).end == (S).allocated)

Definition at line 17 of file stack.h.

◆ INIT_STACK

#define INIT_STACK ( S)
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:
(BEGIN_STACK (S)[CADICAL_assert ((N) < SIZE_STACK (S)), (N)])
#define CADICAL_assert(ignore)
Definition global.h:14
#define SIZE_STACK(S)
Definition stack.h:19

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

#define POP_STACK ( S)
Value:
(CADICAL_assert (!EMPTY_STACK (S)), *--(S).end)
#define EMPTY_STACK(S)
Definition stack.h:18

Definition at line 37 of file stack.h.

◆ PUSH_STACK

#define PUSH_STACK ( S,
E )
Value:
do { \
if (FULL_STACK (S)) \
ENLARGE_STACK (S); \
*(S).end++ = (E); \
} while (0)
#define FULL_STACK(S)
Definition stack.h:17

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 { \
DEALLOC ((S).begin, CAPACITY_STACK (S)); \
INIT_STACK (S); \
} while (0)
#define CAPACITY_STACK(S)
Definition stack.h:20

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 { \
CADICAL_assert (!EMPTY_STACK (S)); \
T *END_REMOVE_STACK = END_STACK (S); \
T *P_REMOVE_STACK = BEGIN_STACK (S); \
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 { \
CADICAL_assert (BEGIN_STACK (S) <= (P)); \
CADICAL_assert ((P) <= END_STACK (S)); \
if ((P) == END_STACK (S)) \
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

#define SIZE_STACK ( S)
Value:
((size_t) ((S).end - (S).begin))

Definition at line 19 of file stack.h.

◆ STACK

#define STACK ( TYPE)
Value:
struct { \
TYPE *begin; \
TYPE *end; \
TYPE *allocated; \
}
@ TYPE
Definition inflate.h:34

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

#define TOP_STACK ( S)
Value:

Definition at line 27 of file stack.h.

Function Documentation

◆ STACK() [1/4]

typedef STACK ( char )

◆ STACK() [2/4]

typedef STACK ( int )

◆ STACK() [3/4]

typedef STACK ( size_t )

◆ STACK() [4/4]

typedef STACK ( unsigned )

Definition at line 89 of file cadical_kitten.c.

94 {
95 unsigned level;
96 unsigned reason;
97};