depanalysis: fix segfault, remove some warnings
[lttv.git] / lttv / modules / text / sstack.h
CommitLineData
8c108c1c
PMF
1#ifndef SSTACK_H
2#define SSTACK_H
3
4#define SSTACK_TYPE_PUSH 1
5#define SSTACK_TYPE_POP 2
6#define SSTACK_TYPE_EVENT 3
7
8//#define SSTACK_PUSH_VAL(i) (()i->data_val)
9
10/* An item of a struct sstack, that describes a stack operation */
11
12struct sstack_item {
13 /* state flags */
14 unsigned char finished;
15 unsigned char processable;
16 unsigned char deletable;
17
18 /* Type of operation: SSTACK_TYPE_PUSH, SSTACK_TYPE_POP or SSTACK_TYPE_EVENT */
19 int data_type;
20 /* private, application-dependant data */
21 void *data_val;
22
23 /* Function to call to delete data_val */
24 void (*delete_data_val)(void *data_val);
25
26 /* The index of the corresponding push (for a pop) or pop (for a push) */
27 int pushpop;
28
29 /* Does this item require that we wait for its pop to process it */
30 int wait_pop;
31
32 GArray *depends;
33 GArray *rev_depends;
34};
35
36/* external debugging function to print the private data of an item */
37extern void (*print_sstack_item_data)(struct sstack_item *);
38
39/* An actual sstack */
40
41struct sstack {
42 GArray *array;
43
44 /* Stack of the indexes of the pushes that have been done. An index is popped when the
45 * corresponding pop is added to the sstack. This enables us to find the index of the
46 * last push.
47 */
48 GArray *pushes;
49
50 /* Stack of 0's and 1's. 0: don't wait for pop to process the children
51 * 1: wait for pop to process its children
52 */
53 GArray *wait_pop_stack;
54
55 /* Next item we must try to process */
56 int proc_index;
57
58 void (*process_func)(void *arg, struct sstack_item *item);
59 void *process_func_arg; /* the pointer passed as the "arg" argument of process_func */
60};
61
62struct sstack_item *sstack_new_item();
63
64void sstack_add_item(struct sstack *stack, struct sstack_item *item);
65
66struct sstack *sstack_new(void);
67struct sstack_item *sstack_item_new(void);
68struct sstack_item *sstack_item_new_push(unsigned char finished);
69struct sstack_item *sstack_item_new_pop(void);
70struct sstack_item *sstack_item_new_evt(void);
71
b1d18041
PMF
72extern void print_stack(struct sstack *stack);
73
8c108c1c 74#endif /* SSTACK_H */
This page took 0.025086 seconds and 4 git commands to generate.