/usr/include/yalecad/deck.h is in libycadgraywolf-dev 0.1.4+20170307gite1bf319-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | /* -----------------------------------------------------------------
DESCRIPTION:Insert file for deck library routines. Add & subtract
members from a top/bottom of doubly-linked list. Multiple decks may
occur simultaneously. The complexity of the routines are as follows.
Ydeck_top : O(1)
Ydeck_bottom : O(1)
Ydeck_up : O(1)
Ydeck_down : O(1)
Ydeck_pop : O(1)
Ydeck_push : O(1)
Ydeck_enqueue : O(1)
Ydeck_dequeue : O(1)
Ydeck_getTop : O(1)
Ydeck_getBottom : O(1)
Ydeck_getData : O(1)
Ydeck_size : O(1)
Ydeck_init : O(1)
Ydeck_empty : O(n)
Ydeck_free : O(n)
----------------------------------------------------------------- */
#ifndef DECK_H
#define DECK_H
#ifndef lint
static char YdeckId[] = "@(#) deck.h (Yale) version 1.16 1/22/92" ;
#endif
#include <yalecad/base.h>
#include <yalecad/message.h>
/* *********** data structures *************** */
typedef struct Ydeck_info {
VOIDPTR data;
struct Ydeck_info *up ;
struct Ydeck_info *down ;
} YCARD, *YCARDPTR ;
typedef struct {
INT size ; /* size of list */
YCARDPTR top ;
YCARDPTR bottom ;
YCARDPTR current ;
} YDECK, *YDECKPTR ;
/* *********** list macros ***************** */
#define Ydeck_up( deck_xyz ) (deck_xyz->current = deck_xyz->current->up)
/*
Arguments:
YDECK *deck_xyz ;
Function:
Returns element above the current element in the deck.
*/
#define Ydeck_down( deck_xyz ) (deck_xyz->current = deck_xyz->current->down)
/*
Arguments:
YDECK *deck_xyz ;
Function:
Returns the element below the current element in the deck.
*/
#define Ydeck_top( deck_xyz ) (deck_xyz->current = deck_xyz->top)
/*
Arguments:
YDECK *deck_xyz ;
Function:
Returns the top of the deck and resets position to head.
*/
#define Ydeck_bottom( deck_xyz ) ( deck_xyz->current = deck_xyz->bottom )
/*
Arguments:
YDECK *deck_xyz ;
Function:
Returns the bottom of the deck and resets position to bottom.
*/
#define Ydeck_size( deck_xyz ) (deck_xyz->size)
/*
Arguments:
YDECK *deck_xyz ;
Function:
Returns the number of elements in the deck
*/
#define Ydeck_getData( deck_xyz ) (deck_xyz->current->data)
/*
Arguments:
YDECK *deck_xyz ;
Function:
Returns a pointer to data stored on current card
*/
#define Ydeck_notEnd( deck_xyz ) (deck_xyz->current != Ydeck_sentinel())
/*
Arguments:
YDECK *deck_xyz ;
Function:
returns true if current card is the end of the deck. This is
useful if the user wishes to make his own loop.
eg) for(Ydeck_top(); Ydeck_notEnd() ; Ydeck_down() ) {
operations on Ydeck_getData();
}
*/
#define Ydeck_getTop( deck_xyz ) (deck_xyz->top->data)
/*
Arguments:
YDECK *deck_xyz ;
Function:
Returns a pointer to data stored on the top card
*/
#define Ydeck_getBottom( deck_xyz ) (deck_xyz->bottom->data)
/*
Arguments:
YDECK *deck_xyz ;
Function:
Returns a pointer to data stored on the bottom card
*/
/* *********** deck routines *************** */
extern YDECK *Ydeck_init( /* */ ) ;
/*
Arguments:
none.
Function:
Initialize deck structure and return pointer to deck memory.
*/
extern VOID Ydeck_push( P2( YDECK *deck, VOIDPTR data ) ) ;
/*
Arguments:
YDECK *deck ;
VOIDPTR data ;
Function:
Add a new element to top of the deck. User is required to maintain
memory of the data element.
*/
extern VOID Ydeck_enqueue( P2( YDECK *deck, VOIDPTR data ) ) ;
/*
Arguments:
YDECK *deck ;
VOIDPTR data ;
Function:
Add a new element to bottom of the deck. User is required to maintain
memory of the data element.
*/
extern VOIDPTR Ydeck_pop( P1(YDECK *deck) ) ;
/*
Arguments:
YDECK *deck ;
Function:
Delete top item from deck. If item does not exist does nothing unless
debug switch has been turned on. User is required to maintain
memory of the data element.
Returns data (interger or pointer) stored on card.
*/
extern VOIDPTR Ydeck_dequeue( P1(YDECK *deck) ) ;
/*
Arguments:
YDECK *deck ;
Function:
Delete bottom item from deck. If item does not exist does nothing unless
debug switch has been turned on. User is required to maintain
memory of the data element.
Returns data (interger or pointer) stored on card.
*/
extern VOID Ydeck_dump ( P2( YDECK *deckPtr, VOID (*userPrint)() ) );
/*
Arguments:
YDECK *deckPt ;
INT (*userPrint)();
Function:
For each data item in the deck, call the user print function.
*/
extern VOID Ydeck_empty( P2( YDECK *deck, VOID (*userDelete)() ) ) ;
/*
Arguments:
YDECK *deck ;
(*userDelete)();
Function:
Frees deck memory. User userdelete function is used to free data
if desired. Deck structure remains but links are removed.
Should be used if deck is to be used again.
*/
extern VOID Ydeck_free( P2( YDECK *deck, VOID (*userDelete)() ) ) ;
/*
Arguments:
YDECK *deck ;
(*userdelete)();
Function:
Frees deck memory. User userdelete function is used to free data
*/
extern YCARD *Ydeck_sentinel();
/* Arguments:
none
Function:
returns address of deck sentinel. normally this is not used directly
by the user. Use macro YNOTDECKEND
*/
extern int Ydeck_verify(P1(YDECK *deck));
#endif /* DECK_H */
|