/* My MinNode definitions, basically, but with names
 * that I like better for C applications
 */
struct Nod {
   struct Nod *next,*prev;
};

struct Lst {
   struct Nod *head,*tail,*tailprev;
};

/* some macros for dealing with Exec-like lists
 *    HEAD(lst)   struct Lst *lst:  gives first node
 *    TAIL(lst)   struct Lst *lst:  gives last node
 *    NEXT(nod)   struct Nod *nod:  gives next element
 *    PREV(nod)   struct Nod *nod:  gives previous element
 *    TEST(nod)   struct Nod *nod:  is non-zero for valid nodes
 *    OFF1(nod)   struct Nod *nod:  offsets backward one node
 */
#define HEAD(lst)    (void *)(((struct Lst*)(lst))->head)
#define TAIL(lst)    (void *)(((struct Lst*)(lst))->tailprev)
#define NEXT(nod)    (void *)(((struct Nod *)(nod))->next)
#define PREV(nod)    (void *)(((struct Nod *)(nod))->prev)
#define TEST(nod)    NEXT(nod)
#define OFF1(nod)    (void *)((char *)(nod)-sizeof(struct Nod))
