Optional CCL module. Moved atoi_n to marcdisp.h from yaz-util.h.
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 6 Apr 2001 12:26:45 +0000 (12:26 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 6 Apr 2001 12:26:45 +0000 (12:26 +0000)
README
client/Makefile.am
client/client.c
configure.in
include/yaz/marcdisp.h
include/yaz/yaz-util.h
ztest/ztest.c

diff --git a/README b/README
index ae0e61b..979bd9b 100644 (file)
--- a/README
+++ b/README
@@ -3,7 +3,7 @@ Copyright (C) 1995-2001, Index Data ApS.
 See the file LICENSE for details.
 
 Compilation and installation instructions for YAZ 
 See the file LICENSE for details.
 
 Compilation and installation instructions for YAZ 
-  $Id: README,v 1.34 2001-03-13 18:11:38 adam Exp $
+  $Id: README,v 1.35 2001-04-06 12:26:45 adam Exp $
 
 The primary output of the source here is the lib/libyaz.a library,
 which contains support functions for implementing the server or client
 
 The primary output of the source here is the lib/libyaz.a library,
 which contains support functions for implementing the server or client
@@ -16,8 +16,8 @@ On Unix, GNU configure is used to configure YAZ and generate Makefiles.
 Type "./configure", then "make" to build YAZ.
 
 Note: If you are using the CVS snapshot of YAZ you must have autoconf,
 Type "./configure", then "make" to build YAZ.
 
 Note: If you are using the CVS snapshot of YAZ you must have autoconf,
-automake and libtool installed. Before running configure generate
-support files by running buildconf.sh which is part of YAZ.  
+automake and libtool installed. Before running configure, create
+support files by running buildconf.sh in the top-level directory of YAZ.  
 
 Two test-programs of interest are generated when you type 'make' at the
 top level: ztest/yaz-ztest and client/yaz-client. Ztest is a dummy
 
 Two test-programs of interest are generated when you type 'make' at the
 top level: ztest/yaz-ztest and client/yaz-client. Ztest is a dummy
index dfa0fc7..b9efc62 100644 (file)
@@ -1,6 +1,6 @@
 ## Copyright (C) 1995-2000, Index Data
 ## All rights reserved.
 ## Copyright (C) 1995-2000, Index Data
 ## All rights reserved.
-## $Id: Makefile.am,v 1.10 2001-03-21 15:02:39 adam Exp $
+## $Id: Makefile.am,v 1.11 2001-04-06 12:26:46 adam Exp $
 
 bin_PROGRAMS=yaz-client
 
 
 bin_PROGRAMS=yaz-client
 
@@ -10,4 +10,4 @@ yaz_client_SOURCES=client.c admin.c admin.h
 
 yaz_client_LDADD = ../lib/libyaz.la $(READLINE_LIBS)
 
 
 yaz_client_LDADD = ../lib/libyaz.la $(READLINE_LIBS)
 
-INCLUDES=-I$(top_srcdir)/include -DCCL2RPN=1
+INCLUDES=-I$(top_srcdir)/include
index 8aeede6..7fe8df2 100644 (file)
@@ -3,7 +3,10 @@
  * See the file LICENSE for details.
  *
  * $Log: client.c,v $
  * See the file LICENSE for details.
  *
  * $Log: client.c,v $
- * Revision 1.119  2001-04-05 13:08:48  adam
+ * Revision 1.120  2001-04-06 12:26:46  adam
+ * Optional CCL module. Moved atoi_n to marcdisp.h from yaz-util.h.
+ *
+ * Revision 1.119  2001/04/05 13:08:48  adam
  * New configure options: --enable-module.
  *
  * Revision 1.118  2001/03/27 14:48:06  adam
  * New configure options: --enable-module.
  *
  * Revision 1.118  2001/03/27 14:48:06  adam
 #include <yaz/ill.h>
 #endif
 
 #include <yaz/ill.h>
 #endif
 
-#if CCL2RPN
+#if YAZ_MODULE_ccl
 #include <yaz/yaz-ccl.h>
 #endif
 
 #include <yaz/yaz-ccl.h>
 #endif
 
@@ -445,7 +448,7 @@ static Z_InitResponse *session = 0;     /* session parameters */
 static char last_scan_line[512] = "0";
 static char last_scan_query[512] = "0";
 static char ccl_fields[512] = "default.bib";
 static char last_scan_line[512] = "0";
 static char last_scan_query[512] = "0";
 static char ccl_fields[512] = "default.bib";
-char* esPackageName = 0;
+static char* esPackageName = 0;
 
 static char last_cmd[100] = "?";
 static FILE *marcdump = 0;
 
 static char last_cmd[100] = "?";
 static FILE *marcdump = 0;
@@ -459,7 +462,7 @@ typedef enum {
 
 static QueryType queryType = QueryType_Prefix;
 
 
 static QueryType queryType = QueryType_Prefix;
 
-#if CCL2RPN
+#if YAZ_MODULE_ccl
 static CCL_bibset bibset;               /* CCL bibset handle */
 #endif
 
 static CCL_bibset bibset;               /* CCL bibset handle */
 #endif
 
@@ -1022,7 +1025,7 @@ static int send_searchRequest(char *arg)
     Z_SearchRequest *req = apdu->u.searchRequest;
     Z_Query query;
     int oid[OID_SIZE];
     Z_SearchRequest *req = apdu->u.searchRequest;
     Z_Query query;
     int oid[OID_SIZE];
-#if CCL2RPN
+#if YAZ_MODULE_ccl
     struct ccl_rpn_node *rpn = NULL;
     int error, pos;
 #endif
     struct ccl_rpn_node *rpn = NULL;
     int error, pos;
 #endif
@@ -1030,7 +1033,7 @@ static int send_searchRequest(char *arg)
     Z_RPNQuery *RPNquery;
     Odr_oct ccl_query;
 
     Z_RPNQuery *RPNquery;
     Odr_oct ccl_query;
 
-#if CCL2RPN
+#if YAZ_MODULE_ccl
     if (queryType == QueryType_CCL2RPN)
     {
         rpn = ccl_find_str(bibset, arg, &error, &pos);
     if (queryType == QueryType_CCL2RPN)
     {
         rpn = ccl_find_str(bibset, arg, &error, &pos);
@@ -1098,7 +1101,7 @@ static int send_searchRequest(char *arg)
         ccl_query.buf = (unsigned char*) arg;
         ccl_query.len = strlen(arg);
         break;
         ccl_query.buf = (unsigned char*) arg;
         ccl_query.len = strlen(arg);
         break;
-#if CCL2RPN
+#if YAZ_MODULE_ccl
     case QueryType_CCL2RPN:
         query.which = Z_Query_type_1;
         RPNquery = ccl_rpn_query(out, rpn);
     case QueryType_CCL2RPN:
         query.which = Z_Query_type_1;
         RPNquery = ccl_rpn_query(out, rpn);
@@ -1502,6 +1505,17 @@ static Z_External *create_ItemOrderExternal(const char *type, int itemno)
         r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 
             create_external_ILL_APDU(ILL_APDU_ILL_Request);
     }
         r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 
             create_external_ILL_APDU(ILL_APDU_ILL_Request);
     }
+    else if (!strcmp(type, "xml") || !strcmp(type, "3"))
+    {
+       const char *xml_buf =
+               "<itemorder>\n"
+               "  <type>request</type>\n"
+               "  <libraryNo>000200</libraryNo>\n"
+               "  <borrowerTicketNo> 1212 </borrowerTicketNo>\n"
+               "</itemorder>";
+        r->u.itemOrder->u.esRequest->notToKeep->itemRequest =
+            z_ext_record (out, VAL_TEXT_XML, xml_buf, strlen(xml_buf));
+    }
     else
         r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0;
 
     else
         r->u.itemOrder->u.esRequest->notToKeep->itemRequest = 0;
 
@@ -1864,9 +1878,9 @@ int send_scanrequest(const char *query, int pp, int num, const char *term)
     Z_APDU *apdu = zget_APDU(out, Z_APDU_scanRequest);
     Z_ScanRequest *req = apdu->u.scanRequest;
     int use_rpn = 1;
     Z_APDU *apdu = zget_APDU(out, Z_APDU_scanRequest);
     Z_ScanRequest *req = apdu->u.scanRequest;
     int use_rpn = 1;
+#if YAZ_MODULE_ccl
     int oid[OID_SIZE];
     
     int oid[OID_SIZE];
     
-#if CCL2RPN
     if (queryType == QueryType_CCL2RPN)
     {
         oident bib1;
     if (queryType == QueryType_CCL2RPN)
     {
         oident bib1;
@@ -2288,7 +2302,7 @@ int cmd_querytype (char *arg)
         queryType = QueryType_CCL;
     else if (!strcmp (arg, "prefix") || !strcmp(arg, "rpn"))
         queryType = QueryType_Prefix;
         queryType = QueryType_CCL;
     else if (!strcmp (arg, "prefix") || !strcmp(arg, "rpn"))
         queryType = QueryType_Prefix;
-#if CCL2RPN
+#if YAZ_MODULE_ccl
     else if (!strcmp (arg, "ccl2rpn") || !strcmp (arg, "cclrpn"))
         queryType = QueryType_CCL2RPN;
 #endif
     else if (!strcmp (arg, "ccl2rpn") || !strcmp (arg, "cclrpn"))
         queryType = QueryType_CCL2RPN;
 #endif
@@ -2297,7 +2311,7 @@ int cmd_querytype (char *arg)
         printf ("Querytype must be one of:\n");
         printf (" prefix         - Prefix query\n");
         printf (" ccl            - CCL query\n");
         printf ("Querytype must be one of:\n");
         printf (" prefix         - Prefix query\n");
         printf (" ccl            - CCL query\n");
-#if CCL2RPN
+#if YAZ_MODULE_ccl
         printf (" ccl2rpn        - CCL query converted to RPN\n");
 #endif
         return 0;
         printf (" ccl2rpn        - CCL query converted to RPN\n");
 #endif
         return 0;
@@ -2346,7 +2360,7 @@ int cmd_packagename(char* arg) {
 
 static void initialize(void)
 {
 
 static void initialize(void)
 {
-#if CCL2RPN
+#if YAZ_MODULE_ccl
     FILE *inf;
 #endif
     nmem_init();
     FILE *inf;
 #endif
     nmem_init();
@@ -2361,7 +2375,7 @@ static void initialize(void)
     if (apdu_file)
         odr_setprint(print, apdu_file);
 
     if (apdu_file)
         odr_setprint(print, apdu_file);
 
-#if CCL2RPN
+#if YAZ_MODULE_ccl
     bibset = ccl_qual_mk (); 
     inf = fopen (ccl_fields, "r");
     if (inf)
     bibset = ccl_qual_mk (); 
     inf = fopen (ccl_fields, "r");
     if (inf)
index 84fa72f..cd22775 100644 (file)
@@ -1,6 +1,6 @@
 dnl YAZ Toolkit, Index Data 1994-2001
 dnl See the file LICENSE for details.
 dnl YAZ Toolkit, Index Data 1994-2001
 dnl See the file LICENSE for details.
-dnl $Id: configure.in,v 1.43 2001-04-05 13:08:48 adam Exp $
+dnl $Id: configure.in,v 1.44 2001-04-06 12:26:46 adam Exp $
 AC_INIT(include/yaz/yaz-version.h)
 AM_INIT_AUTOMAKE(yaz, 1.7)
 dnl
 AC_INIT(include/yaz/yaz-version.h)
 AM_INIT_AUTOMAKE(yaz, 1.7)
 dnl
@@ -23,9 +23,15 @@ else
        EXTRAMODULE=asn
        HFILE=${srcdir}/asn/prt-proto.h
 fi
        EXTRAMODULE=asn
        HFILE=${srcdir}/asn/prt-proto.h
 fi
-AC_ARG_ENABLE(module,[  --enable-module=\"mod ..\" ill],[
- EXTRAMODULE="$EXTRAMODULE $enable_module"])
+AC_ARG_ENABLE(modules,[  --enable-modules=\"mod ..\" ill],[
+if test "$enable_modules" != "no"; then
+               EXTRAMODULE="$EXTRAMODULE $enable_modules"
+fi
+],[
+EXTRAMODULE="$EXTRAMODULE ill ccl"
+])
 EXTRALIB=""
 EXTRALIB=""
+echo $EXTRAMODULE
 for module in $EXTRAMODULE; do
        EXTRALIB="$EXTRALIB ../$module/lib${module}.la"
        if test $module = "z39.50"; then
 for module in $EXTRAMODULE; do
        EXTRALIB="$EXTRALIB ../$module/lib${module}.la"
        if test $module = "z39.50"; then
@@ -153,7 +159,7 @@ if test -f ${srcdir}/lib/yaz-config.in; then
 fi
 sed s%yaz_echo_source=yes%yaz_echo_source=no%g < ${srcdir}/yaz-config.in >${srcdir}/lib/yaz-config.in
 dnl
 fi
 sed s%yaz_echo_source=yes%yaz_echo_source=no%g < ${srcdir}/yaz-config.in >${srcdir}/lib/yaz-config.in
 dnl
-SUBDIRS_VAR="util odr $EXTRAMODULE zutil comstack ccl tab retrieval server include lib client ztest"
+SUBDIRS_VAR="util odr $EXTRAMODULE zutil comstack tab retrieval server include lib client ztest"
 AC_SUBST(SUBDIRS_VAR)
 dnl ------ Makefiles
 dnl
 AC_SUBST(SUBDIRS_VAR)
 dnl ------ Makefiles
 dnl
index 7c40423..13b41b5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 1995-2000, Index Data.
+ * Copyright (c) 1995-2001, Index Data.
  *
  * Permission to use, copy, modify, distribute, and sell this software and
  * its documentation, in whole or in part, for any purpose, is hereby granted,
  *
  * Permission to use, copy, modify, distribute, and sell this software and
  * its documentation, in whole or in part, for any purpose, is hereby granted,
  * OF THIS SOFTWARE.
  *
  * $Log: marcdisp.h,v $
  * OF THIS SOFTWARE.
  *
  * $Log: marcdisp.h,v $
- * Revision 1.2  2000-02-28 11:20:06  adam
+ * Revision 1.3  2001-04-06 12:26:46  adam
+ * Optional CCL module. Moved atoi_n to marcdisp.h from yaz-util.h.
+ *
+ * Revision 1.2  2000/02/28 11:20:06  adam
  * Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL.
  *
  * Revision 1.1  1999/11/30 13:47:11  adam
  * Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL.
  *
  * Revision 1.1  1999/11/30 13:47:11  adam
@@ -66,6 +69,7 @@ YAZ_BEGIN_CDECL
 
 YAZ_EXPORT int marc_display (const char *buf, FILE *outf);
 YAZ_EXPORT int marc_display_ex (const char *buf, FILE *outf, int debug);
 
 YAZ_EXPORT int marc_display (const char *buf, FILE *outf);
 YAZ_EXPORT int marc_display_ex (const char *buf, FILE *outf, int debug);
+YAZ_EXPORT int atoi_n (const char *buf, int len);
 
 #define ISO2709_RS 035
 #define ISO2709_FS 036
 
 #define ISO2709_RS 035
 #define ISO2709_FS 036
index f508d5a..5030bff 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: yaz-util.h,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: yaz-util.h,v $
- * Revision 1.2  2000-02-28 11:20:06  adam
+ * Revision 1.3  2001-04-06 12:26:46  adam
+ * Optional CCL module. Moved atoi_n to marcdisp.h from yaz-util.h.
+ *
+ * Revision 1.2  2000/02/28 11:20:06  adam
  * Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL.
  *
  * Revision 1.1  1999/11/30 13:47:11  adam
  * Using autoconf. New definitions: YAZ_BEGIN_CDECL/YAZ_END_CDECL.
  *
  * Revision 1.1  1999/11/30 13:47:11  adam
 #include <yaz/wrbuf.h>
 #include <yaz/nmem.h>
 #include <yaz/readconf.h>
 #include <yaz/wrbuf.h>
 #include <yaz/nmem.h>
 #include <yaz/readconf.h>
+#include <yaz/marcdisp.h>
 
 YAZ_BEGIN_CDECL
 
 YAZ_EXPORT int yaz_matchstr(const char *s1, const char *s2);
 
 YAZ_BEGIN_CDECL
 
 YAZ_EXPORT int yaz_matchstr(const char *s1, const char *s2);
-YAZ_EXPORT int atoi_n (const char *buf, int len);
 
 YAZ_END_CDECL
 
 
 YAZ_END_CDECL
 
index 50edbc7..bb816bb 100644 (file)
@@ -6,7 +6,10 @@
  *    Chas Woodfield, Fretwell Downing Datasystems.
  *
  * $Log: ztest.c,v $
  *    Chas Woodfield, Fretwell Downing Datasystems.
  *
  * $Log: ztest.c,v $
- * Revision 1.41  2001-04-05 13:08:48  adam
+ * Revision 1.42  2001-04-06 12:26:46  adam
+ * Optional CCL module. Moved atoi_n to marcdisp.h from yaz-util.h.
+ *
+ * Revision 1.41  2001/04/05 13:08:48  adam
  * New configure options: --enable-module.
  *
  * Revision 1.40  2001/03/25 21:55:13  adam
  * New configure options: --enable-module.
  *
  * Revision 1.40  2001/03/25 21:55:13  adam
@@ -226,6 +229,13 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr)
                    oident *ent = oid_getentbyoid(r->direct_reference);
                    if (ent)
                        yaz_log(LOG_LOG, "OID %s", ent->desc);
                    oident *ent = oid_getentbyoid(r->direct_reference);
                    if (ent)
                        yaz_log(LOG_LOG, "OID %s", ent->desc);
+                    if (ent && ent->value == VAL_TEXT_XML)
+                    {
+                       yaz_log (LOG_LOG, "ILL XML request");
+                        if (r->which == Z_External_octet)
+                            yaz_log (LOG_LOG, "%.*s", r->u.octet_aligned->len,
+                                     r->u.octet_aligned->buf); 
+                    }
                    if (ent && ent->value == VAL_ISO_ILL_1)
                    {
                        yaz_log (LOG_LOG, "Decode ItemRequest begin");
                    if (ent && ent->value == VAL_ISO_ILL_1)
                    {
                        yaz_log (LOG_LOG, "Decode ItemRequest begin");