From fa86345c14168c451f8c76b71309b27230bfee44 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 10 Feb 1998 15:31:46 +0000 Subject: [PATCH] Implemented date and time structure. Changed the Update Extended Service. --- asn/Makefile | 4 +- asn/prt-dat.c | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++ asn/prt-esp.c | 7 ++- asn/prt-exd.c | 14 ++++- asn/prt-ext.c | 8 ++- include/oid.h | 26 ++++++++- include/proto.h | 10 +++- include/prt-dat.h | 144 ++++++++++++++++++++++++++++++++++++++++++++++ include/prt-esp.h | 1 + include/prt-exd.h | 11 ++-- include/prt-ext.h | 3 + 11 files changed, 379 insertions(+), 15 deletions(-) create mode 100644 asn/prt-dat.c create mode 100644 include/prt-dat.h diff --git a/asn/Makefile b/asn/Makefile index 3b20bef..2841d8c 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.26 1998-01-29 13:13:39 adam Exp $ +# $Id: Makefile,v 1.27 1998-02-10 15:31:46 adam Exp $ SHELL=/bin/sh INCLUDE=-I../include -I. @@ -10,7 +10,7 @@ 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-grs.o prt-exd.o prt-dia.o prt-esp.o prt-arc.o prt-add.o prt-dat.o CPP=$(CC) -E RANLIB=ranlib diff --git a/asn/prt-dat.c b/asn/prt-dat.c new file mode 100644 index 0000000..c10f5a3 --- /dev/null +++ b/asn/prt-dat.c @@ -0,0 +1,166 @@ +/* + * This file is part of the YAZ toolkit: + * Copyright (c) 1998, Index Data. + * See the file LICENSE for details. + * Sebastian Hammer, Adam Dickmeiss + * + * Contribution by Ronald van Der Meer (RVDM): + * Databasix Information Systems B.V., Utrecht, The Netherlands. + * + * $Log: prt-dat.c,v $ + * Revision 1.1 1998-02-10 15:31:46 adam + * Implemented date and time structure. Changed the Update Extended + * Service. + * + */ + +#include + +int z_MonthAndDay(ODR o, Z_MonthAndDay **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, odr_integer, &(*p)->month, ODR_CONTEXT, 2, 0) && + odr_implicit(o, odr_integer, &(*p)->day, ODR_CONTEXT, 3, 1) && + odr_sequence_end(o); +} + +int z_Quarter(ODR o, Z_Quarter **p, int opt) +{ + static Odr_arm arm[] = + { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Quarter_first, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Quarter_second, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Quarter_third, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Quarter_fourth, odr_null}, + {-1, -1, -1, -1, 0} + }; + + if (!odr_initmember(o, p, sizeof(**p))) + return opt && odr_ok(o); + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} + +int z_Season(ODR o, Z_Season **p, int opt) +{ + static Odr_arm arm[] = + { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Season_winter, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Season_spring, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Season_summer, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_Season_autumn, odr_null}, + {-1, -1, -1, -1, 0} + }; + + if (!odr_initmember(o, p, sizeof(**p))) + return opt && odr_ok(o); + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} + +int z_PartOfYear(ODR o, Z_PartOfYear **p, int opt) +{ + static Odr_arm arm[] = + { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_PartOfYear_monthAndDay, z_MonthAndDay}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_PartOfYear_julianDay, odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_PartOfYear_weekNumber, odr_integer}, + {ODR_IMPLICIT, ODR_CONTEXT, 4, Z_PartOfYear_quarter, z_Quarter}, + {ODR_IMPLICIT, ODR_CONTEXT, 5, Z_PartOfYear_season, z_Season}, + {-1, -1, -1, -1, 0} + }; + + if (!odr_initmember(o, p, sizeof(**p))) + return opt && odr_ok(o); + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} + +int z_Era(ODR o, Z_Era **p, int opt) +{ + static Odr_arm arm[] = + { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Era_decade, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Era_century, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Era_millennium, odr_null}, + {-1, -1, -1, -1, 0} + }; + + if (!odr_initmember(o, p, sizeof(**p))) + return opt && odr_ok(o); + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} + +int z_DateFlags(ODR o, Z_DateFlags **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, odr_null, &(*p)->circa, ODR_CONTEXT, 1, 1) && + odr_implicit(o, z_Era, &(*p)->era, ODR_CONTEXT, 2, 1) && + odr_sequence_end(o); +} + +int z_Date(ODR o, Z_Date **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, odr_integer, &(*p)->year, ODR_CONTEXT, 1, 0) && + odr_implicit(o, z_PartOfYear, &(*p)->partOfYear, ODR_CONTEXT, 1, 1) && + odr_implicit(o, z_DateFlags, &(*p)->flags, ODR_CONTEXT, 2, 1) && + odr_sequence_end(o); +} + +int z_Zone(ODR o, Z_Zone **p, int opt) +{ + static Odr_arm arm[] = + { + {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Zone_local, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Zone_utc, odr_null}, + {ODR_IMPLICIT, ODR_CONTEXT, 3, Z_Zone_utcOffset, odr_integer}, + {-1, -1, -1, -1, 0} + }; + + if (!odr_initmember(o, p, sizeof(**p))) + return opt && odr_ok(o); + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} + +int z_Time(ODR o, Z_Time **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, odr_integer, &(*p)->hour, ODR_CONTEXT, 1, 0) && + odr_implicit(o, odr_integer, &(*p)->minute, ODR_CONTEXT, 2, 1) && + odr_implicit(o, odr_integer, &(*p)->second, ODR_CONTEXT, 3, 1) && + odr_implicit(o, z_IntUnit, &(*p)->partOfSecond, ODR_CONTEXT, 4, 1) && + odr_implicit(o, z_Zone, &(*p)->zone, ODR_CONTEXT, 5, 1) && + odr_sequence_end(o); +} + +int z_DateTime(ODR o, Z_DateTime **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_implicit(o, z_Date, &(*p)->z3950Date, ODR_CONTEXT, 1, 1) && + odr_implicit(o, z_Time, &(*p)->z3950Time, ODR_CONTEXT, 2, 1) && + odr_sequence_end(o); +} + diff --git a/asn/prt-esp.c b/asn/prt-esp.c index bc11d72..8922bfa 100644 --- a/asn/prt-esp.c +++ b/asn/prt-esp.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-esp.c,v $ - * Revision 1.1 1995-10-12 10:34:37 quinn + * Revision 1.2 1998-02-10 15:31:46 adam + * Implemented date and time structure. Changed the Update Extended + * Service. + * + * Revision 1.1 1995/10/12 10:34:37 quinn * Added Espec-1. * * @@ -47,6 +51,7 @@ int z_SpecificTag(ODR o, Z_SpecificTag **p, int opt) if (!odr_sequence_begin(o, p, sizeof(**p))) return opt && odr_ok(o); return + odr_implicit(o, odr_oid, &(*p)->schemaId, ODR_CONTEXT, 0, 1) && odr_implicit(o, odr_integer, &(*p)->tagType, ODR_CONTEXT, 1, 1) && odr_explicit(o, z_StringOrNumeric, &(*p)->tagValue, ODR_CONTEXT, 2, 0) && diff --git a/asn/prt-exd.c b/asn/prt-exd.c index d32228b..085d09c 100644 --- a/asn/prt-exd.c +++ b/asn/prt-exd.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-exd.c,v $ - * Revision 1.6 1998-01-05 09:04:57 adam + * Revision 1.7 1998-02-10 15:31:46 adam + * Implemented date and time structure. Changed the Update Extended + * Service. + * + * Revision 1.6 1998/01/05 09:04:57 adam * Fixed bugs in encoders/decoders - Not operator (!) missing. * * Revision 1.5 1997/04/30 08:52:02 quinn @@ -283,8 +287,8 @@ int z_IUTaskPackageRecordStructure (ODR o, Z_IUTaskPackageRecordStructure **p, static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_IUTaskPackageRecordStructure_record, odr_external}, - {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_IUTaskPackageRecordStructure_diagnostic, - z_DiagRec}, + {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_IUTaskPackageRecordStructure_surrogateDiagnostics, + z_DiagRecs}, {-1, -1, -1, -1, 0} }; if (!odr_sequence_begin (o, p, sizeof(**p))) @@ -297,6 +301,8 @@ int z_IUTaskPackageRecordStructure (ODR o, Z_IUTaskPackageRecordStructure **p, &(*p)->correlationInfo, ODR_CONTEXT, 2, 1) && odr_implicit (o, odr_integer, &(*p)->recordStatus, ODR_CONTEXT, 3, 0) && + odr_implicit (o, z_DiagRecs, + &(*p)->supplementalDiagnostics, ODR_CONTEXT, 4, 1) && odr_sequence_end (o); } @@ -313,6 +319,8 @@ int z_IUOriginPartToKeep (ODR o, Z_IUOriginPartToKeep **p, int opt) &(*p)->schema, ODR_CONTEXT, 3, 1) && odr_implicit (o, z_InternationalString, &(*p)->elementSetName, ODR_CONTEXT, 4, 1) && + odr_implicit (o, odr_external, + &(*p)->actionQualifier, ODR_CONTEXT, 5, 1) && odr_sequence_end (o); } diff --git a/asn/prt-ext.c b/asn/prt-ext.c index 4dda9d6..4fb0bab 100644 --- a/asn/prt-ext.c +++ b/asn/prt-ext.c @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: prt-ext.c,v $ - * Revision 1.14 1998-01-05 09:04:57 adam + * Revision 1.15 1998-02-10 15:31:46 adam + * Implemented date and time structure. Changed the Update Extended + * Service. + * + * Revision 1.14 1998/01/05 09:04:57 adam * Fixed bugs in encoders/decoders - Not operator (!) missing. * * Revision 1.13 1997/05/14 06:53:22 adam @@ -72,6 +76,7 @@ static Z_ext_typeent type_table[] = {VAL_OPAC, Z_External_OPAC, z_OPACRecord}, {VAL_SEARCHRES1, Z_External_searchResult1, z_SearchInfoReport}, {VAL_DBUPDATE, Z_External_update, z_IUUpdate}, + {VAL_DATETIME, Z_External_dateTime, z_DateTime}, {VAL_NONE, 0, 0} }; @@ -116,6 +121,7 @@ int z_External(ODR o, Z_External **p, int opt) {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_searchResult1, z_SearchInfoReport}, {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_update, z_IUUpdate}, + {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_dateTime, z_DateTime}, {-1, -1, -1, -1, 0} }; diff --git a/include/oid.h b/include/oid.h index eab0ca7..9bc9186 100644 --- a/include/oid.h +++ b/include/oid.h @@ -24,7 +24,11 @@ * OF THIS SOFTWARE. * * $Log: oid.h,v $ - * Revision 1.24 1997-09-29 13:18:59 adam + * Revision 1.25 1998-02-10 15:31:52 adam + * Implemented date and time structure. Changed the Update Extended + * Service. + * + * Revision 1.24 1997/09/29 13:18:59 adam * Added function, oid_ent_to_oid, to replace the function * oid_getoidbyent, which is not thread safe. * @@ -199,7 +203,25 @@ typedef enum oid_value VAL_ESPEC1, VAL_SOIF, VAL_SEARCHRES1, - VAL_THESAURUS + VAL_THESAURUS, + VAL_CHARLANG, + VAL_USERINFO1, + VAL_MULTISRCH1, + VAL_MULTISRCH2, + VAL_DATETIME, + VAL_SQLRS, + VAL_PDF, + VAL_POSTSCRIPT, + VAL_HTML, + VAL_TIFF, + VAL_GIF, + VAL_JPEG, + VAL_PNG, + VAL_MPEG, + VAL_SGML, + VAL_TIFFB, + VAL_WAV, + VAL_UPDATEES } oid_value; typedef struct oident diff --git a/include/proto.h b/include/proto.h index 11e6c93..a94e111 100644 --- a/include/proto.h +++ b/include/proto.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, Index Data. + * Copyright (c) 1995-1998, 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, @@ -24,7 +24,11 @@ * OF THIS SOFTWARE. * * $Log: proto.h,v $ - * Revision 1.40 1997-09-01 08:49:50 adam + * Revision 1.41 1998-02-10 15:31:52 adam + * Implemented date and time structure. Changed the Update Extended + * Service. + * + * Revision 1.40 1997/09/01 08:49:50 adam * New windows NT/95 port using MSV5.0. To export DLL functions the * YAZ_EXPORT modifier was added. Defined in yconfig.h. * @@ -1361,6 +1365,7 @@ YAZ_EXPORT int z_Term(ODR o, Z_Term **p, int opt); YAZ_EXPORT int z_Specification(ODR o, Z_Specification **p, int opt); YAZ_EXPORT int z_Permissions(ODR o, Z_Permissions **p, int opt); YAZ_EXPORT int z_DiagRec(ODR o, Z_DiagRec **p, int opt); +YAZ_EXPORT int z_DiagRecs(ODR o, Z_DiagRecs **p, int opt); YAZ_EXPORT int z_AttributeList(ODR o, Z_AttributeList **p, int opt); YAZ_EXPORT int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt); YAZ_EXPORT Z_APDU *zget_APDU(ODR o, int which); @@ -1381,5 +1386,6 @@ YAZ_EXPORT int z_Query(ODR o, Z_Query **p, int opt); #include #include +#include #endif diff --git a/include/prt-dat.h b/include/prt-dat.h new file mode 100644 index 0000000..6309761 --- /dev/null +++ b/include/prt-dat.h @@ -0,0 +1,144 @@ +/* + * This file is part of the YAZ toolkit: + * Copyright (c) 1998, Index Data. + * See the file LICENSE for details. + * Sebastian Hammer, Adam Dickmeiss + * + * Contribution by Ronald van Der Meer (RVDM): + * Databasix Information Systems B.V., Utrecht, The Netherlands. + * + * $Log: prt-dat.h,v $ + * Revision 1.1 1998-02-10 15:31:52 adam + * Implemented date and time structure. Changed the Update Extended + * Service. + * + */ + +#ifndef __PRT_DAT_H +#define __PRT_DAT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct Z_MonthAndDay +{ + int *month; + int *day; /* OPTIONAL */ +} Z_MonthAndDay; + +typedef struct Z_Quarter +{ + int which; +#define Z_Quarter_first 0 +#define Z_Quarter_second 1 +#define Z_Quarter_third 2 +#define Z_Quarter_fourth 3 + union + { + Odr_null *first; + Odr_null *second; + Odr_null *third; + Odr_null *fourth; + } u; +} Z_Quarter; + +typedef struct Z_Season +{ + int which; +#define Z_Season_winter 0 +#define Z_Season_spring 1 +#define Z_Season_summer 2 +#define Z_Season_autumn 3 + union + { + Odr_null *winter; + Odr_null *spring; + Odr_null *summer; + Odr_null *autumn; + } u; +} Z_Season; + +typedef struct Z_PartOfYear +{ + int which; +#define Z_PartOfYear_monthAndDay 0 +#define Z_PartOfYear_julianDay 1 +#define Z_PartOfYear_weekNumber 2 +#define Z_PartOfYear_quarter 3 +#define Z_PartOfYear_season 4 + union + { + Z_MonthAndDay *monthAndDay; + int *julianDay; + int *weekNumber; + Z_Quarter *quarter; + Z_Season *season; + } u; +} Z_PartOfYear; + +typedef struct Z_Era +{ + int which; +#define Z_Era_decade 0 +#define Z_Era_century 1 +#define Z_Era_millennium 2 + union + { + Odr_null *decade; + Odr_null *century; + Odr_null *millennium; + } u; +} Z_Era; + +typedef struct Z_DateFlags +{ + Odr_null *circa; /* OPTIONAL */ + Z_Era *era; /* OPTIONAL */ +} Z_DateFlags; + +typedef struct Z_Date +{ + int *year; + Z_PartOfYear *partOfYear; /* OPTIONAL */ + Z_DateFlags *flags; /* OPTIONAL */ +} Z_Date; + +typedef struct Z_Zone +{ + int which; +#define Z_Zone_local 0 +#define Z_Zone_utc 1 +#define Z_Zone_utcOffset 2 + union + { + Odr_null *local; + Odr_null *utc; + int *utcOffset; + } u; +} Z_Zone; + +typedef struct Z_Time +{ + int *hour; + int *minute; /* OPTIONAL */ + int *second; /* OPTIONAL */ + Z_IntUnit *partOfSecond; /* OPTIONAL */ + Z_Zone *zone; /* OPTIONAL */ +} Z_Time; + +typedef struct Z_DateTime +{ + Z_Date *z3950Date; /* OPTIONAL */ + Z_Time *z3950Time; /* OPTIONAL */ +} Z_DateTime; + +YAZ_EXPORT int z_DateTime(ODR o, Z_DateTime **p, int opt); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/prt-esp.h b/include/prt-esp.h index 3459ffb..5608213 100644 --- a/include/prt-esp.h +++ b/include/prt-esp.h @@ -56,6 +56,7 @@ typedef struct Z_Occurrences typedef struct Z_SpecificTag { + Odr_oid *schemaId; /* OPTIONAL */ int *tagType; /* OPTIONAL */ Z_StringOrNumeric *tagValue; Z_Occurrences *occurrences; /* OPTIONAL */ diff --git a/include/prt-exd.h b/include/prt-exd.h index 47a1754..a471312 100644 --- a/include/prt-exd.h +++ b/include/prt-exd.h @@ -199,19 +199,21 @@ typedef struct Z_IUOriginPartToKeep #define Z_IUOriginPartToKeep_recordReplace 2 #define Z_IUOriginPartToKeep_recordDelete 3 #define Z_IUOriginPartToKeep_elementUpdate 4 +#define Z_IUOriginPartToKeep_specialUpdate 5 char *databaseName; - Odr_oid *schema; /* OPTIONAL */ - char *elementSetName; /* OPTIONAL */ + Odr_oid *schema; /* OPTIONAL */ + char *elementSetName; /* OPTIONAL */ + Odr_external *actionQualifier; /* OPTIONAL */ } Z_IUOriginPartToKeep; typedef struct Z_IUTaskPackageRecordStructure { int which; #define Z_IUTaskPackageRecordStructure_record 1 -#define Z_IUTaskPackageRecordStructure_diagnostic 2 +#define Z_IUTaskPackageRecordStructure_surrogateDiagnostics 2 union { Odr_external *record; - Z_DiagRec *diagnostic; + Z_DiagRecs *surrogateDiagnostics; } u; /* OPTIONAL */ Z_IUCorrelationInfo *correlationInfo; /* OPTIONAL */ int *recordStatus; @@ -219,6 +221,7 @@ typedef struct Z_IUTaskPackageRecordStructure #define Z_IUTaskPackageRecordStructureS_queued 2 #define Z_IUTaskPackageRecordStructureS_inProcess 3 #define Z_IUTaskPackageRecordStructureS_failure 4 + Z_DiagRecs *supplementalDiagnostics; /* OPTIONAL */ } Z_IUTaskPackageRecordStructure; typedef struct Z_IUTargetPart diff --git a/include/prt-ext.h b/include/prt-ext.h index 988f75e..b01c8d8 100644 --- a/include/prt-ext.h +++ b/include/prt-ext.h @@ -33,6 +33,7 @@ #define PRT_EXT_H #include +#include #ifdef __cplusplus extern "C" { @@ -75,6 +76,7 @@ struct Z_External #define Z_External_OPAC 14 #define Z_External_searchResult1 15 #define Z_External_update 16 +#define Z_External_dateTime 17 union { /* Generic types */ @@ -96,6 +98,7 @@ struct Z_External Z_BriefBib *summary; Z_SearchInfoReport *searchResult1; Z_IUUpdate *update; + Z_DateTime *dateTime; } u; }; -- 1.7.10.4