/* The following is an array cluster to abstract away the ring data */
/* structure.  This should handle resizes, creation, destruction, etc */
/* of the data ring */


/* next and prev increment and decrement indices (returns the index). */
/*  current returns the value that's held in the curr_idx place in the array */

#define Next(dataring, i) (((i) == (dataring.max_idx - 1)) ? 0 : ((i) + 1))
#define Prev(dataring, i) (((i) == 0) ? (dataring.max_idx - 1) : ((i) - 1))
#define Current(dataring, i) (dataring.data[i])

typedef struct {
  int		max_idx;	/* max # data points in the ring */
  int		curr_idx;	/* current index in the array */
  double*  	data;		/* array of data in the array */
} ringarray;

ringarray 	dataring;

static void CreateDataRing(), ResizeDataRing(), DestroyDataRing(), AddData();

static void CreateDataRing(.....)
     will take 2 parameters - the dataring and the
       max length of the array - XtMalloc will be used to create the array.

static void DestroyDataRing(.....)
     will take a dataring and use XtFree to free the memory

static void ResizeDataRing(........)
     will take 2 parameters - the dataring and the old max_idx.
       The procedure will do the following...

       1) move the usable data from wherever it is in the array to 
          data[0] to data[max_idx - 1]
       2) realloc
       3) determine if dataring.max_idx > than the old max_idx.  If so,
          bzero from data[old max_idx] to data[max_idx] (to get rid of
	  garbage)

static void AddData (.......)
     will take 2 parameters - the dataring and the data to enter
       1) increment curr_idx
       2) put data into data[curr_idx]




