From: Adam Dickmeiss Date: Tue, 9 Sep 1997 10:19:49 +0000 (+0000) Subject: New MSV5.0 port with fewer warnings. X-Git-Tag: IRTCL.1.4~74 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=ddc1fe181cb079af835166126fa052e2378e930b;p=ir-tcl-moved-to-github.git New MSV5.0 port with fewer warnings. --- diff --git a/README b/README index 3543d47..1f77a81 100644 --- a/README +++ b/README @@ -1,11 +1,11 @@ - * Copyright (C) 1995-1996, Index Data. + * Copyright (C) 1995-1997, Index Data. * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss IrTcl version 1.2pl1 ----- $Date: 1996-08-09 15:33:05 $ +---- $Date: 1997-09-09 10:19:49 $ Information about IrTcl can be found at http://www.indexdata.dk/irtcl.html. This page contains pointers to documentation in various formats. diff --git a/client.tcl b/client.tcl index 9bc242f..56e8e5e 100644 --- a/client.tcl +++ b/client.tcl @@ -1,10 +1,13 @@ # IR toolkit for tcl/tk -# (c) Index Data 1995-1996 +# (c) Index Data 1995-1997 # See the file LICENSE for details. # Sebastian Hammer, Adam Dickmeiss # # $Log: client.tcl,v $ -# Revision 1.99 1997-04-13 19:00:37 adam +# Revision 1.100 1997-09-09 10:19:50 adam +# New MSV5.0 port with fewer warnings. +# +# Revision 1.99 1997/04/13 19:00:37 adam # Added support for Tcl8.0/Tk8.0. # New command ir-log-init to setup yaz logging facilities. # @@ -488,10 +491,32 @@ wm minsize . 0 0 set setOffset 0 set setMax 0 +if {$tk_version == "3.6" || $tk_version == "4.0" || $tk_version == "4.1" || + $tk_version == "4.2"} { + set font(bb,normal) -Adobe-Helvetica-Medium-R-Normal-*-240-* + set font(bb,bold) -Adobe-Helvetica-Bold-R-Normal-*-240-* + set font(b,normal) -Adobe-Helvetica-Medium-R-Normal-*-180-* + set font(b,bold) -Adobe-Helvetica-Bold-R-Normal-*-180-* + set font(n,normal) -Adobe-Helvetica-Medium-R-Normal-*-120-* + set font(n,bold) -Adobe-Helvetica-Bold-R-Normal-*-120-* + set font(s,bold) -Adobe-Helvetica-Bold-R-Normal-*-100-* + set font(ss,bold) -Adobe-Helvetica-Bold-R-Normal-*-80-* +} else { + set font(bb,normal) {Helvetica 24} + set font(bb,bold) {Helvetica 24 bold} + set font(b,normal) {Helvetica 24} + set font(b,bold) {Helvetica 18 bold} + set font(n,normal) {Helvetica 12} + set font(n,bold) {Helvetica 12 bold} + set font(s,bold) {Helvetica 10 bold} + set font(ss,bold) {Helvetica 8 bold} +} + # Procedure tkerror {err} # err error message # Override the Tk error handler function. proc tkerror err { + global font set w .tkerrorw if {[winfo exists $w]} { @@ -505,7 +530,7 @@ proc tkerror err { label $w.top.b -bitmap error message $w.top.t -aspect 300 -text "Error: $err" \ - -font -Adobe-Helvetica-Bold-R-Normal-*-180-* + -font $font(b,bold) pack $w.top.b $w.top.t -side left -padx 10 -pady 10 bottom-buttons $w [list {Close} [list destroy $w]] 1 @@ -961,7 +986,7 @@ proc popup-license {} { # as implementation-name, implementation-id, etc. proc about-target {} { set w .about-target-w - global hostid + global hostid font toplevel $w @@ -975,8 +1000,7 @@ proc about-target {} { pack $w.top.a $w.top.p -side top -fill x label $w.top.a.about -text "About" - label $w.top.a.irtcl -text $hostid \ - -font -Adobe-Helvetica-Bold-R-Normal-*-240-* + label $w.top.a.irtcl -text $hostid -font $font(bb,bold) pack $w.top.a.about $w.top.a.irtcl -side top set i [z39 targetImplementationName] @@ -1014,8 +1038,7 @@ proc about-origin-logo {n} { # Display various information about origin (this client). proc about-origin {} { set w .about-origin-w - global libdir - global tk_version + global libdir font tk_version if {[winfo exists $w]} { destroy $w @@ -1031,8 +1054,7 @@ proc about-origin {} { pack $w.top.a $w.top.p -side top -fill x - label $w.top.a.irtcl -text "IrTcl" \ - -font -Adobe-Helvetica-Bold-R-Normal-*-240-* + label $w.top.a.irtcl -text "IrTcl" -font $font(bb,bold) label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes @@ -1061,8 +1083,7 @@ proc about-origin {} { # Displays record in set $sno at position $no in window .full-marc$b. # The global variable $popupMarcdf holds the current format method. proc popup-marc {sno no b df} { - global displayFormats - global popupMarcdf + global font displayFormats popupMarcdf if {[z39.$sno type $no] != "DB"} { return @@ -1099,18 +1120,14 @@ proc popup-marc {sno no b df} { $w.top.record tag configure marc-id -foreground black } $w.top.record tag configure marc-data -foreground black - $w.top.record tag configure marc-head \ - -font -Adobe-Times-Medium-R-Normal-*-180-* \ + $w.top.record tag configure marc-head -font $font(n,bold) \ -background black -foreground white - $w.top.record tag configure marc-pref \ - -font -Adobe-Times-Medium-R-Normal-*-180-* \ + $w.top.record tag configure marc-pref -font $font(n,normal) \ -foreground blue - $w.top.record tag configure marc-text \ - -font -Adobe-Times-Medium-R-Normal-*-180-* \ + $w.top.record tag configure marc-text -font $font(n,normal) \ -foreground black - $w.top.record tag configure marc-it \ - -font -Adobe-Times-Medium-I-Normal-*-180-* \ + $w.top.record tag configure marc-it -font $font(n,normal) \ -foreground black pack $w.top.s -side right -fill y @@ -2922,7 +2939,7 @@ proc save-settings {} { proc alert {ask} { set w .alert - global alertAnswer + global alertAnswer font toplevel $w set oldFocus [focus] @@ -2930,8 +2947,7 @@ proc alert {ask} { top-down-window $w label $w.top.warning -bitmap warning - message $w.top.message -text $ask -aspect 300 \ - -font -Adobe-Times-Medium-R-Normal-*-180-* + message $w.top.message -text $ask -aspect 300 -font $font(b,normal) pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes @@ -4071,19 +4087,15 @@ if {! $monoFlag} { .data.record tag configure marc-id -foreground black } .data.record tag configure marc-data -foreground black -.data.record tag configure marc-head \ - -font -Adobe-Times-Bold-R-Normal-*-140-* \ +.data.record tag configure marc-head -font $font(n,normal) \ -foreground brown -relief raised -borderwidth 1 .data.record tag configure marc-small-head -foreground brown .data.record tag configure marc-pref \ - -font -Adobe-Times-Medium-R-Normal-*-140-* \ - -foreground blue + -font $font(n,normal) -foreground blue .data.record tag configure marc-text \ - -font -Adobe-Times-Medium-R-Normal-*-140-* \ - -foreground black + -font $font(n,normal) -foreground black .data.record tag configure marc-it \ - -font -Adobe-Times-Medium-I-Normal-*-140-* \ - -foreground black + -font $font(n,normal) -foreground black # Init: Define logo. button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation @@ -4122,9 +4134,9 @@ if {[file exists ${libdir}/explain.tcl]} { source ${libdir}/explain.tcl } -if {[file exists ${libdir}/setup.tcl]} { - source ${libdir}/setup.tcl -} +#if {[file exists ${libdir}/setup.tcl]} { +# source ${libdir}/setup.tcl +#} # Init: Uncomment this line if you wan't to enable logging. ir-log-init all diff --git a/explain.c b/explain.c index 072b48f..9dbbbaa 100644 --- a/explain.c +++ b/explain.c @@ -1,11 +1,14 @@ /* * IR toolkit for tcl/tk - * (c) Index Data 1996 + * (c) Index Data 1996-1997 * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: explain.c,v $ - * Revision 1.7 1997-08-28 20:17:36 adam + * Revision 1.8 1997-09-09 10:19:51 adam + * New MSV5.0 port with fewer warnings. + * + * Revision 1.7 1997/08/28 20:17:36 adam * Fixed small bug. * * Revision 1.6 1997/05/14 06:57:14 adam @@ -49,11 +52,14 @@ typedef struct { int (*handle)(); } IrExpChoice; +static Odr_null *ODR_NULLVALUE = "NULL"; + typedef char *Z_ElementSetName; typedef Odr_oid *Z_AttributeSetId; typedef char *Z_InternationalString; typedef char *Z_LanguageCode; + static int ir_UnitType (IrExpArg *iea, Z_UnitType *p, const char *name, int argi); static int ir_Unit (IrExpArg *iea, @@ -512,7 +518,7 @@ static int ir_ElementDataTypePrimitive (IrExpArg *iea, if (!ir_match_start (name, p, iea, ++argi)) return TCL_OK; - ir_choice (iea, arm, p, ODR_NULLVAL, argi); + ir_choice (iea, arm, p, ODR_NULLVALUE, argi); return ir_match_end (name, iea, argi); } @@ -673,7 +679,7 @@ static int ir_TermListElement (IrExpArg *iea, ir_InternationalString (iea, p->name, "name", argi); ir_HumanString (iea, p->title, "title", argi); if (p->searchCost) - ir_choice (iea, searchCostArm, p->searchCost, ODR_NULLVAL, argi); + ir_choice (iea, searchCostArm, p->searchCost, ODR_NULLVALUE, argi); ir_bool (iea, p->scanable, "scanable", argi); ir_sequence (ir_InternationalString, iea, p->broader, @@ -723,7 +729,7 @@ static int ir_ExtendedServicesInfo (IrExpArg *iea, ir_bool (iea, p->available, "available", argi); ir_bool (iea, p->retentionSupported, "retentionSupported", argi); - ir_choice (iea, waitActionArm, p->waitAction, ODR_NULLVAL, argi); + ir_choice (iea, waitActionArm, p->waitAction, ODR_NULLVALUE, argi); ir_HumanString (iea, p->description, "description", argi); ir_External (iea, p->specificExplain, "specificExplain", argi); @@ -926,7 +932,7 @@ static int ir_SortKeyDetails (IrExpArg *iea, ir_SortKeyDetailsSortType (iea, p->sortType, "sortType", argi); if (p->caseSensitivity) - ir_choice (iea, sortArm, p->caseSensitivity, ODR_NULLVAL, argi); + ir_choice (iea, sortArm, p->caseSensitivity, ODR_NULLVALUE, argi); return ir_match_end (name, iea, argi); } @@ -951,7 +957,7 @@ static int ir_ProcessingInformation (IrExpArg *iea, ir_CommonInfo (iea, p->commonInfo, "commonInfo", argi); ir_DatabaseName (iea, p->databaseName, "databaseName", argi); - ir_choice (iea, arm, p->processingContext, ODR_NULLVAL, argi); + ir_choice (iea, arm, p->processingContext, ODR_NULLVALUE, argi); ir_InternationalString (iea, p->name, "name", argi); ir_oid (iea, p->oid, "oid", argi); ir_HumanString (iea, p->description, "description", argi); @@ -1162,7 +1168,7 @@ static int ir_IconObjectUnit (IrExpArg *iea, { NULL, 0, NULL }}; if (!ir_match_start (name, p, iea, ++argi)) return TCL_OK; - ir_choice (iea, arm, &p->which, ODR_NULLVAL, argi); + ir_choice (iea, arm, &p->which, ODR_NULLVALUE, argi); ir_InternationalString (iea, p->bodyType, "bodyType", argi); ir_octet (iea, p->content, "content", argi); return ir_match_end (name, iea, argi); @@ -1405,7 +1411,7 @@ static int ir_AccessRestrictionsUnit (IrExpArg *iea, if (!ir_match_start (name, p, iea, ++argi)) return TCL_OK; - ir_choice (iea, arm, p->accessType, ODR_NULLVAL, argi); + ir_choice (iea, arm, p->accessType, ODR_NULLVALUE, argi); ir_HumanString (iea, p->accessText, "accessText", argi); ir_sequence (ir_oid, iea, p->accessChallenges, &p->num_accessChallenges, "accessChallenges", argi); diff --git a/grs.c b/grs.c index f5e4d22..6c05faa 100644 --- a/grs.c +++ b/grs.c @@ -1,11 +1,14 @@ /* * IR toolkit for tcl/tk - * (c) Index Data 1995-1996 + * (c) Index Data 1995-1997 * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: grs.c,v $ - * Revision 1.9 1996-08-16 15:07:44 adam + * Revision 1.10 1997-09-09 10:19:52 adam + * New MSV5.0 port with fewer warnings. + * + * Revision 1.9 1996/08/16 15:07:44 adam * First work on Explain. * * Revision 1.8 1996/07/03 13:31:10 adam @@ -203,7 +206,7 @@ static int ir_tcl_get_grs_r (Tcl_Interp *interp, IrTcl_GRS_Record *grs_record, } else { - int len = strlen(cp1+1); + size_t len = strlen(cp1+1); if (cp1[len] == ')') len--; if (len && strlen(e->tagVal.str) == len && diff --git a/ir-tcl.c b/ir-tcl.c index efccf01..93331e6 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -1,11 +1,14 @@ /* * IR toolkit for tcl/tk - * (c) Index Data 1995-1996 + * (c) Index Data 1995-1997 * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tcl.c,v $ - * Revision 1.100 1997-05-01 15:04:05 adam + * Revision 1.101 1997-09-09 10:19:53 adam + * New MSV5.0 port with fewer warnings. + * + * Revision 1.100 1997/05/01 15:04:05 adam * Added ir-log command. * * Revision 1.99 1997/04/30 07:24:47 adam @@ -1242,6 +1245,9 @@ void ir_tcl_disconnect (IrTcl_Obj *p) odr_reset (p->odr_in); +#if TCL_MAJOR_VERSION == 8 + cs_fileno(p->cs_link) = -1; +#endif cs_close (p->cs_link); p->cs_link = NULL; @@ -1832,7 +1838,7 @@ static int ir_obj_method (ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { IrTcl_Methods tab[3]; - IrTcl_Obj *p = clientData; + IrTcl_Obj *p = (IrTcl_Obj *) clientData; int r; if (argc < 2) @@ -1857,7 +1863,7 @@ static int ir_obj_method (ClientData clientData, Tcl_Interp *interp, */ static void ir_obj_delete (ClientData clientData) { - IrTcl_Obj *obj = clientData; + IrTcl_Obj *obj = (IrTcl_Obj *) clientData; IrTcl_Methods tab[3]; --(obj->ref_count); @@ -1933,7 +1939,7 @@ int ir_obj_init (ClientData clientData, Tcl_Interp *interp, Tcl_AppendResult (interp, "Failed to initialize ", argv[1], NULL); return TCL_ERROR; } - *subData = obj; + *subData = (ClientData) obj; return TCL_OK; } @@ -2517,7 +2523,7 @@ static int do_getSutrs (void *o, Tcl_Interp *interp, int argc, char **argv) Tcl_AppendResult (interp, "No DB record at #", argv[2], NULL); return TCL_ERROR; } - if (rl->u.dbrec.type != VAL_SUTRS) + if (!rl->u.dbrec.buf || rl->u.dbrec.type != VAL_SUTRS) return TCL_OK; Tcl_AppendElement (interp, rl->u.dbrec.buf); return TCL_OK; @@ -2593,12 +2599,12 @@ static int do_getExplain (void *o, Tcl_Interp *interp, int argc, char **argv) Tcl_AppendResult (interp, "No DB record at #", argv[2], NULL); return TCL_ERROR; } - if (rl->u.dbrec.type != VAL_EXPLAIN) + if (!rl->u.dbrec.buf || rl->u.dbrec.type != VAL_EXPLAIN) return TCL_OK; if (!(etype = z_ext_getentbyref (VAL_EXPLAIN))) return TCL_OK; - + assert (rl->u.dbrec.buf); odr_setbuf (p->odr_in, rl->u.dbrec.buf, rl->u.dbrec.size, 0); if (!(*etype->fun)(p->odr_in, &rr, 0)) return TCL_OK; @@ -2734,7 +2740,7 @@ static int do_present (void *o, Tcl_Interp *interp, int argc, char **argv) typedef struct { int encoding; int syntax; - int size; + size_t size; } IrTcl_FileRecordHead; /* @@ -2919,7 +2925,7 @@ static int ir_set_obj_method (ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { IrTcl_Methods tabs[3]; - IrTcl_SetObj *p = clientData; + IrTcl_SetObj *p = (IrTcl_SetObj *) clientData; int r; if (argc < 2) @@ -2944,7 +2950,7 @@ static int ir_set_obj_method (ClientData clientData, Tcl_Interp *interp, static void ir_set_obj_delete (ClientData clientData) { IrTcl_Methods tabs[3]; - IrTcl_SetObj *p = clientData; + IrTcl_SetObj *p = (IrTcl_SetObj *) clientData; logf (LOG_DEBUG, "ir set delete"); @@ -3044,7 +3050,7 @@ static int ir_set_obj_init (ClientData clientData, Tcl_Interp *interp, if (ir_tcl_method (interp, 0, NULL, tabs, NULL) == TCL_ERROR) return TCL_ERROR; - *subData = obj; + *subData = (ClientData) obj; return TCL_OK; } @@ -3381,7 +3387,7 @@ static int ir_scan_obj_method (ClientData clientData, Tcl_Interp *interp, static void ir_scan_obj_delete (ClientData clientData) { IrTcl_Methods tabs[2]; - IrTcl_ScanObj *obj = clientData; + IrTcl_ScanObj *obj = (IrTcl_ScanObj *) clientData; tabs[0].tab = ir_scan_method_tab; tabs[0].obj = obj; @@ -3846,7 +3852,7 @@ static void ir_scanResponse (void *o, Z_ScanResponse *scanrs, */ static void ir_select_read (ClientData clientData) { - IrTcl_Obj *p = clientData; + IrTcl_Obj *p = (IrTcl_Obj *) clientData; Z_APDU *apdu; int r; IrTcl_Request *rq; @@ -3876,7 +3882,7 @@ static void ir_select_read (ClientData clientData) p->failInfo = IR_TCL_FAIL_CONNECT; ir_tcl_eval (p->interp, p->failback); } - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); return; } if (p->callback) @@ -3884,7 +3890,7 @@ static void ir_select_read (ClientData clientData) if (p->ref_count == 2 && p->cs_link && p->request_queue && p->state == IR_TCL_R_Idle) ir_tcl_send_q (p, p->request_queue, "x"); - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); return; } do @@ -3903,7 +3909,6 @@ static void ir_select_read (ClientData clientData) if (r <= 0) { logf (LOG_DEBUG, "cs_get failed, code %d", r); - ir_select_remove (cs_fileno (p->cs_link), p); ir_tcl_disconnect (p); if (p->failback) { @@ -3911,7 +3916,7 @@ static void ir_select_read (ClientData clientData) ir_tcl_eval (p->interp, p->failback); } /* release ir object now if callback deleted it */ - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); return; } /* got complete APDU. Now decode */ @@ -3931,7 +3936,7 @@ static void ir_select_read (ClientData clientData) ir_tcl_eval (p->interp, p->failback); } /* release ir object now if failback deleted it */ - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); return; } /* handle APDU and invoke callback */ @@ -4000,10 +4005,10 @@ static void ir_select_read (ClientData clientData) odr_reset (p->odr_in); if (p->ref_count == 1) { - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); return; } - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); } while (p->cs_link && cs_more (p->cs_link)); if (p->cs_link && p->request_queue && p->state == IR_TCL_R_Idle) ir_tcl_send_q (p, p->request_queue, "x"); @@ -4014,7 +4019,7 @@ static void ir_select_read (ClientData clientData) */ static int ir_select_write (ClientData clientData) { - IrTcl_Obj *p = clientData; + IrTcl_Obj *p = (IrTcl_Obj *) clientData; int r; IrTcl_Request *rq; @@ -4040,12 +4045,12 @@ static int ir_select_write (ClientData clientData) p->failInfo = IR_TCL_FAIL_CONNECT; ir_tcl_eval (p->interp, p->failback); } - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); return 2; } if (p->callback) ir_tcl_eval (p->interp, p->callback); - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); return 2; } rq = p->request_queue; @@ -4064,7 +4069,7 @@ static int ir_select_write (ClientData clientData) p->failInfo = IR_TCL_FAIL_WRITE; ir_tcl_eval (p->interp, p->failback); } - ir_obj_delete (p); + ir_obj_delete ((ClientData) p); } else if (r == 0) /* remove select bit */ { diff --git a/ir-tclp.h b/ir-tclp.h index 06c9150..1712e51 100644 --- a/ir-tclp.h +++ b/ir-tclp.h @@ -5,7 +5,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tclp.h,v $ - * Revision 1.34 1996-08-16 15:07:47 adam + * Revision 1.35 1997-09-09 10:19:54 adam + * New MSV5.0 port with fewer warnings. + * + * Revision 1.34 1996/08/16 15:07:47 adam * First work on Explain. * * Revision 1.33 1996/07/03 13:31:13 adam @@ -272,7 +275,7 @@ struct GRS_Record_entry { struct IrTcl_GRS_Record_ *sub; char *str; struct { - int len; + size_t len; char *buf; } octets; int num; @@ -296,7 +299,10 @@ typedef struct IrTcl_RecordList_ { union { IrTcl_GRS_Record *grs1; } u; + int type; +#if 0 enum oid_value type; +#endif } dbrec; struct { int num; diff --git a/select.c b/select.c index f16cf5f..2c0319b 100644 --- a/select.c +++ b/select.c @@ -5,7 +5,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: select.c,v $ - * Revision 1.4 1997-08-28 20:20:48 adam + * Revision 1.5 1997-09-09 10:19:55 adam + * New MSV5.0 port with fewer warnings. + * + * Revision 1.4 1997/08/28 20:20:48 adam * Added support for Tk8.0/Tcl8.0. Since Tcl_File handlers are gone * we've moved to Tcl_Channel handlers instead. * @@ -87,7 +90,8 @@ void ir_tcl_select_set (void (*f)(ClientData clientData, int r, int w, int e), (*sp)->f = f; (*sp)->clientData = clientData; Tcl_CreateChannelHandler ((*sp)->tcl_Channel, mask, - ir_tcl_tk_select_proc, *sp); + ir_tcl_tk_select_proc, + (ClientData) *sp); } #endif