mei_rt2mei_rt2_fix_1meiyap-rt1rt2
Last change
on this file since b5a3da4 was
da5afdf,
checked in by Mei <mei@…>, 13 years ago
|
1) add static contraint
(limited to integer at this time)
|
-
Property mode set to
100644
|
File size:
954 bytes
|
Rev | Line | |
---|
[e95d652] | 1 | #ifndef __STACK_H__ |
---|
| 2 | #define __STACK_H__ |
---|
| 3 | |
---|
| 4 | #include "utlist.h" |
---|
| 5 | |
---|
| 6 | typedef struct _abac_stack_t abac_stack_t; |
---|
| 7 | typedef struct _abac_stack_element_t abac_stack_element_t; |
---|
| 8 | |
---|
| 9 | struct _abac_stack_element_t { |
---|
| 10 | void *ptr; |
---|
| 11 | abac_stack_element_t *prev, *next; |
---|
| 12 | }; |
---|
| 13 | |
---|
| 14 | struct _abac_stack_t { |
---|
| 15 | abac_stack_element_t *elts; |
---|
| 16 | int size; |
---|
| 17 | }; |
---|
| 18 | |
---|
| 19 | abac_stack_t *abac_stack_new(void); |
---|
| 20 | void abac_stack_push(abac_stack_t *stack, void *elt); |
---|
[da5afdf] | 21 | void abac_stack_unique_push(abac_stack_t *stack, void *elt); |
---|
[e95d652] | 22 | void *abac_stack_pop(abac_stack_t *stack); |
---|
| 23 | int abac_stack_size(abac_stack_t *stack); |
---|
| 24 | void abac_stack_free(abac_stack_t *stack); |
---|
| 25 | |
---|
| 26 | #define abac_stack_foreach(STACK, CURRENT, BODY) do { \ |
---|
| 27 | abac_stack_element_t *_elt; \ |
---|
| 28 | DL_FOREACH(STACK->elts, _elt) { \ |
---|
| 29 | CURRENT = (typeof(CURRENT))_elt->ptr; \ |
---|
| 30 | BODY \ |
---|
| 31 | } \ |
---|
| 32 | } while (0) |
---|
| 33 | |
---|
| 34 | #endif /* __STACK_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.