From 25476b7e1a0e7dbbe261a88fd7f14869aa27e237 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 2 Apr 1998 14:35:29 +0000 Subject: [PATCH] First version of Zebra that works with compiled ASN.1. --- index/zlogs.c | 17 +++++++++++++++-- index/zrpn.c | 38 ++++++++++++++++++++++++++++++++++++-- util/zebramap.c | 11 +++++++++-- 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/index/zlogs.c b/index/zlogs.c index 7c820ba..73942e2 100644 --- a/index/zlogs.c +++ b/index/zlogs.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zlogs.c,v $ - * Revision 1.7 1998-01-29 13:40:11 adam + * Revision 1.8 1998-04-02 14:35:29 adam + * First version of Zebra that works with compiled ASN.1. + * + * Revision 1.7 1998/01/29 13:40:11 adam * Better logging for scan service. * * Revision 1.6 1997/09/29 09:06:41 adam @@ -217,10 +220,20 @@ static void zlog_attributes (Z_AttributesPlusTerm *t, int level, { int of, i; char str[80]; - for (of = 0; of < t->num_attributes; of++) +#ifdef ASN_COMPILED + int num_attributes = t->attributes->num_attributes; +#else + int num_attributes = t->num_attributes; +#endif + + for (of = 0; of < num_attributes; of++) { Z_AttributeElement *element; +#ifdef ASN_COMPILED + element = t->attributes->attributes[of]; +#else element = t->attributeList[of]; +#endif switch (element->which) { diff --git a/index/zrpn.c b/index/zrpn.c index daf07bd..d954939 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.75 1998-03-05 08:45:13 adam + * Revision 1.76 1998-04-02 14:35:29 adam + * First version of Zebra that works with compiled ASN.1. + * + * Revision 1.75 1998/03/05 08:45:13 adam * New result set model and modular ranking system. Moved towards * descent server API. System information stored as "SGML" records. * @@ -304,11 +307,22 @@ typedef struct { static int attr_find (AttrType *src, oid_value *attributeSetP) { - while (src->major < src->zapt->num_attributes) + int num_attributes; + +#ifdef ASN_COMPILED + num_attributes = src->zapt->attributes->num_attributes; +#else + num_attributes = src->zapt->num_attributes; +#endif + while (src->major < num_attributes) { Z_AttributeElement *element; +#ifdef ASN_COMPILED + element = src->zapt->attributes->attributes[src->major]; +#else element = src->zapt->attributeList[src->major]; +#endif if (src->type == *element->attributeType) { switch (element->which) @@ -1466,11 +1480,30 @@ static RSET rpn_search_structure (ZebraHandle zh, Z_RPNStructure *zs, r = rset_create (rset_kind_not, &bool_parms); break; case Z_Operator_prox: +#ifdef ASN_COMPILED + if (zop->u.prox->which != Z_ProximityOperator_known) + { + zh->errCode = 132; + return NULL; + } +#else if (zop->u.prox->which != Z_ProxCode_known) { zh->errCode = 132; return NULL; } +#endif + +#ifdef ASN_COMPILED + if (*zop->u.prox->u.known != Z_ProxUnit_word) + { + char *val = odr_malloc (stream, 16); + zh->errCode = 132; + zh->errString = val; + sprintf (val, "%d", *zop->u.prox->u.known); + return NULL; + } +#else if (*zop->u.prox->proximityUnitCode != Z_ProxUnit_word) { char *val = odr_malloc (stream, 16); @@ -1479,6 +1512,7 @@ static RSET rpn_search_structure (ZebraHandle zh, Z_RPNStructure *zs, sprintf (val, "%d", *zop->u.prox->proximityUnitCode); return NULL; } +#endif r = rpn_proximity (zh, bool_parms.rset_l, bool_parms.rset_r, *zop->u.prox->ordered, (!zop->u.prox->exclusion ? 0 : diff --git a/util/zebramap.c b/util/zebramap.c index 483e177..53632d5 100644 --- a/util/zebramap.c +++ b/util/zebramap.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zebramap.c,v $ - * Revision 1.8 1998-03-05 08:42:44 adam + * Revision 1.9 1998-04-02 14:35:30 adam + * First version of Zebra that works with compiled ASN.1. + * + * Revision 1.8 1998/03/05 08:42:44 adam * Minor changes to zebramap data structures. Query mapping rules changed. * * Revision 1.7 1998/02/10 12:03:07 adam @@ -304,9 +307,13 @@ static int attr_find (AttrType *src, oid_value *attributeSetP) static void attr_init_APT (AttrType *src, Z_AttributesPlusTerm *zapt, int type) { - +#ifdef ASN_COMPILED + src->attributeList = zapt->attributes->attributes; + src->num_attributes = zapt->attributes->num_attributes; +#else src->attributeList = zapt->attributeList; src->num_attributes = zapt->num_attributes; +#endif src->type = type; src->major = 0; src->minor = 0; -- 1.7.10.4