list.h Source Code

Go to: Contents; Previous section; Beginning of section; Next file in section; Previous file in section.

Routines In This File (Alphabetical)

 Line Name
----- ----
   53 append_list_entry
   55 copy_list
   45 dec_list_entries
   71 dequeue_entry
   70 enqueue_entry
   93 entry_blink
   94 entry_flink
   44 inc_list_entries
   56 init_list
  106 isbegin_of_list
   57 isempty_list
  107 isend_of_list
  104 isfirst_entry
  105 islast_entry
   41 list_entries
   42 list_first
   43 list_last
   95 next_entry
   64 pop_entry
   54 prepend_list_entry
   96 prev_entry
   63 push_entry
   98 set_entry_blink
   97 set_entry_flink
   46 set_list_first
   47 set_list_last

BEGINNING OF FILE

     1: /****************************************************************************/
     2: /*									    */
     3: /*  FACILITY:	Generic Support Library					    */
     4: /*									    */
     5: /*  MODULE:	List Management						    */
     6: /*									    */
     7: /*  AUTHOR:	Steve Branam, Network Product Support Group, Digital	    */
     8: /*		Equipment Corporation, Littleton, MA, USA.		    */
     9: /*									    */
    10: /*  DESCRIPTION: This header file contains all type definitions for the	    */
    11: /*  generic list object types used by Routine Analyzer. Member access	    */
    12: /*  routines (get/set values) and a number of object management routines    */
    13: /*  are implemented here as macros.					    */
    14: /*									    */
    15: /*  REVISION HISTORY:							    */
    16: /*									    */
    17: /*  V0.1-00 24-AUG-1994 Steve Branam					    */
    18: /*									    */
    19: /*	Original version.						    */
    20: /*									    */
    21: /****************************************************************************/
    22: 
    23: /****************************************************************************/
    24: /*									    */
    25: /* List object type.							    */
    26: /*									    */
    27: /****************************************************************************/
    28: 
    29: typedef struct {
    30:     long    entries;			    /* Number of items in list.	    */
    31:     struct list_entry_hdr		    /* Ptr to first item in list.   */
    32: 	    *head;
    33:     struct list_entry_hdr		    /* Ptr to last item in list.    */
    34: 	    *tail;
    35: } LIST;
    36: 
    37: /*									    */
    38: /* List object member access routines.					    */
    39: /*									    */
    40: 

ROUTINE list_entries. Go to: Next routine in file; Routines in this file.

    41: #define list_entries(l) ((l)->entries)
END list_entries. Go to: Beginning of routine.



ROUTINE list_first. Go to: Next routine in file; Routines in this file.

    42: #define list_first(l) ((l)->head)
END list_first. Go to: Beginning of routine.



ROUTINE list_last. Go to: Next routine in file; Routines in this file.

    43: #define list_last(l) ((l)->tail)
END list_last. Go to: Beginning of routine.



ROUTINE inc_list_entries. Go to: Next routine in file; Routines in this file.

    44: #define inc_list_entries(l) ((l)->entries++)
END inc_list_entries. Go to: Beginning of routine.



ROUTINE dec_list_entries. Go to: Next routine in file; Routines in this file.

    45: #define dec_list_entries(l) ((l)->entries--)
END dec_list_entries. Go to: Beginning of routine.



ROUTINE set_list_first. Go to: Next routine in file; Routines in this file.

    46: #define set_list_first(l, p) ((l)->head = p)
END set_list_first. Go to: Beginning of routine.



ROUTINE set_list_last. Go to: Next routine in file; Routines in this file.

    47: #define set_list_last(l, p) ((l)->tail = p)
END set_list_last. Go to: Beginning of routine.


    48: 
    49: /*									    */
    50: /* List object management routines.					    */
    51: /*									    */
    52: 

ROUTINE append_list_entry. Go to: Next routine in file; Routines in this file.

    53: #define append_list_entry(l, e) insert_list_entry((l), list_last(l), e)
END append_list_entry. Go to: Beginning of routine.



ROUTINE prepend_list_entry. Go to: Next routine in file; Routines in this file.

    54: #define prepend_list_entry(l, e) insert_list_entry((l), NULL, e)
END prepend_list_entry. Go to: Beginning of routine.



ROUTINE copy_list. Go to: Next routine in file; Routines in this file.

    55: #define copy_list(s, d) ((d)->head=(s)->head,(d)->tail=(s)->tail,(d)->entries=(s)->entries)
END copy_list. Go to: Beginning of routine.



ROUTINE init_list. Go to: Next routine in file; Routines in this file.

    56: #define init_list(l) ((l)->head=NULL, (l)->tail=NULL, (l)->entries=0)
END init_list. Go to: Beginning of routine.



ROUTINE isempty_list. Go to: Next routine in file; Routines in this file.

    57: #define isempty_list(l) ((l)->head == NULL)
END isempty_list. Go to: Beginning of routine.


    58: 
    59: /*									    */
    60: /* Treat a list as a stack: last-in, first-out.				    */
    61: /*									    */
    62: 

ROUTINE push_entry. Go to: Next routine in file; Routines in this file.

    63: #define push_entry(s, e) append_list_entry(s, e)
END push_entry. Go to: Beginning of routine.



ROUTINE pop_entry. Go to: Next routine in file; Routines in this file.

    64: #define pop_entry(s) remove_list_entry(s, list_last(s))
END pop_entry. Go to: Beginning of routine.


    65: 
    66: /*									    */
    67: /* Treat a list as a queue: first-in, first-out.			    */
    68: /*									    */
    69: 

ROUTINE enqueue_entry. Go to: Next routine in file; Routines in this file.

    70: #define enqueue_entry(s, e) append_list_entry(s, e)
END enqueue_entry. Go to: Beginning of routine.



ROUTINE dequeue_entry. Go to: Next routine in file; Routines in this file.

    71: #define dequeue_entry(s) remove_list_entry(s, list_first(s))
END dequeue_entry. Go to: Beginning of routine.


    72: 
    73: /****************************************************************************/
    74: /*									    */
    75: /* List entry header object. Application list entry objects are expected to */
    76: /* define the following as the first element of their structures:	    */
    77: /*									    */
    78: /*	LIST_ENTRY_HDR   entry_hdr;					    */
    79: /*									    */
    80: /****************************************************************************/
    81: 
    82: typedef struct list_entry_hdr {
    83:     struct list_entry_hdr		    /* Ptr to next record in list.  */
    84: 	    *flink;
    85:     struct list_entry_hdr		    /* Ptr to previous record.	    */
    86: 	    *blink;
    87: } LIST_ENTRY_HDR;
    88: 
    89: /*									    */
    90: /* Entry header object member access routines.				    */
    91: /*									    */
    92: 

ROUTINE entry_blink. Go to: Next routine in file; Routines in this file.

    93: #define entry_blink(e) ((e)->blink)
END entry_blink. Go to: Beginning of routine.



ROUTINE entry_flink. Go to: Next routine in file; Routines in this file.

    94: #define entry_flink(e) ((e)->flink)
END entry_flink. Go to: Beginning of routine.



ROUTINE next_entry. Go to: Next routine in file; Routines in this file.

    95: #define next_entry(e) ((e) == NULL ? NULL : entry_flink(&((e)->entry_hdr)))
END next_entry. Go to: Beginning of routine.



ROUTINE prev_entry. Go to: Next routine in file; Routines in this file.

    96: #define prev_entry(e) ((e) == NULL ? NULL : entry_blink(&((e)->entry_hdr)))
END prev_entry. Go to: Beginning of routine.



ROUTINE set_entry_flink. Go to: Next routine in file; Routines in this file.

    97: #define set_entry_flink(e, p) (e->flink = p)
END set_entry_flink. Go to: Beginning of routine.



ROUTINE set_entry_blink. Go to: Next routine in file; Routines in this file.

    98: #define set_entry_blink(e, p) (e->blink = p)
END set_entry_blink. Go to: Beginning of routine.


    99: 
   100: /*									    */
   101: /* Entry header object management routines.				    */
   102: /*									    */
   103: 

ROUTINE isfirst_entry. Go to: Next routine in file; Routines in this file.

   104: #define isfirst_entry(e) (entry_blink(e) == NULL)
END isfirst_entry. Go to: Beginning of routine.



ROUTINE islast_entry. Go to: Next routine in file; Routines in this file.

   105: #define islast_entry(e) (entry_flink(e) == NULL)
END islast_entry. Go to: Beginning of routine.



ROUTINE isbegin_of_list. Go to: Next routine in file; Routines in this file.

   106: #define isbegin_of_list(e) (prev_entry(e) == NULL)
END isbegin_of_list. Go to: Beginning of routine.



ROUTINE isend_of_list. Go to: Next routine in file; Routines in this file.

   107: #define isend_of_list(e) (next_entry(e) == NULL)
END isend_of_list. Go to: Beginning of routine.


   108: 

END OF FILE TOTAL: 26 routines, 1 Avg Length

Go to: Contents; Previous section; Beginning of section; Next file in section; Previous file in section.