| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

event_iterate

#include "smtlib.h"
EVENT *
event_iterate (
    QUEUE *queue,                       /*  Queue to search                  */
    EVENT *event                        /*  Event, or null for first         */
)

Synopsis

Returns the first or next event in the queue. If the 'after' argument is null, returns the first event, else returns the next event. You should not 'walk' the event queue directly, since the implementation may change arbitrarily. Returns a pointer to the next event, or null if no (further) events were found. May set smt_errno to one of:
SMT NOTREADY smt_init() was not called, or failed
SMT QUEUEISEMPTY The queue was empty

Source Code - (smtlib.c)

{
#if (defined (SMT_TRACE))
    trace ("event_iterate");
#endif
    ASSERT (queue);
    if (!smt_alive)                     /*  If SMT API was not correctly     */
      {                                 /*    initialised, forget it         */
        smt_errno = SMT_NOTREADY;
        return (NULL);
      }

    /*  If no event specified, get first event in queue                      */
    if (event == NULL)
        event = (EVENT *) &queue-> events;

    event = event-> next;               /*  Get next event in queue          */
    if (event == (EVENT *) &queue-> events)
      {
        smt_errno = SMT_QUEUEISEMPTY;
        return (NULL);
      }
    return (event);
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation