GTGStack.h
Go to the documentation of this file.
#ifndef GTG_STACK_H
#define GTG_STACK_H
#include "GTGList.h"
typedef struct gtg_list gtg_stack;
typedef gtg_stack* gtg_stack_t;
#define GTG_STACK_INIT(ptr) GTG_LIST_INIT(ptr)
#define GTG_STACK(ptr) GTG_LIST(ptr)
#define gtg_stack_entry(ptr, type, member) gtg_list_entry(ptr, type, member)
static inline void gtg_stack_push(gtg_stack_t lnew, gtg_stack_t p_stack)
{
gtg_list_add_tail(lnew, p_stack);
}
static inline void gtg_stack_pop(gtg_stack_t p_stack)
{
gtg_list_del(p_stack->prev);
}
static inline gtg_stack_t gtg_stack_top(gtg_stack_t p_stack)
{
return p_stack->prev;
}
static inline int gtg_stack_empty(gtg_stack_t p_stack)
{
return p_stack->prev == p_stack;
}
#endif /* GTG_STACK_H */
GTGList.h
gtg_list_del
static void gtg_list_del(gtg_list_t entry)
delete an entry from its list and reinitialize it.
Definition GTGList.h:99
gtg_list_add_tail
static void gtg_list_add_tail(gtg_list_t lnew, gtg_list_t head)
Insert a new entry before the specified head (ie. at the tail of the list).
Definition GTGList.h:76
gtg_stack_pop
static void gtg_stack_pop(gtg_stack_t p_stack)
Definition GTGStack.h:20
gtg_stack
struct gtg_list gtg_stack
Definition GTGStack.h:6
gtg_stack_top
static gtg_stack_t gtg_stack_top(gtg_stack_t p_stack)
Definition GTGStack.h:25
gtg_stack_push
static void gtg_stack_push(gtg_stack_t lnew, gtg_stack_t p_stack)
Definition GTGStack.h:15
gtg_stack_empty
static int gtg_stack_empty(gtg_stack_t p_stack)
Definition GTGStack.h:30
gtg_stack_t
gtg_stack * gtg_stack_t
Definition GTGStack.h:7
gtg_list
Definition GTGList.h:4
gtg_list::prev
struct gtg_list * prev
Definition GTGList.h:5