From: Adam Dickmeiss Date: Wed, 10 Jan 2007 13:25:46 +0000 (+0000) Subject: Implemented ZOOM_connection_peek_event. X-Git-Tag: YAZ.2.1.46~8 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=52741a76f17524da0bc416fe82db69eda7700797 Implemented ZOOM_connection_peek_event. --- diff --git a/include/yaz/zoom.h b/include/yaz/zoom.h index 1128239..3295eb0 100644 --- a/include/yaz/zoom.h +++ b/include/yaz/zoom.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: zoom.h,v 1.42 2007-01-09 13:56:48 adam Exp $ */ +/* $Id: zoom.h,v 1.43 2007-01-10 13:25:46 adam Exp $ */ /** * \file zoom.h @@ -449,6 +449,17 @@ ZOOM_API(int) +/** \brief peek at next event + \param c connection + \returns ZOOM_EVENT_NONE (for no events in queue), ZOOM_EVENT_CONNECT, .. + + Does not actually remove the event from the event queue. ZOOM_event and + ZOOM_process_event removes one event. +*/ + +ZOOM_API(int) + ZOOM_connection_peek_event(ZOOM_connection c); + ZOOM_END_CDECL /* * Local variables: diff --git a/src/zoom-c.c b/src/zoom-c.c index 1888229..3563ab5 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: zoom-c.c,v 1.105 2007-01-09 13:56:48 adam Exp $ + * $Id: zoom-c.c,v 1.106 2007-01-10 13:25:46 adam Exp $ */ /** * \file zoom-c.c @@ -103,6 +103,12 @@ static ZOOM_Event ZOOM_connection_get_event(ZOOM_connection c) return event; } +int ZOOM_connection_peek_event(ZOOM_connection c) +{ + ZOOM_Event event = c->m_queue_front; + + return event ? event->kind : ZOOM_EVENT_NONE; +} static void set_dset_error(ZOOM_connection c, int error, const char *dset, @@ -1244,7 +1250,7 @@ static zoom_ret ZOOM_connection_send_init(ZOOM_connection c) odr_prepend(c->odr_out, "ZOOM-C", ireq->implementationName)); - version = odr_strdup(c->odr_out, "$Revision: 1.105 $"); + version = odr_strdup(c->odr_out, "$Revision: 1.106 $"); if (strlen(version) > 10) /* check for unexpanded CVS strings */ version[strlen(version)-2] = '\0'; ireq->implementationVersion = diff --git a/zoom/zoomtst3.c b/zoom/zoomtst3.c index 8e2a054..98f797c 100644 --- a/zoom/zoomtst3.c +++ b/zoom/zoomtst3.c @@ -1,4 +1,4 @@ -/* $Id: zoomtst3.c,v 1.12 2007-01-03 08:42:17 adam Exp $ */ +/* $Id: zoomtst3.c,v 1.13 2007-01-10 13:25:46 adam Exp $ */ /** \file zoomtst3.c \brief Asynchronous multi-target client @@ -68,7 +68,9 @@ int main(int argc, char **argv) /* network I/O. pass number of connections and array of connections */ while ((i = ZOOM_event (no, z))) { - printf ("no = %d event = %d\n", i-1, + int peek = ZOOM_connection_peek_event(z[i-1]); + printf ("no = %d peek = %d event = %d\n", i-1, + peek, ZOOM_connection_last_event(z[i-1])); }