X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=ir-tcl.c;h=7f07d79571bcdb8d6b1669198f3204b4d0d292d3;hb=a7334bf2f1a57040a010a7dabdfa5d50d62f4ae4;hp=e52a1c02f0f3aab8caaaede837f6c941da3f3f79;hpb=3add7ff834c7a01f3bf1e9c8a74dc3199d1970e6;p=ir-tcl-moved-to-github.git diff --git a/ir-tcl.c b/ir-tcl.c index e52a1c0..7f07d79 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -5,7 +5,17 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tcl.c,v $ - * Revision 1.66 1995-11-28 17:26:39 adam + * Revision 1.69 1996-01-04 16:12:12 adam + * Setting PDUType renamed to eventType. + * + * Revision 1.68 1996/01/04 11:05:22 adam + * New setting: PDUType - returns type of last PDU returned from the target. + * Fixed a bug in configure/Makefile. + * + * Revision 1.67 1996/01/03 09:00:51 adam + * Updated to use new version of Yaz (names changed to avoid C++ conflict). + * + * Revision 1.66 1995/11/28 17:26:39 adam * Removed Carriage return from ir-tcl.c! * Removed misc. debug logs. * @@ -990,6 +1000,7 @@ static int do_connect (void *obj, Tcl_Interp *interp, do_disconnect (p, NULL, 2, NULL); return TCL_ERROR; } + p->eventType = "connect"; ir_select_add (cs_fileno (p->cs_link), p); if (r == 1) { @@ -1019,6 +1030,7 @@ static int do_disconnect (void *obj, Tcl_Interp *interp, if (argc == 0) { p->state = IR_TCL_R_Idle; + p->eventType = NULL; p->hostname = NULL; p->cs_link = NULL; return TCL_OK; @@ -1093,10 +1105,28 @@ static int do_logLevel (void *o, Tcl_Interp *interp, /* + * do_eventType: Return type of last event + */ +static int do_eventType (void *obj, Tcl_Interp *interp, + int argc, char **argv) +{ + IrTcl_Obj *p = obj; + + if (argc <= 0) + { + p->eventType = NULL; + return TCL_OK; + } + Tcl_AppendElement (interp, p->eventType ? p->eventType : ""); + return TCL_OK; +} + + +/* * do_callback: add callback */ static int do_callback (void *obj, Tcl_Interp *interp, - int argc, char **argv) + int argc, char **argv) { IrTcl_Obj *p = obj; @@ -1497,7 +1527,6 @@ static int do_mediumSetElementSetNames (void *obj, Tcl_Interp *interp, return TCL_OK; } - static IrTcl_Method ir_method_tab[] = { { 1, "comstack", do_comstack }, { 1, "protocol", do_protocol }, @@ -1505,6 +1534,7 @@ static IrTcl_Method ir_method_tab[] = { { 0, "failInfo", do_failInfo }, { 0, "logLevel", do_logLevel }, +{ 0, "eventType", do_eventType }, { 1, "connect", do_connect }, { 0, "protocolVersion", do_protocolVersion }, { 1, "preferredMessageSize", do_preferredMessageSize }, @@ -1683,7 +1713,7 @@ static int do_search (void *o, Tcl_Interp *interp, int argc, char **argv) obj->start = 1; bib1.proto = p->protocol_type; - bib1.class = CLASS_ATTSET; + bib1.oclass = CLASS_ATTSET; bib1.value = VAL_BIB1; set_referenceId (p->odr_out, &req->referenceId, @@ -1704,7 +1734,7 @@ static int do_search (void *o, Tcl_Interp *interp, int argc, char **argv) struct oident ident; ident.proto = p->protocol_type; - ident.class = CLASS_RECSYN; + ident.oclass = CLASS_RECSYN; ident.value = *obj->set_inher.preferredRecordSyntax; logf (LOG_DEBUG, "Preferred record syntax is %d", ident.value); req->preferredRecordSyntax = odr_oiddup (p->odr_out, @@ -2257,7 +2287,7 @@ static int do_present (void *o, Tcl_Interp *interp, int argc, char **argv) struct oident ident; ident.proto = p->protocol_type; - ident.class = CLASS_RECSYN; + ident.oclass = CLASS_RECSYN; ident.value = *obj->set_inher.preferredRecordSyntax; logf (LOG_DEBUG, "Preferred record syntax is %d", ident.value); req->preferredRecordSyntax = odr_oiddup (p->odr_out, @@ -2516,7 +2546,7 @@ static int do_scan (void *o, Tcl_Interp *interp, int argc, char **argv) } bib1.proto = p->protocol_type; - bib1.class = CLASS_ATTSET; + bib1.oclass = CLASS_ATTSET; bib1.value = VAL_BIB1; apdu = zget_APDU (p->odr_out, Z_APDU_scanRequest); @@ -3210,17 +3240,21 @@ void ir_select_read (ClientData clientData) switch(apdu->which) { case Z_APDU_initResponse: + p->eventType = "init"; ir_initResponse (p, apdu->u.initResponse); break; case Z_APDU_searchResponse: + p->eventType = "search"; ir_searchResponse (p, apdu->u.searchResponse, (IrTcl_SetObj *) cmd_info.clientData); break; case Z_APDU_presentResponse: + p->eventType = "present"; ir_presentResponse (p, apdu->u.presentResponse, (IrTcl_SetObj *) cmd_info.clientData); break; case Z_APDU_scanResponse: + p->eventType = "scan"; ir_scanResponse (p, apdu->u.scanResponse, (IrTcl_ScanObj *) cmd_info.clientData); break;