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:
41: #define list_entries(l) ((l)->entries)END list_entries. Go to: Beginning of routine.
42: #define list_first(l) ((l)->head)END list_first. Go to: Beginning of routine.
43: #define list_last(l) ((l)->tail)END list_last. Go to: Beginning of routine.
44: #define inc_list_entries(l) ((l)->entries++)END inc_list_entries. Go to: Beginning of routine.
45: #define dec_list_entries(l) ((l)->entries--)END dec_list_entries. Go to: Beginning of routine.
46: #define set_list_first(l, p) ((l)->head = p)END set_list_first. Go to: Beginning of routine.
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:
53: #define append_list_entry(l, e) insert_list_entry((l), list_last(l), e)END append_list_entry. Go to: Beginning of routine.
54: #define prepend_list_entry(l, e) insert_list_entry((l), NULL, e)END prepend_list_entry. Go to: Beginning of routine.
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.
56: #define init_list(l) ((l)->head=NULL, (l)->tail=NULL, (l)->entries=0)END init_list. Go to: Beginning of routine.
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:
63: #define push_entry(s, e) append_list_entry(s, e)END push_entry. Go to: Beginning of routine.
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:
70: #define enqueue_entry(s, e) append_list_entry(s, e)END enqueue_entry. Go to: Beginning of routine.
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:
93: #define entry_blink(e) ((e)->blink)END entry_blink. Go to: Beginning of routine.
94: #define entry_flink(e) ((e)->flink)END entry_flink. Go to: Beginning of routine.
95: #define next_entry(e) ((e) == NULL ? NULL : entry_flink(&((e)->entry_hdr)))END next_entry. Go to: Beginning of routine.
96: #define prev_entry(e) ((e) == NULL ? NULL : entry_blink(&((e)->entry_hdr)))END prev_entry. Go to: Beginning of routine.
97: #define set_entry_flink(e, p) (e->flink = p)END set_entry_flink. Go to: Beginning of routine.
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:
104: #define isfirst_entry(e) (entry_blink(e) == NULL)END isfirst_entry. Go to: Beginning of routine.
105: #define islast_entry(e) (entry_flink(e) == NULL)END islast_entry. Go to: Beginning of routine.
106: #define isbegin_of_list(e) (prev_entry(e) == NULL)END isbegin_of_list. Go to: Beginning of routine.
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