Prefix ZOOM_ instead of Z3950_. Documentation updates.
authorAdam Dickmeiss <adam@indexdata.dk>
Sun, 18 Nov 2001 21:14:22 +0000 (21:14 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Sun, 18 Nov 2001 21:14:22 +0000 (21:14 +0000)
20 files changed:
CHANGELOG
configure.in
debian/rules
doc/installation.xml
doc/zoom.xml
include/yaz/yaz-version.h
include/yaz/zoom.h
win/yaz.rc
yaz.spec
zoom/zoom-c.c
zoom/zoom-opt.c
zoom/zoom-p.h
zoom/zoomsh.c
zoom/zoomtst1.c
zoom/zoomtst2.c
zoom/zoomtst3.c
zoom/zoomtst4.c
zoom/zoomtst5.c
zoom/zoomtst6.c
zoom/zoomtst7.c

index c1ef0fd..6d356bf 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,11 +1,13 @@
 Possible compatibility problems with earlier versions marked with '*'.
 
+*** ZOOM. Prefix for ZOOM definitions changed from Z3950_ to ZOOM_.
+
 * ZOOM. Removed Z3950_connection_host. Use Z3950_connection_option_get
 with key="host" to get same result.
 
-* ZOOM. Added Z3950_record_dup and removed Z3950_resultset_get.
+* ZOOM. Added Z3950_record_clone and removed Z3950_resultset_get.
 Function Z3950_resultset_record(s) returns references to records
-"owned" by resultset. To become owner use Z3950_record_dup.
+"owned" by resultset. To become owner use Z3950_record_clone.
 
 Function z_ext_record handles Extended Services. Thanks to
 Irina Dijour.
index 1885daf..51392a8 100644 (file)
@@ -1,8 +1,8 @@
 dnl YAZ Toolkit, Index Data 1994-2001
 dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.54 2001-11-13 23:00:42 adam Exp $
+dnl $Id: configure.in,v 1.55 2001-11-18 21:14:22 adam Exp $
 AC_INIT(include/yaz/yaz-version.h)
-AM_INIT_AUTOMAKE(yaz, 1.8.2)
+AM_INIT_AUTOMAKE(yaz, 1.8.3)
 dnl
 AC_SUBST(READLINE_LIBS)
 dnl ------ Checking programs
index d4ee863..595e951 100755 (executable)
@@ -34,7 +34,7 @@ YAZSRCDIR=$(shell pwd)
 YAZ_VERSION=$(shell date -r$(YAZSRCDIR)/CVS +"CVS%Y%m%d")
 else
 YAZSRCDIR=$(shell pwd)
-YAZ_VERSION=1.8.2
+YAZ_VERSION=1.8.3
 endif
 
 configure: stamp-configure
index 2394ed3..ae46e14 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $Id: installation.xml,v 1.8 2001-11-08 12:36:15 adam Exp $ -->
+<!-- $Id: installation.xml,v 1.9 2001-11-18 21:14:22 adam Exp $ -->
  <chapter id="installation"><title>Compilation and Installation</title>
   
   <sect1><title>Introduction</title>
        </para></listitem>
      </varlistentry>
      <varlistentry><term><literal>--disable-shared</literal></term>
-      <listitem><para>The make process will be not create
+      <listitem><para>The make process will not create
         static libraries (<filename>.a</filename>).
         By default, static libraries are created -
         equivalent to <literal>--enable-static</literal>.
 
      <varlistentry><term><filename>lib/libyazthread.la</filename></term>
       <listitem><para>
-        When threading is supported/enabled by configure this GNU libtool
+        When threading is supported/enabled by configure this Libtool
         library is created. It includes functions that allows &yaz;
         to use threads.
        </para></listitem></varlistentry>
        </para></listitem></varlistentry>
      
      <varlistentry><term><filename>yaz-config</filename></term>
-      <listitem><para>A Bourne-shell script, generate by configure, that
+      <listitem><para>A Bourne-shell script, generated by configure, that
         specifies how external applications should compile - and link with
         &yaz;.
        </para></listitem></varlistentry>
         A simple shell implemented on top of the 
         <link linkend="zoom">ZOOM</link> functions.
         The shell is a command line application that allows you to enter
-        simple commands perform to perform ZOOM operations.
+        simple commands to perform ZOOM operations.
        </para></listitem></varlistentry>
 
      <varlistentry><term><filename>zoom/zoomtst1</filename>, 
    </para>
    
    <para>
-    If you wish to install &yaz; in system directories such as 
+    If you wish to install &yaz; in system directories  
     <filename>/usr/local/bin</filename>,
-    <filename>/usr/local/lib</filename> you can type:
+    <filename>/usr/local/lib</filename> .. etc, you can type:
    </para>
    
    <screen>
    </para>
    
    <para>
-    If you wish to perform an un-installation of &yaz; use:
+    If you wish to perform an un-installation of &yaz;, use:
    </para>
    
    <screen>
      require you to pass more options to your linker/compiler.
     </para>
     <para>
-     The <filename>yaz-config</filename> script accepts the options
-     that makes the <filename>yaz-config</filename> script print
+     The <filename>yaz-config</filename> script accepts command line
+     options that makes the <filename>yaz-config</filename> script print
      options that you should use in your make process.
      The most important ones are:
      <literal>--cflags</literal>, <literal>--libs</literal>
      </para>
     <para>
      A small and complete <literal>Makefile</literal> for a C
-     application consisting of one source file
-     <filename>myprog.c</filename> may look like this:
+     application consisting of one source file,
+     <filename>myprog.c</filename>, may look like this:
      <screen>
       YAZCONFIG=/usr/local/bin/yaz-config
       CFLAGS=`$(YAZCONFIG) --cflags`
       </screen>
      </para>
     <para>
-     The CFLAGS string will consists of an option that will set the
-     include path to the <emphasis>parent</emphasis> directory
+     The CFLAGS variable consists of a C compiler directive that will set
+     the include path to the <emphasis>parent</emphasis> directory
      of <filename>yaz</filename>. That is, if &yaz; header files were
      installed in <filename>/usr/local/include/yaz</filename>,
      then include path is set to <filename>/usr/local/include</filename>.
      Libtool acrhive(s) for &yaz; rather than the ordinary ones.
     </para>
     <para>
-     Applications that wish to use the threaded version of &yaz;
-     should specify <literal>threads</literal> after the
-     other options. When <literal>threads</literal> is given
+     For applications using the threaded version of &yaz;,
+     specify <literal>threads</literal> after the
+     other options. When <literal>threads</literal> is given,
      more flags and linker flags will be printed by
      <filename>yaz-config</filename>. If our previous example was
       using threads, you'd have to modify the lines that set
       LIBS=`$(YAZCONFIG) --libs threads`
      </screen>
      There is no need specify POSIX thread libraries in your Makefile.
-     The <literal>LIBS</literal> includes that as well.
+     The <literal>LIBS</literal> variable includes that as well.
     </para>
    </sect2>
   </sect1>
     <para>
      Some people are confused by the fact that we use the nmake
      tool to build &yaz;. They think they have to do that too - in order
-     to make WIN32 applications using &yaz;. The good news is that
+     to make their WIN32 applications work with &yaz;. The good news is that
      you don't have to. You can use the integrated environement of
-     Visual Studio if desired.
+     Visual Studio if desired for your own application.
     </para>
     <para>
      When setting up a project or Makefile you have to set the following:
index 0c702f1..6d2ced2 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $Id: zoom.xml,v 1.11 2001-11-16 09:52:39 adam Exp $ -->
+<!-- $Id: zoom.xml,v 1.12 2001-11-18 21:14:22 adam Exp $ -->
  <chapter id="zoom"><title>Building clients with ZOOM</title>
   
   <para>
    <synopsis>
    #include &lt;yaz/zoom.h>
     
-   Z3950_connection Z3950_connection_new (const char *host, int portnum);
+   ZOOM_connection ZOOM_connection_new (const char *host, int portnum);
     
-   Z3950_connection Z3950_connection_create (Z3950_options options);
+   ZOOM_connection ZOOM_connection_create (ZOOM_options options);
 
-   void Z3950_connection_connect(Z3950_connection c, const char *host,
+   void ZOOM_connection_connect(ZOOM_connection c, const char *host,
                                  int portnum);
-   void Z3950_connection_destroy (Z3950_connection c);
+   void ZOOM_connection_destroy (ZOOM_connection c);
    </synopsis>
    <para>
     Connection objects are created with either function
-    <function>Z3950_connection_new</function> or 
-    <function>Z3950_connection_create</function>.
+    <function>ZOOM_connection_new</function> or 
+    <function>ZOOM_connection_create</function>.
     The former creates and automatically attempts to establish a network
     connection with the target. The latter doesn't establish
     a connection immediately, thus allowing you to specify options
     before establishing network connection using the function
-    <function>Z3950_connection_connect</function>. 
+    <function>ZOOM_connection_connect</function>. 
     If the portnumber, <literal>portnum</literal>, is zero, the
     <literal>host</literal> is consulted for a port specification.
     If no port is given, 210 is used. A colon denotes the beginning of
    </para>
    <para>
     Connection objects should be destroyed using the function
-    <function>Z3950_connection_destroy</function>.
+    <function>ZOOM_connection_destroy</function>.
    </para>
    <synopsis>
-    void Z3950_connection_option_set (Z3950_connection c,
-                                      const char *key,
-                                      const char *val);
+    void ZOOM_connection_option_set (ZOOM_connection c,
+                                     const char *key,
+                                     const char *val);
 
-    const char *Z3950_connection_option_get (Z3950_connection c,
-                                             const char *key);
+    const char *ZOOM_connection_option_get (ZOOM_connection c,
+                                            const char *key);
    </synopsis>
    <para>
-    The <function>Z3950_connection_option_set</function> allows you to
+    The <function>ZOOM_connection_option_set</function> allows you to
     set an option given by <parameter>key</parameter> to the value
     <parameter>value</parameter> for the connection.
-     Function <function>Z3950_connection_option_get</function> returns
+     Function <function>ZOOM_connection_option_get</function> returns
     the value for an option given by <parameter>key</parameter>.
    </para>
-   <table frame="top"><title>ZOOM Connection Options</title>
+   <table frame="sides" colsep="1"><title>ZOOM Connection Options</title>
     <tgroup cols="3">
      <colspec colwidth="4*" colname="name"></colspec>
      <colspec colwidth="7*" colname="description"></colspec>
         async</entry><entry>If true (1) the connection operates in 
         asynchronous operation which means that all calls are non-blocking
         except
-        <link linkend="zoom.events"><function>Z3950_event</function></link>.
+        <link linkend="zoom.events"><function>ZOOM_event</function></link>.
        </entry><entry>0</entry></row>
       <row><entry>
         maximumRecordSize</entry><entry> Maximum size of single record.
     </tgroup>
    </table>
    <synopsis>
-     int Z3950_connection_error (Z3950_connection c, const char **cp,
+     int ZOOM_connection_error (ZOOM_connection c, const char **cp,
                                  const char **addinfo);
    </synopsis>
    <para>
-    Use <function>Z3950_connection_error</function> to check for
+    Use <function>ZOOM_connection_error</function> to check for
     errors for the last operation(s) performed. The function returns
     zero if no errors occurred; non-zero otherwise indicating the error.
     Pointers <parameter>cp</parameter> and <parameter>addinfo</parameter>
    </para>
    <sect2><title>Protocol behavior</title>
     <para>
-     The calls <function>Z3950_connection_new</function> and
-     <function>Z3950_connection_connect</function> establises a TCP/IP
+     The calls <function>ZOOM_connection_new</function> and
+     <function>ZOOM_connection_connect</function> establises a TCP/IP
       connection and sends an Initialize Request to the target if
       possible. In addition, the calls waits for an Initialize Response
       from the target and the result is inspected (OK or rejected).
     <para>
      When option <literal>async</literal> is 1, it really means that
      all network operations are postponed (and queued) until the
-     function <literal>Z3950_event</literal> is invoked. When doing so
+     function <literal>ZOOM_event</literal> is invoked. When doing so
      it doesn't make sense to check for errors after
-     <literal>Z3950_connection_new</literal> is called since that
+     <literal>ZOOM_connection_new</literal> is called since that
      operation "connecting - and init" is still incomplete and the
      API cannot tell the outcome (yet).
     </para>
     Query objects represents queries.
    </para>
    <synopsis>
-     Z3950_query Z3950_query_create(void);
+     ZOOM_query ZOOM_query_create(void);
 
-     void Z3950_query_destroy(Z3950_query q);
+     void ZOOM_query_destroy(ZOOM_query q);
 
-     int Z3950_query_prefix(Z3950_query q, const char *str);
+     int ZOOM_query_prefix(ZOOM_query q, const char *str);
 
-     int Z3950_query_sortby(Z3950_query q, const char *criteria);
+     int ZOOM_query_sortby(ZOOM_query q, const char *criteria);
    </synopsis>
    <para>
-    Create query objects using <function>Z3950_query_create</function>
-    and destroy them by calling <function>Z3950_query_destroy</function>.
+    Create query objects using <function>ZOOM_query_create</function>
+    and destroy them by calling <function>ZOOM_query_destroy</function>.
     RPN-queries can be specified in <link linkend="PQF">PQF</link>
     notation by using the
-    function <function>Z3950_query_prefix</function>. More
+    function <function>ZOOM_query_prefix</function>. More
     query types will be added later, such as
     <link linkend="CCL">CCL</link> to RPN-mapping, native CCL query,
     etc. In addition to a search, a sort criteria may be set. Function
-    <function>Z3950_query_sortby</function> specifies a 
+    <function>ZOOM_query_sortby</function> specifies a 
     sort criteria using the same string notation for sort as offered by
     the <link linkend="sortspec">YAZ client</link>.
    </para>
     a target.
    </para>
    <synopsis>
-     Z3950_resultset Z3950_connection_search(Z3950_connection,
-                                             Z3950_query q);
+     ZOOM_resultset ZOOM_connection_search(ZOOM_connection,
+                                           ZOOM_query q);
 
-     Z3950_resultset Z3950_connection_search_pqf(Z3950_connection c,
-                                                 const char *q);
+     ZOOM_resultset ZOOM_connection_search_pqf(ZOOM_connection c,
+                                               const char *q);
 
-     void Z3950_resultset_destroy(Z3950_resultset r);
+     void ZOOM_resultset_destroy(ZOOM_resultset r);
    </synopsis>
    <para>
-    Function <function>Z3950_connection_search</function> creates
+    Function <function>ZOOM_connection_search</function> creates
      a result set given a connection and query.
     Destroy a result set by calling
-    <function>Z3950_resultset_destroy</function>.
+    <function>ZOOM_resultset_destroy</function>.
     Simple clients may using PQF only may use function
-    <function>Z3950_connection_search_pqf</function> in which case
+    <function>ZOOM_connection_search_pqf</function> in which case
     creating query objects is not necessary.
    </para>
    <synopsis>
-     void Z3950_resultset_option_set (Z3950_resultset r,
+     void ZOOM_resultset_option_set (ZOOM_resultset r,
                                       const char *key,
                                       const char *val);
 
-     const char *Z3950_resultset_option_get (Z3950_resultset r,
+     const char *ZOOM_resultset_option_get (ZOOM_resultset r,
                                              const char *key);
 
-     size_t Z3950_resultset_size (Z3950_resultset r);
+     size_t ZOOM_resultset_size (ZOOM_resultset r);
    </synopsis>
    <para>
-    Functions <function>Z3950_resultset_options_set</function> and
-    <function>Z3950_resultset_get</function> sets and gets an option
-    for a result set similar to <function>Z3950_connection_option_get</function>
-    and <function>Z3950_connection_option_set</function>.
+    Functions <function>ZOOM_resultset_options_set</function> and
+    <function>ZOOM_resultset_get</function> sets and gets an option
+    for a result set similar to <function>ZOOM_connection_option_get</function>
+    and <function>ZOOM_connection_option_set</function>.
    </para>
    <para>
     The number of hits also called result-count is returned by
-    function <function>Z3950_resultset_size</function>.
+    function <function>ZOOM_resultset_size</function>.
    </para>
    <table frame="top"><title>ZOOM Result set Options</title>
     <tgroup cols="3">
     created from result sets.
    </para>
    <synopsis>
-     void Z3950_resultset_records (Z3950_resultset r,
-                                   Z3950_record *recs,
-                                  size_t start, size_t count);
-     Z3950_record Z3950_resultset_record (Z3950_resultset s, size_t pos);
+     void ZOOM_resultset_records (ZOOM_resultset r,
+                                  ZOOM_record *recs,
+                                  size_t start, size_t count);
+     ZOOM_record ZOOM_resultset_record (ZOOM_resultset s, size_t pos);
 
-     void *Z3950_record_get (Z3950_record rec, const char *type,
-                             size_t *len);
+     void *ZOOM_record_get (ZOOM_record rec, const char *type,
+                            size_t *len);
 
-     Z3950_record Z3950_record_dup (Z3950_record rec);
+     ZOOM_record ZOOM_record_clone (ZOOM_record rec);
 
-     void Z3950_record_destroy (Z3950_record rec);
+     void ZOOM_record_destroy (ZOOM_record rec);
    </synopsis>
    <para>
     References to temporary records are returned by functions 
-    <function>Z3950_resultset_records</function> or
-    <function>Z3950_resultset_record</function>.
+    <function>ZOOM_resultset_records</function> or
+    <function>ZOOM_resultset_record</function>.
     </para>
    <para>
     If a persistent reference to a record is desired
-    <function>Z3950_record_dup</function> should be used.
-    It returns a record reference that at any
-    later stage should be destroyed by
-    <function>Z3950_record_destroy</function>.
+    <function>ZOOM_record_clone</function> should be used.
+    It returns a record reference that should be destroyed
+    by a call to <function>ZOOM_record_destroy</function>.
    </para>
    <para>
     A single record is returned by function
-    <function>Z3950_resultset_record</function> that takes a 
+    <function>ZOOM_resultset_record</function> that takes a 
     position as argument. First record has position zero.
     If no record could be obtained <literal>NULL</literal> is returned.
    </para>
    <para>
-    Function <function>Z3950_resultset_records</function> retrieves
+    Function <function>ZOOM_resultset_records</function> retrieves
     a number of records from a result set. Parameter <literal>start</literal>
     and <literal>count</literal> specifies the range of records to
     be returned. Upon completion array
     <literal>recs[0], ..recs[count-1]</literal>
     holds record objects for the records. The array of records
-     <literal>recs</literal> should be allocate prior to calling 
-    <function>Z3950_resultset_records</function>. Note that for those
+     <literal>recs</literal> should be allocated prior the call
+    <function>ZOOM_resultset_records</function>. Note that for those
     records that couldn't be retrieved from the target
     <literal>recs[ ..]</literal> is set to <literal>NULL</literal>.
    </para>
    <para id="zoom.record.get">
     In order to extract information about a single record,
-    <function>Z3950_record_get</function> is provided. The
+    <function>ZOOM_record_get</function> is provided. The
     function returns a pointer to certain record information. The
-    nature (type) of the pointer depends on the <function>type</function>
-    given. In addition for certain types, the length
+    nature (type) of the pointer depends on the parameter,
+    <function>type</function>.
+    In addition, for certain types, the length
     <literal>len</literal> passed will be set to the size in bytes of
     the returned information.
     <variablelist>
    </para>
    <sect2><title>Protocol behavior</title>
     <para>
-     The functions <function>Z3950_resultset_record</function> and
-     <function>Z3950_resultset_records</function> inspects the client-side
+     The functions <function>ZOOM_resultset_record</function> and
+     <function>ZOOM_resultset_records</function> inspects the client-side
      record cache. Records not found in cache are fetched using
      Present.
      The functions may block (and perform network I/O)  - even though option
      </para>
     <para>
      There is a trick, however, in the usage of function
-     <function>Z3950_resultset_records</function> that allows for
+     <function>ZOOM_resultset_records</function> that allows for
      delayed retrieval (and makes it non-blocking). By passing
      a null pointer for <parameter>recs</parameter> you're indicating
      you're not interested in getting records objects
     an associative array / hash array, etc.
    </para>
    <synopsis>
-     Z3950_options Z3950_options_create (void);
+     ZOOM_options ZOOM_options_create (void);
 
-     Z3950_options Z3950_options_create_with_parent (Z3950_options parent);
+     ZOOM_options ZOOM_options_create_with_parent (ZOOM_options parent);
 
-     void Z3950_options_destroy (Z3950_options opt);
+     void ZOOM_options_destroy (ZOOM_options opt);
    </synopsis>
    <synopsis>
-     const char *Z3950_options_get (Z3950_options opt, const char *name);
+     const char *ZOOM_options_get (ZOOM_options opt, const char *name);
 
-     void Z3950_options_set (Z3950_options opt, const char *name,
-                             const char *v);
+     void ZOOM_options_set (ZOOM_options opt, const char *name,
+                            const char *v);
    </synopsis>
    <synopsis>
-     typedef const char *(*Z3950_options_callback)
+     typedef const char *(*ZOOM_options_callback)
                                      (void *handle, const char *name);
 
-     Z3950_options_callback
-             Z3950_options_set_callback (Z3950_options opt,
-                                         Z3950_options_callback c,
-                                        void *handle);
+     ZOOM_options_callback
+             ZOOM_options_set_callback (ZOOM_options opt,
+                                        ZOOM_options_callback c,
+                                        void *handle);
    </synopsis>
   </sect1>
   <sect1 id="zoom.events"><title>Events</title>
     with events.
    </para>
    <synopsis>
-    int Z3950_event (int no, Z3950_connection *cs);
+    int ZOOM_event (int no, ZOOM_connection *cs);
    </synopsis>
    <para>
-    The <function>Z3950_event</function> executes pending events for
+    The <function>ZOOM_event</function> executes pending events for
     a number of connections. Supply the number of connections in
     <literal>no</literal> and an array of connections in
     <literal>cs</literal> (<literal>cs[0] ... cs[no-1]</literal>).
     A pending event could be a sending a search, receiving a response,
     etc.
-    When an event has a occured for one of the connections, this function
+    When an event has occured for one of the connections, this function
     returns a positive integer <literal>n</literal> denoting that an event
     occurred for connection <literal>cs[n-1]</literal>.
     When no events are pending for the connections, a value of zero is
index 45b471f..b38b77c 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * Current software version.
  *
- * $Id: yaz-version.h,v 1.9 2001-11-12 11:27:42 adam Exp $
+ * $Id: yaz-version.h,v 1.10 2001-11-18 21:14:23 adam Exp $
  */
 #ifndef YAZ_VERSION
 
-#define YAZ_VERSION "1.8.2"
+#define YAZ_VERSION "1.8.3"
 #include <yaz/yaz-date.h>
 
 #ifdef WIN32
index c7df143..61e7550 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Public header for ZOOM C.
- * $Id: zoom.h,v 1.6 2001-11-16 09:52:39 adam Exp $
+ * $Id: zoom.h,v 1.7 2001-11-18 21:14:23 adam Exp $
  */
 
 #include <yaz/yconfig.h>
@@ -14,12 +14,12 @@ ZOOM_BEGIN_CDECL
 /* ----------------------------------------------------------- */
 /* the types we use */
 
-typedef struct Z3950_options_p *Z3950_options;
-typedef struct Z3950_query_p *Z3950_query;
-typedef struct Z3950_connection_p *Z3950_connection;
-typedef        struct Z3950_resultset_p *Z3950_resultset;
-typedef struct Z3950_task_p *Z3950_task;
-typedef struct Z3950_record_p *Z3950_record;
+typedef struct ZOOM_options_p *ZOOM_options;
+typedef struct ZOOM_query_p *ZOOM_query;
+typedef struct ZOOM_connection_p *ZOOM_connection;
+typedef        struct ZOOM_resultset_p *ZOOM_resultset;
+typedef struct ZOOM_task_p *ZOOM_task;
+typedef struct ZOOM_record_p *ZOOM_record;
 
 /* ----------------------------------------------------------- */
 /* connections */
@@ -27,155 +27,155 @@ typedef struct Z3950_record_p *Z3950_record;
 /* create connection, connect to host, if portnum is 0, then port is
 read from host string (e.g. myhost:9821) */
 ZOOM_EXPORT
-Z3950_connection Z3950_connection_new (const char *host, int portnum);
+ZOOM_connection ZOOM_connection_new (const char *host, int portnum);
 
 /* create connection, don't connect, apply options */
 ZOOM_EXPORT
-Z3950_connection Z3950_connection_create (Z3950_options options);
+ZOOM_connection ZOOM_connection_create (ZOOM_options options);
 
 /* connect given existing connection */
 ZOOM_EXPORT
-void Z3950_connection_connect(Z3950_connection c, const char *host,
+void ZOOM_connection_connect(ZOOM_connection c, const char *host,
                              int portnum);
 
 /* destroy connection (close connection also) */
 ZOOM_EXPORT
-void Z3950_connection_destroy (Z3950_connection c);
+void ZOOM_connection_destroy (ZOOM_connection c);
 
 /* get/set option for connection */
 ZOOM_EXPORT
-const char *Z3950_connection_option_get (Z3950_connection c, const char *key);
+const char *ZOOM_connection_option_get (ZOOM_connection c, const char *key);
 
 ZOOM_EXPORT
-void Z3950_connection_option_set (Z3950_connection c, const char *key,
+void ZOOM_connection_option_set (ZOOM_connection c, const char *key,
                                   const char *val);
 
 /* return error code (0 == success, failure otherwise). cp
    holds error string on failure, addinfo holds addititional info (if any)
 */
 ZOOM_EXPORT
-int Z3950_connection_error (Z3950_connection c, const char **cp,
+int ZOOM_connection_error (ZOOM_connection c, const char **cp,
                            const char **addinfo);
 
 /* returns error code */
 ZOOM_EXPORT
-int Z3950_connection_errcode (Z3950_connection c);
+int ZOOM_connection_errcode (ZOOM_connection c);
 /* returns error message */
 ZOOM_EXPORT
-const char *Z3950_connection_errmsg (Z3950_connection c);
+const char *ZOOM_connection_errmsg (ZOOM_connection c);
 /* returns additional info */
 ZOOM_EXPORT
-const char *Z3950_connection_addinfo (Z3950_connection c);
+const char *ZOOM_connection_addinfo (ZOOM_connection c);
 
-#define Z3950_ERROR_NONE 0
-#define Z3950_ERROR_CONNECT 10000
-#define Z3950_ERROR_MEMORY  10001
-#define Z3950_ERROR_ENCODE  10002
-#define Z3950_ERROR_DECODE  10003
-#define Z3950_ERROR_CONNECTION_LOST 10004
-#define Z3950_ERROR_INIT 10005
-#define Z3950_ERROR_INTERNAL 10006
-#define Z3950_ERROR_TIMEOUT 10007
+#define ZOOM_ERROR_NONE 0
+#define ZOOM_ERROR_CONNECT 10000
+#define ZOOM_ERROR_MEMORY  10001
+#define ZOOM_ERROR_ENCODE  10002
+#define ZOOM_ERROR_DECODE  10003
+#define ZOOM_ERROR_CONNECTION_LOST 10004
+#define ZOOM_ERROR_INIT 10005
+#define ZOOM_ERROR_INTERNAL 10006
+#define ZOOM_ERROR_TIMEOUT 10007
 
 /* ----------------------------------------------------------- */
 /* result sets */
 
 /* create result set given a search */
 ZOOM_EXPORT
-Z3950_resultset Z3950_connection_search(Z3950_connection, Z3950_query q);
+ZOOM_resultset ZOOM_connection_search(ZOOM_connection, ZOOM_query q);
 /* create result set given PQF query */
 ZOOM_EXPORT
-Z3950_resultset Z3950_connection_search_pqf(Z3950_connection c, const char *q);
+ZOOM_resultset ZOOM_connection_search_pqf(ZOOM_connection c, const char *q);
 
 /* destroy result set */
 ZOOM_EXPORT
-void Z3950_resultset_destroy(Z3950_resultset r);
+void ZOOM_resultset_destroy(ZOOM_resultset r);
 
 /* result set option */
 ZOOM_EXPORT
-const char *Z3950_resultset_option_get (Z3950_resultset r, const char *key);
+const char *ZOOM_resultset_option_get (ZOOM_resultset r, const char *key);
 ZOOM_EXPORT
-void Z3950_resultset_option_set (Z3950_resultset r, const char *key, const char *val);
+void ZOOM_resultset_option_set (ZOOM_resultset r, const char *key, const char *val);
 
 /* return size of result set (alias hit count AKA result count) */
 ZOOM_EXPORT
-size_t Z3950_resultset_size (Z3950_resultset r);
+size_t ZOOM_resultset_size (ZOOM_resultset r);
 
 /* retrieve records */
 ZOOM_EXPORT
-void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs,
+void ZOOM_resultset_records (ZOOM_resultset r, ZOOM_record *recs,
                              size_t start, size_t count);
 
 /* return record object at pos. Returns 0 if unavailable */
 ZOOM_EXPORT
-Z3950_record Z3950_resultset_record (Z3950_resultset s, size_t pos);
+ZOOM_record ZOOM_resultset_record (ZOOM_resultset s, size_t pos);
 
-/* like Z3950_resultset_record - but never blocks .. */
+/* like ZOOM_resultset_record - but never blocks .. */
 ZOOM_EXPORT
-Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s, size_t pos);
+ZOOM_record ZOOM_resultset_record_immediate (ZOOM_resultset s, size_t pos);
 
 /* ----------------------------------------------------------- */
 /* records */
 
 /* get record information, in a form given by type */
 ZOOM_EXPORT
-void *Z3950_record_get (Z3950_record rec, const char *type, size_t *len);
+void *ZOOM_record_get (ZOOM_record rec, const char *type, size_t *len);
 
 /* destroy record */
 ZOOM_EXPORT
-void Z3950_record_destroy (Z3950_record rec);
+void ZOOM_record_destroy (ZOOM_record rec);
 
 /* return copy of record */
 ZOOM_EXPORT
-Z3950_record Z3950_record_dup (Z3950_record srec);
+ZOOM_record ZOOM_record_clone (ZOOM_record srec);
 
 /* ----------------------------------------------------------- */
 /* searches */
 
 /* create search object */
 ZOOM_EXPORT
-Z3950_query Z3950_query_create(void);
+ZOOM_query ZOOM_query_create(void);
 /* destroy it */
 ZOOM_EXPORT
-void Z3950_query_destroy(Z3950_query s);
+void ZOOM_query_destroy(ZOOM_query s);
 /* specify prefix query for search */
 ZOOM_EXPORT
-int Z3950_query_prefix(Z3950_query s, const char *str);
+int ZOOM_query_prefix(ZOOM_query s, const char *str);
 /* specify sort criteria for search */
 ZOOM_EXPORT
-int Z3950_query_sortby(Z3950_query s, const char *criteria);
+int ZOOM_query_sortby(ZOOM_query s, const char *criteria);
 
 /* ----------------------------------------------------------- */
 /* options */
-typedef const char *(*Z3950_options_callback)(void *handle, const char *name);
+typedef const char *(*ZOOM_options_callback)(void *handle, const char *name);
 
 ZOOM_EXPORT
-Z3950_options_callback Z3950_options_set_callback (Z3950_options opt,
-                                                  Z3950_options_callback c,
+ZOOM_options_callback ZOOM_options_set_callback (ZOOM_options opt,
+                                                  ZOOM_options_callback c,
                                                   void *handle);
 ZOOM_EXPORT
-Z3950_options Z3950_options_create (void);
+ZOOM_options ZOOM_options_create (void);
 
 ZOOM_EXPORT
-Z3950_options Z3950_options_create_with_parent (Z3950_options parent);
+ZOOM_options ZOOM_options_create_with_parent (ZOOM_options parent);
 
 ZOOM_EXPORT
-const char *Z3950_options_get (Z3950_options opt, const char *name);
+const char *ZOOM_options_get (ZOOM_options opt, const char *name);
 
 ZOOM_EXPORT
-void Z3950_options_set (Z3950_options opt, const char *name, const char *v);
+void ZOOM_options_set (ZOOM_options opt, const char *name, const char *v);
 
 ZOOM_EXPORT
-void Z3950_options_destroy (Z3950_options opt);
+void ZOOM_options_destroy (ZOOM_options opt);
 
 ZOOM_EXPORT
-int Z3950_options_get_bool (Z3950_options opt, const char *name, int defa);
+int ZOOM_options_get_bool (ZOOM_options opt, const char *name, int defa);
 
 ZOOM_EXPORT
-int Z3950_options_get_int (Z3950_options opt, const char *name, int defa);
+int ZOOM_options_get_int (ZOOM_options opt, const char *name, int defa);
 
 ZOOM_EXPORT
-void Z3950_options_addref (Z3950_options opt);
+void ZOOM_options_addref (ZOOM_options opt);
 
 /* ----------------------------------------------------------- */
 /* events */
@@ -185,6 +185,6 @@ void Z3950_options_addref (Z3950_options opt);
    connection for which the event occurred. There's no way to get
    the details yet, sigh. */
 ZOOM_EXPORT
-int Z3950_event (int no, Z3950_connection *cs);
+int ZOOM_event (int no, ZOOM_connection *cs);
 
 ZOOM_END_CDECL
index 7851297..f2d3532 100644 (file)
@@ -54,8 +54,8 @@ END
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,8,2,0
- PRODUCTVERSION 1,8,2,0
+ FILEVERSION 1,8,3,0
+ PRODUCTVERSION 1,8,3,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -73,14 +73,14 @@ BEGIN
             VALUE "Comments", "Z39.50 C Library\0"
             VALUE "CompanyName", "Index Data\0"
             VALUE "FileDescription", "YAZ Toolkit\0"
-            VALUE "FileVersion", "1, 8, 2, 0\0"
+            VALUE "FileVersion", "1, 8, 3, 0\0"
             VALUE "InternalName", "YAZ\0"
             VALUE "LegalCopyright", "Copyright Â© 1996-2001 Index Data\0"
             VALUE "LegalTrademarks", "\0"
             VALUE "OriginalFilename", "yaz.rc\0"
             VALUE "PrivateBuild", "\0"
             VALUE "ProductName", "Index Data YAZ Toolkit\0"
-            VALUE "ProductVersion", "1, 8, 2, 0\0"
+            VALUE "ProductVersion", "1, 8, 3, 0\0"
             VALUE "SpecialBuild", "\0"
         END
     END
index 865dd00..1e1e067 100644 (file)
--- a/yaz.spec
+++ b/yaz.spec
@@ -1,5 +1,5 @@
 Name: yaz
-Version: 1.8.2
+Version: 1.8.3
 Release: 1
 Copyright: YAZ License
 Group: Development/Libraries
index d3dbe06..b5a26df 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoom-c.c,v 1.10 2001-11-16 10:18:20 adam Exp $
+ * $Id: zoom-c.c,v 1.11 2001-11-18 21:14:23 adam Exp $
  *
  * ZOOM layer for C, connections, result sets, queries.
  */
 #include <sys/poll.h>
 #endif
 
-static Z3950_Event Z3950_Event_create (int kind)
+static ZOOM_Event ZOOM_Event_create (int kind)
 {
-    Z3950_Event event = xmalloc (sizeof(*event));
+    ZOOM_Event event = xmalloc (sizeof(*event));
     event->kind = kind;
     event->next = 0;
     event->prev = 0;
     return event;
 }
 
-static void Z3950_Event_destroy (Z3950_Event event)
+static void ZOOM_Event_destroy (ZOOM_Event event)
 {
     xfree (event);
 }
 
-static void Z3950_connection_put_event (Z3950_connection c, Z3950_Event event)
+static void ZOOM_connection_put_event (ZOOM_connection c, ZOOM_Event event)
 {
     // put in back of queue
     if (c->m_queue_back)
@@ -48,10 +48,10 @@ static void Z3950_connection_put_event (Z3950_connection c, Z3950_Event event)
     c->m_queue_back = event;
 }
 
-static Z3950_Event Z3950_connection_get_event(Z3950_connection c)
+static ZOOM_Event ZOOM_connection_get_event(ZOOM_connection c)
 {
     // get from front of queue
-    Z3950_Event event = c->m_queue_front;
+    ZOOM_Event event = c->m_queue_front;
     if (!event)
        return 0;
     assert (c->m_queue_back);
@@ -66,16 +66,16 @@ static Z3950_Event Z3950_connection_get_event(Z3950_connection c)
     return event;
 }
 
-static void clear_error (Z3950_connection c)
+static void clear_error (ZOOM_connection c)
 {
-    c->error = Z3950_ERROR_NONE;
+    c->error = ZOOM_ERROR_NONE;
     xfree (c->addinfo);
     c->addinfo = 0;
 }
 
-Z3950_task Z3950_connection_add_task (Z3950_connection c, int which)
+ZOOM_task ZOOM_connection_add_task (ZOOM_connection c, int which)
 {
-    Z3950_task *taskp = &c->tasks;
+    ZOOM_task *taskp = &c->tasks;
     while (*taskp)
        taskp = &(*taskp)->next;
     *taskp = xmalloc (sizeof(**taskp));
@@ -87,22 +87,22 @@ Z3950_task Z3950_connection_add_task (Z3950_connection c, int which)
     return *taskp;
 }
 
-void Z3950_connection_remove_task (Z3950_connection c)
+void ZOOM_connection_remove_task (ZOOM_connection c)
 {
-    Z3950_task task = c->tasks;
+    ZOOM_task task = c->tasks;
 
     if (task)
     {
        c->tasks = task->next;
        switch (task->which)
        {
-       case Z3950_TASK_SEARCH:
-           Z3950_resultset_destroy (task->u.resultset);
+       case ZOOM_TASK_SEARCH:
+           ZOOM_resultset_destroy (task->u.resultset);
            break;
-       case Z3950_TASK_RETRIEVE:
-           Z3950_resultset_destroy (task->u.resultset);
+       case ZOOM_TASK_RETRIEVE:
+           ZOOM_resultset_destroy (task->u.resultset);
            break;
-        case Z3950_TASK_CONNECT:
+        case ZOOM_TASK_CONNECT:
             break;
        default:
            assert (0);
@@ -111,24 +111,24 @@ void Z3950_connection_remove_task (Z3950_connection c)
     }
 }
 
-void Z3950_connection_remove_tasks (Z3950_connection c)
+void ZOOM_connection_remove_tasks (ZOOM_connection c)
 {
     while (c->tasks)
-       Z3950_connection_remove_task(c);
+       ZOOM_connection_remove_task(c);
 }
 
-static Z3950_record record_cache_lookup (Z3950_resultset r,
+static ZOOM_record record_cache_lookup (ZOOM_resultset r,
                                         int pos,
                                         const char *elementSetName);
 
-Z3950_connection Z3950_connection_create (Z3950_options options)
+ZOOM_connection ZOOM_connection_create (ZOOM_options options)
 {
-    Z3950_connection c = xmalloc (sizeof(*c));
+    ZOOM_connection c = xmalloc (sizeof(*c));
 
     c->cs = 0;
     c->mask = 0;
     c->state = STATE_IDLE;
-    c->error = Z3950_ERROR_NONE;
+    c->error = ZOOM_ERROR_NONE;
     c->addinfo = 0;
     c->buf_in = 0;
     c->len_in = 0;
@@ -136,7 +136,7 @@ Z3950_connection Z3950_connection_create (Z3950_options options)
     c->len_out = 0;
     c->resultsets = 0;
 
-    c->options = Z3950_options_create_with_parent(options);
+    c->options = ZOOM_options_create_with_parent(options);
 
     c->host_port = 0;
     c->proxy = 0;
@@ -157,12 +157,12 @@ Z3950_connection Z3950_connection_create (Z3950_options options)
 
 /* set database names. Take local databases (if set); otherwise
    take databases given in ZURL (if set); otherwise use Default */
-static char **set_DatabaseNames (Z3950_connection con, int *num)
+static char **set_DatabaseNames (ZOOM_connection con, int *num)
 {
     char **databaseNames;
     const char *c;
     int no = 2;
-    const char *cp = Z3950_options_get (con->options, "databaseName");
+    const char *cp = ZOOM_options_get (con->options, "databaseName");
     
     if (!cp || !*cp)
     {
@@ -207,21 +207,21 @@ static char **set_DatabaseNames (Z3950_connection con, int *num)
     return databaseNames;
 }
 
-Z3950_connection Z3950_connection_new (const char *host, int portnum)
+ZOOM_connection ZOOM_connection_new (const char *host, int portnum)
 {
-    Z3950_connection c = Z3950_connection_create (0);
+    ZOOM_connection c = ZOOM_connection_create (0);
 
-    Z3950_connection_connect (c, host, portnum);
+    ZOOM_connection_connect (c, host, portnum);
     return c;
 }
 
-void Z3950_connection_connect(Z3950_connection c,
+void ZOOM_connection_connect(ZOOM_connection c,
                              const char *host, int portnum)
 {
     const char *val;
-    Z3950_task task;
+    ZOOM_task task;
 
-    val = Z3950_options_get (c->options, "proxy");
+    val = ZOOM_options_get (c->options, "proxy");
     if (val && *val)
        c->proxy = xstrdup (val);
     else
@@ -236,22 +236,22 @@ void Z3950_connection_connect(Z3950_connection c,
     else
        c->host_port = xstrdup(host);
 
-    Z3950_options_set(c->options, "host", c->host_port);
+    ZOOM_options_set(c->options, "host", c->host_port);
 
-    c->async = Z3950_options_get_bool (c->options, "async", 0);
+    c->async = ZOOM_options_get_bool (c->options, "async", 0);
     
-    task = Z3950_connection_add_task (c, Z3950_TASK_CONNECT);
+    task = ZOOM_connection_add_task (c, ZOOM_TASK_CONNECT);
 
     if (!c->async)
     {
-       while (Z3950_event (1, &c))
+       while (ZOOM_event (1, &c))
            ;
     }
 }
 
-Z3950_query Z3950_query_create(void)
+ZOOM_query ZOOM_query_create(void)
 {
-    Z3950_query s = xmalloc (sizeof(*s));
+    ZOOM_query s = xmalloc (sizeof(*s));
 
     s->refcount = 1;
     s->query = 0;
@@ -261,13 +261,13 @@ Z3950_query Z3950_query_create(void)
     return s;
 }
 
-void Z3950_query_destroy(Z3950_query s)
+void ZOOM_query_destroy(ZOOM_query s)
 {
     if (!s)
        return;
 
     (s->refcount)--;
-    yaz_log (LOG_DEBUG, "Z3950_query_destroy count=%d", s->refcount);
+    yaz_log (LOG_DEBUG, "ZOOM_query_destroy count=%d", s->refcount);
     if (s->refcount == 0)
     {
        odr_destroy (s->odr);
@@ -275,7 +275,7 @@ void Z3950_query_destroy(Z3950_query s)
     }
 }
 
-int Z3950_query_prefix(Z3950_query s, const char *str)
+int ZOOM_query_prefix(ZOOM_query s, const char *str)
 {
     s->query = odr_malloc (s->odr, sizeof(*s->query));
     s->query->which = Z_Query_type_1;
@@ -285,7 +285,7 @@ int Z3950_query_prefix(Z3950_query s, const char *str)
     return 0;
 }
 
-int Z3950_query_sortby(Z3950_query s, const char *criteria)
+int ZOOM_query_sortby(ZOOM_query s, const char *criteria)
 {
     s->sort_spec = yaz_sort_spec (s->odr, criteria);
     if (!s->sort_spec)
@@ -293,11 +293,11 @@ int Z3950_query_sortby(Z3950_query s, const char *criteria)
     return 0;
 }
 
-static int do_write(Z3950_connection c);
+static int do_write(ZOOM_connection c);
 
-void Z3950_connection_destroy(Z3950_connection c)
+void ZOOM_connection_destroy(ZOOM_connection c)
 {
-    Z3950_resultset r;
+    ZOOM_resultset r;
     if (!c)
        return;
     if (c->cs)
@@ -309,20 +309,20 @@ void Z3950_connection_destroy(Z3950_connection c)
     xfree (c->addinfo);
     odr_destroy (c->odr_in);
     odr_destroy (c->odr_out);
-    Z3950_options_destroy (c->options);
-    Z3950_connection_remove_tasks (c);
+    ZOOM_options_destroy (c->options);
+    ZOOM_connection_remove_tasks (c);
     xfree (c->host_port);
     xfree (c);
 }
 
-void Z3950_resultset_addref (Z3950_resultset r)
+void ZOOM_resultset_addref (ZOOM_resultset r)
 {
     if (r)
        (r->refcount)++;
 }
-Z3950_resultset Z3950_resultset_create ()
+ZOOM_resultset ZOOM_resultset_create ()
 {
-    Z3950_resultset r = xmalloc (sizeof(*r));
+    ZOOM_resultset r = xmalloc (sizeof(*r));
 
     r->refcount = 1;
     r->size = 0;
@@ -339,52 +339,52 @@ Z3950_resultset Z3950_resultset_create ()
     return r;
 }
 
-Z3950_resultset Z3950_connection_search_pqf(Z3950_connection c, const char *q)
+ZOOM_resultset ZOOM_connection_search_pqf(ZOOM_connection c, const char *q)
 {
-    Z3950_resultset r;
-    Z3950_query s = Z3950_query_create();
+    ZOOM_resultset r;
+    ZOOM_query s = ZOOM_query_create();
 
-    Z3950_query_prefix (s, q);
+    ZOOM_query_prefix (s, q);
 
-    r = Z3950_connection_search (c, s);
-    Z3950_query_destroy (s);
+    r = ZOOM_connection_search (c, s);
+    ZOOM_query_destroy (s);
     return r;
 }
 
-Z3950_resultset Z3950_connection_search(Z3950_connection c, Z3950_query q)
+ZOOM_resultset ZOOM_connection_search(ZOOM_connection c, ZOOM_query q)
 {
-    Z3950_resultset r = Z3950_resultset_create ();
-    Z3950_task task;
+    ZOOM_resultset r = ZOOM_resultset_create ();
+    ZOOM_task task;
 
     r->r_sort_spec = q->sort_spec;
     r->r_query = q->query;
     r->search = q;
 
-    r->options = Z3950_options_create_with_parent(c->options);
+    r->options = ZOOM_options_create_with_parent(c->options);
 
-    r->start = Z3950_options_get_int(r->options, "start", 0);
-    r->count = Z3950_options_get_int(r->options, "count", 0);
-    r->piggyback = Z3950_options_get_bool (r->options, "piggyback", 1);
+    r->start = ZOOM_options_get_int(r->options, "start", 0);
+    r->count = ZOOM_options_get_int(r->options, "count", 0);
+    r->piggyback = ZOOM_options_get_bool (r->options, "piggyback", 1);
     r->connection = c;
 
     r->next = c->resultsets;
     c->resultsets = r;
 
-    task = Z3950_connection_add_task (c, Z3950_TASK_SEARCH);
+    task = ZOOM_connection_add_task (c, ZOOM_TASK_SEARCH);
     task->u.resultset = r;
-    Z3950_resultset_addref (r);  
+    ZOOM_resultset_addref (r);  
 
     (q->refcount)++;
 
     if (!c->async)
     {
-       while (Z3950_event (1, &c))
+       while (ZOOM_event (1, &c))
            ;
     }
     return r;
 }
 
-void Z3950_resultset_destroy(Z3950_resultset r)
+void ZOOM_resultset_destroy(ZOOM_resultset r)
 {
     if (!r)
         return;
@@ -395,7 +395,7 @@ void Z3950_resultset_destroy(Z3950_resultset r)
        if (r->connection)
        {
            /* remove ourselves from the resultsets in connection */
-           Z3950_resultset *rp = &r->connection->resultsets;
+           ZOOM_resultset *rp = &r->connection->resultsets;
            while (1)
            {
                assert (*rp);   /* we must be in this list!! */
@@ -407,19 +407,19 @@ void Z3950_resultset_destroy(Z3950_resultset r)
                rp = &(*rp)->next;
            }
        }
-       Z3950_query_destroy (r->search);
-       Z3950_options_destroy (r->options);
+       ZOOM_query_destroy (r->search);
+       ZOOM_options_destroy (r->options);
        odr_destroy (r->odr);
        xfree (r);
     }
 }
 
-size_t Z3950_resultset_size (Z3950_resultset r)
+size_t ZOOM_resultset_size (ZOOM_resultset r)
 {
     return r->size;
 }
 
-static void do_close (Z3950_connection c)
+static void do_close (ZOOM_connection c)
 {
     if (c->cs)
        cs_close(c->cs);
@@ -428,11 +428,11 @@ static void do_close (Z3950_connection c)
     c->state = STATE_IDLE;
 }
 
-static void Z3950_resultset_retrieve (Z3950_resultset r,
+static void ZOOM_resultset_retrieve (ZOOM_resultset r,
                                      int force_sync, int start, int count)
 {
-    Z3950_task task;
-    Z3950_connection c;
+    ZOOM_task task;
+    ZOOM_connection c;
 
     if (!r)
        return;
@@ -445,19 +445,19 @@ static void Z3950_resultset_retrieve (Z3950_resultset r,
     if (start + count > r->size)
        count = r->size - start;
 
-    task = Z3950_connection_add_task (c, Z3950_TASK_RETRIEVE);
+    task = ZOOM_connection_add_task (c, ZOOM_TASK_RETRIEVE);
     task->u.resultset = r;
-    Z3950_resultset_addref (r);
+    ZOOM_resultset_addref (r);
 
     r->start = start;
     r->count = count;
 
     if (!r->connection->async || force_sync)
-       while (r->connection && Z3950_event (1, &r->connection))
+       while (r->connection && ZOOM_event (1, &r->connection))
            ;
 }
 
-void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs,
+void ZOOM_resultset_records (ZOOM_resultset r, ZOOM_record *recs,
                              size_t start, size_t count)
 {
     int force_present = 0;
@@ -466,16 +466,16 @@ void Z3950_resultset_records (Z3950_resultset r, Z3950_record *recs,
        return ;
     if (count && recs)
         force_present = 1;
-    Z3950_resultset_retrieve (r, force_present, start, count);
+    ZOOM_resultset_retrieve (r, force_present, start, count);
     if (force_present)
     {
         size_t i;
         for (i = 0; i< count; i++)
-            recs[i] = Z3950_resultset_record_immediate (r, i+start);
+            recs[i] = ZOOM_resultset_record_immediate (r, i+start);
     }
 }
 
-static int do_connect (Z3950_connection c)
+static int do_connect (ZOOM_connection c)
 {
     void *add;
     const char *effective_host;
@@ -497,31 +497,31 @@ static int do_connect (Z3950_connection c)
        if (ret >= 0)
        {
            c->state = STATE_CONNECTING; 
-           c->mask = Z3950_SELECT_READ | Z3950_SELECT_WRITE | 
-                Z3950_SELECT_EXCEPT;
+           c->mask = ZOOM_SELECT_READ | ZOOM_SELECT_WRITE | 
+                ZOOM_SELECT_EXCEPT;
            return 1;
        }
     }
     c->state = STATE_IDLE;
-    c->error = Z3950_ERROR_CONNECT;
+    c->error = ZOOM_ERROR_CONNECT;
     return 0;
 }
 
-int z3950_connection_socket(Z3950_connection c)
+int z3950_connection_socket(ZOOM_connection c)
 {
     if (c->cs)
        return cs_fileno(c->cs);
     return -1;
 }
 
-int z3950_connection_mask(Z3950_connection c)
+int z3950_connection_mask(ZOOM_connection c)
 {
     if (c->cs)
        return c->mask;
     return 0;
 }
 
-static int encode_APDU(Z3950_connection c, Z_APDU *a, ODR out)
+static int encode_APDU(ZOOM_connection c, Z_APDU *a, ODR out)
 {
     char str[120];
 
@@ -545,14 +545,14 @@ static int encode_APDU(Z3950_connection c, Z_APDU *a, ODR out)
            odr_destroy(odr_pr);
            fclose (outf);
        }
-       c->error = Z3950_ERROR_ENCODE;
+       c->error = ZOOM_ERROR_ENCODE;
        do_close (c);
        return -1;
     }
     return 0;
 }
 
-static int send_APDU (Z3950_connection c, Z_APDU *a)
+static int send_APDU (ZOOM_connection c, Z_APDU *a)
 {
     assert (a);
     if (encode_APDU(c, a, c->odr_out))
@@ -563,15 +563,15 @@ static int send_APDU (Z3950_connection c, Z_APDU *a)
     return 0;  
 }
 
-static int Z3950_connection_send_init (Z3950_connection c)
+static int ZOOM_connection_send_init (ZOOM_connection c)
 {
     const char *impname;
     Z_APDU *apdu = zget_APDU(c->odr_out, Z_APDU_initRequest);
     Z_InitRequest *ireq = apdu->u.initRequest;
     Z_IdAuthentication *auth = odr_malloc(c->odr_out, sizeof(*auth));
-    const char *auth_groupId = Z3950_options_get (c->options, "group");
-    const char *auth_userId = Z3950_options_get (c->options, "user");
-    const char *auth_password = Z3950_options_get (c->options, "pass");
+    const char *auth_groupId = ZOOM_options_get (c->options, "group");
+    const char *auth_userId = ZOOM_options_get (c->options, "user");
+    const char *auth_password = ZOOM_options_get (c->options, "pass");
     
     ODR_MASK_SET(ireq->options, Z_Options_search);
     ODR_MASK_SET(ireq->options, Z_Options_present);
@@ -586,7 +586,7 @@ static int Z3950_connection_send_init (Z3950_connection c)
     ODR_MASK_SET(ireq->protocolVersion, Z_ProtocolVersion_2);
     ODR_MASK_SET(ireq->protocolVersion, Z_ProtocolVersion_3);
     
-    impname = Z3950_options_get (c->options, "implementationName");
+    impname = ZOOM_options_get (c->options, "implementationName");
     ireq->implementationName =
        odr_malloc (c->odr_out, 15 + (impname ? strlen(impname) : 0));
     strcpy (ireq->implementationName, "");
@@ -598,9 +598,9 @@ static int Z3950_connection_send_init (Z3950_connection c)
     strcat (ireq->implementationName, "ZOOM-C/YAZ");
     
     *ireq->maximumRecordSize =
-       Z3950_options_get_int (c->options, "maximumRecordSize", 1024*1024);
+       ZOOM_options_get_int (c->options, "maximumRecordSize", 1024*1024);
     *ireq->preferredMessageSize =
-       Z3950_options_get_int (c->options, "preferredMessageSize", 1024*1024);
+       ZOOM_options_get_int (c->options, "preferredMessageSize", 1024*1024);
     
     if (auth_groupId || auth_password)
     {
@@ -650,9 +650,9 @@ static int Z3950_connection_send_init (Z3950_connection c)
     return 0;
 }
 
-static int Z3950_connection_send_search (Z3950_connection c)
+static int ZOOM_connection_send_search (ZOOM_connection c)
 {
-    Z3950_resultset r;
+    ZOOM_resultset r;
     int lslb, ssub, mspn;
     const char *syntax;
     Z_APDU *apdu = zget_APDU(c->odr_out, Z_APDU_searchRequest);
@@ -662,16 +662,16 @@ static int Z3950_connection_send_search (Z3950_connection c)
     const char *mediumSetElementSetName;
 
     assert (c->tasks);
-    assert (c->tasks->which == Z3950_TASK_SEARCH);
+    assert (c->tasks->which == ZOOM_TASK_SEARCH);
 
     r = c->tasks->u.resultset;
 
     elementSetName =
-       Z3950_options_get (r->options, "elementSetName");
+       ZOOM_options_get (r->options, "elementSetName");
     smallSetElementSetName  =
-       Z3950_options_get (r->options, "smallSetElementSetName");
+       ZOOM_options_get (r->options, "smallSetElementSetName");
     mediumSetElementSetName =
-       Z3950_options_get (r->options, "mediumSetElementSetName");
+       ZOOM_options_get (r->options, "mediumSetElementSetName");
 
     if (!smallSetElementSetName)
        smallSetElementSetName = elementSetName;
@@ -689,11 +689,11 @@ static int Z3950_connection_send_search (Z3950_connection c)
        set_DatabaseNames (c, &search_req->num_databaseNames);
 
     /* get syntax (no need to provide unless piggyback is in effect) */
-    syntax = Z3950_options_get (r->options, "preferredRecordSyntax");
+    syntax = ZOOM_options_get (r->options, "preferredRecordSyntax");
 
-    lslb = Z3950_options_get_int (r->options, "largeSetLowerBound", -1);
-    ssub = Z3950_options_get_int (r->options, "smallSetUpperBound", -1);
-    mspn = Z3950_options_get_int (r->options, "mediumSetPresentNumber", -1);
+    lslb = ZOOM_options_get_int (r->options, "largeSetLowerBound", -1);
+    ssub = ZOOM_options_get_int (r->options, "smallSetUpperBound", -1);
+    mspn = ZOOM_options_get_int (r->options, "mediumSetPresentNumber", -1);
     if (lslb != -1 && ssub != -1 && mspn != -1)
     {
        /* So're a Z39.50 expert? Let's hope you don't do sort */
@@ -743,7 +743,7 @@ static int Z3950_connection_send_search (Z3950_connection c)
     return 1;
 }
 
-static void response_diag (Z3950_connection c, Z_DiagRec *p)
+static void response_diag (ZOOM_connection c, Z_DiagRec *p)
 {
     Z_DefaultDiagFormat *r;
     char *addinfo = 0;
@@ -752,7 +752,7 @@ static void response_diag (Z3950_connection c, Z_DiagRec *p)
     c->addinfo = 0;
     if (p->which != Z_DiagRec_defaultFormat)
     {
-       c->error = Z3950_ERROR_DECODE;
+       c->error = ZOOM_ERROR_DECODE;
        return;
     }
     r = p->u.defaultFormat;
@@ -770,12 +770,12 @@ static void response_diag (Z3950_connection c, Z_DiagRec *p)
     c->error = *r->condition;
 }
 
-Z3950_record Z3950_record_dup (Z3950_record srec)
+ZOOM_record ZOOM_record_clone (ZOOM_record srec)
 {
     char *buf;
     int size;
     ODR odr_enc;
-    Z3950_record nrec;
+    ZOOM_record nrec;
 
     odr_enc = odr_createmem(ODR_ENCODE);
     if (!z_NamePlusRecord (odr_enc, &srec->npr, 0, 0))
@@ -792,18 +792,18 @@ Z3950_record Z3950_record_dup (Z3950_record srec)
     return nrec;
 }
 
-Z3950_record Z3950_resultset_record_immediate (Z3950_resultset s,size_t pos)
+ZOOM_record ZOOM_resultset_record_immediate (ZOOM_resultset s,size_t pos)
 {
     return record_cache_lookup (s, pos, 0);
 }
 
-Z3950_record Z3950_resultset_record (Z3950_resultset r, size_t pos)
+ZOOM_record ZOOM_resultset_record (ZOOM_resultset r, size_t pos)
 {
-    Z3950_resultset_retrieve (r, 1, pos, 1);
-    return Z3950_resultset_record_immediate (r, pos);
+    ZOOM_resultset_retrieve (r, 1, pos, 1);
+    return ZOOM_resultset_record_immediate (r, pos);
 }
 
-void Z3950_record_destroy (Z3950_record rec)
+void ZOOM_record_destroy (ZOOM_record rec)
 {
     if (!rec)
        return;
@@ -813,7 +813,7 @@ void Z3950_record_destroy (Z3950_record rec)
     xfree (rec);
 }
 
-void *Z3950_record_get (Z3950_record rec, const char *type, size_t *len)
+void *ZOOM_record_get (ZOOM_record rec, const char *type, size_t *len)
 {
     Z_NamePlusRecord *npr;
     if (!rec)
@@ -893,12 +893,12 @@ void *Z3950_record_get (Z3950_record rec, const char *type, size_t *len)
     return 0;
 }
 
-static void record_cache_add (Z3950_resultset r,
+static void record_cache_add (ZOOM_resultset r,
                              Z_NamePlusRecord *npr,
                              int pos,
                              const char *elementSetName)
 {
-    Z3950_record_cache rc;
+    ZOOM_record_cache rc;
 
     for (rc = r->record_cache; rc; rc = rc->next)
     {
@@ -929,11 +929,11 @@ static void record_cache_add (Z3950_resultset r,
     r->record_cache = rc;
 }
 
-static Z3950_record record_cache_lookup (Z3950_resultset r,
+static ZOOM_record record_cache_lookup (ZOOM_resultset r,
                                         int pos,
                                         const char *elementSetName)
 {
-    Z3950_record_cache rc;
+    ZOOM_record_cache rc;
 
     for (rc = r->record_cache; rc; rc = rc->next)
     {
@@ -948,15 +948,15 @@ static Z3950_record record_cache_lookup (Z3950_resultset r,
     return 0;
 }
                                             
-static void handle_records (Z3950_connection c, Z_Records *sr,
+static void handle_records (ZOOM_connection c, Z_Records *sr,
                            int present_phase)
 {
-    Z3950_resultset resultset;
+    ZOOM_resultset resultset;
 
     if (!c->tasks)
        return ;
-    if (c->tasks->which != Z3950_TASK_SEARCH &&
-       c->tasks->which != Z3950_TASK_RETRIEVE)
+    if (c->tasks->which != ZOOM_TASK_SEARCH &&
+       c->tasks->which != ZOOM_TASK_RETRIEVE)
        return ;
     
     resultset = c->tasks->u.resultset;
@@ -974,7 +974,7 @@ static void handle_records (Z3950_connection c, Z_Records *sr,
        if (sr->u.multipleNonSurDiagnostics->num_diagRecs >= 1)
            response_diag(c, sr->u.multipleNonSurDiagnostics->diagRecs[0]);
        else
-           c->error = Z3950_ERROR_DECODE;
+           c->error = ZOOM_ERROR_DECODE;
     }
     else 
     {
@@ -999,29 +999,29 @@ static void handle_records (Z3950_connection c, Z_Records *sr,
            if (present_phase && p->num_records == 0)
            {
                /* present response and we didn't get any records! */
-               c->error = Z3950_ERROR_DECODE;
+               c->error = ZOOM_ERROR_DECODE;
            }
        }
        else if (present_phase)
        {
            /* present response and we didn't get any records! */
-           c->error = Z3950_ERROR_DECODE;
+           c->error = ZOOM_ERROR_DECODE;
        }
     }
 }
 
-static void handle_present_response (Z3950_connection c, Z_PresentResponse *pr)
+static void handle_present_response (ZOOM_connection c, Z_PresentResponse *pr)
 {
     handle_records (c, pr->records, 1);
 }
 
-static void handle_search_response (Z3950_connection c, Z_SearchResponse *sr)
+static void handle_search_response (ZOOM_connection c, Z_SearchResponse *sr)
 {
-    Z3950_resultset resultset;
+    ZOOM_resultset resultset;
 
     yaz_log (LOG_DEBUG, "got search response");
 
-    if (!c->tasks || c->tasks->which != Z3950_TASK_SEARCH)
+    if (!c->tasks || c->tasks->which != ZOOM_TASK_SEARCH)
        return ;
 
     resultset = c->tasks->u.resultset;
@@ -1030,17 +1030,17 @@ static void handle_search_response (Z3950_connection c, Z_SearchResponse *sr)
     handle_records (c, sr->records, 0);
 }
 
-static void sort_response (Z3950_connection c, Z_SortResponse *res)
+static void sort_response (ZOOM_connection c, Z_SortResponse *res)
 {
     if (res->diagnostics && res->num_diagnostics > 0)
        response_diag (c, res->diagnostics[0]);
 }
 
-static int send_sort (Z3950_connection c)
+static int send_sort (ZOOM_connection c)
 {
-    Z3950_resultset  resultset;
+    ZOOM_resultset  resultset;
 
-    if (!c->tasks || c->tasks->which != Z3950_TASK_SEARCH)
+    if (!c->tasks || c->tasks->which != ZOOM_TASK_SEARCH)
        return 0;
 
     resultset = c->tasks->u.resultset;
@@ -1068,21 +1068,21 @@ static int send_sort (Z3950_connection c)
     return 0;
 }
 
-static int send_present (Z3950_connection c)
+static int send_present (ZOOM_connection c)
 {
     Z_APDU *apdu = zget_APDU(c->odr_out, Z_APDU_presentRequest);
     Z_PresentRequest *req = apdu->u.presentRequest;
     int i = 0;
     const char *syntax = 
-       Z3950_options_get (c->options, "preferredRecordSyntax");
+       ZOOM_options_get (c->options, "preferredRecordSyntax");
     const char *element =
-       Z3950_options_get (c->options, "elementSetName");
-    Z3950_resultset  resultset;
+       ZOOM_options_get (c->options, "elementSetName");
+    ZOOM_resultset  resultset;
 
     if (!c->tasks)
        return 0;
-    if (c->tasks->which != Z3950_TASK_SEARCH && 
-       c->tasks->which != Z3950_TASK_RETRIEVE)
+    if (c->tasks->which != ZOOM_TASK_SEARCH && 
+       c->tasks->which != ZOOM_TASK_RETRIEVE)
        return 0;
 
     resultset = c->tasks->u.resultset;
@@ -1093,7 +1093,7 @@ static int send_present (Z3950_connection c)
        return 0;
     for (i = 0; i<resultset->count; i++)
     {
-       Z3950_record rec =
+       ZOOM_record rec =
            record_cache_lookup (resultset, i + resultset->start, 0);
        if (!rec)
            break;
@@ -1126,43 +1126,43 @@ static int send_present (Z3950_connection c)
     return 1;
 }
 
-static int Z3950_connection_exec_task (Z3950_connection c)
+static int ZOOM_connection_exec_task (ZOOM_connection c)
 {
-    Z3950_task task = c->tasks;
+    ZOOM_task task = c->tasks;
 
-    yaz_log (LOG_LOG, "Z3950_connection_exec_task");
+    yaz_log (LOG_DEBUG, "ZOOM_connection_exec_task");
     if (!task)
        return 0;
-    if (c->error != Z3950_ERROR_NONE ||
-        (!c->cs && task->which != Z3950_TASK_CONNECT))
+    if (c->error != ZOOM_ERROR_NONE ||
+        (!c->cs && task->which != ZOOM_TASK_CONNECT))
     {
-       Z3950_connection_remove_tasks (c);
+       ZOOM_connection_remove_tasks (c);
        return 0;
     }
-    yaz_log (LOG_DEBUG, "Z3950_connection_exec_task type=%d", task->which);
+    yaz_log (LOG_DEBUG, "ZOOM_connection_exec_task type=%d", task->which);
     if (task->running)
        return 0;
     task->running = 1;
     switch (task->which)
     {
-    case Z3950_TASK_SEARCH:
+    case ZOOM_TASK_SEARCH:
        /* see if search hasn't been sent yet. */
-       if (Z3950_connection_send_search (c))
+       if (ZOOM_connection_send_search (c))
            return 1;
        break;
-    case Z3950_TASK_RETRIEVE:
+    case ZOOM_TASK_RETRIEVE:
        if (send_present (c))
            return 1;
        break;
-    case Z3950_TASK_CONNECT:
+    case ZOOM_TASK_CONNECT:
         if (do_connect(c))
             return 1;
     }
-    Z3950_connection_remove_task (c);
+    ZOOM_connection_remove_task (c);
     return 0;
 }
 
-static int send_sort_present (Z3950_connection c)
+static int send_sort_present (ZOOM_connection c)
 {
     int r = send_sort (c);
     if (!r)
@@ -1170,7 +1170,7 @@ static int send_sort_present (Z3950_connection c)
     return r;
 }
 
-static void handle_apdu (Z3950_connection c, Z_APDU *apdu)
+static void handle_apdu (ZOOM_connection c, Z_APDU *apdu)
 {
     Z_InitResponse *initrs;
     
@@ -1182,7 +1182,7 @@ static void handle_apdu (Z3950_connection c, Z_APDU *apdu)
        initrs = apdu->u.initResponse;
        if (!*initrs->result)
        {
-           c->error = Z3950_ERROR_INIT;
+           c->error = ZOOM_ERROR_INIT;
        }
        else
        {
@@ -1195,30 +1195,30 @@ static void handle_apdu (Z3950_connection c, Z_APDU *apdu)
                c->cookie_in = xstrdup(cookie);
             if (c->tasks)
             {
-                assert (c->tasks->which == Z3950_TASK_CONNECT);
-                Z3950_connection_remove_task (c);
+                assert (c->tasks->which == ZOOM_TASK_CONNECT);
+                ZOOM_connection_remove_task (c);
             }
-           Z3950_connection_exec_task (c);
+           ZOOM_connection_exec_task (c);
        }
        break;
     case Z_APDU_searchResponse:
        handle_search_response (c, apdu->u.searchResponse);
        if (!send_sort_present (c))
-           Z3950_connection_remove_task (c);
+           ZOOM_connection_remove_task (c);
        break;
     case Z_APDU_presentResponse:
        handle_present_response (c, apdu->u.presentResponse);
        if (!send_present (c))
-           Z3950_connection_remove_task (c);
+           ZOOM_connection_remove_task (c);
        break;
     case Z_APDU_sortResponse:
        sort_response (c, apdu->u.sortResponse);
        if (!send_present (c))
-           Z3950_connection_remove_task (c);
+           ZOOM_connection_remove_task (c);
     }
 }
 
-static int do_read (Z3950_connection c)
+static int do_read (ZOOM_connection c)
 {
     int r;
     Z_APDU *apdu;
@@ -1228,7 +1228,7 @@ static int do_read (Z3950_connection c)
        return 0;
     if (r <= 0)
     {
-       c->error= Z3950_ERROR_CONNECTION_LOST;
+       c->error= ZOOM_ERROR_CONNECTION_LOST;
        do_close (c);
     }
     else
@@ -1237,7 +1237,7 @@ static int do_read (Z3950_connection c)
        odr_setbuf (c->odr_in, c->buf_in, r, 0);
        if (!z_APDU (c->odr_in, &apdu, 0, 0))
        {
-           c->error = Z3950_ERROR_DECODE;
+           c->error = ZOOM_ERROR_DECODE;
            do_close (c);
        }
        else
@@ -1248,81 +1248,81 @@ static int do_read (Z3950_connection c)
     return 1;
 }
 
-static int do_write_ex (Z3950_connection c, char *buf_out, int len_out)
+static int do_write_ex (ZOOM_connection c, char *buf_out, int len_out)
 {
     int r;
     
     if ((r=cs_put (c->cs, buf_out, len_out)) < 0)
     {
        if (c->state == STATE_CONNECTING)
-           c->error = Z3950_ERROR_CONNECT;
+           c->error = ZOOM_ERROR_CONNECT;
        else
-           c->error = Z3950_ERROR_CONNECTION_LOST;
+           c->error = ZOOM_ERROR_CONNECTION_LOST;
        do_close (c);
        return 1;
     }
     else if (r == 1)
     {
        c->state = STATE_ESTABLISHED;
-       c->mask = Z3950_SELECT_READ|Z3950_SELECT_WRITE|Z3950_SELECT_EXCEPT;
+       c->mask = ZOOM_SELECT_READ|ZOOM_SELECT_WRITE|ZOOM_SELECT_EXCEPT;
     }
     else
     {
        c->state = STATE_ESTABLISHED;
-       c->mask = Z3950_SELECT_READ|Z3950_SELECT_EXCEPT;
+       c->mask = ZOOM_SELECT_READ|ZOOM_SELECT_EXCEPT;
     }
     return 0;
 }
 
-static int do_write(Z3950_connection c)
+static int do_write(ZOOM_connection c)
 {
     return do_write_ex (c, c->buf_out, c->len_out);
 }
 
 
-const char *Z3950_connection_option_get (Z3950_connection c, const char *key)
+const char *ZOOM_connection_option_get (ZOOM_connection c, const char *key)
 {
-    return Z3950_options_get (c->options, key);
+    return ZOOM_options_get (c->options, key);
 }
 
-void Z3950_connection_option_set (Z3950_connection c, const char *key,
+void ZOOM_connection_option_set (ZOOM_connection c, const char *key,
                                   const char *val)
 {
-    Z3950_options_set (c->options, key, val);
+    ZOOM_options_set (c->options, key, val);
 }
 
-const char *Z3950_resultset_option_get (Z3950_resultset r, const char *key)
+const char *ZOOM_resultset_option_get (ZOOM_resultset r, const char *key)
 {
-    return Z3950_options_get (r->options, key);
+    return ZOOM_options_get (r->options, key);
 }
 
-void Z3950_resultset_option_set (Z3950_resultset r, const char *key,
+void ZOOM_resultset_option_set (ZOOM_resultset r, const char *key,
                                   const char *val)
 {
-    Z3950_options_set (r->options, key, val);
+    ZOOM_options_set (r->options, key, val);
 }
 
 
-int Z3950_connection_errcode (Z3950_connection c)
+int ZOOM_connection_errcode (ZOOM_connection c)
 {
-    return Z3950_connection_error (c, 0, 0);
+    return ZOOM_connection_error (c, 0, 0);
 }
 
-const char *Z3950_connection_errmsg (Z3950_connection c)
+const char *ZOOM_connection_errmsg (ZOOM_connection c)
 {
     const char *msg;
-    Z3950_connection_error (c, &msg, 0);
+    ZOOM_connection_error (c, &msg, 0);
     return msg;
 }
 
-const char *Z3950_connection_addinfo (Z3950_connection c)
+const char *ZOOM_connection_addinfo (ZOOM_connection c)
 {
     const char *addinfo;
-    Z3950_connection_error (c, 0, &addinfo);
+    ZOOM_connection_error (c, 0, &addinfo);
     return addinfo;
 }
 
-int Z3950_connection_error (Z3950_connection c, const char **cp,
+int ZOOM_connection_error (ZOOM_connection c, const char **cp,
                            const char **addinfo)
 {
     int error = c->error;
@@ -1330,23 +1330,23 @@ int Z3950_connection_error (Z3950_connection c, const char **cp,
     {
        switch (error)
        {
-       case Z3950_ERROR_NONE:
+       case ZOOM_ERROR_NONE:
            *cp = "No error"; break;
-       case Z3950_ERROR_CONNECT:
+       case ZOOM_ERROR_CONNECT:
            *cp = "Connect failed"; break;
-       case Z3950_ERROR_MEMORY:
+       case ZOOM_ERROR_MEMORY:
            *cp = "Out of memory"; break;
-       case Z3950_ERROR_ENCODE:
+       case ZOOM_ERROR_ENCODE:
            *cp = "Encoding failed"; break;
-       case Z3950_ERROR_DECODE:
+       case ZOOM_ERROR_DECODE:
            *cp = "Decoding failed"; break;
-       case Z3950_ERROR_CONNECTION_LOST:
+       case ZOOM_ERROR_CONNECTION_LOST:
            *cp = "Connection lost"; break;
-       case Z3950_ERROR_INIT:
+       case ZOOM_ERROR_INIT:
            *cp = "Init rejected"; break;
-       case Z3950_ERROR_INTERNAL:
+       case ZOOM_ERROR_INTERNAL:
            *cp = "Internal failure"; break;
-       case Z3950_ERROR_TIMEOUT:
+       case ZOOM_ERROR_TIMEOUT:
            *cp = "Timeout"; break;
        default:
            *cp = diagbib1_str (error);
@@ -1362,17 +1362,17 @@ int Z3950_connection_error (Z3950_connection c, const char **cp,
     return c->error;
 }
 
-int Z3950_connection_do_io(Z3950_connection c, int mask)
+int ZOOM_connection_do_io(ZOOM_connection c, int mask)
 {
-    Z3950_Event event;
+    ZOOM_Event event;
 #if 0
     int r = cs_look(c->cs);
-    yaz_log (LOG_LOG, "Z3950_connection_do_io c=%p mask=%d cs_look=%d",
+    yaz_log (LOG_LOG, "ZOOM_connection_do_io c=%p mask=%d cs_look=%d",
             c, mask, r);
     
     if (r == CS_NONE)
     {
-       c->error = Z3950_ERROR_CONNECT;
+       c->error = ZOOM_ERROR_CONNECT;
        do_close (c);
     }
     else if (r == CS_CONNECT)
@@ -1380,55 +1380,55 @@ int Z3950_connection_do_io(Z3950_connection c, int mask)
        yaz_log (LOG_LOG, "calling rcvconnect");
        if (cs_rcvconnect (c->cs) < 0)
        {
-           c->error = Z3950_ERROR_CONNECT;
+           c->error = ZOOM_ERROR_CONNECT;
            do_close (c);
        }
        else
-           Z3950_connection_send_init (c);
+           ZOOM_connection_send_init (c);
     }
     else
     {
-       if (mask & Z3950_SELECT_READ)
+       if (mask & ZOOM_SELECT_READ)
            do_read (c);
-       if (c->cs && (mask & Z3950_SELECT_WRITE))
+       if (c->cs && (mask & ZOOM_SELECT_WRITE))
            do_write (c);
     }  
 #else
-    yaz_log (LOG_DEBUG, "Z3950_connection_do_io c=%p mask=%d", c, mask);
+    yaz_log (LOG_DEBUG, "ZOOM_connection_do_io c=%p mask=%d", c, mask);
     if (c->state == STATE_CONNECTING)
     {
-       if (mask & Z3950_SELECT_WRITE)
-           Z3950_connection_send_init (c);
+       if (mask & ZOOM_SELECT_WRITE)
+           ZOOM_connection_send_init (c);
        else
        {
-           c->error = Z3950_ERROR_CONNECT;
+           c->error = ZOOM_ERROR_CONNECT;
            do_close (c);
        }
     }
     else if (c->state == STATE_ESTABLISHED)
     {
-       if (mask & Z3950_SELECT_READ)
+       if (mask & ZOOM_SELECT_READ)
            do_read (c);
-       if (c->cs && (mask & Z3950_SELECT_WRITE))
+       if (c->cs && (mask & ZOOM_SELECT_WRITE))
            do_write (c);
     }
     else
     {
-       c->error = Z3950_ERROR_INTERNAL;
+       c->error = ZOOM_ERROR_INTERNAL;
        do_close (c);
     }
 #endif
-    event = Z3950_Event_create (1);
-    Z3950_connection_put_event (c, event);
+    event = ZOOM_Event_create (1);
+    ZOOM_connection_put_event (c, event);
     return 1;
 }
 
 
-int Z3950_event (int no, Z3950_connection *cs)
+int ZOOM_event (int no, ZOOM_connection *cs)
 {
 #if HAVE_SYS_POLL_H
     struct pollfd pollfds[1024];
-    Z3950_connection poll_cs[1024];
+    ZOOM_connection poll_cs[1024];
 #else
     struct timeval tv;
     fd_set input, output, except;
@@ -1438,18 +1438,18 @@ int Z3950_event (int no, Z3950_connection *cs)
 
     for (i = 0; i<no; i++)
     {
-       Z3950_connection c = cs[i];
-        Z3950_Event event;
-       if (c && (event = Z3950_connection_get_event(c)))
+       ZOOM_connection c = cs[i];
+        ZOOM_Event event;
+       if (c && (event = ZOOM_connection_get_event(c)))
         {
-            Z3950_Event_destroy (event);
+            ZOOM_Event_destroy (event);
            return i+1;
         }
     }
     for (i = 0; i<no; i++)
     {
-        Z3950_connection c = cs[i];
-        if (c && Z3950_connection_exec_task (c))
+        ZOOM_connection c = cs[i];
+        if (c && ZOOM_connection_exec_task (c))
             return i+1;
     }
 #if HAVE_SYS_POLL_H
@@ -1465,7 +1465,7 @@ int Z3950_event (int no, Z3950_connection *cs)
     nfds = 0;
     for (i = 0; i<no; i++)
     {
-       Z3950_connection c = cs[i];
+       ZOOM_connection c = cs[i];
        int fd, mask;
        
        if (!c)
@@ -1483,11 +1483,11 @@ int Z3950_event (int no, Z3950_connection *cs)
         {
             short poll_events = 0;
 
-            if (mask & Z3950_SELECT_READ)
+            if (mask & ZOOM_SELECT_READ)
                 poll_events += POLLIN;
-            if (mask & Z3950_SELECT_WRITE)
+            if (mask & ZOOM_SELECT_WRITE)
                 poll_events += POLLOUT;
-            if (mask & Z3950_SELECT_EXCEPT)
+            if (mask & ZOOM_SELECT_EXCEPT)
                 poll_events += POLLERR;
             pollfds[nfds].fd = fd;
             pollfds[nfds].events = poll_events;
@@ -1496,17 +1496,17 @@ int Z3950_event (int no, Z3950_connection *cs)
             nfds++;
         }
 #else
-       if (mask & Z3950_SELECT_READ)
+       if (mask & ZOOM_SELECT_READ)
        {
            FD_SET (fd, &input);
            nfds++;
        }
-       if (mask & Z3950_SELECT_WRITE)
+       if (mask & ZOOM_SELECT_WRITE)
        {
            FD_SET (fd, &output);
            nfds++;
        }
-       if (mask & Z3950_SELECT_EXCEPT)
+       if (mask & ZOOM_SELECT_EXCEPT)
        {
            FD_SET (fd, &except);
            nfds++;
@@ -1516,31 +1516,31 @@ int Z3950_event (int no, Z3950_connection *cs)
     if (!nfds)
         return 0;
 #if HAVE_SYS_POLL_H
-    yaz_log (LOG_LOG, "poll start");
+    yaz_log (LOG_DEBUG, "poll start");
     r = poll (pollfds, nfds, 15000);
-    yaz_log (LOG_LOG, "poll stop, returned r=%d", r);
+    yaz_log (LOG_DEBUG, "poll stop, returned r=%d", r);
     for (i = 0; i<nfds; i++)
     {
-        Z3950_connection c = poll_cs[i];
+        ZOOM_connection c = poll_cs[i];
         if (r && c->mask)
         {
             int mask = 0;
             if (pollfds[i].revents & POLLIN)
-                mask += Z3950_SELECT_READ;
+                mask += ZOOM_SELECT_READ;
             if (pollfds[i].revents & POLLOUT)
-                mask += Z3950_SELECT_WRITE;
+                mask += ZOOM_SELECT_WRITE;
             if (pollfds[i].revents & POLLERR)
-                mask += Z3950_SELECT_EXCEPT;
+                mask += ZOOM_SELECT_EXCEPT;
             if (mask)
-                Z3950_connection_do_io(c, mask);
+                ZOOM_connection_do_io(c, mask);
         }
         else if (r == 0 && c->mask)
         {
-            Z3950_Event event = Z3950_Event_create(0);
+            ZOOM_Event event = ZOOM_Event_create(0);
            /* timeout and this connection was waiting */
-           c->error = Z3950_ERROR_TIMEOUT;
+           c->error = ZOOM_ERROR_TIMEOUT;
             do_close (c);
-            Z3950_connection_put_event(c, event);
+            ZOOM_connection_put_event(c, event);
         }
     }
 #else
@@ -1549,7 +1549,7 @@ int Z3950_event (int no, Z3950_connection *cs)
     yaz_log (LOG_DEBUG, "select stop, returned r=%d", r);
     for (i = 0; i<no; i++)
     {
-       Z3950_connection c = cs[i];
+       ZOOM_connection c = cs[i];
        int fd, mask;
 
        if (!c)
@@ -1560,32 +1560,32 @@ int Z3950_event (int no, Z3950_connection *cs)
        {
            /* no timeout and real socket */
            if (FD_ISSET(fd, &input))
-               mask += Z3950_SELECT_READ;
+               mask += ZOOM_SELECT_READ;
            if (FD_ISSET(fd, &output))
-               mask += Z3950_SELECT_WRITE;
+               mask += ZOOM_SELECT_WRITE;
            if (FD_ISSET(fd, &except))
-               mask += Z3950_SELECT_EXCEPT;
+               mask += ZOOM_SELECT_EXCEPT;
            if (mask)
-               Z3950_connection_do_io(c, mask);
+               ZOOM_connection_do_io(c, mask);
        }
        if (r == 0 && c->mask)
        {
-            Z3950_Event event = Z3950_Event_create(0);
+            ZOOM_Event event = ZOOM_Event_create(0);
            /* timeout and this connection was waiting */
-           c->error = Z3950_ERROR_TIMEOUT;
+           c->error = ZOOM_ERROR_TIMEOUT;
             do_close (c);
-            yaz_log (LOG_LOG, "timeout");
-            Z3950_connection_put_event(c, event);
+            yaz_log (LOG_DEBUG, "timeout");
+            ZOOM_connection_put_event(c, event);
        }
     }
 #endif
     for (i = 0; i<no; i++)
     {
-       Z3950_connection c = cs[i];
-        Z3950_Event event;
-       if (c && (event = Z3950_connection_get_event(c)))
+       ZOOM_connection c = cs[i];
+        ZOOM_Event event;
+       if (c && (event = ZOOM_connection_get_event(c)))
         {
-            Z3950_Event_destroy (event);
+            ZOOM_Event_destroy (event);
            return i+1;
         }
     }
index ddb5a89..f99092e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoom-opt.c,v 1.1 2001-10-23 21:00:20 adam Exp $
+ * $Id: zoom-opt.c,v 1.2 2001-11-18 21:14:23 adam Exp $
  *
  * ZOOM layer for C, options handling
  */
@@ -9,14 +9,14 @@
 
 #include "zoom-p.h"
 
-Z3950_options Z3950_options_create (void)
+ZOOM_options ZOOM_options_create (void)
 {
-    return Z3950_options_create_with_parent (0);
+    return ZOOM_options_create_with_parent (0);
 }
 
-Z3950_options Z3950_options_create_with_parent (Z3950_options parent)
+ZOOM_options ZOOM_options_create_with_parent (ZOOM_options parent)
 {
-    Z3950_options opt = xmalloc (sizeof(*opt));
+    ZOOM_options opt = xmalloc (sizeof(*opt));
 
     opt->refcount = 1;
     opt->callback_func = 0;
@@ -28,17 +28,17 @@ Z3950_options Z3950_options_create_with_parent (Z3950_options parent)
     return opt;
 }
 
-void Z3950_options_addref (Z3950_options opt)
+void ZOOM_options_addref (ZOOM_options opt)
 {
     (opt->refcount)++;
 }
 
-Z3950_options_callback Z3950_options_set_callback (
-    Z3950_options opt,
-    Z3950_options_callback callback_func,
+ZOOM_options_callback ZOOM_options_set_callback (
+    ZOOM_options opt,
+    ZOOM_options_callback callback_func,
     void *callback_handle)
 {
-    Z3950_options_callback callback_old;
+    ZOOM_options_callback callback_old;
 
     assert (opt);
     callback_old = opt->callback_func;
@@ -47,20 +47,20 @@ Z3950_options_callback Z3950_options_set_callback (
     return callback_old;
 }
 
-void Z3950_options_destroy (Z3950_options opt)
+void ZOOM_options_destroy (ZOOM_options opt)
 {
     if (!opt)
        return;
     (opt->refcount)--;
     if (opt->refcount == 0)
     {
-       struct Z3950_options_entry *e;
+       struct ZOOM_options_entry *e;
        
-       Z3950_options_destroy (opt->parent);
+       ZOOM_options_destroy (opt->parent);
        e = opt->entries;
        while (e)
        {
-           struct Z3950_options_entry *e0 = e;
+           struct ZOOM_options_entry *e0 = e;
            xfree (e->name);
            xfree (e->value);
            e = e->next;
@@ -70,9 +70,9 @@ void Z3950_options_destroy (Z3950_options opt)
     }
 }
 
-void Z3950_options_set (Z3950_options opt, const char *name, const char *value)
+void ZOOM_options_set (ZOOM_options opt, const char *name, const char *value)
 {
-    struct Z3950_options_entry **e;
+    struct ZOOM_options_entry **e;
 
     e = &opt->entries;
     while (*e)
@@ -91,7 +91,7 @@ void Z3950_options_set (Z3950_options opt, const char *name, const char *value)
     (*e)->next = 0;
 }
 
-const char *Z3950_options_get (Z3950_options opt, const char *name)
+const char *ZOOM_options_get (ZOOM_options opt, const char *name)
 {
     const char *v = 0;
     if (!opt)
@@ -100,7 +100,7 @@ const char *Z3950_options_get (Z3950_options opt, const char *name)
        v = (*opt->callback_func)(opt->callback_handle, name);
     if (!v)
     {
-       struct Z3950_options_entry *e;
+       struct ZOOM_options_entry *e;
        for (e = opt->entries; e; e = e->next)
            if (!strcmp(e->name, name))
            {
@@ -109,13 +109,13 @@ const char *Z3950_options_get (Z3950_options opt, const char *name)
            }
     }
     if (!v)
-       return Z3950_options_get(opt->parent, name);
+       return ZOOM_options_get(opt->parent, name);
     return v;
 }
 
-int Z3950_options_get_bool (Z3950_options opt, const char *name, int defa)
+int ZOOM_options_get_bool (ZOOM_options opt, const char *name, int defa)
 {
-    const char *v = Z3950_options_get (opt, name);
+    const char *v = ZOOM_options_get (opt, name);
 
     if (!v)
        return defa;
@@ -124,9 +124,9 @@ int Z3950_options_get_bool (Z3950_options opt, const char *name, int defa)
     return 0;
 }
 
-int Z3950_options_get_int (Z3950_options opt, const char *name, int defa)
+int ZOOM_options_get_int (ZOOM_options opt, const char *name, int defa)
 {
-    const char *v = Z3950_options_get (opt, name);
+    const char *v = ZOOM_options_get (opt, name);
 
     if (!v || !*v)
        return defa;
index 5958aff..85a80db 100644 (file)
@@ -1,15 +1,15 @@
 /*
  * Private C header for ZOOM C.
- * $Id: zoom-p.h,v 1.4 2001-11-13 22:57:03 adam Exp $
+ * $Id: zoom-p.h,v 1.5 2001-11-18 21:14:23 adam Exp $
  */
 #include <yaz/proto.h>
 #include <yaz/comstack.h>
 #include <yaz/wrbuf.h>
 #include <yaz/zoom.h>
 
-typedef struct Z3950_Event_p *Z3950_Event;
+typedef struct ZOOM_Event_p *ZOOM_Event;
 
-struct Z3950_query_p {
+struct ZOOM_query_p {
     Z_Query *query;
     Z_SortKeySpecList *sort_spec;
     int refcount;
@@ -20,11 +20,11 @@ struct Z3950_query_p {
 #define STATE_CONNECTING 1
 #define STATE_ESTABLISHED 2
 
-#define Z3950_SELECT_READ 1
-#define Z3950_SELECT_WRITE 2
-#define Z3950_SELECT_EXCEPT 4
+#define ZOOM_SELECT_READ 1
+#define ZOOM_SELECT_WRITE 2
+#define ZOOM_SELECT_EXCEPT 4
 
-struct Z3950_connection_p {
+struct ZOOM_connection_p {
     COMSTACK cs;
     char *host_port;
     int error;
@@ -41,76 +41,76 @@ struct Z3950_connection_p {
     char *cookie_out;
     char *cookie_in;
     int async;
-    Z3950_task tasks;
-    Z3950_options options;
-    Z3950_resultset resultsets;
-    Z3950_Event m_queue_front;
-    Z3950_Event m_queue_back;
+    ZOOM_task tasks;
+    ZOOM_options options;
+    ZOOM_resultset resultsets;
+    ZOOM_Event m_queue_front;
+    ZOOM_Event m_queue_back;
 };
 
 
-struct Z3950_options_entry {
+struct ZOOM_options_entry {
     char *name;
     char *value;
-    struct Z3950_options_entry *next;
+    struct ZOOM_options_entry *next;
 };
 
-struct Z3950_options_p {
+struct ZOOM_options_p {
     int refcount;
     void *callback_handle;
-    Z3950_options_callback callback_func;
-    struct Z3950_options_entry *entries;
-    Z3950_options parent;
+    ZOOM_options_callback callback_func;
+    struct ZOOM_options_entry *entries;
+    ZOOM_options parent;
 };
 
-typedef struct Z3950_record_cache_p *Z3950_record_cache;
+typedef struct ZOOM_record_cache_p *ZOOM_record_cache;
 
-struct Z3950_resultset_p {
+struct ZOOM_resultset_p {
     Z_Query *r_query;
     Z_SortKeySpecList *r_sort_spec;
-    Z3950_query search;
+    ZOOM_query search;
     int refcount;
     int size;
     int start;
     int count;
     int piggyback;
     ODR odr;
-    Z3950_record_cache record_cache;
-    Z3950_options options;
-    Z3950_connection connection;
-    Z3950_resultset next;
+    ZOOM_record_cache record_cache;
+    ZOOM_options options;
+    ZOOM_connection connection;
+    ZOOM_resultset next;
 };
 
-struct Z3950_record_p {
+struct ZOOM_record_p {
     ODR odr;
     WRBUF wrbuf_marc;
     Z_NamePlusRecord *npr;
 };
 
-struct Z3950_record_cache_p {
-    struct Z3950_record_p rec;
+struct ZOOM_record_cache_p {
+    struct ZOOM_record_p rec;
     char *elementSetName;
     int pos;
-    Z3950_record_cache next;
+    ZOOM_record_cache next;
 };
 
-struct Z3950_task_p {
+struct ZOOM_task_p {
     int running;
     int which;
     union {
-#define Z3950_TASK_SEARCH 1
-       Z3950_resultset resultset;
-#define Z3950_TASK_RETRIEVE 2
+#define ZOOM_TASK_SEARCH 1
+       ZOOM_resultset resultset;
+#define ZOOM_TASK_RETRIEVE 2
        /** also resultset here */
-#define Z3950_TASK_CONNECT 3
+#define ZOOM_TASK_CONNECT 3
     } u;
-    Z3950_task next;
+    ZOOM_task next;
 };
 
-struct Z3950_Event_p {
+struct ZOOM_Event_p {
     int kind;
-    Z3950_Event next;
-    Z3950_Event prev;
+    ZOOM_Event next;
+    ZOOM_Event prev;
 };
 
 
index e403a17..24746d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoomsh.c,v 1.6 2001-11-16 10:18:20 adam Exp $
+ * $Id: zoomsh.c,v 1.7 2001-11-18 21:14:23 adam Exp $
  *
  * ZOOM-C Shell
  */
@@ -64,8 +64,8 @@ static int is_command (const char *cmd_str, const char *this_str, int this_len)
     return 1;
 }
 
-static void cmd_set (Z3950_connection *c, Z3950_resultset *r,
-                    Z3950_options options,
+static void cmd_set (ZOOM_connection *c, ZOOM_resultset *r,
+                    ZOOM_options options,
                     const char **args)
 {
     char key[40], val[80];
@@ -77,15 +77,15 @@ static void cmd_set (Z3950_connection *c, Z3950_resultset *r,
     }
     if (!next_token_copy (args, val, sizeof(val)))
     {
-       const char *val = Z3950_options_get(options, key);
+       const char *val = ZOOM_options_get(options, key);
        printf ("%s = %s\n", key, val ? val : "<null>");
     }
     else
-       Z3950_options_set(options, key, val);
+       ZOOM_options_set(options, key, val);
 }
 
-static void cmd_close (Z3950_connection *c, Z3950_resultset *r,
-                      Z3950_options options,
+static void cmd_close (ZOOM_connection *c, ZOOM_resultset *r,
+                      ZOOM_options options,
                       const char **args)
 {
     char host[60];
@@ -96,33 +96,33 @@ static void cmd_close (Z3950_connection *c, Z3950_resultset *r,
        const char *h;
        if (!c[i])
            continue;
-       if ((h = Z3950_connection_option_get(c[i], "host"))
+       if ((h = ZOOM_connection_option_get(c[i], "host"))
             && !strcmp (h, host))
        {
-           Z3950_connection_destroy (c[i]);
+           ZOOM_connection_destroy (c[i]);
            c[i] = 0;
        }
        else if (*host == '\0')
        {
-           Z3950_connection_destroy (c[i]);
+           ZOOM_connection_destroy (c[i]);
            c[i] = 0;
        }
     }
 }
 
-static void display_records (Z3950_connection c,
-                            Z3950_resultset r,
+static void display_records (ZOOM_connection c,
+                            ZOOM_resultset r,
                             int start, int count)
 {
     int i;
     for (i = 0; i<count; i++)
     {
        int pos = i + start;
-        Z3950_record rec = Z3950_resultset_record (r, pos);
-       const char *db = Z3950_record_get (rec, "database", 0);
+        ZOOM_record rec = ZOOM_resultset_record (r, pos);
+       const char *db = ZOOM_record_get (rec, "database", 0);
        int len;
-       const char *render = Z3950_record_get (rec, "render", &len);
-       const char *syntax = Z3950_record_get (rec, "syntax", 0);
+       const char *render = ZOOM_record_get (rec, "render", &len);
+       const char *syntax = ZOOM_record_get (rec, "syntax", 0);
        /* if rec is non-null, we got a record for display */
        if (rec)
        {
@@ -134,22 +134,22 @@ static void display_records (Z3950_connection c,
     }
 }
 
-static void cmd_show (Z3950_connection *c, Z3950_resultset *r,
-                     Z3950_options options,
+static void cmd_show (ZOOM_connection *c, ZOOM_resultset *r,
+                     ZOOM_options options,
                      const char **args)
 {
     int i;
     char start_str[10], count_str[10];
 
     if (next_token_copy (args, start_str, sizeof(start_str)))
-       Z3950_options_set (options, "start", start_str);
+       ZOOM_options_set (options, "start", start_str);
 
     if (next_token_copy (args, count_str, sizeof(count_str)))
-       Z3950_options_set (options, "count", count_str);
+       ZOOM_options_set (options, "count", count_str);
 
     for (i = 0; i<MAX_CON; i++)
-       Z3950_resultset_records (r[i], 0, atoi(start_str), atoi(count_str));
-    while (Z3950_event (MAX_CON, c))
+       ZOOM_resultset_records (r[i], 0, atoi(start_str), atoi(count_str));
+    while (ZOOM_event (MAX_CON, c))
        ;
 
     for (i = 0; i<MAX_CON; i++)
@@ -159,29 +159,29 @@ static void cmd_show (Z3950_connection *c, Z3950_resultset *r,
        /* display errors if any */
        if (!c[i])
            continue;
-       if ((error = Z3950_connection_error(c[i], &errmsg, &addinfo)))
+       if ((error = ZOOM_connection_error(c[i], &errmsg, &addinfo)))
            fprintf (stderr, "%s error: %s (%d) %s\n",
-                    Z3950_connection_option_get(c[i], "host"), errmsg,
+                    ZOOM_connection_option_get(c[i], "host"), errmsg,
                     error, addinfo);
        else if (r[i])
        {
            /* OK, no major errors. Display records... */
-           int start = Z3950_options_get_int (options, "start", 0);
-           int count = Z3950_options_get_int (options, "count", 0);
+           int start = ZOOM_options_get_int (options, "start", 0);
+           int count = ZOOM_options_get_int (options, "count", 0);
            display_records (c[i], r[i], start, count);
        }
     }
 }
 
-static void cmd_search (Z3950_connection *c, Z3950_resultset *r,
-                       Z3950_options options,
+static void cmd_search (ZOOM_connection *c, ZOOM_resultset *r,
+                       ZOOM_options options,
                        const char **args)
 {
-    Z3950_query s;
+    ZOOM_query s;
     int i;
     
-    s = Z3950_query_create ();
-    if (Z3950_query_prefix (s, *args))
+    s = ZOOM_query_create ();
+    if (ZOOM_query_prefix (s, *args))
     {
        fprintf (stderr, "Bad PQF: %s\n", *args);
        return;
@@ -190,14 +190,14 @@ static void cmd_search (Z3950_connection *c, Z3950_resultset *r,
     {
        if (c[i])
        {
-           Z3950_resultset_destroy (r[i]);
+           ZOOM_resultset_destroy (r[i]);
            r[i] = 0;
        }
        if (c[i])
-           r[i] = Z3950_connection_search (c[i], s);
+           r[i] = ZOOM_connection_search (c[i], s);
     }
 
-    while (Z3950_event (MAX_CON, c))
+    while (ZOOM_event (MAX_CON, c))
        ;
 
     for (i = 0; i<MAX_CON; i++)
@@ -207,27 +207,27 @@ static void cmd_search (Z3950_connection *c, Z3950_resultset *r,
        /* display errors if any */
        if (!c[i])
            continue;
-       if ((error = Z3950_connection_error(c[i], &errmsg, &addinfo)))
+       if ((error = ZOOM_connection_error(c[i], &errmsg, &addinfo)))
            fprintf (stderr, "%s error: %s (%d) %s\n",
-                    Z3950_connection_option_get(c[i], "host"), errmsg,
+                    ZOOM_connection_option_get(c[i], "host"), errmsg,
                     error, addinfo);
        else if (r[i])
        {
            /* OK, no major errors. Look at the result count */
-           int start = Z3950_options_get_int (options, "start", 0);
-           int count = Z3950_options_get_int (options, "count", 0);
+           int start = ZOOM_options_get_int (options, "start", 0);
+           int count = ZOOM_options_get_int (options, "count", 0);
 
-           printf ("%s: %d hits\n", Z3950_connection_option_get(c[i], "host"),
-                   Z3950_resultset_size(r[i]));
+           printf ("%s: %d hits\n", ZOOM_connection_option_get(c[i], "host"),
+                   ZOOM_resultset_size(r[i]));
            /* and display */
            display_records (c[i], r[i], start, count);
        }
     }
-    Z3950_query_destroy (s);
+    ZOOM_query_destroy (s);
 }
 
-static void cmd_help (Z3950_connection *c, Z3950_resultset *r,
-                     Z3950_options options,
+static void cmd_help (ZOOM_connection *c, ZOOM_resultset *r,
+                     ZOOM_options options,
                      const char **args)
 {
     printf ("connect <zurl>\n");
@@ -254,8 +254,8 @@ static void cmd_help (Z3950_connection *c, Z3950_resultset *r,
     printf (" implementationName\n");
 }
 
-static void cmd_connect (Z3950_connection *c, Z3950_resultset *r,
-                        Z3950_options options,
+static void cmd_connect (ZOOM_connection *c, ZOOM_resultset *r,
+                        ZOOM_options options,
                         const char **args)
 {
     int error;
@@ -270,10 +270,10 @@ static void cmd_connect (Z3950_connection *c, Z3950_resultset *r,
     for (j = -1, i = 0; i<MAX_CON; i++)
     {
        const char *h;
-       if (c[i] && (h = Z3950_connection_option_get(c[i], "host")) &&
+       if (c[i] && (h = ZOOM_connection_option_get(c[i], "host")) &&
            !strcmp (h, host))
        {
-           Z3950_connection_destroy (c[i]);
+           ZOOM_connection_destroy (c[i]);
            break;
        }
        else if (c[i] == 0 && j == -1)
@@ -288,18 +288,18 @@ static void cmd_connect (Z3950_connection *c, Z3950_resultset *r,
        }
        i = j;   /* OK, use this one is available */
     }
-    c[i] = Z3950_connection_create (options);
-    Z3950_connection_connect (c[i], host, 0);
+    c[i] = ZOOM_connection_create (options);
+    ZOOM_connection_connect (c[i], host, 0);
 
-    if ((error = Z3950_connection_error(c[i], &errmsg, &addinfo)))
+    if ((error = ZOOM_connection_error(c[i], &errmsg, &addinfo)))
        printf ("%s error: %s (%d) %s\n",
-                Z3950_connection_option_get(c[i], "host"),
+                ZOOM_connection_option_get(c[i], "host"),
                errmsg, error, addinfo);
     
 }
 
-static int cmd_parse (Z3950_connection *c, Z3950_resultset *r,
-                     Z3950_options options, 
+static int cmd_parse (ZOOM_connection *c, ZOOM_resultset *r,
+                     ZOOM_options options, 
                      const char **buf)
 {
     int cmd_len;
@@ -327,7 +327,7 @@ static int cmd_parse (Z3950_connection *c, Z3950_resultset *r,
     return 2;
 }
 
-void shell(Z3950_connection *c, Z3950_resultset *r, Z3950_options options)
+void shell(ZOOM_connection *c, ZOOM_resultset *r, ZOOM_options options)
 {
     while (1)
     {
@@ -363,10 +363,10 @@ void shell(Z3950_connection *c, Z3950_resultset *r, Z3950_options options)
 
 int main (int argc, char **argv)
 {
-    Z3950_options options = Z3950_options_create();
+    ZOOM_options options = ZOOM_options_create();
     int i, res;
-    Z3950_connection z39_con[MAX_CON];
-    Z3950_resultset  z39_res[MAX_CON];
+    ZOOM_connection z39_con[MAX_CON];
+    ZOOM_resultset  z39_res[MAX_CON];
     for (i = 0; i<MAX_CON; i++)
     {
        z39_con[i] = 0;
@@ -386,12 +386,12 @@ int main (int argc, char **argv)
     }
     if (res)  /* do cmdline shell only if not quitting */
        shell(z39_con, z39_res, options);
-    Z3950_options_destroy(options);
+    ZOOM_options_destroy(options);
 
     for (i = 0; i<MAX_CON; i++)
     {
-       Z3950_connection_destroy(z39_con[i]);
-       Z3950_resultset_destroy(z39_res[i]);
+       ZOOM_connection_destroy(z39_con[i]);
+       ZOOM_resultset_destroy(z39_res[i]);
     }
     exit (0);
 }
index f21d30b..a70e173 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoomtst1.c,v 1.2 2001-11-13 22:57:03 adam Exp $
+ * $Id: zoomtst1.c,v 1.3 2001-11-18 21:14:23 adam Exp $
  *
  * Synchronous single-target client doing search (but no retrieval)
  */
@@ -11,8 +11,8 @@
 
 int main(int argc, char **argv)
 {
-    Z3950_connection z;
-    Z3950_resultset r;
+    ZOOM_connection z;
+    ZOOM_resultset r;
     int error;
     const char *errmsg, *addinfo;
 
@@ -22,20 +22,20 @@ int main(int argc, char **argv)
         fprintf (stderr, " eg.  bagel.indexdata.dk/gils computer\n");
         exit (1);
     }
-    z = Z3950_connection_new (argv[1], 0);
+    z = ZOOM_connection_new (argv[1], 0);
     
-    if ((error = Z3950_connection_error(z, &errmsg, &addinfo)))
+    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
     {
        fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
        exit (2);
     }
 
-    r = Z3950_connection_search_pqf (z, argv[2]);
-    if ((error = Z3950_connection_error(z, &errmsg, &addinfo)))
+    r = ZOOM_connection_search_pqf (z, argv[2]);
+    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
        fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
     else
-       printf ("Result count: %d\n", Z3950_resultset_size(r));
-    Z3950_resultset_destroy (r);
-    Z3950_connection_destroy (z);
+       printf ("Result count: %d\n", ZOOM_resultset_size(r));
+    ZOOM_resultset_destroy (r);
+    ZOOM_connection_destroy (z);
     exit (0);
 }
index 9dede46..c0d85db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoomtst2.c,v 1.2 2001-11-15 13:16:02 adam Exp $
+ * $Id: zoomtst2.c,v 1.3 2001-11-18 21:14:23 adam Exp $
  *
  * Asynchronous single-target client performing search (no retrieval)
  */
@@ -11,8 +11,8 @@
 
 int main(int argc, char **argv)
 {
-    Z3950_connection z;
-    Z3950_resultset r;
+    ZOOM_connection z;
+    ZOOM_resultset r;
     int error;
     const char *errmsg, *addinfo;
 
@@ -25,30 +25,30 @@ int main(int argc, char **argv)
     }
 
     /* create connection (don't connect yet) */
-    z = Z3950_connection_create(0);
+    z = ZOOM_connection_create(0);
 
     /* option: set async operation */
-    Z3950_connection_option_set (z, "async", "1");
+    ZOOM_connection_option_set (z, "async", "1");
 
     /* connect to target and initialize */
-    Z3950_connection_connect (z, argv[1], 0);
+    ZOOM_connection_connect (z, argv[1], 0);
 
     /* search using prefix query format */
-    r = Z3950_connection_search_pqf (z, argv[2]);
+    r = ZOOM_connection_search_pqf (z, argv[2]);
 
     /* block here: only one connection */
-    while (Z3950_event (1, &z))
+    while (ZOOM_event (1, &z))
        ;
 
     /* see if any error occurred */
-    if ((error = Z3950_connection_error(z, &errmsg, &addinfo)))
+    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
     {
        fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
        exit (2);
     }
     else /* OK print hit count */
-       printf ("Result count: %d\n", Z3950_resultset_size(r)); 
-    Z3950_resultset_destroy (r);
-    Z3950_connection_destroy (z);
+       printf ("Result count: %d\n", ZOOM_resultset_size(r));  
+    ZOOM_resultset_destroy (r);
+    ZOOM_connection_destroy (z);
     exit (0);
 }
index f393f91..f7fbbca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoomtst3.c,v 1.3 2001-11-15 08:58:29 adam Exp $
+ * $Id: zoomtst3.c,v 1.4 2001-11-18 21:14:23 adam Exp $
  *
  * Asynchronous multi-target client doing search and piggyback retrieval
  */
@@ -16,9 +16,9 @@ int main(int argc, char **argv)
 {
     int i;
     int no = argc-2;
-    Z3950_connection z[500]; /* allow at most 500 connections */
-    Z3950_resultset r[500];  /* and result sets .. */
-    Z3950_options o = Z3950_options_create ();
+    ZOOM_connection z[500]; /* allow at most 500 connections */
+    ZOOM_resultset r[500];  /* and result sets .. */
+    ZOOM_options o = ZOOM_options_create ();
 
     if (argc < 3)
     {
@@ -30,30 +30,30 @@ int main(int argc, char **argv)
         no = 500;
 
     /* async mode */
-    Z3950_options_set (o, "async", "1");
+    ZOOM_options_set (o, "async", "1");
 
     /* get first 10 records of result set (using piggyback) */
-    Z3950_options_set (o, "count", "10");
+    ZOOM_options_set (o, "count", "10");
 
     /* preferred record syntax */
-    Z3950_options_set (o, "preferredRecordSyntax", "usmarc");
-    Z3950_options_set (o, "elementSetName", "F");
+    ZOOM_options_set (o, "preferredRecordSyntax", "usmarc");
+    ZOOM_options_set (o, "elementSetName", "F");
 
     /* connect to all */
     for (i = 0; i<no; i++)
     {
        /* create connection - pass options (they are the same for all) */
-       z[i] = Z3950_connection_create (o);
+       z[i] = ZOOM_connection_create (o);
 
        /* connect and init */
-       Z3950_connection_connect (z[i], argv[1+i], 0);
+       ZOOM_connection_connect (z[i], argv[1+i], 0);
     }
     /* search all */
     for (i = 0; i<no; i++)
-        r[i] = Z3950_connection_search_pqf (z[i], argv[argc-1]);
+        r[i] = ZOOM_connection_search_pqf (z[i], argv[argc-1]);
 
     /* network I/O. pass number of connections and array of connections */
-    while (Z3950_event (no, z))
+    while (ZOOM_event (no, z))
        ;
     
     /* no more to be done. Inspect results */
@@ -62,21 +62,21 @@ int main(int argc, char **argv)
        int error;
        const char *errmsg, *addinfo;
        /* display errors if any */
-       if ((error = Z3950_connection_error(z[i], &errmsg, &addinfo)))
+       if ((error = ZOOM_connection_error(z[i], &errmsg, &addinfo)))
            fprintf (stderr, "%s error: %s (%d) %s\n", argv[i+1], errmsg,
                     error, addinfo);
        else
        {
            /* OK, no major errors. Look at the result count */
            int pos;
-           printf ("%s: %d hits\n", argv[i+1], Z3950_resultset_size(r[i]));
+           printf ("%s: %d hits\n", argv[i+1], ZOOM_resultset_size(r[i]));
            /* go through all records at target */
            for (pos = 0; pos < 10; pos++)
            {
                int len; /* length of buffer rec */
                const char *rec =
-                   Z3950_record_get (
-                        Z3950_resultset_record (r[i], pos), "render", &len);
+                   ZOOM_record_get (
+                        ZOOM_resultset_record (r[i], pos), "render", &len);
                /* if rec is non-null, we got a record for display */
                if (rec)
                {
@@ -91,9 +91,9 @@ int main(int argc, char **argv)
     /* destroy and exit */
     for (i = 0; i<no; i++)
     {
-        Z3950_resultset_destroy (r[i]);
-        Z3950_connection_destroy (z[i]);
+        ZOOM_resultset_destroy (r[i]);
+        ZOOM_connection_destroy (z[i]);
     }
-    Z3950_options_destroy(o);
+    ZOOM_options_destroy(o);
     exit (0);
 }
index 187b047..7ed678f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoomtst4.c,v 1.4 2001-11-16 09:52:39 adam Exp $
+ * $Id: zoomtst4.c,v 1.5 2001-11-18 21:14:23 adam Exp $
  *
  * Asynchronous multi-target going through proxy doing search and retrieve
  * using present.
@@ -22,10 +22,10 @@ int main(int argc, char **argv)
 {
     int i;
     int no = argc-3;
-    Z3950_connection z[500]; /* allow at most 500 connections */
-    Z3950_resultset r[500];  /* and result sets .. */
-    Z3950_query q;
-    Z3950_options o = Z3950_options_create ();
+    ZOOM_connection z[500]; /* allow at most 500 connections */
+    ZOOM_resultset r[500];  /* and result sets .. */
+    ZOOM_query q;
+    ZOOM_options o = ZOOM_options_create ();
 
     if (argc < 4)
     {
@@ -37,18 +37,18 @@ int main(int argc, char **argv)
         no = 500;
 
     /* function my_callback called when reading options .. */
-    Z3950_options_set_callback (o, my_callback, 0);
+    ZOOM_options_set_callback (o, my_callback, 0);
 
     /* get 20 (at most) records from offset 5 */
-    Z3950_options_set (o, "start", "5");
-    Z3950_options_set (o, "count", "20");
+    ZOOM_options_set (o, "start", "5");
+    ZOOM_options_set (o, "count", "20");
 
     /* set proxy */
-    Z3950_options_set (o, "proxy", argv[1]);
+    ZOOM_options_set (o, "proxy", argv[1]);
     
     /* create query */
-    q = Z3950_query_create ();
-    if (Z3950_query_prefix (q, argv[argc-1]))
+    q = ZOOM_query_create ();
+    if (ZOOM_query_prefix (q, argv[argc-1]))
     {
        printf ("bad PQF: %s\n", argv[argc-1]);
        exit (1);
@@ -56,13 +56,13 @@ int main(int argc, char **argv)
     /* connect - and search all */
     for (i = 0; i<no; i++)
     {
-       z[i] = Z3950_connection_create (o);
-       Z3950_connection_connect (z[i], argv[i+2], 0);
-        r[i] = Z3950_connection_search (z[i], q);
+       z[i] = ZOOM_connection_create (o);
+       ZOOM_connection_connect (z[i], argv[i+2], 0);
+        r[i] = ZOOM_connection_search (z[i], q);
     }
 
     /* network I/O */
-    while (Z3950_event (no, z))
+    while (ZOOM_event (no, z))
        ;
 
     /* handle errors */
@@ -70,19 +70,19 @@ int main(int argc, char **argv)
     {
        int error;
        const char *errmsg, *addinfo;
-       if ((error = Z3950_connection_error(z[i], &errmsg, &addinfo)))
+       if ((error = ZOOM_connection_error(z[i], &errmsg, &addinfo)))
            fprintf (stderr, "%s error: %s (%d) %s\n",
-                    Z3950_connection_option_get(z[i], "host"),
+                    ZOOM_connection_option_get(z[i], "host"),
                      errmsg, error, addinfo);
     }
 
     /* destroy stuff and exit */
-    Z3950_query_destroy (q);
+    ZOOM_query_destroy (q);
     for (i = 0; i<no; i++)
     {
-        Z3950_resultset_destroy (r[i]);
-        Z3950_connection_destroy (z[i]);
+        ZOOM_resultset_destroy (r[i]);
+        ZOOM_connection_destroy (z[i]);
     }
-    Z3950_options_destroy(o);
+    ZOOM_options_destroy(o);
     exit (0);
 }
index b6fb59a..a267465 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoomtst5.c,v 1.5 2001-11-16 09:52:39 adam Exp $
+ * $Id: zoomtst5.c,v 1.6 2001-11-18 21:14:23 adam Exp $
  *
  * Asynchronous multi-target client doing search, sort and present
  */
@@ -22,12 +22,12 @@ int main(int argc, char **argv)
 {
     int i;
     int no = argc-3;
-    Z3950_connection z[500]; /* allow at most 500 connections */
-    Z3950_resultset r[500];  /* and result sets .. */
-    Z3950_query q;
-    Z3950_options o;
+    ZOOM_connection z[500]; /* allow at most 500 connections */
+    ZOOM_resultset r[500];  /* and result sets .. */
+    ZOOM_query q;
+    ZOOM_options o;
 
-    o = Z3950_options_create ();
+    o = ZOOM_options_create ();
     if (argc < 4)
     {
        fprintf (stderr, "usage:\n%s target1 .. targetN query sort\n",
@@ -38,23 +38,23 @@ int main(int argc, char **argv)
         no = 500;
 
     /* function my_callback called when reading options .. */
-    Z3950_options_set_callback (o, my_callback, 0);
+    ZOOM_options_set_callback (o, my_callback, 0);
 
     /* get 20 (at most) records from beginning */
-    Z3950_options_set (o, "count", "20");
+    ZOOM_options_set (o, "count", "20");
 
-    Z3950_options_set (o, "implementationName", "sortapp");
-    Z3950_options_set (o, "preferredRecordSyntax", "usmarc");
-    Z3950_options_set (o, "elementSetName", "B");
+    ZOOM_options_set (o, "implementationName", "sortapp");
+    ZOOM_options_set (o, "preferredRecordSyntax", "usmarc");
+    ZOOM_options_set (o, "elementSetName", "B");
 
     /* create query */
-    q = Z3950_query_create ();
-    if (Z3950_query_prefix (q, argv[argc-2]))
+    q = ZOOM_query_create ();
+    if (ZOOM_query_prefix (q, argv[argc-2]))
     {
        printf ("bad PQF: %s\n", argv[argc-2]);
        exit (1);
     }
-    if (Z3950_query_sortby (q, argv[argc-1]))
+    if (ZOOM_query_sortby (q, argv[argc-1]))
     {
        printf ("bad sort spec: %s\n", argv[argc-1]);
        exit (1);
@@ -62,13 +62,13 @@ int main(int argc, char **argv)
     /* connect - and search all */
     for (i = 0; i<no; i++)
     {
-       z[i] = Z3950_connection_create (o);
-       Z3950_connection_connect (z[i], argv[i+1], 0);
-        r[i] = Z3950_connection_search (z[i], q);
+       z[i] = ZOOM_connection_create (o);
+       ZOOM_connection_connect (z[i], argv[i+1], 0);
+        r[i] = ZOOM_connection_search (z[i], q);
     }
 
     /* network I/O */
-    while (Z3950_event (no, z))
+    while (ZOOM_event (no, z))
        ;
 
     /* handle errors */
@@ -76,29 +76,29 @@ int main(int argc, char **argv)
     {
        int error;
        const char *errmsg, *addinfo;
-       if ((error = Z3950_connection_error(z[i], &errmsg, &addinfo)))
+       if ((error = ZOOM_connection_error(z[i], &errmsg, &addinfo)))
            fprintf (stderr, "%s error: %s (%d) %s\n",
-                    Z3950_connection_option_get(z[i], "host"),
+                    ZOOM_connection_option_get(z[i], "host"),
                     errmsg, error, addinfo);
        else
        {
            /* OK, no major errors. Look at the result count */
            int pos;
-           printf ("%s: %d hits\n", Z3950_connection_option_get(z[i], "host"),
-                   Z3950_resultset_size(r[i]));
+           printf ("%s: %d hits\n", ZOOM_connection_option_get(z[i], "host"),
+                   ZOOM_resultset_size(r[i]));
            /* go through all records at target */
            for (pos = 0; pos < 20; pos++)
            {
-               Z3950_record rec;
+               ZOOM_record rec;
                const char *db, *syntax, *str;
                int len;
 
-               rec = Z3950_resultset_record (r[i], pos);
+               rec = ZOOM_resultset_record (r[i], pos);
                /* get database for record and record itself at pos */
 
-               db = Z3950_record_get (rec,  "database", 0);
-               str = Z3950_record_get (rec, "render", &len);
-               syntax = Z3950_record_get (rec, "syntax", &len);
+               db = ZOOM_record_get (rec,  "database", 0);
+               str = ZOOM_record_get (rec, "render", &len);
+               syntax = ZOOM_record_get (rec, "syntax", &len);
                /* if rec is non-null, we got a record for display */
                if (str)
                {
@@ -113,12 +113,12 @@ int main(int argc, char **argv)
     }
 
     /* destroy stuff and exit */
-    Z3950_query_destroy (q);
+    ZOOM_query_destroy (q);
     for (i = 0; i<no; i++)
     {
-        Z3950_resultset_destroy (r[i]);
-        Z3950_connection_destroy (z[i]);
+        ZOOM_resultset_destroy (r[i]);
+        ZOOM_connection_destroy (z[i]);
     }
-    Z3950_options_destroy(o);
+    ZOOM_options_destroy(o);
     exit(0);
 }
index efb94da..aa583bb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoomtst6.c,v 1.6 2001-11-16 09:52:39 adam Exp $
+ * $Id: zoomtst6.c,v 1.7 2001-11-18 21:14:23 adam Exp $
  *
  * Asynchronous multi-target client doing two searches
  */
 
 #include <yaz/zoom.h>
 
-static void display_records (const char *tname, Z3950_resultset r)
+static void display_records (const char *tname, ZOOM_resultset r)
 {
     /* OK, no major errors. Look at the result count */
     int pos;
-    printf ("%s: %d hits\n", tname, Z3950_resultset_size(r));
+    printf ("%s: %d hits\n", tname, ZOOM_resultset_size(r));
     /* go through all records at target */
     for (pos = 0; pos < 2; pos++)
     {
-        Z3950_record rec = Z3950_resultset_record (r, pos);
+        ZOOM_record rec = ZOOM_resultset_record (r, pos);
 
        /* get database for record and record itself at pos */
-       const char *db = Z3950_record_get (rec, "database", 0);
+       const char *db = ZOOM_record_get (rec, "database", 0);
        int len;
-       const char *render = Z3950_record_get (rec, "render", &len);
+       const char *render = ZOOM_record_get (rec, "render", &len);
        /* if rec is non-null, we got a record for display */
        if (rec)
        {
@@ -39,13 +39,13 @@ int main(int argc, char **argv)
 {
     int i;
     int no = argc-3;
-    Z3950_connection z[500];  /* allow at most 500 connections */
-    Z3950_resultset r1[500];  /* and result sets .. */
-    Z3950_resultset r2[500];  /* and result sets .. */
-    Z3950_query q;
-    Z3950_options o;
+    ZOOM_connection z[500];  /* allow at most 500 connections */
+    ZOOM_resultset r1[500];  /* and result sets .. */
+    ZOOM_resultset r2[500];  /* and result sets .. */
+    ZOOM_query q;
+    ZOOM_options o;
 
-    o = Z3950_options_create ();
+    o = ZOOM_options_create ();
     if (argc < 4)
     {
        fprintf (stderr, "usage:\n%s target1 .. targetN query1 query2\n",
@@ -55,17 +55,17 @@ int main(int argc, char **argv)
     if (no > 500)
         no = 500;
 
-    Z3950_options_set (o, "async", "1");
+    ZOOM_options_set (o, "async", "1");
 
     /* get 3 (at most) records from beginning */
-    Z3950_options_set (o, "count", "3");
+    ZOOM_options_set (o, "count", "3");
 
-    Z3950_options_set (o, "preferredRecordSyntax", "sutrs");
-    Z3950_options_set (o, "elementSetName", "B");
+    ZOOM_options_set (o, "preferredRecordSyntax", "sutrs");
+    ZOOM_options_set (o, "elementSetName", "B");
 
     /* create query */
-    q = Z3950_query_create ();
-    if (Z3950_query_prefix (q, argv[argc-2]))
+    q = ZOOM_query_create ();
+    if (ZOOM_query_prefix (q, argv[argc-2]))
     {
        printf ("bad PQF: %s\n", argv[argc-2]);
        exit (2);
@@ -73,29 +73,29 @@ int main(int argc, char **argv)
     /* connect - and search all */
     for (i = 0; i<no; i++)
     {
-       z[i] = Z3950_connection_create (o);
-       Z3950_connection_connect (z[i], argv[i+1], 0);
-        r1[i] = Z3950_connection_search (z[i], q);
+       z[i] = ZOOM_connection_create (o);
+       ZOOM_connection_connect (z[i], argv[i+1], 0);
+        r1[i] = ZOOM_connection_search (z[i], q);
     }
-    if (Z3950_query_prefix (q, argv[argc-1]))
+    if (ZOOM_query_prefix (q, argv[argc-1]))
     {
        printf ("bad sort spec: %s\n", argv[argc-1]);
        exit (2);
     }
     /* queue second search */
     for (i = 0; i<no; i++)
-        r2[i] = Z3950_connection_search (z[i], q);
+        r2[i] = ZOOM_connection_search (z[i], q);
 
 
     /* network I/O */
-    while (Z3950_event (no, z))
+    while (ZOOM_event (no, z))
        ;
 
     for (i = 0; i<no; i++)
-        Z3950_resultset_records (r1[i], 0, 4, 1);
+        ZOOM_resultset_records (r1[i], 0, 4, 1);
 
     /* network I/O */
-    while (Z3950_event (no, z))
+    while (ZOOM_event (no, z))
        ;
 
     /* handle errors */
@@ -103,24 +103,24 @@ int main(int argc, char **argv)
     {
        int error;
        const char *errmsg, *addinfo;
-       if ((error = Z3950_connection_error(z[i], &errmsg, &addinfo)))
+       if ((error = ZOOM_connection_error(z[i], &errmsg, &addinfo)))
            fprintf (stderr, "%s error: %s (%d) %s\n",
-                    Z3950_connection_option_get(z[i], "host"),
+                    ZOOM_connection_option_get(z[i], "host"),
                     errmsg, error, addinfo);
        else
        {
-           display_records (Z3950_connection_option_get(z[i], "host"), r1[i]);
-           display_records (Z3950_connection_option_get(z[i], "host"), r2[i]);
+           display_records (ZOOM_connection_option_get(z[i], "host"), r1[i]);
+           display_records (ZOOM_connection_option_get(z[i], "host"), r2[i]);
        }
     }
     /* destroy stuff and exit */
-    Z3950_query_destroy (q);
+    ZOOM_query_destroy (q);
     for (i = 0; i<no; i++)
     {
-        Z3950_connection_destroy (z[i]);
-        Z3950_resultset_destroy (r1[i]);
-        Z3950_resultset_destroy (r2[i]);
+        ZOOM_connection_destroy (z[i]);
+        ZOOM_resultset_destroy (r1[i]);
+        ZOOM_resultset_destroy (r2[i]);
     }
-    Z3950_options_destroy(o);
+    ZOOM_options_destroy(o);
     exit (0);
 }
index 2de80f6..2a6085f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: zoomtst7.c,v 1.6 2001-11-15 08:58:29 adam Exp $
+ * $Id: zoomtst7.c,v 1.7 2001-11-18 21:14:23 adam Exp $
  *
  * API test..
  */
 int main(int argc, char **argv)
 {
     int i, j, block;
-    Z3950_connection z;
-    Z3950_resultset r[10];  /* and result sets .. */
-    Z3950_options o;
+    ZOOM_connection z;
+    ZOOM_resultset r[10];  /* and result sets .. */
+    ZOOM_options o;
 
-    o = Z3950_options_create ();
+    nmem_init ();
+    o = ZOOM_options_create ();
 
-    z = Z3950_connection_new ("localhost", 9999);
-    if (Z3950_connection_error (z, 0, 0))
+    z = ZOOM_connection_new ("localhost", 9999);
+    if (ZOOM_connection_error (z, 0, 0))
     {
         printf ("error - couldn't connect?\n");
         exit (1);
     }
         
-    Z3950_connection_destroy (z);
+    ZOOM_connection_destroy (z);
 
     for (block = 0; block < 3; block++)
     {
        switch (block)
        {
        case 0:
-           printf ("blocking - not calling Z3950_events\n");
+           printf ("blocking - not calling ZOOM_events\n");
            break;
        case 1:
-           printf ("blocking - calling Z3950_events\n");
+           printf ("blocking - calling ZOOM_events\n");
            break;
        case 2:
-           printf ("non-blocking - calling Z3950_events\n");
+           printf ("non-blocking - calling ZOOM_events\n");
            break;
        }
        if (block > 1)
-           Z3950_options_set (o, "async", "1");
+           ZOOM_options_set (o, "async", "1");
        for (i = 0; i<10; i++)
        {
            char host[40];
            printf ("session %2d", i);
            sprintf (host, "localhost:9999/%d", i);
-           z = Z3950_connection_create (o);
-           Z3950_connection_connect (z, host, 0);
+           z = ZOOM_connection_create (o);
+           ZOOM_connection_connect (z, host, 0);
            
            for (j = 0; j < 10; j++)
            {
-               Z3950_record recs[2];
+               ZOOM_record recs[2];
                char query[40];
-               Z3950_query s = Z3950_query_create ();
+               ZOOM_query s = ZOOM_query_create ();
                
                sprintf (query, "i%dr%d", i, j);
                
-               if (Z3950_query_prefix (s, query))
+               if (ZOOM_query_prefix (s, query))
                {
                    printf ("bad PQF: %s\n", query);
                    exit (2);
                }
-               Z3950_options_set (o, "start", "0");
-               Z3950_options_set (o, "count", "0");
+               ZOOM_options_set (o, "start", "0");
+               ZOOM_options_set (o, "count", "0");
                
-               r[j] = Z3950_connection_search (z, s); /* non-piggy */
+               r[j] = ZOOM_connection_search (z, s); /* non-piggy */
                
-               Z3950_resultset_records (r[j], recs, 0, 2);  /* first two */
+               ZOOM_resultset_records (r[j], recs, 0, 2);  /* first two */
                
-               Z3950_resultset_records (r[j], recs, 1, 2);  /* third */
+               ZOOM_resultset_records (r[j], recs, 1, 2);  /* third */
 
-               Z3950_resultset_records (r[j], recs, 0, 0);  /* ignored */
+               ZOOM_resultset_records (r[j], recs, 0, 0);  /* ignored */
 
-               if (Z3950_resultset_size (r[j]) > 2)
+               if (ZOOM_resultset_size (r[j]) > 2)
                {
                    if (!recs[0])
                    {
@@ -88,30 +89,30 @@ int main(int argc, char **argv)
                    }
                }
                
-               Z3950_query_destroy (s);
+               ZOOM_query_destroy (s);
 
                putchar ('.');
                if (block > 0)
-                   while (Z3950_event (1, &z))
+                   while (ZOOM_event (1, &z))
                        ;
            }
            for (j = 0; j<i; j++)
-               Z3950_resultset_destroy (r[j]);
-           Z3950_connection_destroy (z);
+               ZOOM_resultset_destroy (r[j]);
+           ZOOM_connection_destroy (z);
            for (; j < 10; j++)
-               Z3950_resultset_destroy (r[j]);
+               ZOOM_resultset_destroy (r[j]);
            printf ("10 searches, 20 presents done\n");
        }
        
        for (i = 0; i<1; i++)
        {
-           Z3950_query q = Z3950_query_create ();
+           ZOOM_query q = ZOOM_query_create ();
            char host[40];
 
            printf ("session %2d", i+10);
            sprintf (host, "localhost:9999/%d", i);
-           z = Z3950_connection_create (o);
-           Z3950_connection_connect (z, host, 0);
+           z = ZOOM_connection_create (o);
+           ZOOM_connection_connect (z, host, 0);
            
            for (j = 0; j < 10; j++)
            {
@@ -119,31 +120,31 @@ int main(int argc, char **argv)
                
                sprintf (query, "i%dr%d", i, j);
                
-               Z3950_options_set (o, "count", "0");
+               ZOOM_options_set (o, "count", "0");
                
-               r[j] = Z3950_connection_search_pqf (z, query);
+               r[j] = ZOOM_connection_search_pqf (z, query);
 
                putchar ('.');
                if (block > 0)
-                   while (Z3950_event (1, &z))
+                   while (ZOOM_event (1, &z))
                        ;
            }
-           Z3950_connection_destroy (z);
+           ZOOM_connection_destroy (z);
            
            for (j = 0; j < 10; j++)
            {
-               Z3950_resultset_records (r[j], 0, 0, 1);
+               ZOOM_resultset_records (r[j], 0, 0, 1);
                if (block > 0)
-                   while (Z3950_event (1, &z))
+                   while (ZOOM_event (1, &z))
                        ;
            }
            for (j = 0; j < 10; j++)
-               Z3950_resultset_destroy (r[j]);
-           Z3950_query_destroy (q);
+               ZOOM_resultset_destroy (r[j]);
+           ZOOM_query_destroy (q);
            printf ("10 searches, 10 ignored presents done\n");
        }
     }
-    Z3950_options_destroy (o);
+    ZOOM_options_destroy (o);
     xmalloc_trav("");
     nmem_exit();
     xmalloc_trav("");