Leptonica 1.68
C Image Processing Library

list.h File Reference

Struct for generic double-linked list; macros for list traversal. More...

Go to the source code of this file.

Data Structures

struct  DoubleLinkedList

Defines

#define L_BEGIN_LIST_FORWARD(head, element)
#define L_BEGIN_LIST_REVERSE(tail, element)
#define L_END_LIST   }}

Typedefs

typedef struct DoubleLinkedList DLLIST

Detailed Description

Struct for generic double-linked list; macros for list traversal.

     Cell for double-linked lists

     This allows composition of a list of cells with 
         prev, next and data pointers.  Generic data
         structures hang on the list cell data pointers.

     The list is not circular because that would add much
         complexity in traversing the list under general
         conditions where list cells can be added and removed.
         The only disadvantage of not having the head point to
         the last cell is that the list must be traversed to
         find its tail.  However, this traversal is fast, and
         the listRemoveFromTail() function updates the tail
         so there is no searching overhead with repeated use.

     The list macros are used to run through a list, and their
     use is encouraged.  They are invoked, e.g., as

           DLLIST  *head, *elem;
           ...
           L_BEGIN_LIST_FORWARD(head, elem)
               <do something with elem and/or elem->data >
           L_END_LIST

Definition in file list.h.


Define Documentation

#define L_BEGIN_LIST_FORWARD (   head,
  element 
)
Value:
{ \
        DLLIST   *_leptvar_nextelem_; \
        for ((element) = (head); (element); (element) = _leptvar_nextelem_) { \
            _leptvar_nextelem_ = (element)->next;

Definition at line 59 of file list.h.

#define L_BEGIN_LIST_REVERSE (   tail,
  element 
)
Value:
{ \
        DLLIST   *_leptvar_prevelem_; \
        for ((element) = (tail); (element); (element) = _leptvar_prevelem_) { \
            _leptvar_prevelem_ = (element)->prev;

Definition at line 66 of file list.h.

#define L_END_LIST   }}

Definition at line 73 of file list.h.


Typedef Documentation

typedef struct DoubleLinkedList DLLIST

Definition at line 55 of file list.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines