95 return ((
t_stack*)d)->count == 0;
252 return "ARRAY_STACK_UP";
254 return "ARRAY_STACK_DOWN";
273 printf(
"%s {max: %d} {size: %d} {top: %d} {type: %s} \n[",s->
name,
282 }
while(i != s->
top);
305 if ((idx < 0) || (idx >= s->
count)) {
342 while (s->
empty(s) !=
true) {
343 s->
free(s->
pop(s), __FILE__, __LINE__);
t_gen create_link_list(char *name, e_lltype type, t_dparams *prm)
Create an instance of link list
@ eSINGLE_LINKLIST
Singly Link list
#define LOG_WARN(mod, fmt, args...)
#define free_mem(mem_addr)
#define get_mem(nmemb, size)
t_gen stack_peek(t_gen d, int idx)
t_gen stack_pop_ll(t_gen d)
Pop an element from a link list based stack
t_gen stack_push_arr_down(t_gen d, t_gen data)
Push an element into down growing stack
t_gen create_stack(char *name, int max_size, e_stacktype stype, t_dparams *prm)
Create an instance of stack
int stack_size(t_gen d)
get stack size
t_gen stack_pop_arr_down(t_gen d)
Pop an element from down growing ll stack
void stack_print(t_gen d)
print_stack_info
t_gen stack_push_arr_up(t_gen d, t_gen data)
Push an element into up growing stack
bool is_stack_empty(t_gen d)
Check stack empty
void destroy_stack(t_gen d)
Destroy instance of the stack
bool is_stack_full(t_gen d)
Check stack full
f_gen2 stack_push[]
Look Up function ptrs for pushing to stack.
t_gen stack_push_ll(t_gen d, t_gen data)
Push an element into a link list based stack
f_gen stack_pop[]
Look Up function ptrs for poping to stack.
t_gen stack_pop_arr_up(t_gen s)
Pop an element from up growing stack
Contains declations of stack types, operations and structure.
e_stacktype
types of supported stacks
@ eARRAY_STACK
Top Growing Stack.
@ eLL_STACK
LinkList based Stack.
@ eARRAY_STACK_DOWN
Down Growing Stack.
f_free free
Routine used for freeing elements of said data.
f_print print_data
Routine used for printing elem data.
Link List main structure.
f_ins add
routine to Add elem at begin of link list
f_get_idx get_idx
routine to get node at idx
f_print print
routine to print the link list
f_destroy destroy
routine destroy the link list instance
f_del_idx del_idx
routine to del node at idx
f_gen get_node_data
routine to get data in given node
f_len len
routine to get len of stack
f_vgen destroy
routine to destroy stack contents
f_print print
routine to print stack contents
f_gen2 push
stack operations
char * name
Stack instance name.
f_empty empty
routine to check if stack is empty
f_free free
routies for operating on data
f_genidx peek
routine to peek elements in stack
int max_size
Max Size of stack.
f_full full
routine to check if stack is full
e_stacktype type
Stack Type.
int count
Total elems present in stack.
f_gen pop
routine to pop element into stack
t_gen(* f_gen2)(t_gen, t_gen)
fn ptr that takes two gen ptr and return gen ptr
void * t_gen
Base Data type used for all data structure and data elements.
t_gen(* f_gen)(t_gen)
Generic data pointer definitions that are common to most data structure operations.