1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It is one of the source files comprising zwgc, the Zephyr WindowGram
5 * Created by: Marc Horowitz <marc@athena.mit.edu>
7 * $Id: stack.h,v 1.5 1999/01/22 23:20:33 ghudson Exp $
9 * Copyright (c) 1989 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
15 #include <zephyr/mit-copyright.h>
17 /****************************************************************************/
19 /* A generic stack type based on linked lists: */
21 /****************************************************************************/
23 #ifndef TYPE_T_stack_TYPE
24 #define TYPE_T_stack_TYPE
30 typedef struct _TYPE_T_stack {
31 struct _TYPE_T_stack *next;
35 #define TYPE_T_stack_create() ((struct _TYPE_T_stack *) NULL)
37 #define TYPE_T_stack_empty(stack) (!(stack))
40 #define TYPE_T_stack_top(stack) ((stack) ? (stack)->data :\
41 (abort(),(stack)->data))
43 #define TYPE_T_stack_top(stack) ((stack)->data)
47 #define TYPE_T_stack_pop(stack) { TYPE_T_stack old = (stack);\
53 #define TYPE_T_stack_pop(stack) { TYPE_T_stack old = (stack);\
58 #define TYPE_T_stack_push(stack,object) \
59 { TYPE_T_stack new = (struct _TYPE_T_stack *)\
60 malloc(sizeof (struct _TYPE_T_stack));\