source: libabac/abac_stack.h @ 9b43fc3

mei_rt2mei_rt2_fix_1
Last change on this file since 9b43fc3 was 7b548fa, checked in by Mei <mei@…>, 12 years ago

1) add time static constraint
2) add example balltime_rt2_typed
3) change the way that time is being kept

from 20120228T080000 to time(2012,2,28,8,0,0) and
the constraint check is via compare(op,time1,time2)

  • Property mode set to 100644
File size: 953 bytes
Line 
1#ifndef __STACK_H__
2#define __STACK_H__
3
4#include "utlist.h"
5
6typedef struct _abac_stack_t abac_stack_t;
7typedef struct _abac_stack_element_t abac_stack_element_t;
8
9struct _abac_stack_element_t {
10    void *ptr;
11    abac_stack_element_t *prev, *next;
12};
13
14struct _abac_stack_t {
15    abac_stack_element_t *elts;
16    int size;
17};
18
19abac_stack_t *abac_stack_new(void);
20void abac_stack_push(abac_stack_t *stack, void *elt);
21int abac_stack_unique_push(abac_stack_t *stack, void *elt);
22void *abac_stack_pop(abac_stack_t *stack);
23int abac_stack_size(abac_stack_t *stack);
24void 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.