From 84b60b9a8d2052540541726390fde416c59e1f40 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 20 Mar 1998 14:46:06 +0000 Subject: [PATCH] Added UNIverse Resource Reports. --- CHANGELOG | 5 ++++ asn/Makefile | 5 ++-- asn/prt-ext.c | 7 ++++- asn/prt-univ.c | 52 +++++++++++++++++++++++++++++++++++++ include/oid.h | 8 ++++-- include/proto.h | 6 ++++- include/prt-ext.h | 1 + include/prt-univ.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tab/usmarc.abs | 4 +-- util/oid.c | 7 ++++- 10 files changed, 159 insertions(+), 9 deletions(-) create mode 100644 asn/prt-univ.c create mode 100644 include/prt-univ.h diff --git a/CHANGELOG b/CHANGELOG index d6e9fee..3c06e80 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ Possible compatibility problems with earlier versions marked with '*'. +Added EXTERNAL: UNIverse Resource Report. + +Implemened odr_enum and odr_set_of functions to handle ASN.1 types +ENUMERATED and SET OF. + * Added 'const' to some of the char pointer arguments for the functions, data1_read_node, data1_getelementbytagname, data1_insert_taggeddata, data1_getesetbyname, data1_getelementbyname, diff --git a/asn/Makefile b/asn/Makefile index 2841d8c..ed1ab7f 100644 --- a/asn/Makefile +++ b/asn/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 1995-1998, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.27 1998-02-10 15:31:46 adam Exp $ +# $Id: Makefile,v 1.28 1998-03-20 14:46:06 adam Exp $ SHELL=/bin/sh INCLUDE=-I../include -I. @@ -10,7 +10,8 @@ LIBINCLUDE=-L$(LIBDIR) DEFS=$(INCLUDE) $(CDEFS) LIB=$(LIBDIR)/libasn.a PO = proto.o diagbib1.o zget.o prt-rsc.o prt-acc.o prt-exp.o prt-ext.o \ - prt-grs.o prt-exd.o prt-dia.o prt-esp.o prt-arc.o prt-add.o prt-dat.o + prt-grs.o prt-exd.o prt-dia.o prt-esp.o prt-arc.o prt-add.o \ + prt-dat.o prt-univ.o CPP=$(CC) -E RANLIB=ranlib diff --git a/asn/prt-ext.c b/asn/prt-ext.c index 4063231..5e83c10 100644 --- a/asn/prt-ext.c +++ b/asn/prt-ext.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-ext.c,v $ - * Revision 1.16 1998-02-11 11:53:32 adam + * Revision 1.17 1998-03-20 14:46:06 adam + * Added UNIverse Resource Reports. + * + * Revision 1.16 1998/02/11 11:53:32 adam * Changed code so that it compiles as C++. * * Revision 1.15 1998/02/10 15:31:46 adam @@ -125,6 +128,8 @@ int z_External(ODR o, Z_External **p, int opt) (Odr_fun)z_SearchInfoReport}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_update, (Odr_fun)z_IUUpdate}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_dateTime, (Odr_fun)z_DateTime}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_universeReport, + (Odr_fun)z_UniverseReport}, {-1, -1, -1, -1, 0} }; diff --git a/asn/prt-univ.c b/asn/prt-univ.c new file mode 100644 index 0000000..427d13d --- /dev/null +++ b/asn/prt-univ.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1998, Index Data. + * See the file LICENSE for details. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: prt-univ.c,v $ + * Revision 1.1 1998-03-20 14:46:06 adam + * Added UNIverse Resource Reports. + * + */ + +#include + +/* YC 0.1 Fri Mar 20 14:28:54 CET 1998 */ +/* Module-C: ResourceReport-Format-Universe-1 */ + +int z_UniverseReportHits (ODR o, Z_UniverseReportHits **p, int opt) +{ + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + z_StringOrNumeric(o, &(*p)->database, 0) && + z_StringOrNumeric(o, &(*p)->hits, 0) && + odr_sequence_end (o); +} + +int z_UniverseReportDuplicate (ODR o, Z_UniverseReportDuplicate **p, int opt) +{ + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + z_StringOrNumeric(o, &(*p)->hitno, 0) && + odr_sequence_end (o); +} + +int z_UniverseReport (ODR o, Z_UniverseReport **p, int opt) +{ + static Odr_arm arm[] = { + {ODR_IMPLICIT, ODR_CONTEXT, 0, Z_UniverseReport_databaseHits, + (Odr_fun) z_UniverseReportHits}, + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_UniverseReport_duplicate, + (Odr_fun) z_UniverseReportDuplicate}, + {-1, -1, -1, -1, (Odr_fun) 0} + }; + if (!odr_sequence_begin (o, p, sizeof(**p))) + return opt && odr_ok (o); + return + odr_integer(o, &(*p)->totalHits, 0) && + odr_choice (o, arm, &(*p)->u, &(*p)->which) && + odr_sequence_end (o); +} + diff --git a/include/oid.h b/include/oid.h index 9bc9186..a111fb0 100644 --- a/include/oid.h +++ b/include/oid.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: oid.h,v $ - * Revision 1.25 1998-02-10 15:31:52 adam + * Revision 1.26 1998-03-20 14:46:06 adam + * Added UNIverse Resource Reports. + * + * Revision 1.25 1998/02/10 15:31:52 adam * Implemented date and time structure. Changed the Update Extended * Service. * @@ -221,7 +224,8 @@ typedef enum oid_value VAL_SGML, VAL_TIFFB, VAL_WAV, - VAL_UPDATEES + VAL_UPDATEES, + VAL_UNIVERSE_REPORT } oid_value; typedef struct oident diff --git a/include/proto.h b/include/proto.h index a94e111..b2e095a 100644 --- a/include/proto.h +++ b/include/proto.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: proto.h,v $ - * Revision 1.41 1998-02-10 15:31:52 adam + * Revision 1.42 1998-03-20 14:46:06 adam + * Added UNIverse Resource Reports. + * + * Revision 1.41 1998/02/10 15:31:52 adam * Implemented date and time structure. Changed the Update Extended * Service. * @@ -1387,5 +1390,6 @@ YAZ_EXPORT int z_Query(ODR o, Z_Query **p, int opt); #include #include +#include #endif diff --git a/include/prt-ext.h b/include/prt-ext.h index 9b60b85..a21de65 100644 --- a/include/prt-ext.h +++ b/include/prt-ext.h @@ -77,6 +77,7 @@ struct Z_External #define Z_External_searchResult1 15 #define Z_External_update 16 #define Z_External_dateTime 17 +#define Z_External_universeReport 18 union { /* Generic types */ diff --git a/include/prt-univ.h b/include/prt-univ.h new file mode 100644 index 0000000..82c3997 --- /dev/null +++ b/include/prt-univ.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 1998 + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation, in whole or in part, for any purpose, is hereby granted, + * provided that: + * + * 1. This copyright and permission notice appear in all copies of the + * software and its documentation. Notices of copyright or attribution + * which appear at the beginning of any file must remain unchanged. + * + * 2. The names of Index Data or the individual authors may not be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR + * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + */ + +#ifndef PRT_UNIV_H +#define PRT_UNIV_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* YC 0.1: Fri Mar 20 14:28:54 CET 1998 */ +/* Module-H ResourceReport-Format-Universe-1 */ + +typedef struct Z_UniverseReportHits Z_UniverseReportHits; +int z_UniverseReportHits (ODR o, Z_UniverseReportHits **p, int opt); + +typedef struct Z_UniverseReportDuplicate Z_UniverseReportDuplicate; +int z_UniverseReportDuplicate (ODR o, Z_UniverseReportDuplicate **p, int opt); + +typedef struct Z_UniverseReport Z_UniverseReport; +int z_UniverseReport (ODR o, Z_UniverseReport **p, int opt); + +struct Z_UniverseReportHits { + Z_StringOrNumeric *database; + Z_StringOrNumeric *hits; +}; + +struct Z_UniverseReportDuplicate { + Z_StringOrNumeric *hitno; +}; + +struct Z_UniverseReport { + int *totalHits; + int which; + union { + Z_UniverseReportHits *databaseHits; + Z_UniverseReportDuplicate *duplicate; +#define Z_UniverseReport_databaseHits 1 +#define Z_UniverseReport_duplicate 2 + } u; +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tab/usmarc.abs b/tab/usmarc.abs index 667131f..38b150d 100644 --- a/tab/usmarc.abs +++ b/tab/usmarc.abs @@ -8,11 +8,11 @@ marc usmarc.mar esetname B usmarc-b.est esetname F @ -elm 245 title - +elm 245 titles - elm 245/? title !:w elm 245/?/a title !:w,!:p -elm 100 author - +elm 100 authors - elm 100/? author !:w elm 100/?/a author !:w,!:p diff --git a/util/oid.c b/util/oid.c index 6ba7250..285a146 100644 --- a/util/oid.c +++ b/util/oid.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: oid.c,v $ - * Revision 1.25 1998-02-10 15:32:03 adam + * Revision 1.26 1998-03-20 14:46:06 adam + * Added UNIverse Resource Reports. + * + * Revision 1.25 1998/02/10 15:32:03 adam * Added new Object Identifiers. * * Revision 1.24 1997/09/29 13:19:00 adam @@ -190,6 +193,7 @@ static oident oids[] = {PROTO_Z3950, CLASS_RESFORM, VAL_RESOURCE1, {7,1,-1}, "Resource-1" }, {PROTO_Z3950, CLASS_RESFORM, VAL_RESOURCE2, {7,2,-1}, "Resource-2" }, + {PROTO_Z3950, CLASS_RESFORM, VAL_UNIVERSE_REPORT, {7,1000,81,1,-1}, "UNIverse-Resource-Report"}, {PROTO_Z3950, CLASS_ACCFORM, VAL_PROMPT1, {8,1,-1}, "Prompt-1" }, {PROTO_Z3950, CLASS_ACCFORM, VAL_DES1, {8,2,-1}, "Des-1" }, @@ -228,6 +232,7 @@ static oident oids[] = {PROTO_Z3950, CLASS_TAGSET, VAL_COLLECT1, {14,5,-1}, "Collections-tagset"}, {PROTO_Z3950, CLASS_TAGSET, VAL_CIMI1, {14,6,-1}, "CIMI-tagset" }, {PROTO_Z3950, CLASS_TAGSET, VAL_THESAURUS, {14,1000,81,1,-1}, "thesaurus-tagset"}, + /* SR definitions. Note that some of them aren't defined by the standard (yet), but are borrowed from Z3950v3 */ -- 1.7.10.4