# Copyright (C) 1995-1998, Index Data I/S
# All rights reserved.
# Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.36 1998-01-29 13:43:03 adam Exp $
+# $Id: Makefile,v 1.37 1998-03-31 15:13:19 adam Exp $
# Uncomment the lines below to enable mOSI communcation.
#ODEFS=-DUSE_XTIMOSI
#LIBMOSI=../../xtimosi/src/libmosi.a ../lib/librfc.a
#XMOSI=xmosi.o
-CDEFS=$(ODEFS)
+CDEFS=$(ODEFS)
+
+#INCLUDE=-I../z39.50 -I. -I../include
+#MOD=z39.50
+
+INCLUDE=-I. -I../include
+MOD=asn
+
#CC=
SHELL=/bin/sh
MAKE=make
-SUBDIR=util odr asn $(RFC1006) ccl comstack retrieval client server ztest makelib
+SUBDIR=$(MOD) util odr $(RFC1006) ccl comstack retrieval client server ztest makelib
# Add external libraries to the ELIBS macro
ELIBS=
CONTROL=RANLIB="ranlib" ELIBS="$(ELIBS)"
all:
for i in $(SUBDIR); do cd $$i; if $(MAKE) $(CONTROL) \
- CFLAGS="$(CFLAGS)" CDEFS="$(CDEFS)" LIBMOSI="$(LIBMOSI)" XMOSI="$(XMOSI)";\
+ INCLUDE="$(INCLUDE)" CFLAGS="$(CFLAGS)" CDEFS="$(CDEFS)" LIBMOSI="$(LIBMOSI)" XMOSI="$(XMOSI)";\
then cd ..; else exit 1; fi; done
dep depend:
- for i in $(SUBDIR); do cd $$i; if $(MAKE) CDEFS="$(CDEFS)" depend;\
+ for i in $(SUBDIR); do cd $$i; if $(MAKE) INCLUDE="$(INCLUDE)" CDEFS="$(CDEFS)" depend;\
then cd ..; else exit 1; fi; done
clean:
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: prt-ext.c,v $
- * Revision 1.18 1998-03-31 11:07:44 adam
+ * Revision 1.19 1998-03-31 15:13:19 adam
+ * Development towards compiled ASN.1.
+ *
+ * Revision 1.18 1998/03/31 11:07:44 adam
* Furhter work on UNIverse resource report.
* Added Extended Services handling in frontend server.
*
{VAL_PROMPT1, Z_External_promptObject1, (Odr_fun)z_PromptObject1 },
{VAL_GRS1, Z_External_grs1, (Odr_fun)z_GenericRecord},
{VAL_EXTENDED, Z_External_extendedService, (Odr_fun)z_TaskPackage},
+#ifdef ASN_COMPILED
+ {VAL_ITEMORDER, Z_External_itemOrder, (Odr_fun)z_IOItemOrder},
+#else
{VAL_ITEMORDER, Z_External_itemOrder, (Odr_fun)z_ItemOrder},
+#endif
{VAL_DIAG1, Z_External_diag1, (Odr_fun)z_DiagnosticFormat},
{VAL_ESPEC1, Z_External_espec1, (Odr_fun)z_Espec1},
{VAL_SUMMARY, Z_External_summary, (Odr_fun)z_BriefBib},
{ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_grs1, (Odr_fun)z_GenericRecord},
{ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_extendedService,
(Odr_fun)z_TaskPackage},
+#ifdef ASN_COMPILED
+ {ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_itemOrder, (Odr_fun)z_IOItemOrder},
+#else
{ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_itemOrder, (Odr_fun)z_ItemOrder},
+#endif
{ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_diag1, (Odr_fun)z_DiagnosticFormat},
{ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_espec1, (Odr_fun)z_Espec1},
{ODR_EXPLICIT, ODR_CONTEXT, 0, Z_External_summary, (Odr_fun)z_BriefBib},
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: zget.c,v $
- * Revision 1.14 1998-02-11 11:53:32 adam
+ * Revision 1.15 1998-03-31 15:13:19 adam
+ * Development towards compiled ASN.1.
+ *
+ * Revision 1.14 1998/02/11 11:53:32 adam
* Changed code so that it compiles as C++.
*
* Revision 1.13 1998/01/29 13:13:39 adam
r->referenceId = 0;
r->deleteFunction = (int *)odr_malloc(o, sizeof(int));
*r->deleteFunction = Z_DeleteRequest_list;
+#ifdef ASN_COMPILED
+ r->num_resultSetList = 0;
+#else
r->num_ids = 0;
+#endif
r->resultSetList = 0;
#ifdef Z_95
r->otherInfo = 0;
r->referenceId = 0;
r->deleteOperationStatus = (int *)odr_malloc(o, sizeof(int));
*r->deleteOperationStatus = Z_DeleteStatus_success;
+#ifdef ASN_COMPILED
+ r->deleteListStatuses = 0;
+#else
r->num_statuses = 0;
r->deleteListStatuses = 0;
+#endif
r->numberNotDeleted = 0;
+#ifdef ASN_COMPILED
+ r->bulkStatuses = 0;
+#else
r->num_bulkStatuses = 0;
r->bulkStatuses = 0;
+#endif
r->deleteMessage = 0;
#ifdef Z_95
r->otherInfo = 0;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: client.c,v $
- * Revision 1.64 1998-03-31 11:07:44 adam
+ * Revision 1.65 1998-03-31 15:13:19 adam
+ * Development towards compiled ASN.1.
+ *
+ * Revision 1.64 1998/03/31 11:07:44 adam
* Furhter work on UNIverse resource report.
* Added Extended Services handling in frontend server.
*
* Note: we throw away the original, BER-encoded record here.
* Do something else with it if you want to keep it.
*/
- r->u.sutrs = (Odr_oct *)rr; /* we don't actually check the type here. */
+ r->u.sutrs = (Z_SUTRS *) rr; /* we don't actually check the type here. */
r->which = type->what;
}
}
ent->oclass != CLASS_DIAGSET || ent->value != VAL_BIB1)
printf("Missing or unknown diagset\n");
printf(" [%d] %s", *r->condition, diagbib1_str(*r->condition));
+#ifdef ASN_COMPILED
+ switch (r->which)
+ {
+ case Z_DefaultDiagFormat_v2Addinfo:
+ printf (" -- v2 addinfo '%s'\n", r->u.v2Addinfo);
+ break;
+ case Z_DefaultDiagFormat_v3Addinfo:
+ printf (" -- v3 addinfo '%s'\n", r->u.v3Addinfo);
+ break;
+ }
+#else
if (r->addinfo && *r->addinfo)
printf(" -- '%s'\n", r->addinfo);
else
printf("\n");
+#endif
}
}
int i;
if (p->which == Z_Records_NSD)
+ {
+#ifdef ASN_COMPILED
+ Z_DiagRec dr, *dr_p = &dr;
+ dr.which = Z_DiagRec_defaultFormat;
+ dr.u.defaultFormat = p->u.nonSurrogateDiagnostic;
+ display_diagrecs (&dr_p, 1);
+#else
display_diagrecs (&p->u.nonSurrogateDiagnostic, 1);
+#endif
+ }
else if (p->which == Z_Records_multipleNSD)
display_diagrecs (p->u.multipleNonSurDiagnostics->diagRecs,
p->u.multipleNonSurDiagnostics->num_diagRecs);
r->u.itemOrder = odr_malloc(out,sizeof(Z_ItemOrder));
memset(r->u.itemOrder, 0, sizeof(Z_ItemOrder));
+#ifdef ASN_COMPILED
+ r->u.itemOrder->which=Z_IOItemOrder_esRequest;
+#else
r->u.itemOrder->which=Z_ItemOrder_esRequest;
+#endif
r->u.itemOrder->u.esRequest = odr_malloc(out,sizeof(Z_IORequest));
memset(r->u.itemOrder->u.esRequest, 0, sizeof(Z_IORequest));
req->referenceId = set_refid (out);
+#ifdef ASN_COMPILED
+ req->num_inputResultSetNames = 1;
+ req->inputResultSetNames = (Z_InternationalString **)
+ odr_malloc (out, sizeof(*req->inputResultSetNames));
+ req->inputResultSetNames[0] = (char *)
+ odr_malloc (out, strlen(setstring)+1);
+ strcpy (req->inputResultSetNames[0], setstring);
+#else
req->inputResultSetNames =
(Z_StringList *)odr_malloc (out, sizeof(*req->inputResultSetNames));
req->inputResultSetNames->num_strings = 1;
req->inputResultSetNames->strings[0] =
(char *)odr_malloc (out, strlen(setstring)+1);
strcpy (req->inputResultSetNames->strings[0], setstring);
+#endif
if (newset && setnumber >= 0)
sprintf (setstring, "%d", ++setnumber);
sks->caseSensitivity = (int *)odr_malloc (out, sizeof(*sks->caseSensitivity));
*sks->caseSensitivity = Z_SortCase_caseSensitive;
+#ifdef ASN_COMPILED
+ sks->which = Z_SortKeySpec_null;
+ sks->u.null = odr_nullval ();
+#else
sks->missingValueAction = NULL;
+#endif
for (i = 0; sort_flags[i]; i++)
{
void process_scanResponse(Z_ScanResponse *res)
{
int i;
+ Z_Entry **entries = NULL;
+ int num_entries = 0;
printf("Received ScanResponse\n");
print_refid (res->referenceId);
printf("Scan returned code %d\n", *res->scanStatus);
if (!res->entries)
return;
+#ifdef ASN_COMPILED
+ if ((entries = res->entries->entries))
+ num_entries = res->entries->num_entries;
+#else
if (res->entries->which == Z_ListEntries_entries)
{
- Z_Entries *ent = res->entries->u.entries;
-
- for (i = 0; i < ent->num_entries; i++)
- if (ent->entries[i]->which == Z_Entry_termInfo)
- {
- printf("%c ", i + 1 == *res->positionOfTerm ? '*' : ' ');
- display_term(ent->entries[i]->u.termInfo);
- }
- else
- display_diagrecs(&ent->entries[i]->u.surrogateDiagnostic, 1);
+ entries = res->entries->u.entries->entries;
+ num_entries = res->entries->u.entries->num_entries;
}
- else
+#endif
+ for (i = 0; i < num_entries; i++)
+ if (entries[i]->which == Z_Entry_termInfo)
+ {
+ printf("%c ", i + 1 == *res->positionOfTerm ? '*' : ' ');
+ display_term(entries[i]->u.termInfo);
+ }
+ else
+ display_diagrecs(&entries[i]->u.surrogateDiagnostic, 1);
+#ifdef ASN_COMPILED
+ if (res->entries->nonsurrogateDiagnostics)
+ display_diagrecs (res->entries->nonsurrogateDiagnostics,
+ res->entries->num_nonsurrogateDiagnostics);
+#else
+ if (res->entries->which == Z_ListEntries_nonSurrogateDiagnostics)
display_diagrecs(&res->entries->
u.nonSurrogateDiagnostics->diagRecs[0], 1);
+#endif
}
void process_sortResponse(Z_SortResponse *res)
}
printf ("\n");
print_refid (res->referenceId);
+#ifdef ASN_COMPILED
+ if (res->diagnostics)
+ display_diagrecs(res->diagnostics,
+ res->num_diagnostics);
+#else
if (res->diagnostics)
display_diagrecs(res->diagnostics->diagRecs,
res->diagnostics->num_diagRecs);
+#endif
}
int cmd_sort_generic(char *arg, int newset)
#define PRT_EXT_H
#include <yconfig.h>
+#include <oid.h>
#ifdef __cplusplus
extern "C" {
/*
- * Copyright (c) 1995-1997, Index Data.
+ * Copyright (c) 1995-1998, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: d1_expout.c,v $
- * Revision 1.9 1998-03-05 08:07:58 adam
+ * Revision 1.10 1998-03-31 15:13:20 adam
+ * Development towards compiled ASN.1.
+ *
+ * Revision 1.9 1998/03/05 08:07:58 adam
* Make data1 to EXPLAIN ignore local tags in root.
*
* Revision 1.8 1998/02/11 11:53:35 adam
c = c->child;
if (!is_numeric_tag (eh, c))
return 0;
+#ifdef ASN_COMPILED
+ if (c->u.tag.element->tag->value.numeric == 210)
+ *wp = Z_DatabaseInfo_actualNumber;
+ else if (c->u.tag.element->tag->value.numeric == 211)
+ *wp = Z_DatabaseInfo_approxNumber;
+ else
+ return 0;
+#else
if (c->u.tag.element->tag->value.numeric == 210)
*wp = Z_Exp_RecordCount_actualNumber;
else if (c->u.tag.element->tag->value.numeric == 211)
*wp = Z_Exp_RecordCount_approxNumber;
else
return 0;
+#endif
if (!c->child || c->child->which != DATA1N_data)
return 0;
sprintf(intbuf, "%.*s", 63, c->child->u.data.data);
res->subDbs = 0;
res->disclaimers = 0;
res->news = 0;
+#ifdef ASN_COMPILED
+ res->u.actualNumber = 0;
+#else
res->recordCount = 0;
+#endif
res->defaultOrder = 0;
res->avRecordSize = 0;
res->maxRecordSize = 0;
break;
case 207: res->disclaimers = f_humstring(eh, c); break;
case 103: res->news = f_humstring(eh, c); break;
+#ifdef ASN_COMPILED
+ case 209: res->u.actualNumber =
+ f_recordCount(eh, c, &res->which); break;
+#else
case 209: res->recordCount =
f_recordCount(eh, c, &res->recordCount_which); break;
+#endif
case 212: res->defaultOrder = f_humstring(eh, c); break;
case 213: res->avRecordSize = f_integer(eh, c); break;
case 214: res->maxRecordSize = f_integer(eh, c); break;
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: seshigh.c,v $
- * Revision 1.73 1998-03-31 11:07:45 adam
+ * Revision 1.74 1998-03-31 15:13:20 adam
+ * Development towards compiled ASN.1.
+ *
+ * Revision 1.73 1998/03/31 11:07:45 adam
* Furhter work on UNIverse resource report.
* Added Extended Services handling in frontend server.
*
* These functions should be merged.
*/
+static void set_addinfo (Z_DefaultDiagFormat *dr, char *addinfo)
+{
+#if ASN_COMPILED
+ dr->which = Z_DefaultDiagFormat_v2Addinfo;
+ dr->u.v2Addinfo = addinfo ? addinfo : "";
+#else
+ dr->which = Z_DiagForm_v2AddInfo;
+ dr->addinfo = addinfo ? addinfo : "";
+#endif
+}
+
/*
* nonsurrogate diagnostic record.
*/
"NULL");
*err = error;
rec->which = Z_Records_NSD;
+#if ASN_COMPILED
+ rec->u.nonSurrogateDiagnostic = dr;
+#else
#ifdef Z_95
rec->u.nonSurrogateDiagnostic = drec;
drec->which = Z_DiagRec_defaultFormat;
#else
rec->u.nonSurrogateDiagnostic = dr;
#endif
+#endif
dr->diagnosticSetId = odr_oiddup (assoc->encode,
oid_ent_to_oid(&bib1, oid));
dr->condition = err;
- dr->which = Z_DiagForm_v2AddInfo;
- dr->addinfo = addinfo ? addinfo : "";
+ set_addinfo (dr, addinfo);
return rec;
}
dr->diagnosticSetId = odr_oiddup (assoc->encode,
oid_ent_to_oid(&bib1, oid));
dr->condition = err;
- dr->which = Z_DiagForm_v2AddInfo;
- dr->addinfo = addinfo ? addinfo : "";
+ set_addinfo (dr, addinfo);
+
return rec;
}
rec->diagnosticSetId = odr_oiddup (assoc->encode,
oid_ent_to_oid(&bib1, oid));
rec->condition = err;
+
+#ifdef ASN_COMPILED
+ rec->which = Z_DefaultDiagFormat_v2Addinfo;
+ rec->u.v2Addinfo = addinfo ? addinfo : "";
+#else
rec->which = Z_DiagForm_v2AddInfo;
rec->addinfo = addinfo ? addinfo : "";
+#endif
return recs;
}
}
else if (fres->format == VAL_SUTRS) /* SUTRS is a single-ASN.1-type */
{
+#if 0
+ Z_SUTRS *sutrs = (Z_SUTRS *)odr_malloc(a->encode, 1+fres->len);
+
+ memcpy(sutrs, fres->record, fres->len);
+ sutrs[fres->len] = '\0';
+#else
Odr_oct *sutrs = (Odr_oct *)odr_malloc(a->encode, sizeof(*sutrs));
thisext->which = Z_External_sutrs;
sutrs->buf = (unsigned char *)odr_malloc(a->encode, fres->len);
sutrs->len = sutrs->size = fres->len;
memcpy(sutrs->buf, fres->record, fres->len);
+#endif
}
else /* octet-aligned record. */
{
int *numberOfEntriesReturned =
(int *)odr_malloc (assoc->encode, sizeof(*numberOfEntriesReturned));
Z_ListEntries *ents = (Z_ListEntries *)odr_malloc (assoc->encode, sizeof(*ents));
+ Z_DiagRecs *diagrecs_p = NULL;
oident *attent;
bend_scanrequest srq;
bend_scanresult *srs;
res->numberOfEntriesReturned = numberOfEntriesReturned;
res->positionOfTerm = 0;
res->entries = ents;
- ents->which = Z_ListEntries_nonSurrogateDiagnostics;
+#if ASN_COMPILED
+ ents->num_entries = 0;
+ ents->entries = NULL;
+ ents->num_nonsurrogateDiagnostics = 0;
+ ents->nonsurrogateDiagnostics = NULL;
+#else
+ ents->which = Z_ListEntries_entries;
+#endif
res->attributeSet = 0;
res->otherInfo = 0;
if (req->attributeSet && (!(attent = oid_getentbyoid(req->attributeSet)) ||
- attent->oclass != CLASS_ATTSET || attent->value != VAL_BIB1))
- ents->u.nonSurrogateDiagnostics = diagrecs(assoc, 121, 0);
+ attent->oclass != CLASS_ATTSET
+ || attent->value != VAL_BIB1))
+ diagrecs_p = diagrecs(assoc, 121, 0);
else if (req->stepSize && *req->stepSize > 0)
- ents->u.nonSurrogateDiagnostics = diagrecs(assoc, 205, 0);
+ diagrecs_p = diagrecs(assoc, 205, 0);
else
{
if (req->termListAndStartPoint->term->which == Z_Term_general)
logf(LOG_DEBUG, " term: '%.*s'",
- req->termListAndStartPoint->term->u.general->len,
- req->termListAndStartPoint->term->u.general->buf);
+ req->termListAndStartPoint->term->u.general->len,
+ req->termListAndStartPoint->term->u.general->buf);
srq.num_bases = req->num_databaseNames;
srq.basenames = req->databaseNames;
srq.num_entries = *req->numberOfTermsRequested;
srq.term_position = req->preferredPositionInResponse ?
*req->preferredPositionInResponse : 1;
if (!(srs = bend_scan(assoc->backend, &srq, 0)))
- ents->u.nonSurrogateDiagnostics = diagrecs(assoc, 2, 0);
+ diagrecs_p = diagrecs(assoc, 2, 0);
else if (srs->errcode)
- ents->u.nonSurrogateDiagnostics = diagrecs(assoc,
- srs->errcode, srs->errstring);
+ diagrecs_p = diagrecs(assoc, srs->errcode, srs->errstring);
else
{
int i;
- Z_Entries *list = (Z_Entries *)odr_malloc (assoc->encode, sizeof(*list));
- Z_Entry **tab = (Z_Entry **)odr_malloc (assoc->encode,
- sizeof(*tab) * srs->num_entries);
-
+#ifdef ASN_COMPILED
+#else
+ Z_Entries *list = (Z_Entries *)
+ odr_malloc (assoc->encode, sizeof(*list));
+#endif
+ Z_Entry **tab = (Z_Entry **)
+ odr_malloc (assoc->encode, sizeof(*tab) * srs->num_entries);
+
if (srs->status == BEND_SCAN_PARTIAL)
*scanStatus = Z_Scan_partial_5;
else
*scanStatus = Z_Scan_success;
- ents->which = Z_ListEntries_entries;
+#ifdef ASN_COMPILED
+ ents->entries = tab;
+ ents->num_entries = srs->num_entries;
+ res->numberOfEntriesReturned = &ents->num_entries;
+#else
ents->u.entries = list;
list->entries = tab;
+ list->num_entries = srs->num_entries;
+ res->numberOfEntriesReturned = &list->num_entries;
+#endif
+ res->positionOfTerm = &srs->term_position;
for (i = 0; i < srs->num_entries; i++)
{
Z_Entry *e;
Z_TermInfo *t;
Odr_oct *o;
-
- list->entries[i] = e = (Z_Entry *)odr_malloc(assoc->encode, sizeof(*e));
+
+ tab[i] = e = (Z_Entry *)odr_malloc(assoc->encode, sizeof(*e));
e->which = Z_Entry_termInfo;
e->u.termInfo = t = (Z_TermInfo *)odr_malloc(assoc->encode, sizeof(*t));
t->suggestedAttributes = 0;
logf(LOG_DEBUG, " term #%d: '%s' (%d)", i,
srs->entries[i].term, srs->entries[i].occurrences);
}
- list->num_entries = i;
- res->numberOfEntriesReturned = &list->num_entries;
- res->positionOfTerm = &srs->term_position;
}
}
-
+ if (diagrecs_p)
+ {
+#ifdef ASN_COMPILED
+ ents->num_nonsurrogateDiagnostics = diagrecs_p->num_diagRecs;
+ ents->nonsurrogateDiagnostics = diagrecs_p->diagRecs;
+#else
+ ents->u.nonSurrogateDiagnostics = diagrecs_p;
+ ents->which = Z_ListEntries_nonSurrogateDiagnostics;
+#endif
+ }
return apdu;
}
logf(LOG_LOG, "Got SortRequest.");
+#ifdef ASN_COMPILED
+ bsrr->num_input_setnames = req->num_inputResultSetNames;
+ bsrr->input_setnames = req->inputResultSetNames;
+#else
bsrr->num_input_setnames = req->inputResultSetNames->num_strings;
bsrr->input_setnames = req->inputResultSetNames->strings;
+#endif
bsrr->output_setname = req->sortedResultSetName;
bsrr->sort_sequence = req->sortSequence;
bsrr->stream = assoc->encode;
*res->sortStatus = bsrr->sort_status;
res->resultSetStatus = 0;
if (bsrr->errcode)
- res->diagnostics = diagrecs(assoc, bsrr->errcode, bsrr->errstring);
+ {
+ Z_DiagRecs *dr = diagrecs (assoc, bsrr->errcode, bsrr->errstring);
+#ifdef ASN_COMPILED
+ res->diagnostics = dr->diagRecs;
+ res->num_diagnostics = dr->num_diagRecs;
+#else
+ res->diagnostics = dr;
+#endif
+ }
else
+ {
+#ifdef ASN_COMPILED
+ res->num_diagnostics = 0;
+#endif
res->diagnostics = 0;
+ }
res->otherInfo = 0;
apdu->which = Z_APDU_sortResponse;
/*
- * Copyright (c) 1995-1997, Index Data.
+ * Copyright (c) 1995-1998, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: pquery.c,v $
- * Revision 1.19 1998-03-05 08:09:03 adam
+ * Revision 1.20 1998-03-31 15:13:20 adam
+ * Development towards compiled ASN.1.
+ *
+ * Revision 1.19 1998/03/05 08:09:03 adam
* Minor change to make C++ happy.
*
* Revision 1.18 1998/02/11 11:53:36 adam
Z_AttributesPlusTerm *zapt;
Odr_oct *term_octet;
Z_Term *term;
+ Z_AttributeElement **elements;
zapt = (Z_AttributesPlusTerm *)odr_malloc (o, sizeof(*zapt));
term_octet = (Odr_oct *)odr_malloc (o, sizeof(*term_octet));
term = (Z_Term *)odr_malloc (o, sizeof(*term));
- zapt->num_attributes = num_attr;
- if (num_attr)
+ if (!num_attr)
+ elements = (Z_AttributeElement**)odr_nullval();
+ else
{
int i;
int *attr_tmp;
- zapt->attributeList = (Z_AttributeElement**)odr_malloc (o, num_attr *
- sizeof(*zapt->attributeList));
+ elements = (Z_AttributeElement**)
+ odr_malloc (o, num_attr * sizeof(*elements));
attr_tmp = (int *)odr_malloc (o, num_attr * 2 * sizeof(int));
memcpy (attr_tmp, attr_list, num_attr * 2 * sizeof(int));
for (i = 0; i < num_attr; i++)
{
- zapt->attributeList[i] =
- (Z_AttributeElement*)odr_malloc (o,sizeof(**zapt->attributeList));
- zapt->attributeList[i]->attributeType = &attr_tmp[2*i];
+ elements[i] =
+ (Z_AttributeElement*)odr_malloc (o,sizeof(**elements));
+ elements[i]->attributeType = &attr_tmp[2*i];
#ifdef Z_95
if (attr_set[i] == VAL_NONE)
- zapt->attributeList[i]->attributeSet = 0;
+ elements[i]->attributeSet = 0;
else
{
oident attrid;
int oid[OID_SIZE];
-
+
attrid.proto = PROTO_Z3950;
attrid.oclass = CLASS_ATTSET;
attrid.value = attr_set[i];
- zapt->attributeList[i]->attributeSet =
- odr_oiddup (o, oid_ent_to_oid (&attrid, oid));
+ elements[i]->attributeSet =
+ odr_oiddup (o, oid_ent_to_oid (&attrid, oid));
}
- zapt->attributeList[i]->which = Z_AttributeValue_numeric;
- zapt->attributeList[i]->value.numeric = &attr_tmp[2*i+1];
+ elements[i]->which = Z_AttributeValue_numeric;
+ elements[i]->value.numeric = &attr_tmp[2*i+1];
#else
- zapt->attributeList[i]->attributeValue = &attr_tmp[2*i+1];
+ elements[i]->attributeValue = &attr_tmp[2*i+1];
#endif
}
}
- else
- zapt->attributeList = (Z_AttributeElement**)odr_nullval();
+#ifdef ASN_COMPILED
+ zapt->attributes = (Z_AttributeList *)
+ odr_malloc (o, sizeof(*zapt->attributes));
+ zapt->attributes->num_attributes = num_attr;
+ zapt->attributes->attributes = elements;
+#else
+ zapt->num_attributes = num_attr;
+ zapt->attributeList = elements;
+#endif
+
zapt->term = term;
term->which = Z_Term_general;
term->u.general = term_octet;
if (!lex (li))
return NULL;
+#ifdef ASN_COMPILED
+ p->which = Z_ProximityOperator_known;
+ p->u.known = (int *)odr_malloc (o, sizeof(*p->u.known));
+ *p->u.known = atoi (li->lex_buf);
+#else
p->proximityUnitCode = (int *)odr_malloc (o, sizeof(*p->proximityUnitCode));
*p->proximityUnitCode = atoi (li->lex_buf);
-
+#endif
return p;
}
/*
- * Copyright (c) 1996-1997, Index Data.
+ * Copyright (c) 1996-1998, Index Data.
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: yaz-ccl.c,v $
- * Revision 1.12 1998-02-11 11:53:36 adam
+ * Revision 1.13 1998-03-31 15:13:20 adam
+ * Development towards compiled ASN.1.
+ *
+ * Revision 1.12 1998/02/11 11:53:36 adam
* Changed code so that it compiles as C++.
*
* Revision 1.11 1997/11/24 11:33:57 adam
Z_AttributesPlusTerm *zapt;
Odr_oct *term_octet;
Z_Term *term;
+ Z_AttributeElement **elements;
zapt = (Z_AttributesPlusTerm *)odr_malloc (o, sizeof(*zapt));
assert (zapt);
for (attr = p->u.t.attr_list; attr; attr = attr->next)
num++;
- zapt->num_attributes = num;
- if (num)
+ if (!num)
+ elements = (Z_AttributeElement**)odr_nullval();
+ else
{
int i = 0;
- zapt->attributeList = (Z_AttributeElement **)odr_malloc (o, num*sizeof(*zapt->attributeList));
- assert (zapt->attributeList);
+ elements = (Z_AttributeElement **)
+ odr_malloc (o, num*sizeof(*elements));
for (attr = p->u.t.attr_list; attr; attr = attr->next, i++)
{
- zapt->attributeList[i] =
- (Z_AttributeElement *)odr_malloc (o, sizeof(**zapt->attributeList));
- assert (zapt->attributeList[i]);
- zapt->attributeList[i]->attributeType =
+ elements[i] = (Z_AttributeElement *)
+ odr_malloc (o, sizeof(**elements));
+ assert (elements[i]);
+ elements[i]->attributeType =
(int *)odr_malloc(o, sizeof(int));
- *zapt->attributeList[i]->attributeType = attr->type;
- zapt->attributeList[i]->attributeSet = 0;
- zapt->attributeList[i]->which = Z_AttributeValue_numeric;
- zapt->attributeList[i]->value.numeric =
+ *elements[i]->attributeType = attr->type;
+ elements[i]->attributeSet = 0;
+ elements[i]->which = Z_AttributeValue_numeric;
+ elements[i]->value.numeric =
(int *)odr_malloc (o, sizeof(int));
- *zapt->attributeList[i]->value.numeric = attr->value;
+ *elements[i]->value.numeric = attr->value;
}
}
- else
- zapt->attributeList = (Z_AttributeElement**)odr_nullval();
-
+#ifdef ASN_COMPILED
+ zapt->attributes = (Z_AttributeList *)
+ odr_malloc (o, sizeof(*zapt->attributes));
+ zapt->attributes->num_attributes = num;
+ zapt->attributes->attributes = elements;
+#else
+ zapt->num_attributes = num;
+ zapt->attributeList = elements;
+#endif
zapt->term = term;
term->which = Z_Term_general;
term->u.general = term_octet;