#ifndef _EVENT_H
#define _EVENT_H

/* Events are actually function pointers, and your event is expected to take
** one argument that is a pointer to the object to which the event occurs.
*/

typedef void *Object;
typedef void (*Event)(Object);
typedef double Time;

typedef struct _eventStruct
{
    Time time;
    Event event;    /* pointer to event function that accepts object as param */
    Object object;
} EventInfo;


/* initialize the event list to have max size.  Returns NULL if too big,
** else non-NULL.
*/
int EventListInit(int maxNumEvents);


/* returns pointer to EventInfo (which you can ignore) if OK, else NULL.
*/
EventInfo *EventInsert(Event event, Time delta, Object object);


/* Returns the next event, or NULL if there are none
*/
EventInfo *EventNext(void);

/* Return the current time */
extern Time _event_now;
#define EventNow() _event_now

#endif  /* _EVENT_H */
