libbbb  1.2.1
Groups common code used in some applications and libraries.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
lnklst.h File Reference

Contains the definition for LnkLst class. More...

Go to the source code of this file.

Classes

struct  _LnkLst
 header for a linked list More...
 

Macros

#define LnkLst_Prepend(p_head, p_new)
 
#define LnkLst_Extract(p_head, p_it)
 
#define LnkLst_Append(p_head, p_tail, p_new)
 
#define LnkLstT_Prepend(p_head, p_tail, p_new)
 
#define LnkLstT_Extract(p_head, p_tail, p_it)
 

Typedefs

typedef struct _LnkLst LnkLst
 

Functions

int LL_index (LnkLst *p_first, LnkLst *p_item)
 get the index of an item in a list
 

Detailed Description

Contains the definition for LnkLst class.

Date
Nov 2012
Author
TNick

Macro Definition Documentation

#define LnkLst_Append (   p_head,
  p_tail,
  p_new 
)
Value:
assert( ((LnkLst*)p_it) != NULL ); \
p_new->p_next_ = NULL; \
if ( p_tail == NULL ) \
{ \
assert( p_head == NULL ); \
((LnkLst*)p_head) = p_new; \
p_new->p_prev_ = NULL; \
} \
else \
{ \
assert( p_head != NULL ); \
p_tail->p_next_ = p_new; \
p_new->p_prev_ = p_tail; \
} \
p_tail = p_new;
#define LnkLst_Extract (   p_head,
  p_it 
)
Value:
assert( ((LnkLst*)p_it) != NULL ); \
assert( p_head != NULL ); \
if ( ((LnkLst*)p_it)->p_next_ != NULL ) \
{ \
((LnkLst*)p_it)->p_next_->p_prev_ = ((LnkLst*)p_it)->p_prev_; \
} \
if ( ((LnkLst*)p_it)->p_prev_ == NULL ) \
{ \
((LnkLst*)p_head) = ((LnkLst*)p_it)->p_next_; \
} \
else /* ( ((LnkLst*)p_it)->p_prev_ != NULL ) */ \
{ \
((LnkLst*)p_it)->p_prev_->p_next_ = ((LnkLst*)p_it)->p_next_; \
}
#define LnkLst_Prepend (   p_head,
  p_new 
)
Value:
assert( p_new != NULL ); \
p_new->p_prev_ = NULL; \
p_new->p_next_ = ((LnkLst*)p_head); \
if ( p_head != NULL ) \
{ \
assert( ((LnkLst*)p_head)->p_prev_ == NULL ); \
((LnkLst*)p_head)->p_prev_ = p_new; \
} \
((LnkLst*)p_head) = p_new;
#define LnkLstT_Extract (   p_head,
  p_tail,
  p_it 
)
Value:
assert( ((LnkLst*)p_it) != NULL ); \
assert( p_head != NULL ); \
assert( p_tail != NULL ); \
if ( ((LnkLst*)p_it)->p_next_ == NULL ) \
{ \
assert( p_tail == ((LnkLst*)p_it) ); \
p_tail = ((LnkLst*)p_it)->p_prev_; \
} \
else \
{ \
((LnkLst*)p_it)->p_next_->p_prev_ = ((LnkLst*)p_it)->p_prev_; \
} \
if ( ((LnkLst*)p_it)->p_prev_ == NULL ) \
{ \
assert( p_head == p_it) ); \
((LnkLst*)p_head) = ((LnkLst*)p_it)->p_next_; \
} \
else /* ( ((LnkLst*)p_it)->p_prev_ != NULL ) */ \
{ \
((LnkLst*)p_it)->p_prev_->p_next_ = (LnkLst*)p_it->p_next_; \
}
#define LnkLstT_Prepend (   p_head,
  p_tail,
  p_new 
)
Value:
assert( p_new != NULL ); \
p_new->p_prev_ = NULL; \
p_new->p_next_ = ((LnkLst*)p_head); \
if ( p_head == NULL ) \
{ \
assert( p_tail == NULL ); \
p_tail = p_new; \
} \
else /* ( p_head != NULL ) */ \
{ \
assert( p_tail != NULL ); \
assert( ((LnkLst*)p_head)->p_prev_ == NULL ); \
((LnkLst*)p_head)->p_prev_ = p_new; \
} \
p_head = p_new;