#include <exec/memory.h>

#define MEMFLAGS    MEMF_CLEAR

/*
 *  Macros for making and freeing data structures
 */

#define NEW(s,p)    (p=(struct s *)AllocMem(sizeof(struct s),MEMFLAGS))
#define FREE(s,p)   (FreeMem(p,sizeof(struct s)))

typedef struct ScreenListItem   *SLISTITEM;
typedef struct WindowListItem   *WLISTITEM;


/*
 *  ScreenListItem
 *
 *  This item stores information about a screen that has sWindows open on it.
 */

struct ScreenListItem
{
   SLISTITEM Next,Prev;      /* linked list pointers */
   struct Screen *Screen;    /* the Intuition screen in use */
   APTR CloseTask;           /* the task waiting to close the window, or NULL */
   ULONG CloseSignal;        /* the Signal for this task */
   WORD UseCount;            /* the number of sWindows on this screen */
};


/*
 *  WindowListItem
 *
 *  The item stores information about each window opened by sWindows
 */

struct WindowListItem
{
   WLISTITEM Next,Prev;     /* linked list pointers */
   struct Window *Window;   /* the window that sWindows opened */
   SLISTITEM Screen;        /* pointer to a ScreenListItem for the screen */
};                          /*  where the window was opened */

extern APTR AllocMem();
