From 05586eb8028d6f6a84d6389f8f3ab829b19f1760 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 5 Dec 2002 12:07:00 +0000 Subject: [PATCH] Range search. Not fully implemented yet. --- include/yaz/proto.h | 3 ++- include/yaz/prt-ext.h | 7 +++++++ z39.50/Makefile.am | 25 +++++++++++++++---------- z39.50/mterm2.asn | 10 ++++++++++ z39.50/prt-ext.c | 12 ++++++++++-- z39.50/z.tcl | 5 ++++- zutil/pquery.c | 13 ++++++++++++- 7 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 z39.50/mterm2.asn diff --git a/include/yaz/proto.h b/include/yaz/proto.h index 05ff950..2350c57 100644 --- a/include/yaz/proto.h +++ b/include/yaz/proto.h @@ -3,7 +3,7 @@ * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * - * $Id: proto.h,v 1.4 2002-10-22 10:05:36 adam Exp $ + * $Id: proto.h,v 1.5 2002-12-05 12:07:00 adam Exp $ */ #ifndef Z_PROTO_H #define Z_PROTO_H @@ -39,6 +39,7 @@ #include #include #include +#include #include #include diff --git a/include/yaz/prt-ext.h b/include/yaz/prt-ext.h index 55254fe..9bfd485 100644 --- a/include/yaz/prt-ext.h +++ b/include/yaz/prt-ext.h @@ -84,6 +84,7 @@ struct Z_External #define Z_External_acfPrompt1 23 #define Z_External_acfDes1 24 #define Z_External_acfKrb1 25 +#define Z_External_multisrch2 26 union { /* Generic types */ @@ -94,27 +95,33 @@ struct Z_External /* Specific types */ Z_SUTRS *sutrs; Z_ExplainRecord *explainRecord; + Z_ResourceReport1 *resourceReport1; Z_ResourceReport2 *resourceReport2; Z_PromptObject1 *promptObject1; Z_GenericRecord *grs1; Z_TaskPackage *extendedService; + Z_ItemOrder *itemOrder; Z_DiagnosticFormat *diag1; Z_Espec1 *espec1; Z_BriefBib *summary; Z_OPACRecord *opac; + Z_SearchInfoReport *searchResult1; Z_IUUpdate *update; Z_DateTime *dateTime; Z_UniverseReport *universeReport; Z_Admin *adminService; + Z_IU0Update *update0; Z_OtherInformation *userInfo1; Z_CharSetandLanguageNegotiation *charNeg3; Z_PromptObject1 *acfPrompt1; Z_DES_RN_Object *acfDes1; + Z_KRBObject *acfKrb1; + Z_MultipleSearchTerms_2 *multipleSearchTerms_2; } u; }; diff --git a/z39.50/Makefile.am b/z39.50/Makefile.am index 9e2b397..d7f70ec 100644 --- a/z39.50/Makefile.am +++ b/z39.50/Makefile.am @@ -1,4 +1,4 @@ -## $Id: Makefile.am,v 1.11 2002-09-11 21:25:57 adam Exp $ +## $Id: Makefile.am,v 1.12 2002-12-05 12:07:00 adam Exp $ AM_CPPFLAGS=-I$(top_srcdir)/include @@ -6,14 +6,15 @@ noinst_LTLIBRARIES = libz39.50.la tabdatadir = $(pkgdatadir)/z39.50 tabdata_DATA=datetime.asn esupdate.asn univres.asn z3950v3.asn z.tcl \ - esadmin.asn charneg-3.asn + esadmin.asn charneg-3.asn mterm2.asn EXTRA_DIST=$(tabdata_DATA) YAZCOMP = $(top_srcdir)/util/yaz-comp +YAZCOMPLINE = ../util/yaz-comp -d z.tcl -i yaz -I../include $(YCFLAGS) libz39_50_la_SOURCES = z-accdes1.c z-accform1.c z-acckrb1.c z-core.c \ - z-diag1.c z-espec1.c z-estask.c z-exp.c z-grs.c z-opac.c z-uifr1.c \ - z-rrf1.c z-rrf2.c z-sum.c z-sutrs.c \ + z-diag1.c z-espec1.c z-estask.c z-exp.c z-grs.c z-mterm2.c z-opac.c \ + z-uifr1.c z-rrf1.c z-rrf2.c z-sum.c z-sutrs.c \ zes-expi.c zes-exps.c zes-order.c zes-pquery.c zes-psched.c \ zes-pset.c zes-update0.c z-date.c z-univ.c zes-update.c zes-admin.c \ z-charneg.c \ @@ -45,31 +46,35 @@ $(srcdir)/zes-update0.c \ $(top_srcdir)/include/z-accdes1.h \ $(top_srcdir)/include/z-core.h: \ $(srcdir)/z.tcl $(srcdir)/z3950v3.asn $(YAZCOMP) - cd $(srcdir); ../util/yaz-comp -d z.tcl -i yaz -I ../include $(YCFLAGS) z3950v3.asn + cd $(srcdir); $(YAZCOMPLINE) z3950v3.asn # Date extension $(srcdir)/z-date.c \ $(top_srcdir)/include/yaz/z-date.h: $(srcdir)/z.tcl $(srcdir)/datetime.asn $(YAZCOMP) - cd $(srcdir); ../util/yaz-comp -d z.tcl -i yaz -I../include $(YCFLAGS) datetime.asn + cd $(srcdir); $(YAZCOMPLINE) datetime.asn # UNIverse extension $(srcdir)/z-univ.c \ $(top_srcdir)/include/yaz/z-univ.h: \ $(srcdir)/z.tcl $(srcdir)/univres.asn $(YAZCOMP) - cd $(srcdir); ../util/yaz-comp -d z.tcl -i yaz -I ../include $(YCFLAGS) univres.asn + cd $(srcdir); $(YAZCOMPLINE) univres.asn # New Update extended service $(srcdir)/zes-update.c \ $(top_srcdir)/include/yaz/zes-update.h: \ $(srcdir)/z.tcl $(srcdir)/esupdate.asn $(YAZCOMP) - cd $(srcdir); ../util/yaz-comp -d z.tcl -i yaz -I ../include $(YCFLAGS) esupdate.asn + cd $(srcdir); $(YAZCOMPLINE) esupdate.asn # Admin extended service $(srcdir)/zes-admin.c \ $(top_srcdir)/include/yaz/zes-admin.h: \ $(srcdir)/z.tcl $(srcdir)/esadmin.asn $(YAZCOMP) - cd $(srcdir); ../util/yaz-comp -d z.tcl -i yaz -I ../include $(YCFLAGS) esadmin.asn + cd $(srcdir); $(YAZCOMPLINE) esadmin.asn # Charset negotiation $(srcdir)/z-charneg.c: $(srcdir)/z.tcl $(srcdir)/charneg-3.asn - cd $(srcdir); ../util/yaz-comp -d z.tcl -i yaz -I ../include $(YCFLAGS) charneg-3.asn + cd $(srcdir); $(YAZCOMPLINE) $(YCFLAGS) charneg-3.asn + +# UserInfoFormat-multipleSearchTerms-2 +$(srcdir)/z-mterm2.c: $(srcdir)/z.tcl $(srcdir)/mterm2.asn + cd $(srcdir); $(YAZCOMPLINE) mterm2.asn diff --git a/z39.50/mterm2.asn b/z39.50/mterm2.asn new file mode 100644 index 0000000..eff29d7 --- /dev/null +++ b/z39.50/mterm2.asn @@ -0,0 +1,10 @@ +UserInfoFormat-multipleSearchTerms-2 +{Z39-50-userInfoFormat MultipleSearchTerms-2 (5)} DEFINITIONS ::= +BEGIN +IMPORTS Term FROM Z39-50-APDU-1995; + +MultipleSearchTerms-2 ::= SEQUENCE OF SEQUENCE{ + term [1] IMPLICIT Term, + flag [2] IMPLICIT BOOLEAN OPTIONAL} + +END diff --git a/z39.50/prt-ext.c b/z39.50/prt-ext.c index bbb5748..03c1cf5 100644 --- a/z39.50/prt-ext.c +++ b/z39.50/prt-ext.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 1995-2001, Index Data. + * Copyright (c) 1995-2002, Index Data. * See the file LICENSE for details. * - * $Id: prt-ext.c,v 1.3 2002-02-11 23:25:27 adam Exp $ + * $Id: prt-ext.c,v 1.4 2002-12-05 12:07:00 adam Exp $ */ #include @@ -37,6 +37,7 @@ static Z_ext_typeent type_table[] = {VAL_PROMPT1, Z_External_acfPrompt1, (Odr_fun) z_PromptObject1}, {VAL_DES1, Z_External_acfDes1, (Odr_fun) z_DES_RN_Object}, {VAL_KRB1, Z_External_acfKrb1, (Odr_fun) z_KRBObject}, + {VAL_MULTISRCH2, Z_External_multisrch2, (Odr_fun) z_MultipleSearchTerms_2}, {VAL_NONE, 0, 0} }; @@ -67,6 +68,7 @@ int z_External(ODR o, Z_External **p, int opt, const char *name) (Odr_fun)z_SUTRS, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_explainRecord, (Odr_fun)z_ExplainRecord, 0}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_resourceReport1, (Odr_fun)z_ResourceReport1, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_resourceReport2, @@ -77,6 +79,7 @@ int z_External(ODR o, Z_External **p, int opt, const char *name) (Odr_fun)z_GenericRecord, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_extendedService, (Odr_fun)z_TaskPackage, 0}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_itemOrder, (Odr_fun)z_IOItemOrder, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_diag1, @@ -87,6 +90,7 @@ int z_External(ODR o, Z_External **p, int opt, const char *name) (Odr_fun)z_BriefBib, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_OPAC, (Odr_fun)z_OPACRecord, 0}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_searchResult1, (Odr_fun)z_SearchInfoReport, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_update, @@ -97,6 +101,7 @@ int z_External(ODR o, Z_External **p, int opt, const char *name) (Odr_fun)z_UniverseReport, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_ESAdmin, (Odr_fun)z_Admin, 0}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_update0, (Odr_fun)z_IU0Update, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_userInfo1, @@ -107,8 +112,11 @@ int z_External(ODR o, Z_External **p, int opt, const char *name) (Odr_fun)z_PromptObject1, 0}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_acfDes1, (Odr_fun)z_DES_RN_Object, 0}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_acfKrb1, (Odr_fun)z_KRBObject, 0}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_multisrch2, + (Odr_fun)z_MultipleSearchTerms_2, 0}, {-1, -1, -1, -1, 0, 0} }; diff --git a/z39.50/z.tcl b/z39.50/z.tcl index a1dc994..bd2d6d7 100644 --- a/z39.50/z.tcl +++ b/z39.50/z.tcl @@ -1,5 +1,5 @@ # YC Sample Config File for Z39.50 -# $Id: z.tcl,v 1.8 2002-08-28 19:12:30 adam Exp $ +# $Id: z.tcl,v 1.9 2002-12-05 12:07:00 adam Exp $ # ---------------------------------------------------------- # Prefix Specifications # @@ -321,6 +321,9 @@ set map($m,Z3950DateSeason) DateSeason set map($m,Date_0) DateFlags set unionmap($m,DateFlags,era) {} # ---- +set m UserInfoFormat-multipleSearchTerms-2 +set filename($m) z-mterm2 +# ---- set m ResourceReport-Format-Universe-1 set filename($m) z-univ # ---- diff --git a/zutil/pquery.c b/zutil/pquery.c index 3d938ce..59e2833 100644 --- a/zutil/pquery.c +++ b/zutil/pquery.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data. * See the file LICENSE for details. * - * $Id: pquery.c,v 1.18 2002-09-24 08:05:42 adam Exp $ + * $Id: pquery.c,v 1.19 2002-12-05 12:07:00 adam Exp $ */ #include @@ -26,6 +26,7 @@ struct yaz_pqf_parser { char *right_sep; int escape_char; int term_type; + int external_type; int error; }; @@ -335,6 +336,10 @@ static Z_AttributesPlusTerm *rpn_term (struct yaz_pqf_parser *li, ODR o, term->which = Z_Term_null; term->u.null = odr_nullval(); break; + case Z_Term_external: + term->which = Z_Term_external; + term->u.external = 0; + break; default: term->which = Z_Term_null; term->u.null = odr_nullval(); @@ -516,6 +521,12 @@ static void rpn_term_type (struct yaz_pqf_parser *li, ODR o) li->term_type = Z_Term_dateTime; else if (compare_term (li, "null", 0)) li->term_type = Z_Term_null; + else if (compare_term(li, "range", 0)) + { + /* prepare for external: range search .. */ + li->term_type = Z_Term_external; + li->external_type = VAL_MULTISRCH2; + } lex (li); } -- 1.7.10.4