From 343e22f495edc668d0302488e64bf6b3874e536d Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 18 Oct 1995 16:42:37 +0000 Subject: [PATCH] New settings: smallSetElementSetNames and mediumSetElementSetNames. --- client.tcl | 12 +++++++- ir-tcl.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- ir-tclp.h | 7 ++++- 3 files changed, 107 insertions(+), 10 deletions(-) diff --git a/client.tcl b/client.tcl index dbdc644..31685b7 100644 --- a/client.tcl +++ b/client.tcl @@ -4,7 +4,10 @@ # Sebastian Hammer, Adam Dickmeiss # # $Log: client.tcl,v $ -# Revision 1.78 1995-10-18 15:45:36 quinn +# Revision 1.79 1995-10-18 16:42:37 adam +# New settings: smallSetElementSetNames and mediumSetElementSetNames. +# +# Revision 1.78 1995/10/18 15:45:36 quinn # *** empty log message *** # # Revision 1.77 1995/10/18 15:37:46 adam @@ -1164,8 +1167,12 @@ proc search-request {bflag} { } if {$elementSetNames == "None" } { z39.$setNo elementSetNames {} + z39.$setNo smallSetElementSetNames {} + z39.$setNo mediumSetElementSetNames {} } else { z39.$setNo elementSetNames $elementSetNames + z39.$setNo smallSetElementSetNames $elementSetNames + z39.$setNo mediumSetElementSetNames $elementSetNames } z39 callback {search-response} z39.$setNo search $query @@ -1556,12 +1563,14 @@ proc add-title-lines {setno no offset} { global setNo global busy + dputs "add-title-lines offset=${offset} no=${no}" if {$setno != -1} { set setNo $setno } else { set setno $setNo } if {$offset == 1} { + .bot.a.set configure -text $setno .data.record delete 0.0 end } @@ -1572,6 +1581,7 @@ proc add-title-lines {setno no offset} { set o [expr $i + $offset] set type [z39.$setno type $o] if {$type == ""} { + dputs "no more at $o" break } .data.record tag bind r$o {} diff --git a/ir-tcl.c b/ir-tcl.c index 064c752..cf40cb5 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -5,7 +5,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tcl.c,v $ - * Revision 1.60 1995-10-18 15:43:31 adam + * Revision 1.61 1995-10-18 16:42:42 adam + * New settings: smallSetElementSetNames and mediumSetElementSetNames. + * + * Revision 1.60 1995/10/18 15:43:31 adam * In search: mediumSetElementSetNames and smallSetElementSetNames are * set to elementSetNames. * @@ -1407,6 +1410,58 @@ static int do_elementSetNames (void *obj, Tcl_Interp *interp, return TCL_OK; } +/* + * do_smallSetElementSetNames: Set/Get element Set Names + */ +static int do_smallSetElementSetNames (void *obj, Tcl_Interp *interp, + int argc, char **argv) +{ + IrTcl_SetCObj *p = obj; + + if (argc == 0) + { + p->smallSetElementSetNames = NULL; + return TCL_OK; + } + else if (argc == -1) + return ir_tcl_strdel (interp, &p->smallSetElementSetNames); + if (argc == 3) + { + free (p->smallSetElementSetNames); + if (ir_tcl_strdup (interp, &p->smallSetElementSetNames, + argv[2]) == TCL_ERROR) + return TCL_ERROR; + } + Tcl_AppendResult (interp, p->smallSetElementSetNames, NULL); + return TCL_OK; +} + +/* + * do_mediumSetElementSetNames: Set/Get element Set Names + */ +static int do_mediumSetElementSetNames (void *obj, Tcl_Interp *interp, + int argc, char **argv) +{ + IrTcl_SetCObj *p = obj; + + if (argc == 0) + { + p->mediumSetElementSetNames = NULL; + return TCL_OK; + } + else if (argc == -1) + return ir_tcl_strdel (interp, &p->mediumSetElementSetNames); + if (argc == 3) + { + free (p->mediumSetElementSetNames); + if (ir_tcl_strdup (interp, &p->mediumSetElementSetNames, + argv[2]) == TCL_ERROR) + return TCL_ERROR; + } + Tcl_AppendResult (interp, p->mediumSetElementSetNames, NULL); + return TCL_OK; +} + static IrTcl_Method ir_method_tab[] = { { 1, "comstack", do_comstack }, @@ -1446,6 +1501,8 @@ static IrTcl_Method ir_set_c_method_tab[] = { { 0, "mediumSetPresentNumber", do_mediumSetPresentNumber}, { 0, "referenceId", do_referenceId }, { 0, "elementSetNames", do_elementSetNames }, +{ 0, "smallSetElementSetNames", do_smallSetElementSetNames }, +{ 0, "mediumSetElementSetNames", do_mediumSetElementSetNames }, { 0, NULL, NULL} }; @@ -1588,6 +1645,8 @@ static int do_search (void *o, Tcl_Interp *interp, int argc, char **argv) apdu = zget_APDU (p->odr_out, Z_APDU_searchRequest); req = apdu->u.searchRequest; + obj->start = 1; + bib1.proto = p->protocol_type; bib1.class = CLASS_ATTSET; bib1.value = VAL_BIB1; @@ -1619,23 +1678,32 @@ static int do_search (void *o, Tcl_Interp *interp, int argc, char **argv) else req->preferredRecordSyntax = 0; - if (obj->set_inher.elementSetNames && *obj->set_inher.elementSetNames) + if (obj->set_inher.smallSetElementSetNames && + *obj->set_inher.smallSetElementSetNames) { Z_ElementSetNames *esn = odr_malloc (p->odr_out, sizeof(*esn)); - + esn->which = Z_ElementSetNames_generic; esn->u.generic = obj->set_inher.elementSetNames; - req->mediumSetElementSetNames = esn; req->smallSetElementSetNames = esn; } else - { - req->mediumSetElementSetNames = NULL; req->smallSetElementSetNames = NULL; + + if (obj->set_inher.mediumSetElementSetNames && + *obj->set_inher.mediumSetElementSetNames) + { + Z_ElementSetNames *esn = odr_malloc (p->odr_out, sizeof(*esn)); + + esn->which = Z_ElementSetNames_generic; + esn->u.generic = obj->set_inher.elementSetNames; + req->mediumSetElementSetNames = esn; } - + else + req->mediumSetElementSetNames = NULL; + req->query = &query; - + if (!strcmp (obj->set_inher.queryType, "rpn")) { Z_RPNQuery *RPNquery; @@ -1814,7 +1882,10 @@ static int do_type (void *o, Tcl_Interp *interp, int argc, char **argv) return TCL_ERROR; rl = find_IR_record (obj, offset); if (!rl) + { + logf (LOG_DEBUG, "No record at position %d", offset); return TCL_OK; + } switch (rl->which) { case Z_NamePlusRecord_databaseRecord: @@ -2129,6 +2200,7 @@ static int do_present (void *o, Tcl_Interp *interp, int argc, char **argv) } else req->preferredRecordSyntax = 0; + if (obj->set_inher.elementSetNames && *obj->set_inher.elementSetNames) { Z_ElementSetNames *esn = odr_malloc (p->odr_out, sizeof(*esn)); @@ -2306,6 +2378,16 @@ static int ir_set_obj_mk (ClientData clientData, Tcl_Interp *interp, == TCL_ERROR) return TCL_ERROR; + if (ir_tcl_strdup (interp, &dst->smallSetElementSetNames, + src->smallSetElementSetNames) + == TCL_ERROR) + return TCL_ERROR; + + if (ir_tcl_strdup (interp, &dst->mediumSetElementSetNames, + src->mediumSetElementSetNames) + == TCL_ERROR) + return TCL_ERROR; + if (src->preferredRecordSyntax && (dst->preferredRecordSyntax = ir_tcl_malloc (sizeof(*dst->preferredRecordSyntax)))) diff --git a/ir-tclp.h b/ir-tclp.h index 45e3ccd..c58b52f 100644 --- a/ir-tclp.h +++ b/ir-tclp.h @@ -5,7 +5,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tclp.h,v $ - * Revision 1.17 1995-10-16 17:00:56 adam + * Revision 1.18 1995-10-18 16:42:44 adam + * New settings: smallSetElementSetNames and mediumSetElementSetNames. + * + * Revision 1.17 1995/10/16 17:00:56 adam * New setting: elementSetNames. * Various client improvements. Medium presentation format looks better. * @@ -105,6 +108,8 @@ typedef struct { char *referenceId; char *elementSetNames; + char *smallSetElementSetNames; + char *mediumSetElementSetNames; int smallSetUpperBound; int largeSetLowerBound; -- 1.7.10.4