From d907e4e56cc3e6908060eea2ca3f324ff6a20999 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 20 Sep 1995 11:37:00 +0000 Subject: [PATCH] Configure searches for tk4.1 and tk7.5. Work on GRS. --- Makefile.in | 7 ++-- configure.in | 35 ++++++++++---------- grs.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++----------- ir-tclp.h | 12 ++++++- 4 files changed, 118 insertions(+), 41 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6d82de3..78cd559 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2,7 +2,7 @@ # (c) Index Data 1995 # See the file LICENSE for details. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile.in,v 1.17 1995-08-29 15:38:33 adam Exp $ +# $Id: Makefile.in,v 1.18 1995-09-20 11:37:00 adam Exp $ SHELL=/bin/sh # IrTcl Version @@ -30,9 +30,10 @@ CC=@CC@ XLIB=@XLIBSW@ XINCLUDE=@XINCLUDES@ -# Tcl/Tk libraries +# Tcl/Tk libraries and include files TCLLIB=@TCLLIB@ TKLIB=@TKLIB@ +TCLINCLUDE=@TCLINCLUDE@ # MOSI directory with libmosi.a and source MOSILIB=@MOSILIB@ @@ -41,7 +42,7 @@ MOSILIB=@MOSILIB@ YAZLIB=$(YAZDIR)/lib/libyaz.a $(MOSILIB) $(YAZDIR)/lib/libutil.a # All include paths -INCLUDE=-I$(YAZDIR)/include $(XINCLUDE) -I$(MOSIDIR) -I/usr/local/include +INCLUDE=-I$(YAZDIR)/include $(XINCLUDE) -I$(MOSIDIR) $(TCLINCLUDE) # All command line options except CFLAGS DEFS=-DCCL2RPN=0 @DEFS@ -DMOSI=@MOSI@ -DIRTCLDIR=\"$(IRTCLDIR)\" \ diff --git a/configure.in b/configure.in index 8cb371f..6998af5 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl IR toolkit for tcl/tk dnl (c) Index Data 1995 dnl See the file LICENSE for details. -dnl $Id: configure.in,v 1.9 1995-08-28 12:21:21 adam Exp $ +dnl $Id: configure.in,v 1.10 1995-09-20 11:37:01 adam Exp $ AC_INIT(ir-tcl.h) CC=${CC-cc} AC_SUBST(CC) @@ -20,14 +20,22 @@ fi AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])) AC_STDC_HEADERS AC_SUBST(TCLLIB) -AC_CHECK_LIB(tcl, Tcl_Eval, tclFound=1, tclFound=0, -lm) -if test "$tclFound" = 1; then - TCLLIB=-ltcl -elif test -r /usr/local/lib/libtcl7.4.a; then - TCLLIB=/usr/local/lib/libtcl7.4.a -else - TCLLIB=/usr/local/lib/libtcl.a -fi +AC_SUBST(TKLIB) +AC_SUBST(TCLINCLUDE) +TCLLIB=-ltcl +TKLIB=-ltk +TCLINCLUDE=" # -I.. Tcl/Tk include path" +for i in .a 7.4.a 7.5.a; do + if test -r /usr/local/lib/libtcl$i; then + TCLLIB=/usr/local/lib/libtcl$i + TCLINCLUDE=-I/usr/local/include + fi +done +for i in .a 4.0.a 4.1.a; do + if test -r /usr/local/lib/libtk$i; then + TKLIB=/usr/local/lib/libtk$i + fi +done AC_SUBST(YAZDIR) AC_SUBST(MOSI) AC_SUBST(MOSILIB) @@ -127,13 +135,4 @@ if test "$XLIBSW" = nope ; then XLIBSW=-lX11 fi AC_SUBST(XLIBSW) -AC_SUBST(TKLIB) -AC_CHECK_LIB(tk, main, tkFound=1, tkFound=0, $TCLLIB $XLIBSW -lm) -if test "$tkFound" = 1; then - TKLIB=-ltk -elif test -r /usr/local/lib/libtk4.0.a; then - TKLIB=/usr/local/lib/libtk4.0.a -else - TKLIB=/usr/local/lib/libtk.a -fi AC_OUTPUT(Makefile) diff --git a/grs.c b/grs.c index 54f7855..cdd12a4 100644 --- a/grs.c +++ b/grs.c @@ -5,7 +5,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: grs.c,v $ - * Revision 1.1 1995-08-29 15:38:34 adam + * Revision 1.2 1995-09-20 11:37:01 adam + * Configure searches for tk4.1 and tk7.5. + * Work on GRS. + * + * Revision 1.1 1995/08/29 15:38:34 adam * Added grs.c. new version. * */ @@ -49,10 +53,42 @@ void ir_tcl_read_grs (Z_GenericRecord *r, IrTcl_GRS_Record **grs_record) ir_tcl_strdup (NULL, &e->tagVal.str, t->tagValue->u.string); e->dataWhich = t->content->which; - if (t->content->which == Z_ElementData_subtree) - ir_tcl_read_grs (t->content->u.subtree, &e->tagData.sub); - else if (t->content->which == Z_ElementData_string) + switch (t->content->which) + { + case Z_ElementData_octets: + e->tagData.octets.len = t->content->u.octets->len; + e->tagData.octets.buf = ir_tcl_malloc (t->content->u.octets->len); + memcpy (e->tagData.octets.buf, t->content->u.octets->buf, + t->content->u.octets->len); + break; + case Z_ElementData_numeric: + e->tagData.num = *t->content->u.numeric; + break; + case Z_ElementData_date: ir_tcl_strdup (NULL, &e->tagData.str, t->content->u.string); + break; + case Z_ElementData_ext: + break; + case Z_ElementData_string: + ir_tcl_strdup (NULL, &e->tagData.str, t->content->u.string); + break; + case Z_ElementData_trueOrFalse: + e->tagData.bool = *t->content->u.trueOrFalse; + break; + case Z_ElementData_oid: + break; + case Z_ElementData_intUnit: + break; + case Z_ElementData_elementNotThere: + case Z_ElementData_elementEmpty: + case Z_ElementData_noDataRequested: + break; + case Z_ElementData_diagnostic: + break; + case Z_ElementData_subtree: + ir_tcl_read_grs (t->content->u.subtree, &e->tagData.sub); + break; + } } } @@ -65,8 +101,6 @@ static int ir_tcl_get_grs_r (Tcl_Interp *interp, IrTcl_GRS_Record *grs_record, if (argno >= argc) { - Tcl_AppendResult (interp, "{ ", NULL); - for (i = 0; inoTags; i++, e++) { @@ -76,29 +110,62 @@ static int ir_tcl_get_grs_r (Tcl_Interp *interp, IrTcl_GRS_Record *grs_record, if (e->tagWhich == Z_StringOrNumeric_numeric) { - Tcl_AppendElement (interp, "N"); + Tcl_AppendResult (interp, " numeric ", NULL); sprintf (tmpbuf, "%d", e->tagVal.num); Tcl_AppendElement (interp, tmpbuf); } else { - Tcl_AppendResult (interp, " S ", NULL); + Tcl_AppendResult (interp, " string ", NULL); Tcl_AppendElement (interp, e->tagVal.str); } - if (e->dataWhich == Z_ElementData_subtree) + switch (e->dataWhich) { - Tcl_AppendResult (interp, " R ", NULL); + case Z_ElementData_octets: + Tcl_AppendResult (interp, " octets {} ", NULL); + break; + case Z_ElementData_numeric: + Tcl_AppendResult (interp, " numeric {} ", NULL); + break; + case Z_ElementData_date: + Tcl_AppendResult (interp, " date {} ", NULL); + break; + case Z_ElementData_ext: + Tcl_AppendResult (interp, " ext {} ", NULL); + break; + case Z_ElementData_string: + Tcl_AppendResult (interp, " string ", NULL); + Tcl_AppendElement (interp, e->tagData.str ); + break; + case Z_ElementData_trueOrFalse: + Tcl_AppendResult (interp, " bool ", + e->tagData.bool ? "1" : "0", " ", NULL); + break; + case Z_ElementData_oid: + Tcl_AppendResult (interp, " oid {} ", NULL); + break; + case Z_ElementData_intUnit: + Tcl_AppendResult (interp, " intUnit {} ", NULL); + break; + case Z_ElementData_elementNotThere: + Tcl_AppendResult (interp, " notThere {} ", NULL); + break; + case Z_ElementData_elementEmpty: + Tcl_AppendResult (interp, " empty {} ", NULL); + break; + case Z_ElementData_noDataRequested: + Tcl_AppendResult (interp, " notRequested {} ", NULL); + break; + case Z_ElementData_diagnostic: + Tcl_AppendResult (interp, " diagnostic {} ", NULL); + break; + case Z_ElementData_subtree: + Tcl_AppendResult (interp, " subtree { ", NULL); ir_tcl_get_grs_r (interp, e->tagData.sub, argc, argv, argno+1); + Tcl_AppendResult (interp, " } ", NULL); + break; } - else - { - Tcl_AppendElement (interp, "S"); - if (e->tagData.str) - Tcl_AppendElement (interp, e->tagData.str ); - else - Tcl_AppendResult (interp, " {} ", NULL); - } - Tcl_AppendResult (interp, " }", NULL); + Tcl_AppendResult (interp, " } ", NULL); } } return TCL_OK; diff --git a/ir-tclp.h b/ir-tclp.h index 8a78675..c4635ae 100644 --- a/ir-tclp.h +++ b/ir-tclp.h @@ -5,7 +5,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tclp.h,v $ - * Revision 1.15 1995-08-29 15:30:15 adam + * Revision 1.16 1995-09-20 11:37:01 adam + * Configure searches for tk4.1 and tk7.5. + * Work on GRS. + * + * Revision 1.15 1995/08/29 15:30:15 adam * Work on GRS records. * * Revision 1.14 1995/08/04 11:32:40 adam @@ -177,6 +181,12 @@ struct GRS_Record_entry { union { struct IrTcl_GRS_Record_ *sub; char *str; + struct { + int len; + char *buf; + } octets; + int num; + int bool; } tagData; }; -- 1.7.10.4