#!/bin/sh # This is `snmp2.22' (part 22 of snmp2). # Do not concatenate these parts, unpack them in order with `/bin/sh'. # File `snmp2/tk/tclIndex' is being continued... # touch -am 1231235999 $$.touch >/dev/null 2>&1 if test ! -f 1231235999 && test -f $$.touch; then shar_touch=touch else shar_touch=: echo echo 'WARNING: not restoring timestamps. Consider getting and' echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 1231235999 $$.touch # if test ! -r _sharseq.tmp; then echo 'Please unpack part 1 first!' exit 1 fi shar_sequence=`cat _sharseq.tmp` if test "$shar_sequence" != 22; then echo "Please unpack part $shar_sequence next!" exit 1 fi if test ! -f _sharnew.tmp; then echo 'x - still skipping snmp2/tk/tclIndex' else echo 'x - continuing file snmp2/tk/tclIndex' sed 's/^X//' << 'SHAR_EOF' >> 'snmp2/tk/tclIndex' && tk_nextMenu menu.tcl tk_nextMenuEntry menu.tcl tk_invokeMenu menu.tcl tk_firstMenu menu.tcl tk_textSelectTo text.tcl tk_textBackspace text.tcl tk_textIndexCloser text.tcl tk_textResetAnchor text.tcl tkerror tkerror.tcl tk_listboxSingleSelect listbox.tcl SHAR_EOF echo 'File snmp2/tk/tclIndex is complete' && $shar_touch -am 1015123693 'snmp2/tk/tclIndex' && chmod 0644 'snmp2/tk/tclIndex' || echo 'restore of snmp2/tk/tclIndex failed' shar_count="`wc -c < 'snmp2/tk/tclIndex'`" test 753 -eq "$shar_count" || echo "snmp2/tk/tclIndex: original size 753, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/Imakefile ============== if test ! -d 'snmp2/snmptcl'; then echo 'x - creating directory snmp2/snmptcl' mkdir 'snmp2/snmptcl' fi if test -f 'snmp2/snmptcl/Imakefile' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/Imakefile (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/Imakefile (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/Imakefile' && /* Imakefile for hypertext and graph widgets */ X CDEBUGFLAGS=-Bstatic -g #CC= /usr/lang/cc #CC = gcc -Wall -fwritable-strings X TCLINC=-I/afs/andrew/netdev/src/cmu/snmp/snmp-apps/src/tcl/tcl TKINC=-I/afs/andrew/netdev/src/cmu/snmp/snmp-apps/src/tcl X INCLUDES=-I. $(TCLINC) $(TKINC) -I../snmplib -I/usr/5include LOCAL_LIBRARIES=$(TKLIB) $(TCLLIB) $(XLIB) $(SNMPLIB) EXTRA_LOAD_FLAGS= -lm X /**/# Indicate the correct paths for each of the following libraries /**/# /**/# XLIB Your X11 (R4 or R5) library. /**/# TCLLIB Tcl Version 6.x library. /**/# TKLIB Tk Version 2.x library. /**/# TCLLIB=-L/afs/andrew/netdev/src/cmu/snmp/snmp-apps/lib -ltcl TKLIB=-L/afs/andrew/netdev/src/cmu/snmp/snmp-apps/lib -ltk SNMPLIB=-L/afs/andrew/netdev/src/cmu/snmp/snmp-apps/ifip/lib -lsnmp -ldes X /**/# /**/# Define the following: /**/# /**/# -DNO_EXP10 if your C math library doesn't have exp10. /**/# -DNO_RINT if your C math library doesn't have rint /**/# -DNO_ALLOCA if your C library doesn't have alloca or a /**/# /usr/include/alloca.h /**/# #ifdef SYSV DEFINES=-DNO_EXP10 -DNO_RINT -DNO_INF -DNO_CURSES #else DEFINES= #endif X SRCS= wish.c tcl_snmp.c graph.c htext2.c OBJS= wish.o tcl_snmp.o graph.o htext2.o X ComplexProgramTarget(wish) SHAR_EOF $shar_touch -am 1015123693 'snmp2/snmptcl/Imakefile' && chmod 0644 'snmp2/snmptcl/Imakefile' || echo 'restore of snmp2/snmptcl/Imakefile failed' shar_count="`wc -c < 'snmp2/snmptcl/Imakefile'`" test 1279 -eq "$shar_count" || echo "snmp2/snmptcl/Imakefile: original size 1279, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/Makefile ============== if test -f 'snmp2/snmptcl/Makefile' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/Makefile (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/Makefile (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/Makefile' && # Makefile generated by imake - do not edit! # $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ # # The cpp used on this machine replaces all newlines and multiple tabs and # spaces in a macro expansion with a single space. Imake tries to compensate # for this, but is not always successful. # X ########################################################################### # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ # # Platform-specific parameters may be set in the appropriate .cf # configuration files. Site-wide parameters may be set in the file # site.def. Full rebuilds are recommended if any parameters are changed. # # If your C preprocessor doesn't define any unique symbols, you'll need # to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing # "make Makefile", "make Makefiles", or "make World"). # # If you absolutely can't get imake to work, you'll need to set the # variables at the top of each Makefile as well as the dependencies at the # bottom (makedepend will do this automatically). # X ########################################################################### # platform-specific configuration parameters - edit sun.cf to change X # platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ # operating system: SunOS 4.1.1 X ########################################################################### # site-specific configuration parameters - edit site.def to change X # site: $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $ X X MKDIRHIER = BourneShell $(BINDIR)/mkdirhier X X DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a X EXTENSIONLIB = -L$(USRLIBDIR) -lXext X X DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a X XLIB = $(EXTENSIONLIB) -L$(USRLIBDIR) -lX11 X X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a X XAUTHLIB = -L$(USRLIBDIR) -lXau X X DEPXMULIB = $(USRLIBDIR)/libXmu.a X XMULIB = -L$(USRLIBDIR) -lXmu X X DEPOLDXLIB = $(USRLIBDIR)/liboldX.a X OLDXLIB = -L$(USRLIBDIR) -loldX X X DEPXTOOLLIB = $(USRLIBDIR)/libXt.a X XTOOLLIB = -L$(USRLIBDIR) -lXt X X DEPXAWLIB = $(USRLIBDIR)/libXaw.a X XAWLIB = -L$(USRLIBDIR) -lXaw X X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln X LINTXLIB = $(USRLIBDIR)/llib-lX11.ln X LINTXMU = $(USRLIBDIR)/llib-lXmu.ln X LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln X LINTXAW = $(USRLIBDIR)/llib-lXaw.ln X X SHELL = /bin/sh X X TOP = . X CURRENT_DIR = . X X AR = ar cq X BOOTSTRAPCFLAGS = X CC = cc X X COMPRESS = compress X CPP = /lib/cpp $(STD_CPP_DEFINES) X PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) X INSTALL = /usr/local/bin/install X LD = ld X LINT = lint X LINTLIBFLAG = -C X LINTOPTS = -axz X LN = ln -s X MAKE = make X MV = mv X CP = cp X RANLIB = ranlib X RANLIBINSTFLAGS = X RM = rm -f X STD_INCLUDES = X X EXTRA_INCLUDES = -I/usr/local/include/res X STD_CPP_DEFINES = X STD_DEFINES = X EXTRA_LOAD_FLAGS = X EXTRA_LIBRARIES = X TAGS = ctags X X SHAREDCODEDEF = -DSHAREDCODE X SHLIBDEF = -DSUNSHLIB X X PROTO_DEFINES = X X INSTPGMFLAGS = -s X X INSTBINFLAGS = -m 0755 X INSTUIDFLAGS = -m 4755 X INSTLIBFLAGS = -m 0664 X INSTINCFLAGS = -m 0444 X INSTMANFLAGS = -m 0444 X INSTDATFLAGS = -m 0444 X INSTKMEMFLAGS = -m 4755 X X DESTDIR = X X TOP_INCLUDES = -I$(INCROOT) X X CDEBUGFLAGS = -O X CCOPTIONS = X COMPATFLAGS = X X ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) X LDCOMBINEFLAGS = -X -r X X MACROFILE = sun.cf X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut X X IMAKE_DEFINES = X X IRULESRC = $(CONFIGDIR) X IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) X X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ X $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ X $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) X ########################################################################### # X Window System Build Parameters # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ X ########################################################################### # X Window System make variables; this need to be coordinated with rules # $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ X X PATHSEP = / X USRLIBDIR = $(DESTDIR)/usr/local/$(DEPOTDIR)lib X BINDIR = $(DESTDIR)/usr/local/$(DEPOTDIR)bin X INCROOT = $(DESTDIR)/usr/local/$(DEPOTDIR)include X BUILDINCROOT = $(TOP) X BUILDINCDIR = $(BUILDINCROOT)/X11 X BUILDINCTOP = .. X INCDIR = $(INCROOT)/X11 X ADMDIR = /usr/bin X LIBDIR = $(USRLIBDIR)/X11 X CONFIGDIR = $(LIBDIR)/config X LINTLIBDIR = $(USRLIBDIR)/lint X X FONTDIR = $(LIBDIR)/fonts X XINITDIR = $(LIBDIR)/xinit X XDMDIR = $(LIBDIR)/xdm X AWMDIR = $(LIBDIR)/awm X TWMDIR = $(LIBDIR)/twm X GWMDIR = $(LIBDIR)/gwm X MANPATH = $(DESTDIR)/usr/local/$(DEPOTDIR)man X MANSOURCEPATH = $(MANPATH)/man X MANDIR = $(MANSOURCEPATH)x X LIBMANDIR = $(MANSOURCEPATH)3 X XAPPLOADDIR = $(LIBDIR)/app-defaults X X SOXLIBREV = 4.2 X SOXTREV = 4.0 X SOXAWREV = 4.0 X SOOLDXREV = 4.0 X SOXMUREV = 4.0 X SOXEXTREV = 4.0 X X FONTCFLAGS = -t X X INSTAPPFLAGS = $(INSTDATFLAGS) X X IMAKE = imake X DEPEND = makedepend X RGB = rgb X FONTC = bdftosnf X MKFONTDIR = mkfontdir X MKDIRHIER = mkdirhier X X CONFIGSRC = $(TOP)/config X CLIENTSRC = $(TOP)/clients X DEMOSRC = $(TOP)/demos X LIBSRC = $(TOP)/lib X FONTSRC = $(TOP)/fonts X INCLUDESRC = $(TOP)/X11 X SERVERSRC = $(TOP)/server X UTILSRC = $(TOP)/util X SCRIPTSRC = $(UTILSRC)/scripts X EXAMPLESRC = $(TOP)/examples X CONTRIBSRC = $(TOP)/../contrib X DOCSRC = $(TOP)/doc X RGBSRC = $(TOP)/rgb X DEPENDSRC = $(UTILSRC)/makedepend X IMAKESRC = $(CONFIGSRC) X XAUTHSRC = $(LIBSRC)/Xau X XLIBSRC = $(LIBSRC)/X X XMUSRC = $(LIBSRC)/Xmu X TOOLKITSRC = $(LIBSRC)/Xt X AWIDGETSRC = $(LIBSRC)/Xaw X OLDXLIBSRC = $(LIBSRC)/oldX X XDMCPLIBSRC = $(LIBSRC)/Xdmcp X BDFTOSNFSRC = $(FONTSRC)/bdftosnf X MKFONTDIRSRC = $(FONTSRC)/mkfontdir X EXTENSIONSRC = $(TOP)/extensions X X DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a X EXTENSIONLIB = -lXext X X DEPXLIB = $(DEPEXTENSIONLIB) X XLIB = $(EXTENSIONLIB) -lX11 X X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a X XAUTHLIB = -lXau X X DEPXMULIB = X XMULIB = -lXmu X X DEPOLDXLIB = X OLDXLIB = -loldX X X DEPXTOOLLIB = X XTOOLLIB = -lXt X X DEPXAWLIB = X XAWLIB = -lXaw X X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln X LINTXLIB = $(USRLIBDIR)/llib-lX11.ln X LINTXMU = $(USRLIBDIR)/llib-lXmu.ln X LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln X LINTXAW = $(USRLIBDIR)/llib-lXaw.ln X X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) X X DEPLIBS1 = $(DEPLIBS) X DEPLIBS2 = $(DEPLIBS) X DEPLIBS3 = $(DEPLIBS) X ########################################################################### # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ X ########################################################################### # start of Imakefile X CDEBUGFLAGS=-Bstatic -g #CC= /usr/lang/cc #CC = gcc -Wall -fwritable-strings X TCLINC=-I/afs/andrew/netdev/src/cmu/snmp/snmp-apps/src/tcl/tcl TKINC=-I/afs/andrew/netdev/src/cmu/snmp/snmp-apps/src/tcl X INCLUDES=-I. $(TCLINC) $(TKINC) -I../snmplib -I/usr/5include LOCAL_LIBRARIES=$(TKLIB) $(TCLLIB) $(XLIB) $(SNMPLIB) EXTRA_LOAD_FLAGS= -lm X # Indicate the correct paths for each of the following libraries # # XLIB Your X11 (R4 or R5) library. # TCLLIB Tcl Version 6.x library. # TKLIB Tk Version 2.x library. # TCLLIB=-L/afs/andrew/netdev/src/cmu/snmp/snmp-apps/lib -ltcl TKLIB=-L/afs/andrew/netdev/src/cmu/snmp/snmp-apps/lib -ltk SNMPLIB=-L/afs/andrew/netdev/src/cmu/snmp/snmp-apps/ifip/lib -lsnmp -ldes X # # Define the following: # # -DNO_EXP10 if your C math library doesn't have exp10. # -DNO_RINT if your C math library doesn't have rint # -DNO_ALLOCA if your C library doesn't have alloca or a # /usr/include/alloca.h # X DEFINES= X SRCS= wish.c tcl_snmp.c graph.c htext2.c OBJS= wish.o tcl_snmp.o graph.o htext2.o X X PROGRAM = wish X all:: wish X wish: $(OBJS) $(DEPLIBS) X $(RM) $@ X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) X install:: wish X $(INSTALL) -c $(INSTPGMFLAGS) wish $(BINDIR) X install.man:: wish.man X $(INSTALL) -c $(INSTMANFLAGS) wish.man $(MANDIR)/wish.x X depend:: X $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) X lint: X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) X clean:: X $(RM) $(PROGRAM) X ########################################################################### # common rules for all Makefiles - do not edit X emptyrule:: X clean:: X $(RM_CMD) \#* X Makefile:: X -@if [ -f Makefile ]; then \ X echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ X else exit 0; fi X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) X tags:: X $(TAGS) -w *.[ch] X $(TAGS) -xw *.[ch] > TAGS X ########################################################################### # empty rules for directories that do not have SUBDIRS - do not edit X install:: X @echo "install in $(CURRENT_DIR) done" X install.man:: X @echo "install.man in $(CURRENT_DIR) done" X Makefiles:: X includes:: X ########################################################################### # dependencies generated by makedepend X SHAR_EOF $shar_touch -am 1015123693 'snmp2/snmptcl/Makefile' && chmod 0644 'snmp2/snmptcl/Makefile' || echo 'restore of snmp2/snmptcl/Makefile failed' shar_count="`wc -c < 'snmp2/snmptcl/Makefile'`" test 10557 -eq "$shar_count" || echo "snmp2/snmptcl/Makefile: original size 10557, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/README ============== if test -f 'snmp2/snmptcl/README' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/README (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/README (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/README' && This is a port of Poul-Henning Kamp's excellent TCL SNMP package (originally for CMU SNMP 1) to CMU SNMP 2. This should be regarded as a prototype as the TCL API for the CMU SNMP distribution will probably change remarkably. X To compile your own version of TCL, you need to pick up TCL and TK separately from sprite.berkeley.edu. Remember to edit the Imakefile in this directory with the correct pathnames for your system and then run xmkmf (imake). X If you want to experiment without building your own version of the command interpreter, wish, a copy is available on lancaster.andrew.cmu.edu in the pub/snmp-dist directory. The snmpgraph application in this directory will work with this (make sure wish is in your path). snmpgraph.ps can be printed to see what the application looks like. X In any case, you need to put wish in your path and provide some libraries to the wish executable in a well known place. Create the following links: ln -s $SNMPROOT/tk /usr/lib/tk ln -s $SNMPROOT/tcl /usr/lib/tcl (Without this, you will get errors complaining that certain files can't be found). X For snmpgraph, try: X snmpgraph -v 1 hostname 5 interfaces.ifTable.ifEntry.ifInOctets.1 X Dragging the left mouse button zooms. Dragging the right mouse button moves the legend. Pressing pause pauses screen updates (data is still being polled). Press pause again to update. Pressing the top right button takes the dataset off the screen (intended for plotting multiple variables). Pressing "p" creates a postscript image of the window named snmpgraph.ps. Pressing "^C" exits. X SHAR_EOF $shar_touch -am 1015123693 'snmp2/snmptcl/README' && chmod 0644 'snmp2/snmptcl/README' || echo 'restore of snmp2/snmptcl/README failed' shar_count="`wc -c < 'snmp2/snmptcl/README'`" test 1568 -eq "$shar_count" || echo "snmp2/snmptcl/README: original size 1568, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/all.c ============== if test -f 'snmp2/snmptcl/all.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/all.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/all.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/all.c' && /* X * main.c -- X * X * A simple program to test the toolkit facilities. X * X * Copyright 1990-1992 Regents of the University of California. X * Permission to use, copy, modify, and distribute this X * software and its documentation for any purpose and without X * fee is hereby granted, provided that the above copyright X * notice appear in all copies. The University of California X * makes no representations about the suitability of this X * software for any purpose. It is provided "as is" without X * express or implied warranty. X */ X #ifndef lint static char rcsid[]= "$Header: /usr/user/tcl_snmp/RCS/all.c,v 1.1 1992/10/22 09:15:10 jc79 Exp $ SPRITE (Berkeley)"; X #endif X #ifndef notdef #include #include #include #include #include #else #include "tkConfig.h" #include "tkInt.h" #endif /* X * Declarations for library procedures: X */ X extern int isatty (); X extern Tcl_CmdProc GraphCmd; extern Tcl_CmdProc HypertextCmd; X /* extern Tcl_CmdProc Tk_TextCmd; */ X /* X * Command used to initialize wish: X */ X char initCmd[]= "source $tk_library/wish.tcl"; X Tk_Window w; /* NULL means window has been deleted. */ Tk_TimerToken timeToken = 0; int idleHandler = 0; Tcl_Interp *interp; int x, y; Tcl_CmdBuf buffer; int tty; extern int Tk_SquareCmd _ANSI_ARGS_ ((ClientData clientData, X Tcl_Interp * interp, int argc, char **argv)); X /* X * Information for testing out command-line options: X */ X int synchronize = 0; char *fileName = NULL; char *name = NULL; char *display = NULL; char *geometry = NULL; static int debug = 0; X Tk_ArgvInfo argTable[]= { X {"-file", TK_ARGV_STRING, (char *)NULL, (char *)&fileName, X "File from which to read commands"}, X {"-geometry", TK_ARGV_STRING, (char *)NULL, (char *)&geometry, X "Initial geometry for window"}, X {"-display", TK_ARGV_STRING, (char *)NULL, (char *)&display, X "Display to use"}, X {"-debug", TK_ARGV_INT, (char *)NULL, (char *)&debug, X "Debugging level to use"}, X {"-name", TK_ARGV_STRING, (char *)NULL, (char *)&name, X "Name to use for application"}, X {"-sync", TK_ARGV_CONSTANT, (char *)1, (char *)&synchronize, X "Use synchronous mode for display server"}, X {(char *)NULL, TK_ARGV_END, (char *)NULL, (char *)NULL, X (char *)NULL} }; X X /* ARGSUSED */ void StdinProc (clientData, mask) X ClientData clientData; /* Not used. */ X int mask; { X char line[200]; X static int gotPartial = 0; X char *cmd; X int result; X X if (mask & TK_READABLE) { X if (fgets (line, 200, stdin) == NULL) { X if (!gotPartial) { X if (tty) { X Tcl_Eval (interp, "destroy .", 0, (char **)NULL); X exit (0); X } else { X Tk_DeleteFileHandler (0); X } X return; X } else { X line[0] = 0; X } X } X cmd = Tcl_AssembleCmd (buffer, line); X if (cmd == NULL) { X gotPartial = 1; X return; X } X gotPartial = 0; X result = Tcl_RecordAndEval (interp, cmd, 0); X if (*interp->result != 0) { X if ((result != TCL_OK) || (tty)) { X printf ("%s\n", interp->result); X } X } X if (tty) { X printf ("wish: "); X fflush (stdout); X } X } } X X /* ARGSUSED */ static void StructureProc (clientData, eventPtr) X ClientData clientData; /* Information about window. */ X XEvent *eventPtr; /* Information about event. */ { X if (eventPtr->type == DestroyNotify) { X w = NULL; X } } X /* X * Procedure to map initial window. This is invoked as a do-when-idle X * handler. Wait for all other when-idle handlers to be processed X * before mapping the window, so that the window's correct geometry X * has been determined. X */ X X /* ARGSUSED */ static void DelayedMap (clientData) X ClientData clientData; /* Not used. */ { X X while (Tk_DoOneEvent (1) != 0) { X /* Empty loop body. */ X } X if (w == NULL) { X return; X } X Tk_MapWindow (w); } X X /* ARGSUSED */ int MapCmd (tkwin, interp, argc, argv) X Tk_Window tkwin; /* Application window. */ X Tcl_Interp *interp; /* Current interpreter. */ X int argc; /* Number of arguments. */ X char **argv; /* Argument strings. */ { X Tk_Window window; X X if (argc != 2) { X Tcl_AppendResult (interp, "wrong # args: should be \"", argv[0], X " window\"", (char *)NULL); X return TCL_ERROR; X } X window = Tk_NameToWindow (interp, argv[1], tkwin); X if (window == NULL) { X return TCL_ERROR; X } X Tk_MapWindow (window); X return TCL_OK; } X static void DebugProc (clientData, interp, level, command, cmdProc, X cmdClientData, argc, argv) X ClientData clientData; /* Data passed to debugr */ X Tcl_Interp *interp; /* Interpreter */ X int level; /* Current level */ X char *command; /* Command before substitution */ X int (*cmdProc) (); /* Address of command procedure to be called */ X ClientData cmdClientData;/* Data passed to this procedure */ X int argc; X char **argv; /* Command afer processing */ { X register int i; X X fprintf (stderr, "%3d> %s\n ", level, command); X for (i = 0; i < argc; i++) X fprintf (stderr, "%s ", argv[i]); X fprintf (stderr, "\n"); } X static int DebugCmd (clientData, interp, argc, argv) X ClientData clientData; X Tcl_Interp *interp; X int argc; X char **argv; { X static int debug_on = False; X static Tcl_Trace debug_token; X static int debug_level; X int new_level; X X if (argc > 2) { X sprintf (interp->result, "Wrong number of arguments\n\tUsage: %s level", X argv[0]); X return (TCL_ERROR); X } X if (argc == 1) { X char buf[30]; X X sprintf (buf, "is %d", debug_level); X Tcl_SetResult (interp, buf, TCL_VOLATILE); X return (TCL_OK); X } X if (Tcl_GetInt (interp, argv[1], &new_level) != TCL_OK) X return (TCL_ERROR); X X if (debug_on) { X Tcl_DeleteTrace (interp, debug_token); X debug_on = False; X } X debug_level = new_level; X if (debug_level > 0) { X debug_token = Tcl_CreateTrace (interp, debug_level, X (void (*)())DebugProc, NULL); X debug_on = True; X } X return (TCL_OK); } X X /* ARGSUSED */ int DotCmd (dummy, interp, argc, argv) X ClientData dummy; /* Not used. */ X Tcl_Interp *interp; /* Current interpreter. */ X int argc; /* Number of arguments. */ X char **argv; /* Argument strings. */ { X int x, y; X X if (argc != 3) { X Tcl_AppendResult (interp, "wrong # args: should be \"", argv[0], X " x y\"", (char *)NULL); X return TCL_ERROR; X } X x = strtol (argv[1], (char **)NULL, 0); X y = strtol (argv[2], (char **)NULL, 0); X Tk_MakeWindowExist (w); X XDrawPoint (Tk_Display (w), Tk_WindowId (w), X DefaultGCOfScreen (Tk_Screen (w)), x, y); X return TCL_OK; } X X /* ARGSUSED */ int MovetoCmd (dummy, interp, argc, argv) X ClientData dummy; /* Not used. */ X Tcl_Interp *interp; /* Current interpreter. */ X int argc; /* Number of arguments. */ X char **argv; /* Argument strings. */ { X if (argc != 3) { X Tcl_AppendResult (interp, "wrong # args: should be \"", argv[0], X " x y\"", (char *)NULL); X return TCL_ERROR; X } X x = strtol (argv[1], (char **)NULL, 0); X y = strtol (argv[2], (char **)NULL, 0); X return TCL_OK; } X X /* ARGSUSED */ int LinetoCmd (dummy, interp, argc, argv) X ClientData dummy; /* Not used. */ X Tcl_Interp *interp; /* Current interpreter. */ X int argc; /* Number of arguments. */ X char **argv; /* Argument strings. */ { X int newX, newY; X X if (argc != 3) { X Tcl_AppendResult (interp, "wrong # args: should be \"", argv[0], X " x y\"", (char *)NULL); X return TCL_ERROR; X } X newX = strtol (argv[1], (char **)NULL, 0); X newY = strtol (argv[2], (char **)NULL, 0); X Tk_MakeWindowExist (w); X XDrawLine (Tk_Display (w), Tk_WindowId (w), X DefaultGCOfScreen (Tk_Screen (w)), x, y, newX, newY); X x = newX; X y = newY; X return TCL_OK; } X int main (argc, argv) X int argc; X char **argv; { X char *args, *p, *msg; X char buf[20]; X int result; X Tk_3DBorder border; X X interp = Tcl_CreateInterp (); #ifdef TCL_MEM_DEBUG X Tcl_InitMemory (interp); #endif X if (Tk_ParseArgv (interp, (Tk_Window) NULL, &argc, argv, argTable, 0) X != TCL_OK) { X fprintf (stderr, "%s\n", interp->result); X exit (1); X } X if (name == NULL) { X if (fileName != NULL) { X p = fileName; X } else { X p = argv[0]; X } X name = strrchr (p, '/'); X if (name != NULL) { X name++; X } else { X name = p; X } X } X w = Tk_CreateMainWindow (interp, display, name); X if (w == NULL) { X fprintf (stderr, "%s\n", interp->result); X exit (1); X } X Tk_SetClass (w, "Tk"); X Tk_CreateEventHandler (w, StructureNotifyMask, StructureProc, X (ClientData) NULL); X Tk_DoWhenIdle (DelayedMap, (ClientData) NULL); X tty = isatty (0); X X args = Tcl_Merge (argc, argv); X Tcl_SetVar (interp, "argv", args, TCL_GLOBAL_ONLY); X ckfree (args); X sprintf (buf, "%d", argc); X Tcl_SetVar (interp, "argc", buf, TCL_GLOBAL_ONLY); X X if (synchronize) { X XSynchronize (Tk_Display (w), True); X } X Tk_GeometryRequest (w, 200, 200); X border = Tk_Get3DBorder (interp, w, None, "#4eee94"); X if (border == NULL) { X Tcl_SetResult (interp, (char *)NULL, TCL_STATIC); X Tk_SetWindowBackground (w, WhitePixelOfScreen (Tk_Screen (w))); X } else { X Tk_SetBackgroundFromBorder (w, border); X } X XSetForeground (Tk_Display (w), DefaultGCOfScreen (Tk_Screen (w)), X BlackPixelOfScreen (Tk_Screen (w))); X X Tcl_CreateCommand (interp, "debug", DebugCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "htext", HypertextCmd, (ClientData) w, X (void (*)())NULL); /* Tcl_CreateCommand(interp, "text", Tk_TextCmd, (ClientData) w, X (void (*)()) NULL); X */ X Tcl_CreateCommand (interp, "xygraph", GraphCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "barchart", GraphCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "map", MapCmd, (ClientData) w, X (void (*)())NULL); X X Tcl_CreateCommand (interp, "dot", DotCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "lineto", LinetoCmd, (ClientData) w, X (void (*)())NULL); X Tcl_CreateCommand (interp, "moveto", MovetoCmd, (ClientData) w, X (void (*)())NULL); #ifdef SQUARE_DEMO X Tcl_CreateCommand (interp, "square", Tk_SquareCmd, (ClientData) w, X (void (*)())NULL); #endif X if (debug > 0) { X char buf[80]; X X sprintf (buf, "debug %d", debug); X Tcl_Eval (interp, buf, 0, 0); X } X if (geometry != NULL) { X Tcl_SetVar (interp, "geometry", geometry, TCL_GLOBAL_ONLY); X } X result = Tcl_Eval (interp, initCmd, 0, (char **)NULL); X if (result != TCL_OK) { X goto error; X } X if (fileName != NULL) { X result = Tcl_VarEval (interp, "source ", fileName, (char *)NULL); X if (result != TCL_OK) { X goto error; X } X tty = 0; X } else { X tty = isatty (0); X Tk_CreateFileHandler (0, TK_READABLE | TK_EXCEPTION, StdinProc, X (ClientData) 0); X if (tty) { X printf ("wish: "); X } X } X fflush (stdout); X buffer = Tcl_CreateCmdBuf (); X (void)Tcl_Eval (interp, "update", 0, (char **)NULL); X X Tk_MainLoop (); X Tcl_DeleteInterp (interp); X Tcl_DeleteCmdBuf (buffer); X exit (0); X X error: X msg = Tcl_GetVar (interp, "errorInfo", TCL_GLOBAL_ONLY); X if (msg == NULL) { X msg = interp->result; X } X fprintf (stderr, "%s\n", msg); X Tcl_Eval (interp, "destroy .", 0, (char **)NULL); X exit (1); X return 0; } X X SHAR_EOF $shar_touch -am 1015123693 'snmp2/snmptcl/all.c' && chmod 0444 'snmp2/snmptcl/all.c' || echo 'restore of snmp2/snmptcl/all.c failed' shar_count="`wc -c < 'snmp2/snmptcl/all.c'`" test 11446 -eq "$shar_count" || echo "snmp2/snmptcl/all.c: original size 11446, current size $shar_count" rm -f _sharnew.tmp fi # ============= snmp2/snmptcl/graph.c ============== if test -f 'snmp2/snmptcl/graph.c' && test X"$1" != X"-c"; then echo 'x - skipping snmp2/snmptcl/graph.c (file already exists)' rm -f _sharnew.tmp else > _sharnew.tmp echo 'x - extracting snmp2/snmptcl/graph.c (text)' sed 's/^X//' << 'SHAR_EOF' > 'snmp2/snmptcl/graph.c' && /* X * graph.c -- X * X * This module implements a graph widget for X * the Tk toolkit. X * X * Copyright 1990 Regents of the University of California. X * Permission to use, copy, modify, and distribute this X * software and its documentation for any purpose and without X * fee is hereby granted, provided that the above copyright X * notice appear in all copies. The University of California X * makes no representations about the suitability of this X * software for any purpose. It is provided "as is" without X * express or implied warranty. X * X * Copyright 1991,1992 by AT&T Bell Laboratories. X * Permission to use, copy, modify, and distribute this software X * and its documentation for any purpose and without fee is hereby X * granted, provided that the above copyright notice appear in all X * copies and that both that the copyright notice and warranty X * disclaimer appear in supporting documentation, and that the X * names of AT&T Bell Laboratories any of their entities not be used X * in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * AT&T disclaims all warranties with regard to this software, including X * all implied warranties of merchantability and fitness. In no event X * shall AT&T be liable for any special, indirect or consequential X * damages or any damages whatsoever resulting from loss of use, data X * or profits, whether in an action of contract, negligence or other X * tortuous action, arising out of or in connection with the use or X * performance of this software. X * X * Graph widget created by Sani Nassif and George Howlett. X */ X /* To do: X * X * 1) Fix log autoscale routines to use data min/max as limits X * instead of the next unit largest/smallest unit. X * X * 2) Rotated PS text doesn't display background color X * X * 3) Add PS monochrome and centering option. Kill automatic scaling? X * X * 3) Scale fonts with graph (Scale by width and/or height?) X * X * 4) No PS for bitmaps. X * X * 6) Update manual page. X * X * 7) piechart X * X * 8) Account for roundoff error when calculating bar widths X */ #include #include #include #include #ifndef HUGE_VAL #include #endif #ifndef NO_ALLOCA #include #endif X #include #include #include #include #include X #ifdef DEBUG #include #endif X #ifdef sun /* Override defines in Sun's */ # undef minor # undef major # endif /*sun*/ X #define TRUE 1 #define FALSE 0 #define NULLSTR(s) ((s)==NULL || *(s)=='\0') X #if defined (__GNUC__) && defined (__STDC__) #define INLINE inline #else #define INLINE #endif /* GNUC && STDC */ X X #define BLACK "#000000" #define WHITE "#ffffff" #define BISQUE2 "#eed5b7" #define BISQUE3 "#cdb79e" #define LIGHTBLUE2 "#b2dfee" #define LIGHTPINK1 "#ffaeb9" #define MAROON "#b03060" X /* X * Orthogonal rotations for drawing text strings X */ enum RightAngles { X ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270 }; X /* X * Line attributes: either symbol types or line styles X */ #define SOLID_LINESTYLE 0x01 #define DASHED_LINESTYLE 0x02 #define DOTTED_LINESTYLE 0x04 #define POINT_SYMBOL 0x08 #define SQUARE_SYMBOL 0x10 #define CIRCLE_SYMBOL 0x20 #define DIAMOND_SYMBOL 0x40 #define PLUS_SYMBOL 0x80 #define CROSS_SYMBOL 0x100 X #define LINESTYLE(s) ((s)&0x07) X /* Types and classes of graphs: */ enum GraphTypes { XYGRAPH_TYPE, BARCHART_TYPE, PIECHART_TYPE }; static char *classNames[] = { "XYGraph", "Barchart", "Piechart" }; static char *configNames[] = { "line", "bar", "slice" }; X /* X * Mask values used to selectively enable entries in the X * configuration specs: X */ #define XYGRAPH_MASK TK_CONFIG_USER_BIT #define BARCHART_MASK TK_CONFIG_USER_BIT << 1 #define PIECHART_MASK TK_CONFIG_USER_BIT << 2 #define ALL_MASK (XYGRAPH_MASK | BARCHART_MASK | PIECHART_MASK) X static int configFlags[]= { X XYGRAPH_MASK, BARCHART_MASK, PIECHART_MASK }; X #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #define ROUND(x,u) (rint((x)/(u))*(u)) #define CEIL(x,u) (ceil((x)/(u))*(u)) #define FLOOR(x,u) (floor((x)/(u))*(u)) #ifdef NO_EXP10 #define exp10(n) pow(10.0,(n)) #endif /* NO_EXP10 */ X #ifdef NO_RINT #define rint(x) ((int)((x) + (((x)<0.0) ? -0.5 : 0.5))) #endif /* NO_RINT */ X #define PADX 2 /* Padding between labels/titles */ #define PADY 2 /* Padding between labels */ #define FONTHEIGHT(f) ((f)->ascent + (f)->descent) X #define MAJOR_TICK 0.025 /* Length of a major tick */ #define MINOR_TICK 0.015 /* Length of a minor (sub) tick */ #define LABEL_TICK 0.030 /* Distance from graph to start of label */ X /* X * Sun's bundled and unbundled C compilers can't grok static X * function typedefs (it can handle extern) like X * X * static Tk_OptionParseProc parseProc; X * static Tk_OptionPrintProc printProc; X * X * Provide forward declarations here: X */ static int SymbolParseProc _ANSI_ARGS_((ClientData clientData, X Tcl_Interp *interp, Tk_Window tkwin, char *value, char *widgRec, int offset)); static char *SymbolPrintProc _ANSI_ARGS_((ClientData clientData, X Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)); static int LimitParseProc _ANSI_ARGS_((ClientData clientData, X Tcl_Interp *interp, Tk_Window tkwin, char *value, char *widgRec, int offset)); static char *LimitPrintProc _ANSI_ARGS_((ClientData clientData, X Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)); static int VectorParseProc _ANSI_ARGS_((ClientData clientData, X Tcl_Interp *interp, Tk_Window tkwin, char *value, char *widgRec, int offset)); static char *VectorPrintProc _ANSI_ARGS_((ClientData clientData, X Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)); static int TwinVectorParseProc _ANSI_ARGS_((ClientData clientData, X Tcl_Interp *interp, Tk_Window tkwin, char *value, char *widgRec, int offset)); static char *TwinVectorPrintProc _ANSI_ARGS_((ClientData clientData, X Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)); static int ExprParseProc _ANSI_ARGS_((ClientData clientData, X Tcl_Interp *interp, Tk_Window tkwin, char *value, char *widgRec, int offset)); static char *ExprPrintProc _ANSI_ARGS_((ClientData clientData, X Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)); static int LegendParseProc _ANSI_ARGS_((ClientData clientData, X Tcl_Interp *interp, Tk_Window tkwin, char *value, char *widgRec, int offset)); static char *LegendPrintProc _ANSI_ARGS_((ClientData clientData, X Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)); X X typedef struct ListEntry { X struct ListEntry *prevPtr; /* Link to the previous entry */ X struct ListEntry *nextPtr; /* Link to the next entry (not used) */ X char *keyPtr; /* Pointer to the (character string) key */ X ClientData clientData; /* Pointer to the data object */ } ListEntry; X typedef struct LinkedList { X ListEntry *headPtr; /* Pointer to first element in list */ X ListEntry *tailPtr; /* Pointer to last element in list */ X int numEntries; /* Number of elements in list */ } LinkedList; X /* X * Structure containing Postscript options X */ typedef struct { X char *fileName; /* Name of generated postscript file */ X char *geometry; /* Geometry of postscript plot */ X int isCentered; /* If non-zero, center the plot on the page */ X int isMonochrome; /* If non-zero, use BW color scheme */ X int isLandscape; /* If non-zero, rotate into landscape */ } PSOption; X /* X * The data structure below contains information pertaining to a line X * vector. It consists of an array of double precision data values and X * for convenience, the number and minimum/maximum values. X */ typedef struct Vector { X double *valueArr; /* Array of values */ X int numValues; /* Number of elements in the array */ X double minValue; /* Smallest value in the array */ X double maxValue; /* Largest value in the array */ } Vector; X /* X * A line is a vector plus several attributes, such as line style, thickness, X * color, and symbol type. It has a name which associates it among the list X * of lines. X */ typedef struct Line { X struct Graph *parent; /* Plotting surface associated with vector */ X char *label; /* Line label */ X char *name; /* Key name to refer the line. Used in the X * "insert", "delete", or "show", commands. */ X int isVisible; /* If true, line is currently visible. */ X int showRetrace; /* If true, draw line retrace. */ X int symbol; /* Integer value representing line symbol X * attribute. */ X double symSizePct; /* Size of symbol as a percentage of the drawing X * area. */ X int symbolSize; /* Computed size of symbol in pixels. */ X Pixmap stipple; /* Bitmap for barchart/piechart patterns */ X int lineWidth; /* Line width for XY graphs */ X XColor *fgColor; /* Line color */ X XColor *bgColor; /* Background color for barcharts/piecharts */ X GC gc; /* Private graphics context of line */ X Vector x, y; /* Contains array of numeric values */ } Line; X static Tk_CustomOption SymbolOption = { X SymbolParseProc, SymbolPrintProc, NULL }; X static double NegativeInfinity; static double PositiveInfinity; X static Tk_CustomOption MinLimitOption = { X LimitParseProc, LimitPrintProc, (ClientData) & NegativeInfinity, }; static Tk_CustomOption MaxLimitOption = { X LimitParseProc, LimitPrintProc, (ClientData) & PositiveInfinity, }; static Tk_CustomOption VectorOption = { X VectorParseProc, VectorPrintProc, NULL }; static Tk_CustomOption TwinVectorOption = { X TwinVectorParseProc, TwinVectorPrintProc, NULL }; static Tk_CustomOption ExprOption = { X ExprParseProc, ExprPrintProc, NULL }; X #define DEF_LINE_BG_COLOR WHITE #define DEF_LINE_BG_MONO WHITE #define DEF_LINE_FG_COLOR BLACK #define DEF_LINE_FG_MONO BLACK #define DEF_LINE_WIDTH "0" #define DEF_LINE_STYLE "solid" #define DEF_LINE_STIPPLE (char *)NULL #define DEF_LINE_VISIBLE "true" #define DEF_LINE_NAME "unknown" #define DEF_LINE_SYMBOL_SIZE "1.5" X static Tk_ConfigSpec lineConfigSpecs[]= { X {TK_CONFIG_COLOR, "-background", "background", "Background", X DEF_LINE_BG_COLOR, Tk_Offset(Line, bgColor), X TK_CONFIG_COLOR_ONLY | PIECHART_MASK | BARCHART_MASK}, X {TK_CONFIG_COLOR, "-background", "background", "Background", X DEF_LINE_BG_MONO, Tk_Offset(Line, bgColor), X TK_CONFIG_MONO_ONLY | PIECHART_MASK | BARCHART_MASK}, X {TK_CONFIG_SYNONYM, "-bg", "background", (char *)NULL, (char *)NULL, 0, X PIECHART_MASK | BARCHART_MASK}, X {TK_CONFIG_COLOR, "-color", "color", "Color", X DEF_LINE_FG_COLOR, Tk_Offset(Line, fgColor), X TK_CONFIG_COLOR_ONLY | XYGRAPH_MASK}, X {TK_CONFIG_COLOR, "-color", "color", "Color", X DEF_LINE_FG_MONO, Tk_Offset(Line, fgColor), X TK_CONFIG_MONO_ONLY | XYGRAPH_MASK}, X {TK_CONFIG_SYNONYM, "-fg", "foreground", (char *)NULL, X (char *)NULL, 0, BARCHART_MASK | PIECHART_MASK}, X {TK_CONFIG_COLOR, "-foreground", "foreground", "Foregound", X DEF_LINE_FG_COLOR, Tk_Offset(Line, fgColor), X TK_CONFIG_COLOR_ONLY | BARCHART_MASK | PIECHART_MASK}, X {TK_CONFIG_COLOR, "-foreground", "foreground", "Foreground", X DEF_LINE_FG_MONO, Tk_Offset(Line, fgColor), X TK_CONFIG_MONO_ONLY | BARCHART_MASK | PIECHART_MASK}, X {TK_CONFIG_PIXELS, "-linewidth", "lineWidth", "LineWidth", X DEF_LINE_WIDTH, Tk_Offset(Line, lineWidth), XYGRAPH_MASK}, X {TK_CONFIG_DOUBLE, "-symbolsize", "symbolSize", "SymbolSize", X DEF_LINE_SYMBOL_SIZE, Tk_Offset(Line, symSizePct), ALL_MASK}, X {TK_CONFIG_CUSTOM, "-symbol", "symbol", "Symbol", X DEF_LINE_STYLE, Tk_Offset(Line, symbol), XYGRAPH_MASK, &SymbolOption}, X {TK_CONFIG_BITMAP, "-stipple", "stipple", "Stipple", X DEF_LINE_STIPPLE, Tk_Offset(Line, stipple), X BARCHART_MASK | PIECHART_MASK}, X {TK_CONFIG_CUSTOM, "-xdata", "xData", (char *)NULL, X NULL, Tk_Offset(Line, x), ALL_MASK, &VectorOption}, X {TK_CONFIG_CUSTOM, "-ydata", "yData", (char *)NULL, X NULL, Tk_Offset(Line, y), ALL_MASK, &VectorOption}, X {TK_CONFIG_CUSTOM, "-xydata", "xyData", (char *)NULL, X NULL, 0, XYGRAPH_MASK, &TwinVectorOption}, X {TK_CONFIG_STRING, "-label", "label", "Label", X NULL, Tk_Offset(Line, label), ALL_MASK}, X {TK_CONFIG_STRING, "-showretrace", (char *)NULL, (char *)NULL, X NULL, Tk_Offset(Line, showRetrace), ALL_MASK}, /* remaining configuration options go here */ X {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0} }; X /* Tags */ typedef struct { X char *name; /* Tag identifier */ X char *text; /* Tag text */ X char *lineName; /* Line associated with tag */ X double x, y; /* Coordinate values */ X int anchor; /* Anchor of text around point */ X int rotation; /* Rotation of text around point */ X Pixmap bitmap; /* If not None, use bitmap instead of text */ X XColor *fgColor; /* Foreground color of tag */ X XColor *bgColor; /* Background color of tag */ X XFontStruct *fontPtr; /* Font to use for text */ X GC gc; /* Private graphics context */ } Tag; X #define DEF_TAG_ROTATION "0" #define DEF_TAG_FONT "*-Helvetica-Bold-R-Normal-*-120-*" #define DEF_TAG_BG_MONO WHITE #define DEF_TAG_BG_COLOR WHITE #define DEF_TAG_FG_MONO BLACK #define DEF_TAG_FG_COLOR BLACK X #define DEF_TAG_ANCHOR "center" X static Tk_ConfigSpec tagConfigSpecs[]= { X {TK_CONFIG_ANCHOR, "-anchor", "anchor", "Anchor", X DEF_TAG_ANCHOR, Tk_Offset(Tag, anchor), ALL_MASK}, X {TK_CONFIG_COLOR, "-background", "background", "Background", X DEF_TAG_BG_COLOR, Tk_Offset(Tag, bgColor), X TK_CONFIG_COLOR_ONLY | ALL_MASK}, X {TK_CONFIG_COLOR, "-background", "background", "Background", X DEF_TAG_BG_MONO, Tk_Offset(Tag, bgColor), X TK_CONFIG_MONO_ONLY | ALL_MASK}, X {TK_CONFIG_SYNONYM, "-bg", "background", (char *)NULL, X (char *)NULL, 0, ALL_MASK}, X {TK_CONFIG_BITMAP, "-bitmap", "bitmap", "Bitmap", X (char *)NULL, Tk_Offset(Tag, bitmap), ALL_MASK | TK_CONFIG_NULL_OK}, X {TK_CONFIG_SYNONYM, "-fg", "foreground", (char *)NULL, X (char *)NULL, 0, ALL_MASK}, X {TK_CONFIG_FONT, "-font", "font", "Font", X DEF_TAG_FONT, Tk_Offset(Tag, fontPtr), ALL_MASK}, X {TK_CONFIG_COLOR, "-foreground", "foreground", "Foregound", X DEF_TAG_FG_COLOR, Tk_Offset(Tag, fgColor), X TK_CONFIG_COLOR_ONLY | ALL_MASK}, X {TK_CONFIG_COLOR, "-foreground", "foreground", "Foreground", X DEF_LINE_FG_MONO, Tk_Offset(Tag, fgColor), X TK_CONFIG_MONO_ONLY | ALL_MASK}, X {TK_CONFIG_STRING, "-line", (char *)NULL, (char *)NULL, X (char *)NULL, Tk_Offset(Tag, lineName), XYGRAPH_MASK}, X {TK_CONFIG_STRING, "-bar", (char *)NULL, (char *)NULL, X (char *)NULL, Tk_Offset(Tag, lineName), BARCHART_MASK}, X {TK_CONFIG_INT, "-rotation", "rotation", "Rotation", X DEF_TAG_ROTATION, Tk_Offset(Tag, rotation), ALL_MASK}, X {TK_CONFIG_STRING, "-text", "text", "Text", X (char *)NULL, Tk_Offset(Tag, text), ALL_MASK}, X {TK_CONFIG_CUSTOM, "-xcoordinate", "xCoordinate", "Coordinate", X (char *)NULL, Tk_Offset(Tag, x), ALL_MASK, &ExprOption}, X {TK_CONFIG_CUSTOM, "-ycoordinate", "yCoordinate", "Coordinate", X (char *)NULL, Tk_Offset(Tag, y), ALL_MASK, &ExprOption}, X {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0} }; X /* X * Tick contains information of where and how many ticks are X * to be displayed on an axis. X */ typedef struct { X int numSteps; /* Number of ticks */ X double stepSize; /* Stepping distance for ticks */ X double low; /* Smallest tick */ X double high; /* Largest tick */ } Tick; X /* An axis is a set of options controlling how the axis will be X * displayed. X */ typedef struct { X double minLimit; /* Smallest axis value */ X double maxLimit; /* Largest axis value */ X double range; /* Range of values (maxLimit-minLimit) */ X int offset; /* Offset of plotting region from screen origin */ X double scale; /* Scale factor to convert values to pixels */ X int manualConfig; /* If non-zero, do not automatically configure X * the graph axis. Use user-specified limits. */ X Tick major, minor; /* Information about major and minor ticks */ X int logScale; /* If non-zero, use logarithmic scale for axis */ X char *label; /* Axis label */ X double reqStepSize; /* User defined step size */ X double reqMinimum; /* User defined minimum value */ X double reqMaximum; /* User defined maximum value */ } Axis; X /* X * The data structure below holds information specific to X * how the legend will be displayed. X */ typedef struct { X int isVisible; /* If non-zero, legend is displayed */ X int borderWidth; /* Width of legend 3-D border */ X Tk_3DBorder border; /* 3-D border and background. */ X int relief; /* 3-d effect: TK_RELIEF_RAISED etc. */ X int x, y; /* Position of legend in screen coordinates */ X int usePosition; /* If non-zero, use user-specified position */ X int width; /* Legend width */ X int height; /* Legend height */ X int maxSymSize; /* Size of largest symbol to be displayed */ X int numEntries; /* Number of symbols/labels to display */ } Legend; X X static Tk_CustomOption LegendOption = { X LegendParseProc, LegendPrintProc, NULL }; X /* X * A data structure of the following type is kept for each graph that X * exists within a given instance of a Tcl interpreter X */ typedef struct Graph { X Tk_Window tkwin; /* Window that embodies the widget */ X Tcl_Interp *interp; /* Interpreter associated with widget */ X Tk_3DBorder border; /* 3-D border and background. */ X int borderWidth; /* Width of 3-D border (if any). */ X int relief; /* 3-d effect: TK_RELIEF_RAISED etc. */ X char *geometry; /* Geometry that user requested. */ SHAR_EOF : || echo 'restore of snmp2/snmptcl/graph.c failed' fi echo 'End of snmp2 part 22' echo 'File snmp2/snmptcl/graph.c is continued in part 23' echo 23 > _sharseq.tmp exit 0