From e2d91d1909aaa37a9f43b6fba81107539006f13f Mon Sep 17 00:00:00 2001 From: pnenzi Date: Sun, 25 Jan 2004 09:00:31 +0000 Subject: [PATCH] Added xgraph plotting program. --- Makefile.am | 2 +- configure.in | 28 +- xgraph/INSTALL | 190 +++ xgraph/Makefile.am | 57 + xgraph/Makefile.in | 444 +++++++ xgraph/README | 26 + xgraph/README.ANNOUNCE | 84 ++ xgraph/README.GENERAL | 74 ++ xgraph/README.HARDCOPY | 288 ++++ xgraph/README.INSTALL | 79 ++ xgraph/README.NEWFEATURES | 43 + xgraph/aclocal.m4 | 146 ++ xgraph/alloc.c | 284 ++++ xgraph/autoconf.h.in | 35 + xgraph/bitmaps/dot.11 | 4 + xgraph/bitmaps/gray | 6 + xgraph/bitmaps/mark1.11 | 6 + xgraph/bitmaps/mark2.11 | 6 + xgraph/bitmaps/mark3.11 | 6 + xgraph/bitmaps/mark4.11 | 6 + xgraph/bitmaps/mark5.11 | 6 + xgraph/bitmaps/mark6.11 | 6 + xgraph/bitmaps/mark7.11 | 6 + xgraph/bitmaps/mark8.11 | 6 + xgraph/configure | 2442 ++++++++++++++++++++++++++++++++++ xgraph/configure.in | 34 + xgraph/copyright.h | 65 + xgraph/derivative.c | 130 ++ xgraph/dialog.c | 942 +++++++++++++ xgraph/draw.c | 1263 ++++++++++++++++++ xgraph/examples/Animation.xg | 2047 ++++++++++++++++++++++++++++ xgraph/examples/bar.xg | 21 + xgraph/examples/surface.xg | 1805 +++++++++++++++++++++++++ xgraph/examples/surface2.xg | 631 +++++++++ xgraph/examples/surface3.xg | 667 ++++++++++ xgraph/examples/xgtest.xg | 725 ++++++++++ xgraph/general.h | 0 xgraph/hard_devices.c | 97 ++ xgraph/hard_devices.h | 41 + xgraph/hpgl.c | 337 +++++ xgraph/idraw.c | 498 +++++++ xgraph/init.c | 622 +++++++++ xgraph/install-sh | 251 ++++ xgraph/missing | 190 +++ xgraph/mkinstalldirs | 40 + xgraph/params.c | 567 ++++++++ xgraph/params.h | 127 ++ xgraph/plotter.h | 60 + xgraph/ps.c | 620 +++++++++ xgraph/read.c | 365 +++++ xgraph/st.c | 571 ++++++++ xgraph/st.h | 119 ++ xgraph/stamp-h.in | 1 + xgraph/tgif.c | 329 +++++ xgraph/xgX.c | 480 +++++++ xgraph/xgout.h | 65 + xgraph/xgraph.c | 1279 ++++++++++++++++++ xgraph/xgraph.h | 210 +++ xgraph/xgraph.man | 389 ++++++ xgraph/xtb.c | 1617 ++++++++++++++++++++++ xgraph/xtb.h | 192 +++ 61 files changed, 21673 insertions(+), 4 deletions(-) create mode 100644 xgraph/INSTALL create mode 100644 xgraph/Makefile.am create mode 100644 xgraph/Makefile.in create mode 100644 xgraph/README create mode 100644 xgraph/README.ANNOUNCE create mode 100644 xgraph/README.GENERAL create mode 100644 xgraph/README.HARDCOPY create mode 100644 xgraph/README.INSTALL create mode 100644 xgraph/README.NEWFEATURES create mode 100644 xgraph/aclocal.m4 create mode 100644 xgraph/alloc.c create mode 100644 xgraph/autoconf.h.in create mode 100644 xgraph/bitmaps/dot.11 create mode 100644 xgraph/bitmaps/gray create mode 100644 xgraph/bitmaps/mark1.11 create mode 100644 xgraph/bitmaps/mark2.11 create mode 100644 xgraph/bitmaps/mark3.11 create mode 100644 xgraph/bitmaps/mark4.11 create mode 100644 xgraph/bitmaps/mark5.11 create mode 100644 xgraph/bitmaps/mark6.11 create mode 100644 xgraph/bitmaps/mark7.11 create mode 100644 xgraph/bitmaps/mark8.11 create mode 100755 xgraph/configure create mode 100644 xgraph/configure.in create mode 100644 xgraph/copyright.h create mode 100644 xgraph/derivative.c create mode 100644 xgraph/dialog.c create mode 100644 xgraph/draw.c create mode 100644 xgraph/examples/Animation.xg create mode 100644 xgraph/examples/bar.xg create mode 100644 xgraph/examples/surface.xg create mode 100644 xgraph/examples/surface2.xg create mode 100644 xgraph/examples/surface3.xg create mode 100644 xgraph/examples/xgtest.xg create mode 100644 xgraph/general.h create mode 100644 xgraph/hard_devices.c create mode 100644 xgraph/hard_devices.h create mode 100644 xgraph/hpgl.c create mode 100644 xgraph/idraw.c create mode 100644 xgraph/init.c create mode 100755 xgraph/install-sh create mode 100755 xgraph/missing create mode 100755 xgraph/mkinstalldirs create mode 100644 xgraph/params.c create mode 100644 xgraph/params.h create mode 100644 xgraph/plotter.h create mode 100644 xgraph/ps.c create mode 100644 xgraph/read.c create mode 100644 xgraph/st.c create mode 100644 xgraph/st.h create mode 100644 xgraph/stamp-h.in create mode 100644 xgraph/tgif.c create mode 100644 xgraph/xgX.c create mode 100644 xgraph/xgout.h create mode 100644 xgraph/xgraph.c create mode 100644 xgraph/xgraph.h create mode 100644 xgraph/xgraph.man create mode 100644 xgraph/xtb.c create mode 100644 xgraph/xtb.h diff --git a/Makefile.am b/Makefile.am index 9de328b87..cb390a3ea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = doc src man tests +SUBDIRS = @XGRAPHDIR@ doc src man tests EXTRA_DIST = FAQ acconfig.h autogen.sh NOTES BUGS AUTHORS ChangeLog \ DEVICES NEWS README diff --git a/configure.in b/configure.in index 3507f6f7b..2e2d072f0 100644 --- a/configure.in +++ b/configure.in @@ -116,12 +116,20 @@ dnl --enable-numparams: define NUMPARAMS in the code. This is for .param support AC_ARG_ENABLE(numparam, [ --enable-numparam Enable numparams library support, experimental *not in standard distribution*]) +dnl --enable-xgraph: Compile the xgraph plotting program. Default is "no". +dnl Xgraph is a plotitng package for X11 once very popular. +AC_ARG_ENABLE(xgraph, + [ --enable-xgraph Enable xgraph compilation.]) + dnl --with-readline: Includes GNU readline support into CLI. Default is "no". dnl Including readline into ngspice is a violation of GPL license. It's use dnl is discouraged. AC_ARG_WITH(readline, [ --with-readline[=yes/no] Enable GNU readline support for CLI. Default=no.]) + + + dnl Enable maintainer commands only if requested AM_MAINTAINER_MODE @@ -394,6 +402,16 @@ if test "$enable_pzdebug" = "yes"; then AC_MSG_RESULT(WARNING: Pole/Zero analysis debug is enabled) fi +if test "$enable_xgraph" = "yes"; then + AC_MSG_RESULT(Xgraph compilation enabled.) + AC_CONFIG_SUBDIRS(xgraph) + XGRAPHDIR="xgraph" +else + XGRAPHDIR="" +fi + +AC_SUBST(XGRAPHDIR) + if test "$enable_ekv" = "yes"; then AC_MSG_RESULT(Model EKV included) AC_DEFINE(HAVE_EKV) @@ -502,9 +520,11 @@ AC_SUBST(NUMPARAMDIR) AC_SUBST(NUMPARAMLIB) dnl ---- Option to include GNU readline support in ngspice CLI ---- -if test "$with_readline" != "yes"; then +dnl ---- Default: disabled. ---- +dnl ---- Hope to see in the future readline replacement. ---- + +if test "$with_readline" = "yes"; then AC_MSG_RESULT(GNU readline disabled.) - else AC_MSG_RESULT(Checking for readline:) AC_CHECK_HEADERS([readline/readline.h readline/history.h], @@ -512,9 +532,11 @@ else [AC_MSG_ERROR(Couldn't find GNU readline headers.)]) AC_CHECK_LIB(readline, readline, [LIBS="$LIBS -lreadline"], - [AC_MSG_ERROR(Couldn't find readline libraries.)]) + [AC_MSG_ERROR(Couldn't find readline libraries.)]) fi + + AC_OUTPUT( \ Makefile \ doc/Makefile \ diff --git a/xgraph/INSTALL b/xgraph/INSTALL new file mode 100644 index 000000000..92e3dc91d --- /dev/null +++ b/xgraph/INSTALL @@ -0,0 +1,190 @@ + +XGRAPH INSTALLATION +=================== + + +Quick Start +----------- + +- download the source code +- extract tar file with gzip (gnu zip, not pkzip) and tar + (typically "gunzip + +BEFORE posting to the mailing list. Mailing list info can be found at +the xgraph web page. + + +Xgraph-specific configure options +--------------------------------- + +Use + --with-additional-includes=/path/to/includes +and + --with-additional-libs=/path/to/libs + +if configure can't find particular includes or libraries on your +system. + + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/xgraph/Makefile.am b/xgraph/Makefile.am new file mode 100644 index 000000000..ce9f90d7f --- /dev/null +++ b/xgraph/Makefile.am @@ -0,0 +1,57 @@ +## Process this file with automake to produce Makefile.in + +# Copyright (C) 1999 by John Heidemann + +## shallow +AUTOMAKE_OPTIONS = 1.0 foreign + +bin_PROGRAMS = xgraph +xgraph_c_sources = \ + xgraph.c xgX.c hard_devices.c dialog.c hpgl.c \ + ps.c idraw.c xtb.c st.c params.c alloc.c draw.c \ + init.c read.c tgif.c derivative.c \ + copyright.h \ + general.h \ + hard_devices.h \ + params.h \ + plotter.h \ + st.h \ + xgout.h \ + xgraph.h \ + xtb.h +xgraph_SOURCES = $(xgraph_c_sources) + +man_MANS = xgraph.man + +EXTRA_DIST=\ + $(man_MANS) \ + README.ANNOUNCE \ + README.GENERAL \ + README.HARDCOPY \ + README.INSTALL \ + README.NEWFEATURES \ + bitmaps/dot.11 \ + bitmaps/gray \ + bitmaps/mark1.11 \ + bitmaps/mark2.11 \ + bitmaps/mark3.11 \ + bitmaps/mark4.11 \ + bitmaps/mark5.11 \ + bitmaps/mark6.11 \ + bitmaps/mark7.11 \ + bitmaps/mark8.11 \ + examples/Animation.xg \ + examples/bar.xg \ + examples/surface.xg \ + examples/surface2.xg \ + examples/surface3.xg \ + examples/xgtest.xg + + +# C_WARNINGS = -Wall +C_WARNINGS = +CFLAGS=$(ADDITIONAL_INCLUDES) $(C_WARNINGS) -g $(X_CFLAGS) + +xgraph_LDADD= $(ADDITIONAL_LIBS) $(X_LIBS) $(X_PRE_LIBS) $(X_EXTRA_LIBS) -lX11 -lm + + diff --git a/xgraph/Makefile.in b/xgraph/Makefile.in new file mode 100644 index 000000000..f6d150c04 --- /dev/null +++ b/xgraph/Makefile.in @@ -0,0 +1,444 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Copyright (C) 1999 by John Heidemann + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +ADDITIONAL_INCLUDES = @ADDITIONAL_INCLUDES@ +ADDITIONAL_LIBS = @ADDITIONAL_LIBS@ +CC = @CC@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +AUTOMAKE_OPTIONS = 1.0 foreign + +bin_PROGRAMS = xgraph +xgraph_c_sources = xgraph.c xgX.c hard_devices.c dialog.c hpgl.c ps.c idraw.c xtb.c st.c params.c alloc.c draw.c init.c read.c tgif.c derivative.c copyright.h general.h hard_devices.h params.h plotter.h st.h xgout.h xgraph.h xtb.h + +xgraph_SOURCES = $(xgraph_c_sources) + +man_MANS = xgraph.man + +EXTRA_DIST = $(man_MANS) README.ANNOUNCE README.GENERAL README.HARDCOPY README.INSTALL README.NEWFEATURES bitmaps/dot.11 bitmaps/gray bitmaps/mark1.11 bitmaps/mark2.11 bitmaps/mark3.11 bitmaps/mark4.11 bitmaps/mark5.11 bitmaps/mark6.11 bitmaps/mark7.11 bitmaps/mark8.11 examples/Animation.xg examples/bar.xg examples/surface.xg examples/surface2.xg examples/surface3.xg examples/xgtest.xg + + +# C_WARNINGS = -Wall +C_WARNINGS = +CFLAGS = $(ADDITIONAL_INCLUDES) $(C_WARNINGS) -g $(X_CFLAGS) + +xgraph_LDADD = $(ADDITIONAL_LIBS) $(X_LIBS) $(X_PRE_LIBS) $(X_EXTRA_LIBS) -lX11 -lm +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = autoconf.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_LIBS = @X_LIBS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +xgraph_OBJECTS = xgraph.o xgX.o hard_devices.o dialog.o hpgl.o ps.o \ +idraw.o xtb.o st.o params.o alloc.o draw.o init.o read.o tgif.o \ +derivative.o +xgraph_DEPENDENCIES = +xgraph_LDFLAGS = +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +manmdir = $(mandir)/manm +MANS = $(man_MANS) + +NROFF = nroff +DIST_COMMON = README ./stamp-h.in INSTALL Makefile.am Makefile.in \ +aclocal.m4 autoconf.h.in configure configure.in install-sh missing \ +mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(xgraph_SOURCES) +OBJECTS = $(xgraph_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +autoconf.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/autoconf.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=autoconf.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/autoconf.h.in: $(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f autoconf.h + +maintainer-clean-hdr: + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +xgraph: $(xgraph_OBJECTS) $(xgraph_DEPENDENCIES) + @rm -f xgraph + $(LINK) $(xgraph_LDFLAGS) $(xgraph_OBJECTS) $(xgraph_LDADD) $(LIBS) + +install-manm: + $(mkinstalldirs) $(DESTDIR)$(manmdir) + @list='$(manm_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.m*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(manmdir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(manmdir)/$$inst; \ + done + +uninstall-manm: + @list='$(manm_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.m*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(manmdir)/$$inst"; \ + rm -f $(DESTDIR)$(manmdir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-manm +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-manm + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) autoconf.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)autoconf.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags autoconf.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + $(mkinstalldirs) $(distdir)/bitmaps $(distdir)/examples + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +alloc.o: alloc.c +derivative.o: derivative.c xgraph.h autoconf.h xgout.h +dialog.o: dialog.c copyright.h xgout.h xgraph.h autoconf.h \ + hard_devices.h xtb.h params.h +draw.o: draw.c copyright.h xgraph.h autoconf.h xgout.h xtb.h \ + hard_devices.h params.h +hard_devices.o: hard_devices.c copyright.h xgout.h hard_devices.h \ + params.h xgraph.h autoconf.h +hpgl.o: hpgl.c copyright.h xgraph.h autoconf.h xgout.h plotter.h +idraw.o: idraw.c hard_devices.h xgout.h +init.o: init.c copyright.h xgraph.h autoconf.h xgout.h xtb.h \ + hard_devices.h params.h +params.o: params.c st.h params.h xgraph.h autoconf.h xgout.h \ + hard_devices.h +ps.o: ps.c copyright.h xgraph.h autoconf.h xgout.h +read.o: read.c copyright.h xgraph.h autoconf.h xgout.h xtb.h \ + hard_devices.h params.h +st.o: st.c copyright.h st.h xgraph.h autoconf.h xgout.h +tgif.o: tgif.c hard_devices.h xgout.h +xgX.o: xgX.c copyright.h xgout.h params.h xgraph.h autoconf.h \ + bitmaps/dot.11 bitmaps/mark1.11 bitmaps/mark2.11 \ + bitmaps/mark3.11 bitmaps/mark4.11 bitmaps/mark5.11 \ + bitmaps/mark6.11 bitmaps/mark7.11 bitmaps/mark8.11 +xgraph.o: xgraph.c copyright.h xgraph.h autoconf.h xgout.h xtb.h \ + hard_devices.h params.h +xtb.o: xtb.c xtb.h copyright.h + +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +all-recursive-am: autoconf.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: install-binPROGRAMS +install-exec: install-exec-am + +install-data-am: install-man +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-binPROGRAMS uninstall-man +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) $(MANS) autoconf.h +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/manm + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ + mostlyclean-compile mostlyclean-tags \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ + distclean-tags distclean-generic clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile install-manm uninstall-manm install-man \ +uninstall-man tags mostlyclean-tags distclean-tags clean-tags \ +maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck all-recursive-am install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xgraph/README b/xgraph/README new file mode 100644 index 000000000..87a39db62 --- /dev/null +++ b/xgraph/README @@ -0,0 +1,26 @@ + +xgraph 12.1 + + +distributed by the VINT project + + + +Welcome to the VINT release of xgraph. +Xgraph is an X-Windows application that includes: + + - interactive plotting and graphing, by David Harrison of UC Berkeley + - animation and deritives, added by Paul Walker of NCSA + - portability and bug fixes, by the VINT project + + +See the file "INSTALL" for installation instructions. + +If you have installation problems or questions, check: + + + +BEFORE posting to the mailing list. Mailing list info can be found at +the xgraph web page. + + diff --git a/xgraph/README.ANNOUNCE b/xgraph/README.ANNOUNCE new file mode 100644 index 000000000..977f4013d --- /dev/null +++ b/xgraph/README.ANNOUNCE @@ -0,0 +1,84 @@ + +A new version of xgraph is now available. Xgraph is a popular +two-dimensional plotting program that accepts data in a form similar +to the unix program graph and displays line graphs, scatter plots, or +bar charts on an X11 display. These graphs are fully annotated with a +title, axis numbering and labels, and a legend. Zooming in on regions +of a graph is supported. The program can automatically generate +hardcopy output to Postscript printers and HPGL plotters. A new +option allows xgraph output to be directly pasted into idraw for +further annotation. + +This program is NOT a widget. It is a stand-alone program written at +the Xlib level and should run on any machine with a reasonable +implementation of X11 release 3 or later. The source for the program +is available through anonymous ftp to shambhala.Berkeley.EDU +(128.32.132.54): + + % ftp shambhala.Berkeley.EDU + Name: anonymous + Password: + ftp> cd pub + ftp> binary + ftp> get xgraph-11.tar.Z + ftp> quit + % uncompress xgraph-11.tar.Z + % tar xf xgraph-11.tar + +This will create a directory called xgraph-11. In that directory +you will find a file called README.INSTALL that contains directions +for building the program. I plan to submit the sources to the +moderator of comp.sources.x after I have tested the program under X11 +release 4 (meaning a few weeks after the X Consortium releases the +distribution). + +Those who do not have ftp access can obtain the source for xgraph +using a mail archive system I have installed on dent.Berkeley.EDU +(courtesy of Brian Reid at Digital). An example is given below: + + To: ucbvax!dent!archive-server + Subject: send programs xgraph.shar.01 xgraph.shar.02 + + send programs xgraph.shar.03 xgraph.shar.04 xgraph.shar.05 + send programs xgraph.shar.06 xgraph.shar.07 xgraph.shar.08 + +The archive server will send you these files as time and load permits. +They are standard shell archives and can be unpacked by running them +through /bin/sh (in order). If you would like to know more about the +mail server, send a message with a subject of "help". I am afraid I +am no mail wizard so I cannot help you determine a path to dent. + +For those familar with xgraph, the most important changes are +summarized below: + +- A new data reader has been written that allows discontinuous data in + each data set. Also, nearly all of the display options for xgraph + can be set in the data file. The reader is also more forgiving + about blank lines and excess white space. + +- A new option has been added to the Postscript hardcopy facility to + allow xgraph output to be included in other documents using psfig. + As mentioned above, xgraph output can be imported into idraw for + further annotation if necessary. + +- I received lots of complaints about the way xgraph obtains fonts and + visuals. The new xgraph uses a much simpler scheme to obtain these + resources and has fall back code to insure it will run in almost any + situation. + +- Options handling has been cleaned up substantially. Xgraph options + can now be specified as X resources (~/.Xdefaults), in the data + file, or on the command line. + +- Drawing is somewhat faster on some servers due to a better choice of + initial defaults. + +Please send all bug reports, questions, comments or suggestions to +the electronic address below. + + David Harrison + UC Berkeley Electronics Research Lab + (davidh@ic.Berkeley.EDU, ...!ucbvax!ucbcad!davidh) + + + diff --git a/xgraph/README.GENERAL b/xgraph/README.GENERAL new file mode 100644 index 000000000..0296af327 --- /dev/null +++ b/xgraph/README.GENERAL @@ -0,0 +1,74 @@ + +This directory contains source for the X11 version of xgraph, a +two-dimensional data plotting program. Those familar with the X10 +version of this program will find that is completely compatible. +However, there are a few important notes and changes you should +be aware of: + +1. The program was developed and tested on X11 release 3 on a + color VAXstation GPX and on a color DECstation 3100. It should + work on most other servers without change but has not been tested + on these other configurations. If you have problems, please send + a note to: + + davidh@ic.Berkeley.EDU + or + ...!ucbvax!ucbcad!davidh + +2. This version includes an improved hardcopy facility. + An additional option, "Include in Document", has been added since + the first X11 release. A new output type, Idraw, has also been + added. See the manual page for details about the hardcopy dialog. + +3. There are several changes to the input format for xgraph. However, + the new format is compatible with the old and there should be no + problem running xgraph with old data sets. The new form allows + discontinuous data in data sets (using the "move" operator), + parameter specification using a format similar to that found in the + ~/.Xdefaults file, and comments. See the manual page for details. + +4. In some cases, xgraph uses dashed lines to distinguish different + data sets. Some servers are notoriously slow at rendering dashed + lines. Be prepared for a significantly reduced performance on + those servers. + +5. Xgraph now uses software clipping to clip data to its display + windows. This means you should be able to zoom in much farther + on large data sets than was possible under the X10 version. + +6. Xgraph used to use some rather sophisticated heuristics to handle + visuals and colormaps. Due to complaints, I have removed these + heuristics. Xgraph will display on whatever screen is specified in + the DISPLAY environment variable or on the command line. + +7. I plan to add full ICCCM support when X11 release 4 becomes + available. In the meantime, the program should work under most + window mangers (it is somewhat conformant already). + +8. As a follow-on to (7), note that the operation of the program + is heavily influenced by your choice of window managers. Focus + based window managers (like dxwm from Digital) will require you + to set focus in the text input slots of the hardcopy dialog box. + +9. Many people have sent me notes about the state of code of xgraph. + Xgraph was constructed initially as a challenge from another + programmer here at Berkeley. The first version of the program was + written in an afternoon. Since then, the program has "evolved" + quite dramatically. Since this is not my primary work, I generally + tacked on features quickly as the need became apparent. Some day, + I would truely like to rewrite it. Until then, please bear with + me. + +10. Since xgraph has become quite popular, those in positions of power + have recommended I add the standard UC Berkeley copyright notice + to this software. See copyright.h for details. + +11. Many people have sent me suggestions and comments. Some have + written new code or sent patches to fix problems. I greately + appreciate these contributions. Special thanks go to Beorn Johnson + and Alan Kramer for the idraw output code. + + David Harrison + UC Berkeley Electronics Research Lab + (davidh@ic.Berkeley.EDU, ...!ucbvax!ucbcad!davidh) + diff --git a/xgraph/README.HARDCOPY b/xgraph/README.HARDCOPY new file mode 100644 index 000000000..d198776e7 --- /dev/null +++ b/xgraph/README.HARDCOPY @@ -0,0 +1,288 @@ +/* + * Hardcopy Interface for Xgraph + * + * Major differences from first version: + * A flags argument has been added to xg_init(). This new argument + * is used to specify a new binary option: D_DOCU. See below + * for details. + * + * Four new parameters are passed to the device initialization routine: + * title_family, title_size, axis_family, and axis_size. See the + * description of xg_init() for details. + * + * Clipping is done automatically by xgraph. The xg_clip() routine + * is obsolete. + * + * The xg_line() routine has become the xg_seg() routine. It now + * draws segments rather than a series of lines. + * + * A new field (max_segs) in the device structure now specifies + * the maximum number of segments the device can handle in a group. + */ + + +/* + * Adding an output device to xgraph + * + * Step 1 + * Write versions of the following routines for your device: + * xg_init(), xg_text(), xg_seg(), xg_dot(), and xg_end(). + * The interface and function of these routines are described + * in detail below. These routines should be named according + * to your device. For example, the initialization routine + * for the Postscript output device is psInit(). Also, name + * your source file after your device (e.g. the postscript + * routines are in the file ps.c). Instructions continue + * after the description of the interface routines. + * + * The definitions below are quoted here as a convenience. In + * your output module, you can include "xgout.h" to obtain these + * definitions. + */ + +#define D_COLOR 0x01 +#define ERRBUFSIZE 2048 + +#define D_DOCU 0x01 + +typedef struct xg_out { + int dev_flags; /* Device characteristic flags */ + int area_w, area_h; /* Width and height in pixels */ + int bdr_pad; /* Padding from border */ + int axis_pad; /* Extra space around axis labels */ + int tick_len; /* Length of a tick mark */ + int legend_pad; /* Top of legend text to legend line */ + int axis_width; /* Width of big character of axis font */ + int axis_height; /* Height of big character of axis font */ + int title_width; /* Width of big character of title font */ + int title_height; /* Height of big character of title font */ + int max_segs; /* Maximum number of segments in group */ + + void (*xg_text)(); /* Draws text at a location */ + void (*xg_seg)(); /* Draws a series of segments */ + void (*xg_dot)(); /* Draws a dot or marker at a location */ + void (*xg_end)(); /* Stops the drawing sequence */ + + char *user_state; /* User supplied state information */ +} xgOut; + + +int xg_init(strm, width, height, title_family, title_size, + axis_family, axis_size, out_info, errmsg) +FILE *strm; /* Output stream */ +int width, height; /* Size of space (microns) */ +char *title_family; /* Name of title font family */ +double title_size; /* Title font height (points) */ +char *axis_family; /* Name of axis font family */ +double axis_size; /* Axis font height (points) */ +int flags; /* Flags (see below) */ +xgOut *out_info; /* Device info (RETURN) */ +char errmsg[ERRBUFSIZE]; /* Error message area */ +/* + * This routine is called by xgraph just before drawing is to + * begin. The desired size of the plot is given by `width' + * and `height'. The parameters `title_family', `title_size', + * `axis_family', and `axis_size' specify the names of the + * title and axis fonts and their vertical sizes (in points). + * These parameters can be ignored if your device does not + * support multiple fonts. The `flags' argument specifies + * certain binary flags to the output routines. These + * flags are: + * D_DOCU: + * If this flag is set, it indicates the user has specified that + * the output will be included in some larger document. Devices + * may choose to use this information to produce output that + * can be integrated into documents with less effort. For example, + * the Postscript output routines produce bounding box information + * when this flag is set. + * The routine should fill in all of the fields of `out_info' with + * appropriate values. The values are described below: + * area_w, area_h: + * Size of the drawing space in device coordinates. + * This should take in account the requested area + * given by `width', and `height'. + * bdr_pad: + * Xgraph will leave this number of device coordinates around + * all of the outer edges of the graph. + * axis_pad: + * Additional space around axis labels (in devcoords) + * so that the labels do not appear crowded. + * legend_pad: + * Space (in devcoords) from the top of legend text to + * the representative line drawn above the legend text. + * tick_len: + * Size of a tick mark placed on axis (in devcoords) + * axis_width: + * An estimate of the width of a large character in + * the axis font (in devcoords). This can be an overestimate. An + * underestimate may produce bad results. + * axis_height: + * An estimate of the height of a large character in + * the axis labeling font (in devcoords). + * title_width, title_height: + * Same as above except for the title font. + * max_segs: + * Due to buffering constraints, some devices may not be able to + * handle massive segment lists. This parameter tells xgraph not + * to send more than `max_segs' segments in one request. + * Output to the device should be written to the stream `strm'. + * The functions are described individually below. After filling + * in the parameters and setting the function pointers, the routine + * should initialize its drawing state and store any extra needed + * information in `user_state'. This value will be passed to all + * other routines during the drawing sequence. If the device + * cannot initialize, it should return a zero status and fill + * `errmsg' with an informative error message. + */ + +/* Text justifications */ +#define T_CENTER 0 +#define T_LEFT 1 +#define T_UPPERLEFT 2 +#define T_TOP 3 +#define T_UPPERRIGHT 4 +#define T_RIGHT 5 +#define T_LOWERRIGHT 6 +#define T_BOTTOM 7 +#define T_LOWERLEFT 8 + +/* Text styles */ +#define T_AXIS 0 +#define T_TITLE 1 + +void xg_text(user_state, x, y, text, just, style) +char *user_state; /* Value set in xg_init */ +int x, y; /* Text position (pixels) */ +char *text; /* Null terminated text */ +int just; /* Justification (above) */ +int style; /* Text style (above) */ +/* + * This routine should draw text at the indicated position using + * the indicated justification and style. The justification refers + * to the location of the point in reference to the text. For example, + * if just is T_LOWERLEFT, (x,y) should be located at the lower left + * edge of the text string. + */ + +/* Line Styles */ +#define L_AXIS 0 +#define L_ZERO 1 +#define L_VAR 2 + +void xg_seg(user_state, ns, seglist, width, style, lappr, color) +char *user_state; /* Value set in xg_init */ +int ns; /* Number of segments */ +XSegment *seglist; /* X array of segments */ +int width; /* Width of lines */ +int style; /* See above */ +int lappr; /* Line appearence */ +int color; /* Line color (if any) */ +/* + * This routine draws a number of line segments at the points + * given in `seglist'. Note that contiguous segments need not share + * endpoints but often do. All segments should be `width' devcoords wide + * and drawn in style `style'. The `width' may be zero meaning that + * the line should be drawn as thin as the device allows. If `style' is + * L_VAR, the parameters `color' and `lappr' should be used to draw the + * line. Both parameters vary from 0 to 7. If the device is capable of + * color, `color' varies faster than `style'. If the device + * has no color, `style' will vary faster than `color' and + * `color' can be safely ignored. However, if the + * the device has more than 8 line appearences, the two can + * be combined to specify 64 line style variations. + * Xgraph promises not to send more than the `max_segs' in the + * xgOut structure passed back from xg_init(). + */ + +/* Marker styles */ +#define P_PIXEL 0 +#define P_DOT 1 +#define P_MARK 2 + +void xg_dot(user_state, x, y, style, type, color) +char *user_state; /* Value set in xg_init */ +int x, y; /* Location in pixel units */ +int style; /* Dot style */ +int type; /* Type of marker */ +int color; /* Marker color (if any) */ +/* + * This routine should draw a marker at location `x,y'. If the + * style is P_PIXEL, the dot should be a single pixel. If + * the style is P_DOT, the dot should be a reasonably large + * dot. If the style is P_MARK, it should be a distinguished + * mark which is specified by `type' (0-7). If the output + * device is capable of color, the marker should be drawn in + * `color' (0-7) which corresponds with the color for xg_line. + */ + +void xg_end(user_state) +char *user_state; +/* + * This routine is called after a drawing sequence is complete. + * It can be used to clean up the user state and set the device + * state appropriately. This routine is optional in the structure. + */ + +/* + * Adding an output device to xgraph + * + * Step 2 + * Edit the file hard_devices.c. Declare your initialization + * function and add your device to the list of devices, + * hard_devices[]. The structure hard_dev is described below + * and is defined in hard_devices.h: + */ + +#define MFNAME 25 + +typedef enum hard_dev_docu_defn { NONE, NO, YES } hard_dev_docu; + +typedef struct hard_dev { + char *dev_name; /* Device name */ + int (*dev_init)(); /* Initialization function */ + char *dev_spec; /* Default pipe program */ + char dev_file[MFNAME]; /* Default file name */ + char dev_printer[MFNAME]; /* Default printer name */ + double dev_max_dim; /* Default maximum dimension (cm) */ + char dev_title_font[MFNAME];/* Default name of title font */ + double dev_title_size; /* Default size of title font (pnts) */ + char dev_axis_font[MFNAME]; /* Default name of axis font */ + double dev_axis_size; /* Default size of axis font (pnts) */ + hard_dev_docu dev_docu; /* Document predicate */ +}; + +/* + * dev_spec: + * The dev_spec field should be a command that directly outputs to + * your device. The command should contain one %s directive that + * will be filled in with the name of the device from the hardcopy + * dialog. + * dev_file: + * The default file to write output to if the user selects `To File'. + * dev_printer: + * The default printer to write output to if the user selects + * `To Device'. + * dev_max_dim: + * The default maximum dimension for the device in centimeters. + * dev_title_font, dev_title_size: + * The default title font and size. Sizes are specified in + * points (1/72 inch). + * dev_axis_font, dev_axis_size: + * The default axis font and size. + * dev_docu + * Some devices may require extra preparation when including xgraph + * output in a document. This parameter indicates the default + * value of the Document predicate in the hardcopy dialog. If + * the value is NONE, the device doesn't need any special preparation + * for producing output for inclusion in documents. + */ + +/* + * Adding an output device to xgraph + * + * Step 3 + * Edit the file Makefile. Add your source file to the SRC variable + * and the corresponding object file to the OBJ variable. Finally, + * remake xgraph. Your device should now be available in the + * hardcopy dialog. + */ diff --git a/xgraph/README.INSTALL b/xgraph/README.INSTALL new file mode 100644 index 000000000..de072ba7f --- /dev/null +++ b/xgraph/README.INSTALL @@ -0,0 +1,79 @@ + +This file contains instructions for building the X11 version of xgraph. +When unpacked, the source is distributed in three directories: + + xgraph-11 Source for the program + xgraph-11/bitmaps Bitmaps used for cursors and markers + xgraph-11/examples Sample data for trying out the program + +First, you should examine the file hard_devices.c. This file lists +the default hardcopy parameters for each hardcopy output device. Some +of these defaults are site-specific and should be taylored to your +site. For example, at our site, the default HPGL plotter is called +"paper" and the default Postscript printer is called "lps40". You can +change these names in this file. See hard_devices.h for a description +of the initialization fields. + +If you do not like the default values for xgraph options, you can +change these by editing the default values as listed on the third page +in xgraph.c. Remember that changing these values changes the default +behaviour for everyone running the program. Personal preference +should be left for specification in the user's Xresources or Xdefaults +file. + +An Imakefile is provided for compiling the program in an X11 release 3 +source tree. If you have such a source tree, type the following in +the xgraph-11 directory: + + % make TOP= + +where is the top level directory of the X11 release +3 source tree. If you don't have an X11 source tree but you have all +of the X libraries and include files installed in "standard +locations", type the following the in the xgraph-11 directory: + + % make -f Makefile.std + +Either of these commands will produce an executable xgraph in the +xgraph-11 directory. If you are installing the program in an X11 +source tree, you can use the following to install the program and +manual page in the proper locations: + + % make TOP= install + % make TOP= install.man + +You might want to try these commands with the "-n" option once to make +sure the program and manual page are installed in the proper +directories. If they aren't, you may want to change the DESTDIR +variable and try again. If you really need to change the Makefile +options, you can generate a new Makefile from the Imakefile using +imake as provided on the X11 release tape. + +Several example data sets are provided in the xgraph-11/examples +directory. Try the following to check out xgraph: + + % xgraph examples/xgtest.xg + +This should produce a graph with a series of parabolic curves. + +Other documentation files are included. A summary of these +files is given below: + +README.ANNOUNCE Message submitted to comp.windows.x announcing + the program and how to obtain it. + +README.GENERAL Important notes about differences and quirks + of the program. + +README.HARDCOPY Documenation for writing your own hardcopy + driver library. + +README.INSTALL This file. + +xgraph.man Xgraph manual page. + + David Harrison + UC Berkeley Electronics Research Lab + (davidh@ic.Berkeley.EDU, ...!ucbvax!ucbcad!davidh) + + diff --git a/xgraph/README.NEWFEATURES b/xgraph/README.NEWFEATURES new file mode 100644 index 000000000..2580de307 --- /dev/null +++ b/xgraph/README.NEWFEATURES @@ -0,0 +1,43 @@ +This code is essentially XGraph release 11.4, with some modifications +which were made for use by the NCSA Relativity group. +These modifications were made by Paul Walker, and he should be +contacted at the below address if you have any problems/questions +regarding these features. + +1. Animation. XGraph will now do a *very* crude animation of + your data sets. It occasionally has problems with refreshes + and will consequently run your animation three of four times. + Consider this an undocumented feature! You can adjust the + speed of the animation with the -dl option. I find "2" works + well on a sparc displaying on MacX, "5" on a sparc on its + own display, and "10" on an SGI or RS6K on its own display. + Remeber, this animation is not being advertised as anything + other than very crude, so if you are looking for production + quality video, turn elsewhere. We find it useful as it will + quickly generate animation which shows time evolution. + +2. Differentation. You can press the "Derivative" button to + see the first and second derivatives of your data set. The + method is a standard centered difference. You cannot display + higher than second derivatives. Animation, zooming, etc... + work in each of the derivative windows. Endpoints are found + linearly interpolating inner values to ends, so pay them + little heed! + +3. New Color Map. We couldn't differentiate the colors once we + got past yellow, so we created a new color map. If you don't + like it, look in init.c for the variable "defColors" and + comment out the new one, replacing it with the commented + old one. Of course, you are free to insert your own choices + here also ... Just use standard X color names. + + +These modifications were made by Paul Walker, and distributed with the +Original author's consent. See Copyright.h for information about +distribution and ownership of these changes. Contact Paul Walker at + +Paul Walker +NCSA +605 E. Springfield Ave +Champaign IL 61820 +pwalker@ncsa.uiuc.edu diff --git a/xgraph/aclocal.m4 b/xgraph/aclocal.m4 new file mode 100644 index 000000000..fd58a3053 --- /dev/null +++ b/xgraph/aclocal.m4 @@ -0,0 +1,146 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + + +# serial 1 + +AC_DEFUN(AM_WITH_DMALLOC, +[AC_MSG_CHECKING(if malloc debugging is wanted) +AC_ARG_WITH(dmalloc, +[ --with-dmalloc use dmalloc, as in + ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz], +[if test "$withval" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(WITH_DMALLOC,1, + [Define if using the dmalloc debugging malloc package]) + LIBS="$LIBS -ldmalloc" + LDFLAGS="$LDFLAGS -g" +else + AC_MSG_RESULT(no) +fi], [AC_MSG_RESULT(no)]) +]) + diff --git a/xgraph/alloc.c b/xgraph/alloc.c new file mode 100644 index 000000000..357771c05 --- /dev/null +++ b/xgraph/alloc.c @@ -0,0 +1,284 @@ +/* $Header$ */ +/* + * + * alloc.c : Memory checked Malloc. This malloc keeps track of memory usage. + * + * Routines: + * char * Malloc(); + * char * Calloc(); + * char * Realloc(); + * void Free(); + * unsigned MemStat(); + * unsigned MemPtr(); + * void MemChain(); + * + * $Log$ + * Revision 1.1 2004-01-25 09:00:49 pnenzi + * + * Added xgraph plotting program. + * + * Revision 1.1.1.1 1999/12/03 23:15:53 heideman + * xgraph-12.0 + * + * Revision 1.10 1991/02/01 08:12:55 christos + * Overhaul... Simplified and added calloc. + * + * Revision 1.9 1990/10/02 18:11:24 christos + * Another Realloc() bug! + * + * Revision 1.8 90/10/02 17:32:45 christos + * Fixed Realloc() bug. + * + * Revision 1.7 90/08/24 02:28:15 christos + * Changed bigstruct_t to align_t + * for lint. + * + * Revision 1.6 90/07/15 17:31:33 christos + * Fixed MemPtr Bug + * + * Revision 1.5 90/07/11 16:19:31 christos + * Added Realloc() + * + * Revision 1.4 90/03/21 12:58:44 christos + * Fixed void buggy computations. + * + * Revision 1.3 90/02/26 02:15:11 christos + * ANSI conformance. + * + * Revision 1.2 89/08/29 14:08:25 christos + * Fixed. + * + * Revision 1.1 89/03/27 14:23:40 christos + * Initial revision + * + */ +#ifndef lint +static char rcsid[] = "$Id$"; + +#endif /* lint */ +#include +#ifdef __STDC__ +#include +#include +#else +extern char *malloc(); +extern char *calloc(); +extern char *realloc(); +extern void free(); +extern void abort(); +extern char *memset(); + +#endif + +#ifndef NIL +#define NIL(a) ((a *) 0) +#endif /* NIL */ + +#ifndef MIN +#define MIN(a, b) ((a) > (b) ? (b) : (a)) +#endif /* MIN */ + +#ifndef MAX +#define MAX(a, b) ((a) < (b) ? (b) : (a)) +#endif /* MAX */ + +#ifndef private +#define private static +#endif /* private */ + +#ifndef public +#define public +#endif /* public */ + + +#define SIG_GOOD 0x01020304 +#define SIG_FREE 0x04030201 +#define OVERHEAD (sizeof(long) + sizeof(unsigned)) + +private unsigned memused = 0; +private unsigned memalloc = 0; + +#ifdef __STDC__ +typedef void *Ptr; + +#else +typedef char *Ptr; + +#endif + +/* _chaina(): + * Check things for validity and allocate space + */ +private Ptr +_chaina(n, routine, action, tptr) +unsigned n; + +Ptr(*routine) (); +char *action; +Ptr tptr; +{ + char *ptr; + + if (n == 0) { + (void) fprintf(stderr, "*** %s zero length block.\n", + action); + if (tptr != (Ptr) 0) { + ptr = tptr; + *((long *) ptr) = SIG_GOOD; + memused += *((unsigned *) &ptr[sizeof(long)]); + memalloc++; + } + abort(); + } + + ptr = (tptr == (Ptr) 0) ? (char *) (*routine) (n + OVERHEAD) : + (char *) (*routine) (tptr, n + OVERHEAD); + + if (ptr == NIL(char)) { + if (tptr != (Ptr) 0) + *((long *) tptr) = SIG_GOOD; + (void) fprintf(stderr, + "*** Out of memory in %s (current allocation %d).\n", + action, memused, n); + + abort(); + } + *((long *) ptr) = SIG_GOOD; + memused += (*((unsigned *) &ptr[sizeof(long)]) = n); + memalloc++; + ptr += OVERHEAD; + return ((Ptr) ptr); +} /* end _chaina */ + + +/* _chainc(): + * Check the pointer given + */ +private unsigned +_chainc(ptr, action) +char **ptr; +char *action; +{ + static char *msg = "*** %s %s pointer.\n"; + + if (*ptr == NIL(char)) { + (void) fprintf(stderr, msg, action, "nil"); + abort(); + } + *ptr -= OVERHEAD; + switch (*((long *) *ptr)) { + case SIG_GOOD: + return (*((unsigned *) &((*ptr)[sizeof(long)]))); + case SIG_FREE: + (void) fprintf(stderr, msg, action, "free"); + abort(); + default: + (void) fprintf(stderr, msg, action, "invalid"); + abort(); + } + return (0); +} /* end _chainc */ + + +/* Malloc(): + * real alloc + */ +public Ptr +Malloc(n) +unsigned n; +{ + static char *routine = "malloc"; + + return (_chaina(n, malloc, routine, (Ptr) 0)); +} /* end Malloc */ + + +/* Calloc(): + * real alloc + */ +public Ptr +Calloc(n, sz) +unsigned n, + sz; +{ + Ptr ptr; + static char *routine = "calloc"; + + n *= sz; + ptr = _chaina(n, malloc, routine, (Ptr) 0); + memset((char *) ptr, 0, n); + return (ptr); +} /* end Calloc */ + + +/* Realloc(): + * real alloc + */ +public Ptr +Realloc(ptr, n) +Ptr ptr; +unsigned n; +{ + static char *routine = "realloc"; + + memused -= _chainc((char **) &ptr, routine); + memalloc--; + *((long *) ptr) = SIG_FREE; + return (_chaina(n, realloc, routine, ptr)); +} /* end Realloc */ + + +/* Free(): + * free memory counting the number of bytes freed + */ +public void +Free(ptr) +Ptr ptr; +{ + static char *routine = "free"; + + memused -= _chainc((char **) &ptr, routine); + memalloc--; + *((long *) ptr) = SIG_FREE; + free(ptr); +} /* end Free */ + + +/* MemChain(): + * Dump the chain + */ +public void +MemChain() +{ + if (memused == 0 && memalloc == 0) + (void) fprintf(stdout, "\tNo memory allocated.\n"); + else { + (void) fprintf(stdout, "\t%u Bytes allocated in %u chunks.\n", memused, + memalloc); + (void) fprintf(stdout, "\tAverage chunk length %u bytes.\n", + memused / memalloc); + } +} /* end MemChain */ + + +/* MemStat(): + * return the amount of memory in use + */ +public unsigned +MemStat() +{ + return (memused); +} /* end MemStat */ + + +/* MemPtr(): + * return the amount of memory used by the pointer + */ +public unsigned +MemPtr(ptr) +Ptr ptr; +{ + static char *routine = "get size"; + + return (_chainc((char **) &ptr, routine)); +} /* end MemPtr */ diff --git a/xgraph/autoconf.h.in b/xgraph/autoconf.h.in new file mode 100644 index 000000000..870854f7d --- /dev/null +++ b/xgraph/autoconf.h.in @@ -0,0 +1,35 @@ +/* autoconf.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the header file. */ +#undef HAVE_FLOAT_H + +/* Define if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + +/* Define if using the dmalloc debugging malloc package */ +#undef WITH_DMALLOC + diff --git a/xgraph/bitmaps/dot.11 b/xgraph/bitmaps/dot.11 new file mode 100644 index 000000000..29fa09d71 --- /dev/null +++ b/xgraph/bitmaps/dot.11 @@ -0,0 +1,4 @@ +#define dot_width 8 +#define dot_height 8 +static char dot_bits[] = { + 0x00, 0x3c, 0x7e, 0x7e, 0x7e, 0x7e, 0x3c, 0x00}; diff --git a/xgraph/bitmaps/gray b/xgraph/bitmaps/gray new file mode 100644 index 000000000..12ff0b981 --- /dev/null +++ b/xgraph/bitmaps/gray @@ -0,0 +1,6 @@ +#define gray_width 16 +#define gray_height 16 +static char gray_bits[] = { + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa}; diff --git a/xgraph/bitmaps/mark1.11 b/xgraph/bitmaps/mark1.11 new file mode 100644 index 000000000..c049d44d7 --- /dev/null +++ b/xgraph/bitmaps/mark1.11 @@ -0,0 +1,6 @@ +#define mark1_width 8 +#define mark1_height 8 +#define mark1_x_hot 3 +#define mark1_y_hot 3 +static char mark1_bits[] = { + 0x00, 0x00, 0x1c, 0x1c, 0x1c, 0x00, 0x00, 0x00}; diff --git a/xgraph/bitmaps/mark2.11 b/xgraph/bitmaps/mark2.11 new file mode 100644 index 000000000..25137a453 --- /dev/null +++ b/xgraph/bitmaps/mark2.11 @@ -0,0 +1,6 @@ +#define mark2_width 8 +#define mark2_height 8 +#define mark2_x_hot 3 +#define mark2_y_hot 3 +static char mark2_bits[] = { + 0x00, 0x3e, 0x22, 0x22, 0x22, 0x3e, 0x00, 0x00}; diff --git a/xgraph/bitmaps/mark3.11 b/xgraph/bitmaps/mark3.11 new file mode 100644 index 000000000..d1d92737d --- /dev/null +++ b/xgraph/bitmaps/mark3.11 @@ -0,0 +1,6 @@ +#define mark3_width 8 +#define mark3_height 8 +#define mark3_x_hot 3 +#define mark3_y_hot 3 +static char mark3_bits[] = { + 0x00, 0x1c, 0x36, 0x22, 0x36, 0x1c, 0x00, 0x00}; diff --git a/xgraph/bitmaps/mark4.11 b/xgraph/bitmaps/mark4.11 new file mode 100644 index 000000000..213693674 --- /dev/null +++ b/xgraph/bitmaps/mark4.11 @@ -0,0 +1,6 @@ +#define mark4_width 8 +#define mark4_height 8 +#define mark4_x_hot 3 +#define mark4_y_hot 3 +static char mark4_bits[] = { + 0x00, 0x22, 0x14, 0x08, 0x14, 0x22, 0x00, 0x00}; diff --git a/xgraph/bitmaps/mark5.11 b/xgraph/bitmaps/mark5.11 new file mode 100644 index 000000000..1200f0794 --- /dev/null +++ b/xgraph/bitmaps/mark5.11 @@ -0,0 +1,6 @@ +#define mark5_width 8 +#define mark5_height 8 +#define mark5_x_hot 3 +#define mark5_y_hot 3 +static char mark5_bits[] = { + 0x00, 0x08, 0x14, 0x22, 0x14, 0x08, 0x00, 0x00}; diff --git a/xgraph/bitmaps/mark6.11 b/xgraph/bitmaps/mark6.11 new file mode 100644 index 000000000..41393ea1a --- /dev/null +++ b/xgraph/bitmaps/mark6.11 @@ -0,0 +1,6 @@ +#define mark6_width 8 +#define mark6_height 8 +#define mark6_x_hot 3 +#define mark6_y_hot 3 +static char mark6_bits[] = { + 0x00, 0x1c, 0x14, 0x1c, 0x14, 0x1c, 0x00, 0x00}; diff --git a/xgraph/bitmaps/mark7.11 b/xgraph/bitmaps/mark7.11 new file mode 100644 index 000000000..846782480 --- /dev/null +++ b/xgraph/bitmaps/mark7.11 @@ -0,0 +1,6 @@ +#define mark7_width 8 +#define mark7_height 8 +#define mark7_x_hot 3 +#define mark7_y_hot 3 +static char mark7_bits[] = { + 0x00, 0x1c, 0x2a, 0x36, 0x2a, 0x1c, 0x00, 0x00}; diff --git a/xgraph/bitmaps/mark8.11 b/xgraph/bitmaps/mark8.11 new file mode 100644 index 000000000..c1b98f911 --- /dev/null +++ b/xgraph/bitmaps/mark8.11 @@ -0,0 +1,6 @@ +#define mark8_width 8 +#define mark8_height 8 +#define mark8_x_hot 3 +#define mark8_y_hot 3 +static char mark8_bits[] = { + 0x00, 0x3e, 0x1c, 0x08, 0x1c, 0x3e, 0x00, 0x00}; diff --git a/xgraph/configure b/xgraph/configure new file mode 100755 index 000000000..4f909ca87 --- /dev/null +++ b/xgraph/configure @@ -0,0 +1,2442 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --with-dmalloc use dmalloc, as in + ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz" +ac_help="$ac_help + --with-x use the X Window System" +ac_help="$ac_help +--with-additional-includes=path" +ac_help="$ac_help +--with-additional-libs=path" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=xgraph.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:565: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:618: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:675: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=xgraph + +VERSION=12.1 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:721: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:734: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:747: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:760: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:773: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + + + + + +echo $ac_n "checking if malloc debugging is wanted""... $ac_c" 1>&6 +echo "configure:792: checking if malloc debugging is wanted" >&5 +# Check whether --with-dmalloc or --without-dmalloc was given. +if test "${with_dmalloc+set}" = set; then + withval="$with_dmalloc" + if test "$withval" = yes; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define WITH_DMALLOC 1 +EOF + + LIBS="$LIBS -ldmalloc" + LDFLAGS="$LDFLAGS -g" +else + echo "$ac_t""no" 1>&6 +fi +else + echo "$ac_t""no" 1>&6 +fi + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:816: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:846: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:897: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:929: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 940 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:971: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:976: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1004: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1037: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1092: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +# If we find X, set shell vars x_includes and x_libraries to the +# paths, otherwise set no_x=yes. +# Uses ac_ vars as temps to allow command line to override cache and checks. +# --without-x overrides everything else, but does not touch the cache. +echo $ac_n "checking for X""... $ac_c" 1>&6 +echo "configure:1121: checking for X" >&5 + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + : +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else +if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=NO ac_x_libraries=NO +rm -fr conftestdir +if mkdir conftestdir; then + cd conftestdir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat > Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case "$ac_im_incroot" in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; + esac + case "$ac_im_usrlibdir" in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; + esac + fi + cd .. + rm -fr conftestdir +fi + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1188: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + # Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done +fi +rm -f conftest* +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ + /usr/X11/lib \ + /usr/X11R6/lib \ + /usr/X11R5/lib \ + /usr/X11R4/lib \ + \ + /usr/lib/X11 \ + /usr/lib/X11R6 \ + /usr/lib/X11R5 \ + /usr/lib/X11R4 \ + \ + /usr/local/X11/lib \ + /usr/local/X11R6/lib \ + /usr/local/X11R5/lib \ + /usr/local/X11R4/lib \ + \ + /usr/local/lib/X11 \ + /usr/local/lib/X11R6 \ + /usr/local/lib/X11R5 \ + /usr/local/lib/X11R4 \ + \ + /usr/X386/lib \ + /usr/x386/lib \ + /usr/XFree86/lib/X11 \ + \ + /usr/lib \ + /usr/local/lib \ + /usr/unsupported/lib \ + /usr/athena/lib \ + /usr/local/x11r5/lib \ + /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ + \ + /usr/openwin/lib \ + /usr/openwin/share/lib \ + ; \ +do + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest* +fi # $ac_x_libraries = NO + +if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$ac_t""$have_x" 1>&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 +fi + +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + cat >> confdefs.h <<\EOF +#define X_DISPLAY_MISSING 1 +EOF + + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case "`(uname -sr) 2>/dev/null`" in + "SunOS 5"*) + echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 +echo "configure:1370: checking whether -R must be followed by a space" >&5 + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_R_nospace=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_R_nospace=no +fi +rm -f conftest* + if test $ac_R_nospace = yes; then + echo "$ac_t""no" 1>&6 + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_R_space=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_R_space=no +fi +rm -f conftest* + if test $ac_R_space = yes; then + echo "$ac_t""yes" 1>&6 + X_LIBS="$X_LIBS -R $x_libraries" + else + echo "$ac_t""neither works" 1>&6 + fi + fi + LIBS="$ac_xsave_LIBS" + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And karl@cs.umb.edu says + # the Alpha needs dnet_stub (dnet does not exist). + echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 +echo "configure:1435: checking for dnet_ntoa in -ldnet" >&5 +ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldnet $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 +echo "configure:1476: checking for dnet_ntoa in -ldnet_stub" >&5 +ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldnet_stub $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to dickey@clark.net. + echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 +echo "configure:1524: checking for gethostbyname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +gethostbyname(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_gethostbyname=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_gethostbyname=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_gethostbyname = no; then + echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +echo "configure:1573: checking for gethostbyname in -lnsl" >&5 +ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says simon@lia.di.epfl.ch: it contains + # gethostby* variants that don't use the nameserver (or something). + # -lsocket must be given before -lnsl if both are needed. + # We assume that if connect needs -lnsl, so does gethostbyname. + echo $ac_n "checking for connect""... $ac_c" 1>&6 +echo "configure:1622: checking for connect" >&5 +if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +connect(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_connect=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_connect=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_connect = no; then + echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 +echo "configure:1671: checking for connect in -lsocket" >&5 +ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. + echo $ac_n "checking for remove""... $ac_c" 1>&6 +echo "configure:1714: checking for remove" >&5 +if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_remove) || defined (__stub___remove) +choke me +#else +remove(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_remove=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_remove=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_remove = no; then + echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 +echo "configure:1763: checking for remove in -lposix" >&5 +ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lposix $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +else + echo "$ac_t""no" 1>&6 +fi + + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + echo $ac_n "checking for shmat""... $ac_c" 1>&6 +echo "configure:1806: checking for shmat" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shmat) || defined (__stub___shmat) +choke me +#else +shmat(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shmat=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shmat=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + + if test $ac_cv_func_shmat = no; then + echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 +echo "configure:1855: checking for shmat in -lipc" >&5 +ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lipc $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +else + echo "$ac_t""no" 1>&6 +fi + + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS="$LDFLAGS" + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. + echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 +echo "configure:1907: checking for IceConnectionNumber in -lICE" >&5 +ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lICE $X_EXTRA_LIBS $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +else + echo "$ac_t""no" 1>&6 +fi + + LDFLAGS="$ac_save_LDFLAGS" + +fi + + +for ac_hdr in float.h limits.h stdlib.h string.h strings.h unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1955: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + + +for ac_func in strcasecmp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1996: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + + +# Check whether --with-additional-includes or --without-additional-includes was given. +if test "${with_additional_includes+set}" = set; then + withval="$with_additional_includes" + ADDITIONAL_INCLUDES=$withval +else + ADDITIONAL_INCLUDES="" +fi + +# Check whether --with-additional-libs or --without-additional-libs was given. +if test "${with_additional_libs+set}" = set; then + withval="$with_additional_libs" + ADDITIONAL_LIBS=$withval +else + ADDITIONAL_LIBS="" +fi + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile autoconf.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@X_CFLAGS@%$X_CFLAGS%g +s%@X_PRE_LIBS@%$X_PRE_LIBS%g +s%@X_LIBS@%$X_LIBS%g +s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g +s%@ADDITIONAL_INCLUDES@%$ADDITIONAL_INCLUDES%g +s%@ADDITIONAL_LIBS@%$ADDITIONAL_LIBS%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + diff --git a/xgraph/configure.in b/xgraph/configure.in new file mode 100644 index 000000000..6f2fb5bbe --- /dev/null +++ b/xgraph/configure.in @@ -0,0 +1,34 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(xgraph.c) +AM_INIT_AUTOMAKE(xgraph,12.1) + +AM_CONFIG_HEADER(autoconf.h) + +AM_WITH_DMALLOC + +dnl Checks for programs. +AC_PROG_CC + +dnl Checks for libraries. +AC_PATH_XTRA + +dnl check header files. +AC_CHECK_HEADERS(float.h limits.h stdlib.h string.h strings.h unistd.h) + +dnl checks for typedefs +dnl checks for structures +dnl checks for compiler characteristics + +dnl checks for library functions +AC_CHECK_FUNCS(strcasecmp) + +dnl checks for system services + +AC_ARG_WITH(additional-includes, --with-additional-includes=path, ADDITIONAL_INCLUDES=$withval,ADDITIONAL_INCLUDES="") +AC_ARG_WITH(additional-libs, --with-additional-libs=path, ADDITIONAL_LIBS=$withval,ADDITIONAL_LIBS="") +AC_SUBST(ADDITIONAL_INCLUDES) +AC_SUBST(ADDITIONAL_LIBS) + + +AC_OUTPUT([Makefile]) + diff --git a/xgraph/copyright.h b/xgraph/copyright.h new file mode 100644 index 000000000..b40b03f41 --- /dev/null +++ b/xgraph/copyright.h @@ -0,0 +1,65 @@ +/* + * xgraph - program to graphically display numerical data + * + * David Harrison + * University of California, Berkeley + * 1989 + * + * Animation, Differentiation by Paul Walker + * NCSA and University of Illinois at Urbana Champaign Dept. of Physics + * + * Copyright (c) 1988, 1989, Regents of the University of California. + * All rights reserved. + * + * Use and copying of this software and preparation of derivative works + * based upon this software are permitted. However, any distribution of + * this software or derivative works must include the above copyright + * notice. + * + * This software is made available AS IS, and neither the Electronics + * Research Laboratory or the University of California make any + * warranty about the software, its performance or its conformity to + * any specification. + * + +Animation and differentiation routines were added by Paul Walker, +NCSA and UIUC Dept of Physics. The following copyright and disclaimer +applies to these parts of the code only. + +UNIVERSITY OF ILLINOIS (UI), NATIONAL CENTER FOR SUPERCOMPUTING +APPLICATIONS (NCSA), Software Distribution Policy for Copyrighted Software + +The above mentioned modifications to XGraph made with the authors consent are +copyrighted, but available without fee for education, academic research +and non-commercial purposes. The modifications are copyrighted in the name of +the UI, and ownership of the modifications remains with the UI. Users may +distribute the binary and source code to third parties provided that the +copyright notice and this statement appears on all copies and that no +charge is made for such copies. Any entity wishing to integrate all or +part of the source code into a product for commercial use or resale, +should contact the University of Illinois, c/o NCSA, to negotiate an +appropriate license for such commercial use. + +UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY +PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. THE +UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE USER OF THIS +SOFTWARE. The software may have been developed under agreements between +the UI and the Federal Government which entitle the Government to certain +rights. + +By copying this program, you, the user, agree to abide by the copyright +conditions and understandings with respect to any software which is marked +with a copyright notice. + +Send all comments about the modifications to Paul Walker, +pwalker@ncsa.uiuc.edu + + * + */ + +#ifndef _RIGHTS_ +#define _RIGHTS_ + +static char copyright[] = "Copyright (c) 1989, Regents of the University of California. All rights reserved."; + +#endif /* _RIGHTS_ */ diff --git a/xgraph/derivative.c b/xgraph/derivative.c new file mode 100644 index 000000000..dc14434b9 --- /dev/null +++ b/xgraph/derivative.c @@ -0,0 +1,130 @@ +/* This entire routine written by PW. */ + +#include +#include +#include "xgraph.h" + +void +Der1() +{ + PointList *theList, *D1List, *D2List; + double m,b; + int i; + + + for (i=0;inumPoints = D2List->numPoints = theList->numPoints; + D1List->xvec = (double *)malloc(sizeof(double)*theList->numPoints); + D1List->yvec = (double *)malloc(sizeof(double)*theList->numPoints); + D1List->next = NULL; + D2List->xvec = (double *)malloc(sizeof(double)*theList->numPoints); + D2List->yvec = (double *)malloc(sizeof(double)*theList->numPoints); + D2List->next = NULL; + + for (j=1;jnumPoints-1;j++) { + D1List->xvec[j] = D2List->xvec[j] = theList->xvec[j]; + D1List->yvec[j] = (theList->yvec[j+1] - theList->yvec[j-1]) / + (theList->xvec[j+1] - theList->xvec[j-1]); + D2List->yvec[j] = (theList->yvec[j+1] + theList->yvec[j-1] - + 2.0*theList->yvec[j]) / + ((theList->xvec[j+1] - theList->xvec[j]) * + (theList->xvec[j]-theList->xvec[j-1])); + + } + + /* Extrapolate to get the endpoints ... */ + /* end near 0 */ + D1List->xvec[0] = theList->xvec[0]; + D1List->xvec[theList->numPoints-1] = + theList->xvec[theList->numPoints-1]; + m = (D1List->yvec[2]-D1List->yvec[1]) / + (theList->xvec[2]-theList->xvec[1]); + b = D1List->yvec[1] - m*theList->xvec[1]; + D1List->yvec[0] = m*theList->xvec[0] + b; + /* end near numPoints-1 */ + m = (D1List->yvec[theList->numPoints-2]- + D1List->yvec[theList->numPoints-3]) / + (theList->xvec[theList->numPoints-2]- + theList->xvec[theList->numPoints-3]); + b = D1List->yvec [theList->numPoints-2] - + m*theList->xvec[theList->numPoints-2]; + D1List->yvec[theList->numPoints-1] = + m*theList->xvec[theList->numPoints-1] + b; + + /* Extrapolate to get the endpoints ... */ + /* end near 0 */ + D2List->xvec[0] = theList->xvec[0]; + D2List->xvec[theList->numPoints-1] = + theList->xvec[theList->numPoints-1]; + m = (D2List->yvec[2]-D2List->yvec[1]) / + (theList->xvec[2]-theList->xvec[1]); + b = D2List->yvec[1] - m*theList->xvec[1]; + D2List->yvec[0] = m*theList->xvec[0] + b; + /* end near numPoints-1 */ + m = (D2List->yvec[theList->numPoints-2]- + D2List->yvec[theList->numPoints-3]) / + (theList->xvec[theList->numPoints-2]- + theList->xvec[theList->numPoints-3]); + b = D2List->yvec[theList->numPoints-2] - + m*theList->xvec[theList->numPoints-2]; + D2List->yvec[theList->numPoints-1] = + m*theList->xvec[theList->numPoints-1] + b; + + theList = theList->next; + if (theList) { + D1List->next = (PointList *)malloc(sizeof(PointList)); + D2List->next = (PointList *)malloc(sizeof(PointList)); + D1List = D1List->next; + D2List = D2List->next; + } + } + } +} + +void +Bounds(loX, loY, hiX, hiY, Ord) + double *loX, *loY, *hiX, *hiY; + int Ord; +{ + int i; + PointList *theList; + if ((Ord<1) || (Ord>2)) { + printf ("Internal Error - Cannot eval deriv > 2 in Bounds.\n"); + exit(1); + } + *loX = *loY = *hiX = *hiY = 0.0; + for (i=0;inumPoints;j++) { + *loX = (theList->xvec[j]<*loX?theList->xvec[j]:*loX); + *loY = (theList->yvec[j]<*loY?theList->yvec[j]:*loY); + *hiX = (theList->xvec[j]>*hiX?theList->xvec[j]:*hiX); + *hiY = (theList->yvec[j]>*hiY?theList->yvec[j]:*hiY); + } + theList = theList->next; + } + } +} diff --git a/xgraph/dialog.c b/xgraph/dialog.c new file mode 100644 index 000000000..e300205f8 --- /dev/null +++ b/xgraph/dialog.c @@ -0,0 +1,942 @@ +/* + * Xgraph Dialog Boxes + * + * This file constructs the hardcopy and error dialog + * boxes used by xgraph. It uses the mini-toolbox given + * in toolbox.c. + */ + +#include "copyright.h" +#include "xgout.h" +#include "xgraph.h" +#include "hard_devices.h" +#include "xtb.h" +#include "params.h" +#include +#include + +void do_error(); + +#define MAXCHBUF 1024 + +#ifdef SHADOW +#define gray_width 16 +#define gray_height 16 +static short gray_bits[] = +{ + 0x5555, 0xaaaa, 0x5555, 0xaaaa, + 0x5555, 0xaaaa, 0x5555, 0xaaaa, + 0x5555, 0xaaaa, 0x5555, 0xaaaa, + 0x5555, 0xaaaa, 0x5555, 0xaaaa}; + +#endif + +static void make_msg_box(); +static void del_msg_box(); + + +#define D_VPAD 2 +#define D_HPAD 2 +#define D_INT 4 +#define D_BRDR 2 +#define D_INP 35 +#define D_DSP 10 +#define D_FS 10 + +struct d_info { + char *prog; /* Program name */ + xtb_data cookie; /* Info used by do_harcopy */ + Window choices; /* Output device choices */ + Window fod; /* File or device flag */ + Window fodspec; /* File or device spec */ + Window docu_p; /* Document predicate */ + Window dimspec; /* Maximum dimension spec */ + Window tf_family; /* Title font family spec */ + Window tf_size; /* Title font size spec */ + Window af_family; /* Axis font family spec */ + Window af_size; /* Axis font size spec */ +}; + +#define BACKSPACE 0010 +#define DELETE 0177 +#define CONTROL_U 0025 +#define CONTROL_X 0030 + +/*ARGSUSED*/ +static xtb_hret +df_fun(win, ch, text, val) +Window win; /* Widget window */ +int ch; /* Typed character */ +char *text; /* Copy of text */ +xtb_data val; /* User info */ + +/* + * This is the handler function for the text widget for + * specifing the file or device name. It supports simple + * line editing operations. + */ +{ + if ((ch == BACKSPACE) || (ch == DELETE)) { + if (!xtb_ti_dch(win)) + XBell(disp, 0); + } + else if ((ch == CONTROL_U) || (ch == CONTROL_X)) { + (void) xtb_ti_set(win, "", (xtb_data) 0); + } + else { + /* Insert if printable - ascii dependent */ + if ((ch < ' ') || (ch >= DELETE) || !xtb_ti_ins(win, ch)) { + XBell(disp, 0); + } + } + return XTB_HANDLED; +} + +/*ARGSUSED*/ +static xtb_hret +ok_fun(win, bval, info) +Window win; /* Button window */ +int bval; /* Button value */ +xtb_data info; /* Local button info */ + +/* + * This is the handler function for when the `Ok' button + * is hit. It sets the button, does the hardcopy output, + * and turns the button off. It returns a status which + * deactivates the dialog. + */ +{ + struct d_info *real_info = (struct d_info *) info; + int val, + dev_p, + doc_p; + char file_or_dev[MAXCHBUF], + dim_spec[MAXCHBUF], + *dev_spec; + char tfam[MAXCHBUF], + afam[MAXCHBUF]; + char tsizstr[MAXCHBUF], + asizstr[MAXCHBUF]; + double centimeters, + tsize, + asize; + xtb_hret rtn; + + (void) xtb_bt_set(win, 1, (xtb_data) 0, 0); + val = xtb_br_get(real_info->choices); + if ((val >= 0) && (val < hard_count)) { + dev_p = xtb_br_get(real_info->fod); + if ((dev_p == 0) || (dev_p == 1)) { + xtb_ti_get(real_info->fodspec, file_or_dev, (xtb_data *) 0); + doc_p = xtb_bt_get(real_info->docu_p, (xtb_data *) 0, (int *) 0); + xtb_ti_get(real_info->dimspec, dim_spec, (xtb_data *) 0); + if (sscanf(dim_spec, "%lf", ¢imeters) == 1) { + xtb_ti_get(real_info->tf_family, tfam, (xtb_data *) 0); + xtb_ti_get(real_info->af_family, afam, (xtb_data *) 0); + xtb_ti_get(real_info->tf_size, tsizstr, (xtb_data *) 0); + if (sscanf(tsizstr, "%lf", &tsize) == 1) { + xtb_ti_get(real_info->af_size, asizstr, (xtb_data *) 0); + if (sscanf(asizstr, "%lf", &asize) == 1) { + /* Got all the info */ + if (dev_p) { + dev_spec = (char *) 0; + } + else { + dev_spec = hard_devices[val].dev_spec; + } + do_hardcopy(real_info->prog, real_info->cookie, + hard_devices[val].dev_init, dev_spec, + file_or_dev, centimeters, + tfam, tsize, afam, asize, doc_p); + rtn = XTB_STOP; + } + else { + /* Bad axis size */ + do_error("Bad axis font size\n"); + rtn = XTB_HANDLED; + } + } + else { + /* Bad title size */ + do_error("Bad title font size\n"); + rtn = XTB_HANDLED; + } + } + else { + /* Bad max dimension */ + do_error("Bad maximum dimension\n"); + rtn = XTB_HANDLED; + } + } + else { + /* Bad device spec */ + do_error("Must specify `To File' or `To Device'\n"); + rtn = XTB_HANDLED; + } + } + else { + /* Bad value spec */ + do_error("Must specify an output device\n"); + rtn = XTB_HANDLED; + } + (void) xtb_bt_set(win, 0, (xtb_data) 0, 0); + return rtn; +} + +/*ARGSUSED*/ +static xtb_hret +can_fun(win, val, info) +Window win; /* Button window */ +int val; /* Button value */ +xtb_data info; /* Local button info */ + +/* + * This is the handler function for the cancel button. It + * turns itself on and off and then exits with a status + * which kills the dialog. + */ +{ + (void) xtb_bt_set(win, 1, (xtb_data) 0, 0); + (void) xtb_bt_set(win, 0, (xtb_data) 0, 0); + return XTB_STOP; +} + + +/*ARGSUSED*/ +static xtb_hret +docu_fun(win, val, info) +Window win; /* Button window */ +int val; /* Button value */ +xtb_data info; /* Local button info */ + +/* + * This is the handler function for the document button. It + * toggles it's state. + */ +{ + int state; + + state = xtb_bt_get(win, (xtb_data *) 0, (int *) 0); + xtb_bt_set(win, (state == 0), (xtb_data) 0, 0); + return XTB_HANDLED; +} + +/*ARGSUSED*/ +static xtb_hret +dev_fun(win, old, new, info) +Window win; /* Button row window */ +int old; /* Previous button */ +int new; /* Current button */ +xtb_data info; /* User data */ + +/* + * This routine swaps the device specific information + * in the dialog based on what device is selected. The + * information passed is the information for the whole + * dialog. + */ +{ + struct d_info *data = (struct d_info *) info; + char text[MAXCHBUF]; + int fod_spot, + inactive; + + fod_spot = xtb_br_get(data->fod); + if ((old >= 0) && (old < hard_count)) { + /* Save old info */ + xtb_ti_get(data->fodspec, text, (xtb_data *) 0); + if (fod_spot == 1) { + strncpy(hard_devices[old].dev_file, text, MFNAME - 1); + } + else if (fod_spot == 0) { + strncpy(hard_devices[old].dev_printer, text, MFNAME - 1); + } + if (xtb_bt_get(data->docu_p, (xtb_data *) 0, &inactive)) { + if (inactive) + hard_devices[old].dev_docu = NONE; + else + hard_devices[old].dev_docu = YES; + } + else if (inactive) + hard_devices[old].dev_docu = NONE; + else + hard_devices[old].dev_docu = NO; + xtb_ti_get(data->dimspec, text, (xtb_data *) 0); + if (sscanf(text, "%lf", &hard_devices[old].dev_max_dim) != 1) { + do_error("Warning: can't read maximum dimension"); + } + xtb_ti_get(data->tf_family, text, (xtb_data *) 0); + strncpy(hard_devices[old].dev_title_font, text, MFNAME - 1); + xtb_ti_get(data->tf_size, text, (xtb_data *) 0); + if (sscanf(text, "%lf", &hard_devices[old].dev_title_size) != 1) { + do_error("Warning: can't read title font size"); + } + xtb_ti_get(data->af_family, text, (xtb_data *) 0); + strncpy(hard_devices[old].dev_axis_font, text, MFNAME - 1); + xtb_ti_get(data->af_size, text, (xtb_data *) 0); + if (sscanf(text, "%lf", &hard_devices[old].dev_axis_size) != 1) { + do_error("Warning: can't read axis font size"); + } + } + /* Insert new info */ + if ((new >= 0) && (new < hard_count)) { + if (fod_spot == 1) { + xtb_ti_set(data->fodspec, hard_devices[new].dev_file, (xtb_data) 0); + } + else if (fod_spot == 0) { + xtb_ti_set(data->fodspec, hard_devices[new].dev_printer, + (xtb_data) 0); + } + else { + xtb_ti_set(data->fodspec, "", (xtb_data) 0); + } + switch (hard_devices[new].dev_docu) { + case NONE: + (void) xtb_bt_set(data->docu_p, 0, (xtb_data) 0, 1); + break; + case NO: + (void) xtb_bt_set(data->docu_p, 0, (xtb_data) 0, 0); + break; + case YES: + (void) xtb_bt_set(data->docu_p, 1, (xtb_data) 0, 0); + break; + } + (void) sprintf(text, "%lg", hard_devices[new].dev_max_dim); + xtb_ti_set(data->dimspec, text, (xtb_data) 0); + xtb_ti_set(data->tf_family, hard_devices[new].dev_title_font, + (xtb_data) 0); + (void) sprintf(text, "%lg", hard_devices[new].dev_title_size); + xtb_ti_set(data->tf_size, text, (xtb_data) 0); + xtb_ti_set(data->af_family, hard_devices[new].dev_axis_font, + (xtb_data) 0); + (void) sprintf(text, "%lg", hard_devices[new].dev_axis_size); + xtb_ti_set(data->af_size, text, (xtb_data) 0); + } + return XTB_HANDLED; +} + +/*ARGSUSED*/ +static xtb_hret +fd_fun(win, old, new, info) +Window win; /* Button row window */ +int old; /* Previous button */ +int new; /* Current button */ +xtb_data info; /* User data */ + +/* + * This routine swaps the default file or device names + * based on the state of the file or device buttons. + * The information passed is the information for the whole + * dialog. + */ +{ + struct d_info *data = (struct d_info *) info; + char text[MAXCHBUF]; + int which_one; + + which_one = xtb_br_get(data->choices); + if ((which_one >= 0) && (which_one < hard_count)) { + if (old == 0) { + /* Save into device space */ + xtb_ti_get(data->fodspec, text, (xtb_data *) 0); + strncpy(hard_devices[which_one].dev_printer, text, MFNAME - 1); + } + else if (old == 1) { + /* Save into file space */ + xtb_ti_get(data->fodspec, text, (xtb_data *) 0); + which_one = xtb_br_get(data->choices); + strncpy(hard_devices[which_one].dev_file, text, MFNAME - 1); + } + if (new == 0) { + /* Restore into device */ + xtb_ti_set(data->fodspec, hard_devices[which_one].dev_printer, + (xtb_data *) 0); + } + else if (new == 1) { + xtb_ti_set(data->fodspec, hard_devices[which_one].dev_file, + (xtb_data *) 0); + } + } + return XTB_HANDLED; +} + + +/* Indices for frames made in make_dialog */ +enum d_frames_defn { + TITLE_F, ODEVLBL_F, ODEVROW_F, DISPLBL_F, DISPROW_F, FDLBL_F, + FDINP_F, OPTLBL_F, DOCU_F, MDIMLBL_F, MDIMI_F, TFLBL_F, TFFAMLBL_F, TFFAM_F, + TFSIZLBL_F, TFSIZ_F, AFLBL_F, AFFAMLBL_F, AFFAM_F, AFSIZLBL_F, AFSIZ_F, + OK_F, CAN_F, BAR_F, LAST_F +} d_frames; + +#define AF(ix) af[(int) (ix)] + +#define BAR_SLACK 10 + +static void +make_dialog(win, spawned, prog, cookie, okbtn, frame) +Window win; /* Parent window */ +Window spawned; /* Spawned from window */ +char *prog; /* Program name */ +xtb_data cookie; /* Info for do_hardcopy */ +xtb_frame *okbtn; /* Frame for OK button */ +xtb_frame *frame; /* Returned window/size */ + +/* + * This routine constructs a new dialog for asking the user about + * hardcopy devices. The dialog and its size is returned in + * `frame'. The window of the `ok' button is returned in `btnwin'. + * This can be used to reset some of the button state to reuse the dialog. + */ +{ + Window overall; + xtb_frame AF(LAST_F); + xtb_fmt *def, + *cntrl, + *mindim, + *tfarea, + *afarea; + Cursor diag_cursor; + XColor fg_color, + bg_color; + XSizeHints hints; + unsigned long wamask; + XSetWindowAttributes wattr; + struct d_info *info; + int i, + found, + max_width, + which_one, + fodi; + char **names; + static char *fodstrs[] = + {"To Device", "To File"}; + XFontStruct *bigFont = PM_FONT("TitleFont"); + XFontStruct *medFont = PM_FONT("LabelFont"); + char *Odevice = PM_STR("Device"); + char *Odisp = PM_STR("Disposition"); + char *OfileDev = PM_STR("FileOrDev"); + + wamask = CWBackPixel | CWBorderPixel | CWOverrideRedirect | + CWSaveUnder | CWColormap; + wattr.background_pixel = PM_PIXEL("Background"); + wattr.border_pixel = PM_PIXEL("Border"); + wattr.override_redirect = True; + wattr.save_under = True; + wattr.colormap = cmap; + overall = XCreateWindow(disp, win, 0, 0, 1, 1, D_BRDR, + depth, InputOutput, vis, + wamask, &wattr); + frame->win = overall; + frame->width = frame->height = frame->x_loc = frame->y_loc = 0; + XStoreName(disp, overall, "Hardcopy Dialog"); + XSetTransientForHint(disp, spawned, overall); + info = (struct d_info *) Malloc(sizeof(struct d_info)); + info->prog = prog; + info->cookie = cookie; + + /* Make all frames */ + xtb_to_new(overall, "Hardcopy Options", bigFont, &AF(TITLE_F)); + xtb_to_new(overall, "Output device:", medFont, &AF(ODEVLBL_F)); + found = -1; + names = (char **) Malloc((unsigned) (sizeof(char *) * hard_count)); + for (i = 0; i < hard_count; i++) { + names[i] = hard_devices[i].dev_name; + if (strcmp(Odevice, names[i]) == 0) { + found = i; + } + } + xtb_br_new(overall, hard_count, names, found, + dev_fun, (xtb_data) info, &AF(ODEVROW_F)); + info->choices = AF(ODEVROW_F).win; + xtb_to_new(overall, "Disposition:", medFont, &AF(DISPLBL_F)); + found = -1; + for (i = 0; i < 2; i++) { + if (strcmp(Odisp, fodstrs[i]) == 0) { + found = i; + } + } + xtb_br_new(overall, 2, fodstrs, found, + fd_fun, (xtb_data) info, &AF(DISPROW_F)); + info->fod = AF(DISPROW_F).win; + xtb_to_new(overall, "File or Device Name:", medFont, &AF(FDLBL_F)); + xtb_ti_new(overall, "", D_INP, df_fun, (xtb_data) 0, &AF(FDINP_F)); + if (OfileDev && strlen(OfileDev)) { + which_one = xtb_br_get(info->choices); + if ((which_one >= 0) && (which_one < hard_count)) { + fodi = xtb_br_get(info->fod); + if (fodi == 0) { + strncpy(hard_devices[which_one].dev_printer, OfileDev, MFNAME - 1); + } + else if (fodi == 1) { + strncpy(hard_devices[which_one].dev_file, OfileDev, MFNAME - 1); + } + } + } + info->fodspec = AF(FDINP_F).win; + xtb_to_new(overall, "Optional Parameters", bigFont, &AF(OPTLBL_F)); + xtb_bt_new(overall, "Include in Document", docu_fun, (xtb_data) 0, &AF(DOCU_F)); + info->docu_p = AF(DOCU_F).win; + xtb_to_new(overall, "Maximum Dimension (cm):", medFont, &AF(MDIMLBL_F)); + xtb_ti_new(overall, "", D_DSP, df_fun, (xtb_data) 0, &AF(MDIMI_F)); + info->dimspec = AF(MDIMI_F).win; + xtb_to_new(overall, "Title Font", medFont, &AF(TFLBL_F)); + xtb_to_new(overall, "Family:", medFont, &AF(TFFAMLBL_F)); + xtb_ti_new(overall, "", MFNAME, df_fun, (xtb_data) 0, &AF(TFFAM_F)); + info->tf_family = AF(TFFAM_F).win; + xtb_to_new(overall, "Size (pnts):", medFont, &AF(TFSIZLBL_F)); + xtb_ti_new(overall, "", D_FS, df_fun, (xtb_data) 0, &AF(TFSIZ_F)); + info->tf_size = AF(TFSIZ_F).win; + xtb_to_new(overall, "Axis Font", medFont, &AF(AFLBL_F)); + xtb_to_new(overall, "Family:", medFont, &AF(AFFAMLBL_F)); + xtb_ti_new(overall, "", MFNAME, df_fun, (xtb_data) 0, &AF(AFFAM_F)); + info->af_family = AF(AFFAM_F).win; + xtb_to_new(overall, "Size (pnts):", medFont, &AF(AFSIZLBL_F)); + xtb_ti_new(overall, "", D_FS, df_fun, (xtb_data) 0, &AF(AFSIZ_F)); + info->af_size = AF(AFSIZ_F).win; + xtb_bt_new(overall, " Ok ", ok_fun, (xtb_data) info, &AF(OK_F)); + xtb_bt_new(overall, "Cancel", can_fun, (xtb_data) 0, &AF(CAN_F)); + /* Dividing bar */ + max_width = 0; + for (i = 0; i < ((int) BAR_F); i++) { + if (AF(i).width > max_width) + max_width = AF(i).width; + } + xtb_bk_new(overall, max_width - BAR_SLACK, 1, &AF(BAR_F)); + + /* Set device specific info */ + (void) dev_fun(info->choices, -1, xtb_br_get(info->choices), (xtb_data) info); + (void) fd_fun(info->fod, -1, xtb_br_get(info->fod), (xtb_data) info); + + /* + * Now place elements - could make this one expression but pcc is too + * wimpy. + */ + cntrl = xtb_vert(XTB_LEFT, D_VPAD, D_INT, + xtb_hort(XTB_CENTER, D_HPAD, D_INT, + xtb_w(&AF(ODEVLBL_F)), + xtb_w(&AF(ODEVROW_F)), NE), + xtb_hort(XTB_CENTER, D_HPAD, D_INT, + xtb_w(&AF(DISPLBL_F)), + xtb_w(&AF(DISPROW_F)), NE), + xtb_hort(XTB_CENTER, D_HPAD, D_INT, + xtb_w(&AF(FDLBL_F)), + xtb_w(&AF(FDINP_F)), NE), + NE); + + mindim = xtb_vert(XTB_LEFT, D_VPAD, D_INT, + xtb_hort(XTB_CENTER, D_HPAD, D_INT, + xtb_w(&AF(MDIMLBL_F)), + xtb_w(&AF(MDIMI_F)), + NE), + NE); + + tfarea = xtb_vert(XTB_LEFT, D_VPAD, D_INT, + xtb_hort(XTB_CENTER, D_HPAD, D_INT, + xtb_w(&AF(TFFAMLBL_F)), + xtb_w(&AF(TFFAM_F)), + xtb_w(&AF(TFSIZLBL_F)), + xtb_w(&AF(TFSIZ_F)), NE), + NE); + + afarea = xtb_vert(XTB_LEFT, D_VPAD, D_INT, + xtb_hort(XTB_CENTER, D_HPAD, D_INT, + xtb_w(&AF(AFFAMLBL_F)), + xtb_w(&AF(AFFAM_F)), + xtb_w(&AF(AFSIZLBL_F)), + xtb_w(&AF(AFSIZ_F)), NE), + NE); + + def = xtb_fmt_do + (xtb_vert(XTB_CENTER, D_VPAD, D_INT, + xtb_w(&AF(TITLE_F)), + cntrl, + xtb_w(&AF(BAR_F)), + xtb_w(&AF(OPTLBL_F)), + mindim, + xtb_w(&AF(DOCU_F)), + xtb_w(&AF(TFLBL_F)), + tfarea, + xtb_w(&AF(AFLBL_F)), + afarea, + xtb_hort(XTB_CENTER, D_HPAD, D_INT, + xtb_w(&AF(OK_F)), xtb_w(&AF(CAN_F)), NE), + NE), + &frame->width, &frame->height); + xtb_mv_frames(LAST_F, af); + xtb_fmt_free(def); + + /* Make window large enough to contain the info */ + XResizeWindow(disp, overall, frame->width, frame->height); + hints.flags = PSize; + hints.width = frame->width; + hints.height = frame->height; + XSetNormalHints(disp, overall, &hints); + diag_cursor = XCreateFontCursor(disp, XC_dotbox); + fg_color.pixel = PM_PIXEL("Foreground"); + XQueryColor(disp, cmap, &fg_color); + bg_color.pixel = PM_PIXEL("Background"); + XQueryColor(disp, cmap, &bg_color); + XRecolorCursor(disp, diag_cursor, &fg_color, &bg_color); + XDefineCursor(disp, overall, diag_cursor); + frame->width += (2 * D_BRDR); + frame->height += (2 * D_BRDR); + *okbtn = AF(OK_F); +} + + + +#ifdef SHADOW +Window +make_shadow(w, h) +int w, + h; + +/* + * Makes a shadow window for a pop-up window of the specified size. + * Needs hint work as well. Try no background window. + */ +{ + Window shadow; + Bitmap gray_bm; + Pixmap gray_pm; + + gray_bm = XStoreBitmap(gray_width, gray_height, gray_bits); + gray_pm = XMakePixmap(gray_bm, PM_PIXEL("Foreground"), PM_PIXEL("Background")); + shadow = XCreateWindow(RootWindow, 0, 0, w, h, 0, BlackPixmap, gray_pm); + XFreePixmap(gray_pm); + XFreeBitmap(gray_bm); + return shadow; +} + +#endif + + + +#define SH_W 5 +#define SH_H 5 + +void +ho_dialog(parent, prog, cookie) +Window parent; /* Parent window */ +char *prog; /* Program name */ +xtb_data cookie; /* Info passed to do_hardcopy */ + +/* + * Asks the user about hardcopy devices. A table of hardcopy + * device names and function pointers to their initialization + * functions is assumed to be in the global `hard_devices' and + * `hard_count'. Returns a non-zero status if the dialog was + * sucessfully posted. Calls do_hardcopy in xgraph to actually + * output information. + */ +{ +#ifdef SHADOW + static Window shadow; + +#endif + static Window dummy; + static xtb_frame overall = + {(Window) 0, 0, 0, 0, 0}; + static xtb_frame okbtn; + XEvent evt; + XWindowAttributes winInfo; + XSizeHints hints; + struct d_info *info; + + if (!overall.win) { + make_dialog(RootWindow(disp, screen), parent, prog, cookie, + &okbtn, &overall); +#ifdef SHADOW + shadow = make_shadow(d_w, d_h); +#endif + } + else { + /* Change the button information */ + (void) xtb_bt_get(okbtn.win, (xtb_data *) & info, (int *) 0); + info->prog = prog; + info->cookie = cookie; + } + XGetWindowAttributes(disp, parent, &winInfo); + XTranslateCoordinates(disp, parent, RootWindow(disp, screen), + 0, 0, &winInfo.x, &winInfo.y, &dummy); + XMoveWindow(disp, overall.win, + (int) (winInfo.x + winInfo.width / 2 - overall.width / 2), + (int) (winInfo.y + winInfo.height / 2 - overall.height / 2)); + hints.flags = PPosition; + hints.x = winInfo.x + winInfo.width / 2 - overall.width / 2; + hints.y = winInfo.y + winInfo.height / 2 - overall.height / 2; + XSetNormalHints(disp, overall.win, &hints); +#ifdef SHADOW + XMoveWindow(disp, shadow, winInfo.x + winInfo.width / 2 - d_w / 2 + SH_W, + winInfo.y + winInfo.height / 2 - d_h / 2 + SH_H); + hints.flags = PPosition; + hints.x = winInfo.x + winInfo.width / 2 - d_w / 2 + SH_W; + hints.y = winInfo.y + winInfo.height / 2 - d_h / 2 + SH_H; + XSetNormalHints(disp, shadow, &hints); + XRaiseWindow(disp, shadow); + XMapWindow(disp, shadow); +#endif + XRaiseWindow(disp, overall.win); + XMapWindow(disp, overall.win); + do { + XNextEvent(disp, &evt); + } while (xtb_dispatch(&evt) != XTB_STOP); + XUnmapWindow(disp, overall.win); +#ifdef SHADOW + XUnmapWindow(disp, shadow); +#endif +} + + + +/*ARGSUSED*/ +static xtb_hret +err_func(win, bval, info) +Window win; /* Button window */ +int bval; /* Button value */ +xtb_data info; /* Local button info */ + +/* + * Handler function for button in error box. Simply stops dialog. + */ +{ + (void) xtb_bt_set(win, 1, (xtb_data) 0, 0); + (void) xtb_bt_set(win, 0, (xtb_data) 0, 0); + return XTB_STOP; +} + + +struct err_info { + Window title; + Window contbtn; + int num_lines; + int alloc_lines; + Window *lines; +}; + +#define E_LINES 2 +#define E_VPAD 3 +#define E_HPAD 3 +#define E_INTER 1 +#define ML 256 + +static void +make_msg_box(text, title, frame) +char *text; /* Error text */ +char *title; /* Title text */ +xtb_frame *frame; /* Returned frame */ + +/* + * Makes an error box with a title. + */ +{ + XSizeHints hints; + struct err_info *new_info; + xtb_frame tf, + cf, + lf; + char *lineptr, + line[ML]; + int y, + i; + unsigned long wamask; + XSetWindowAttributes wattr; + XFontStruct *bigFont = PM_FONT("TitleFont"); + XFontStruct *medFont = PM_FONT("LabelFont"); + + wamask = CWBackPixel | CWBorderPixel | CWOverrideRedirect | + CWSaveUnder | CWColormap; + wattr.background_pixel = PM_PIXEL("Background"); + wattr.border_pixel = PM_PIXEL("Border"); + wattr.override_redirect = True; + wattr.save_under = True; + wattr.colormap = cmap; + frame->win = XCreateWindow(disp, RootWindow(disp, screen), + 0, 0, 1, 1, D_BRDR, + depth, InputOutput, vis, + wamask, &wattr); + frame->x_loc = frame->y_loc = frame->width = frame->height = 0; + XStoreName(disp, frame->win, "Error Dialog"); + XSetTransientForHint(disp, RootWindow(disp, screen), frame->win); + new_info = (struct err_info *) Malloc((unsigned) sizeof(struct err_info)); + xtb_to_new(frame->win, title, bigFont, &tf); + new_info->title = tf.win; + if (tf.width > frame->width) + frame->width = tf.width; + + xtb_bt_new(frame->win, "Dismiss", err_func, (xtb_data) 0, &cf); + new_info->contbtn = cf.win; + if (cf.width > frame->width) + frame->width = cf.width; + + new_info->alloc_lines = E_LINES; + new_info->num_lines = 0; + new_info->lines = (Window *) Malloc((unsigned) (sizeof(Window) * E_LINES)); + /* zero the memory out of paranoia */ + memset(new_info->lines, 0, sizeof(Window) * E_LINES); + + lineptr = text; + while (getline(&lineptr, line)) { + if (new_info->num_lines >= new_info->alloc_lines) { + int old_alloc_lines_size = new_info->alloc_lines * sizeof(Window); + new_info->alloc_lines *= 2; + new_info->lines = (Window *) Realloc((char *) new_info->lines, + (unsigned) + (new_info->alloc_lines * + sizeof(Window))); + memset(((char*)new_info->lines) + old_alloc_lines_size, + 0, old_alloc_lines_size); + } + xtb_to_new(frame->win, line, medFont, &lf); + new_info->lines[new_info->num_lines] = lf.win; + new_info->num_lines += 1; + if (lf.width > frame->width) + frame->width = lf.width; + } + + + /* Placement */ + frame->width += (2 * E_HPAD); + y = E_VPAD; + /* Title */ + XMoveWindow(disp, new_info->title, (int) (frame->width / 2 - tf.width / 2), y); + y += (tf.height + E_INTER); + /* All lines */ + for (i = 0; i < new_info->num_lines; i++) { + XMoveWindow(disp, new_info->lines[i], E_HPAD, y); + y += (lf.height + E_INTER); + } + /* Button */ + XMoveWindow(disp, new_info->contbtn, (int) (frame->width / 2 - cf.width / 2), y); + y += (cf.height + E_INTER); + + /* Make dialog the right size */ + y += (E_VPAD - E_INTER); + XResizeWindow(disp, frame->win, frame->width, (unsigned int) y); + hints.flags = PSize; + hints.width = frame->width; + hints.height = (unsigned int) y; + XSetNormalHints(disp, frame->win, &hints); + frame->width += (2 * D_BRDR); + frame->height = y + (2 * D_BRDR); + xtb_register(frame->win, (xtb_hret(*) ()) 0, (xtb_data) new_info); +} + +void +msg_box(title, text) +char *title, + *text; + +/* + * This posts a dialog that contains lines of text and a continue + * button. The text may be multiple lines. The dialog is remade + * each time. + */ +{ +#ifdef SHADOW + Window shadow; + +#endif + XWindowAttributes info; + XEvent evt; + XSizeHints hints; + xtb_frame text_frame; + + make_msg_box(text, title, &text_frame); +#ifdef SHADOW + shadow = make_shadow(w, h); +#endif + XGetWindowAttributes(disp, RootWindow(disp, screen), &info); + XMoveWindow(disp, text_frame.win, (int) (info.width / 2 - text_frame.width / 2), + (int) (info.height / 2 - text_frame.height / 2)); + hints.flags = PPosition; + hints.x = info.width / 2 - text_frame.width / 2; + hints.y = info.height / 2 - text_frame.height / 2; + XSetNormalHints(disp, text_frame.win, &hints); +#ifdef SHADOW + XMoveWindow(disp, shadow, info.width / 2 - w / 2 + SH_W, + info.height / 2 - h / 2 + SH_H); + hints.flags = PPosition; + hints.x = info.width / 2 - w / 2 + SH_W; + hints.y = info.height / 2 - h / 2 + SH_H; + XSetNormalHints(disp, text_frame.win, &hints); + XRaiseWindow(disp, shadow); + XMapWindow(disp, shadow); +#endif + XRaiseWindow(disp, text_frame.win); + XMapWindow(disp, text_frame.win); + do { + XNextEvent(disp, &evt); + } while (xtb_dispatch(&evt) != XTB_STOP); +#ifdef SHADOW + XDestroyWindow(disp, shadow); +#endif + del_msg_box(text_frame.win); +} + +void +do_error(err_text) +char *err_text; +{ + if (PM_INT("Output Device") == D_XWINDOWS) + msg_box("Xgraph Error", err_text); + else + fputs(err_text, stderr); +} + + + +int +getline(tptr, lptr) +char **tptr; +char *lptr; + +/* + * Returns next line from tptr. Assumes `lptr' is large enough to + * accept the line. + */ +{ + char *start; + + start = *tptr; + while (*tptr && **tptr && (**tptr != '\n')) { + (*tptr)++; + } + if (*tptr > start) { + (void) strncpy(lptr, start, (*tptr - start)); + lptr[*tptr - start] = '\0'; + if (**tptr == '\n') + (*tptr)++; + return 1; + } + else { + return 0; + } +} + + + +static void +del_msg_box(msg) +Window msg; + +/* + * Deletes all components of an msg box + */ +{ + struct err_info *info; + char *dummy; + int i; + + if (xtb_unregister(msg, (xtb_data *) & info)) { + xtb_to_del(info->title); + xtb_bt_del(info->contbtn, (xtb_data *) & dummy); + for (i = 0; i < info->num_lines; i++) { + xtb_to_del(info->lines[i]); + } + Free((char *) info->lines); + Free((char *) info); + XDestroyWindow(disp, msg); + } +} diff --git a/xgraph/draw.c b/xgraph/draw.c new file mode 100644 index 000000000..0c44a6930 --- /dev/null +++ b/xgraph/draw.c @@ -0,0 +1,1263 @@ +/* $Header$ */ +/* + * draw.c: xgraph drawing code + * + * Routines: + * void DrawWindow(); + * + * $Log$ + * Revision 1.1 2004-01-25 09:00:49 pnenzi + * + * Added xgraph plotting program. + * + * Revision 1.1.1.1 1999/12/03 23:15:53 heideman + * xgraph-12.0 + * + */ +#ifndef lint +static char rcsid[] = "$Id$"; +#endif + +#include "copyright.h" +#include +#include +#include +#include +#include "xgraph.h" +#include "xtb.h" +#include "hard_devices.h" +#include "params.h" + + +static void DrawTitle(); +static void DrawGridAndAxis(); +static void WriteValue(); +static void DrawData(); +static void DrawLegend(); +static int TransformCompute(); +static double initGrid(); +static double stepGrid(); +static double RoundUp(); +static void set_mark_flags(); + +void +DrawWindow(win_info) +LocalWin *win_info; /* Window information */ + +/* + * Draws the data in the window. Does not clear the window. + * The data is scaled so that all of the data will fit. + * Grid lines are drawn at the nearest power of 10 in engineering + * notation. Draws axis numbers along bottom and left hand edges. + * Centers title at top of window. + */ +{ + /* Figure out the transformation constants */ + if (TransformCompute(win_info)) { + + /* Draw the title */ + DrawTitle(win_info); + + /* Draw the legend */ + if (!PM_BOOL("NoLegend")) + DrawLegend(win_info); + + /* Draw the axis unit labels, grid lines, and grid labels */ + DrawGridAndAxis(win_info); + + /* Draw the data sets themselves */ + DrawData(win_info); + } +} + + + + +static void +DrawTitle(wi) +LocalWin *wi; /* Window information */ + +/* + * This routine draws the title of the graph centered in + * the window. It is spaced down from the top by an amount + * specified by the constant PADDING. The font must be + * fixed width. The routine returns the height of the + * title in pixels. + */ +{ + if (wi->DOrder == 0) + wi->dev_info.xg_text(wi->dev_info.user_state, + (int)(wi->dev_info.area_w*0.95) , + wi->dev_info.axis_pad, + PM_STR("TitleText"), T_UPPERRIGHT, T_TITLE); + else if (wi->DOrder == 1) + wi->dev_info.xg_text(wi->dev_info.user_state, + (int)(wi->dev_info.area_w*0.95) , + wi->dev_info.axis_pad, + "First Derivative", T_UPPERRIGHT, T_TITLE); + else if (wi->DOrder == 2) + wi->dev_info.xg_text(wi->dev_info.user_state, + (int)(wi->dev_info.area_w*0.95) , + wi->dev_info.axis_pad, + "Second Derivative", T_UPPERRIGHT, T_TITLE); +} + + + + +static int +TransformCompute(wi) +LocalWin *wi; /* Window information */ + +/* + * This routine figures out how to draw the axis labels and grid lines. + * Both linear and logarithmic axes are supported. Axis labels are + * drawn in engineering notation. The power of the axes are labeled + * in the normal axis labeling spots. The routine also figures + * out the necessary transformation information for the display + * of the points (it touches XOrgX, XOrgY, UsrOrgX, UsrOrgY, and + * UnitsPerPixel). + */ +{ + double bbCenX, + bbCenY, + bbHalfWidth, + bbHalfHeight; + int idx, + maxName, + leftWidth; + char err[MAXBUFSIZE]; + char *XUnitText = PM_STR("XUnitText"); + + /* + * First, we figure out the origin in the X window. Above the space we + * have the title and the Y axis unit label. To the left of the space we + * have the Y axis grid labels. + */ + + wi->XOrgX = wi->dev_info.bdr_pad + (7 * wi->dev_info.axis_width) + + wi->dev_info.bdr_pad; + wi->XOrgY = wi->dev_info.bdr_pad + wi->dev_info.title_height + + wi->dev_info.bdr_pad + wi->dev_info.axis_height + + wi->dev_info.axis_height / 2 + wi->dev_info.bdr_pad; + + /* + * Now we find the lower right corner. Below the space we have the X axis + * grid labels. To the right of the space we have the X axis unit label + * and the legend. We assume the worst case size for the unit label. + */ + + maxName = 0; + for (idx = 0; idx < MAXSETS; idx++) { + if (PlotData[idx].list) { + int tempSize; + + tempSize = strlen(PlotData[idx].setName); + if (tempSize > maxName) + maxName = tempSize; + } + } + if (PM_BOOL("NoLegend")) + maxName = 0; + /* Worst case size of the X axis label: */ + leftWidth = (strlen(XUnitText)) * wi->dev_info.axis_width; + if ((maxName * wi->dev_info.axis_width) + wi->dev_info.bdr_pad > leftWidth) + leftWidth = maxName * wi->dev_info.axis_width + wi->dev_info.bdr_pad; + + wi->XOppX = wi->dev_info.area_w - wi->dev_info.bdr_pad - leftWidth; + wi->XOppY = wi->dev_info.area_h - wi->dev_info.bdr_pad + - wi->dev_info.axis_height - wi->dev_info.bdr_pad; + + if ((wi->XOrgX >= wi->XOppX) || (wi->XOrgY >= wi->XOppY)) { + do_error(strcpy(err, "Drawing area is too small\n")); + return 0; + } + + /* + * We now have a bounding box for the drawing region. Figure out the units + * per pixel using the data set bounding box. + */ + wi->XUnitsPerPixel = (wi->hiX - wi->loX) / + ((double) (wi->XOppX - wi->XOrgX)); + wi->YUnitsPerPixel = (wi->hiY - wi->loY) / + ((double) (wi->XOppY - wi->XOrgY)); + + /* + * Find origin in user coordinate space. We keep the center of the + * original bounding box in the same place. + */ + bbCenX = (wi->loX + wi->hiX) / 2.0; + bbCenY = (wi->loY + wi->hiY) / 2.0; + bbHalfWidth = ((double) (wi->XOppX - wi->XOrgX)) / 2.0 * wi->XUnitsPerPixel; + bbHalfHeight = ((double) (wi->XOppY - wi->XOrgY)) / 2.0 * wi->YUnitsPerPixel; + wi->UsrOrgX = bbCenX - bbHalfWidth; + wi->UsrOrgY = bbCenY - bbHalfHeight; + wi->UsrOppX = bbCenX + bbHalfWidth; + wi->UsrOppY = bbCenY + bbHalfHeight; + + /* + * Everything is defined so we can now use the SCREENX and SCREENY + * transformations. + */ + return 1; +} + +static void +DrawGridAndAxis(wi) +LocalWin *wi; /* Window information */ + +/* + * This routine draws grid line labels in engineering notation, + * the grid lines themselves, and unit labels on the axes. + */ +{ + int expX, + expY; /* Engineering powers */ + int startX; + int Yspot, + Xspot; + char power[10], + value[10], + final[MAXBUFSIZE + 10]; + double Xincr, + Yincr, + Xstart, + Ystart, + Yindex, + Xindex, + larger; + XSegment segs[2]; + double initGrid(), + stepGrid(); + int tickFlag = PM_BOOL("Ticks"); + int axisFlag = PM_BOOL("TickAxis"); + int logXFlag = PM_BOOL("LogX"); + int logYFlag = PM_BOOL("LogY"); + char *XUnitText = PM_STR("XUnitText"); + char *YUnitText = PM_STR("YUnitText"); + + /* + * Grid display powers are computed by taking the log of the largest + * numbers and rounding down to the nearest multiple of 3. + */ + if (logXFlag) { + expX = 0; + } + else { + if (fabs(wi->UsrOrgX) > fabs(wi->UsrOppX)) { + larger = fabs(wi->UsrOrgX); + } + else { + larger = fabs(wi->UsrOppX); + } + expX = ((int) floor(nlog10(larger) / 3.0)) * 3; + } + if (logYFlag) { + expY = 0; + } + else { + if (fabs(wi->UsrOrgY) > fabs(wi->UsrOppY)) { + larger = fabs(wi->UsrOrgY); + } + else { + larger = fabs(wi->UsrOppY); + } + expY = ((int) floor(nlog10(larger) / 3.0)) * 3; + } + + /* + * With the powers computed, we can draw the axis labels. + */ + if (expY != 0) { + (void) strcpy(final, YUnitText); + (void) strcat(final, " x 10"); + Xspot = wi->dev_info.bdr_pad + + ((strlen(YUnitText) + 5) * wi->dev_info.axis_width); + Yspot = wi->dev_info.bdr_pad * 2 + wi->dev_info.title_height + + wi->dev_info.axis_height / 2; + wi->dev_info.xg_text(wi->dev_info.user_state, + Xspot, Yspot, final, T_RIGHT, T_AXIS); + (void) sprintf(power, "%d", expY); + wi->dev_info.xg_text(wi->dev_info.user_state, + Xspot, Yspot, power, T_LOWERLEFT, T_AXIS); + } + else { + Yspot = wi->dev_info.bdr_pad * 2 + wi->dev_info.title_height; + wi->dev_info.xg_text(wi->dev_info.user_state, + wi->dev_info.bdr_pad, Yspot, YUnitText, + T_UPPERLEFT, T_AXIS); + } + + startX = wi->dev_info.area_w - wi->dev_info.bdr_pad; + if (expX != 0) { + (void) sprintf(power, "%d", expX); + startX -= (strlen(power) * wi->dev_info.axis_width); + wi->dev_info.xg_text(wi->dev_info.user_state, + startX, wi->XOppY, power, T_LOWERLEFT, T_AXIS); + (void) strcpy(final, XUnitText); + (void) strcat(final, " x 10"); + wi->dev_info.xg_text(wi->dev_info.user_state, + startX, wi->XOppY, final, T_RIGHT, T_AXIS); + } + else { + wi->dev_info.xg_text(wi->dev_info.user_state, + startX, wi->XOppY, XUnitText, T_RIGHT, T_AXIS); + } + + /* + * First, the grid line labels + */ + Yincr = (wi->dev_info.axis_pad + wi->dev_info.axis_height) * + wi->YUnitsPerPixel; + Ystart = initGrid(wi->UsrOrgY, Yincr, logYFlag); + for (Yindex = Ystart; Yindex < wi->UsrOppY; Yindex = stepGrid()) { + Yspot = SCREENY(wi, Yindex); + /* Write the axis label */ + WriteValue(value, PM_STR("Format X"), Yindex, expY, logYFlag); + wi->dev_info.xg_text(wi->dev_info.user_state, + wi->dev_info.bdr_pad + + (7 * wi->dev_info.axis_width), + Yspot, value, T_RIGHT, T_AXIS); + } + + Xincr = (wi->dev_info.axis_pad + (wi->dev_info.axis_width * 7)) * + wi->XUnitsPerPixel; + Xstart = initGrid(wi->UsrOrgX, Xincr, logXFlag); + + for (Xindex = Xstart; Xindex < wi->UsrOppX; Xindex = stepGrid()) { + Xspot = SCREENX(wi, Xindex); + /* Write the axis label */ + WriteValue(value, PM_STR("Format Y"), Xindex, expX, logXFlag); + wi->dev_info.xg_text(wi->dev_info.user_state, + Xspot, + wi->dev_info.area_h - wi->dev_info.bdr_pad, + value, T_BOTTOM, T_AXIS); + } + + /* + * Now, the grid lines or tick marks + */ + Yincr = (wi->dev_info.axis_pad + wi->dev_info.axis_height) * + wi->YUnitsPerPixel; + Ystart = initGrid(wi->UsrOrgY, Yincr, logYFlag); + for (Yindex = Ystart; Yindex < wi->UsrOppY; Yindex = stepGrid()) { + Yspot = SCREENY(wi, Yindex); + /* Draw the grid line or tick mark */ + if (tickFlag && !(axisFlag && Yindex == Ystart)) { + segs[0].x1 = wi->XOrgX; + segs[0].x2 = wi->XOrgX + wi->dev_info.tick_len; + segs[1].x1 = wi->XOppX - wi->dev_info.tick_len; + segs[1].x2 = wi->XOppX; + segs[0].y1 = segs[0].y2 = segs[1].y1 = segs[1].y2 = Yspot; + } + else { + segs[0].x1 = wi->XOrgX; + segs[0].x2 = wi->XOppX; + segs[0].y1 = segs[0].y2 = Yspot; + } + if ((ABS(Yindex) < ZERO_THRES) && !logYFlag) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, segs, PM_INT("ZeroWidth"), + L_ZERO, 0, 0); + if (tickFlag) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &(segs[1]), PM_INT("ZeroWidth"), + L_ZERO, 0, 0); + } + } + else { + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, segs, PM_INT("GridSize"), + L_AXIS, 0, 0); + if (tickFlag) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &(segs[1]), PM_INT("GridSize"), + L_AXIS, 0, 0); + } + } + } + + Xincr = (wi->dev_info.axis_pad + (wi->dev_info.axis_width * 7)) * + wi->XUnitsPerPixel; + Xstart = initGrid(wi->UsrOrgX, Xincr, logXFlag); + for (Xindex = Xstart; Xindex < wi->UsrOppX; Xindex = stepGrid()) { + Xspot = SCREENX(wi, Xindex); + /* Draw the grid line or tick marks */ + if (tickFlag && !(axisFlag && Xindex == Xstart)) { + segs[0].x1 = segs[0].x2 = segs[1].x1 = segs[1].x2 = Xspot; + segs[0].y1 = wi->XOrgY; + segs[0].y2 = wi->XOrgY + wi->dev_info.tick_len; + segs[1].y1 = wi->XOppY - wi->dev_info.tick_len; + segs[1].y2 = wi->XOppY; + } + else { + segs[0].x1 = segs[0].x2 = Xspot; + segs[0].y1 = wi->XOrgY; + segs[0].y2 = wi->XOppY; + } + if ((ABS(Xindex) < ZERO_THRES) && !logXFlag) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, segs, PM_INT("ZeroWidth"), L_ZERO, 0, 0); + if (tickFlag) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &(segs[1]), PM_INT("ZeroWidth"), + L_ZERO, 0, 0); + + } + } + else { + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, segs, PM_INT("GridSize"), L_AXIS, 0, 0); + if (tickFlag) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &(segs[1]), PM_INT("GridSize"), L_AXIS, 0, 0); + } + } + } + /* Check to see if he wants a bounding box */ + if (PM_BOOL("BoundBox")) { + XSegment bb[4]; + + /* Draw bounding box */ + bb[0].x1 = bb[0].x2 = bb[1].x1 = bb[3].x2 = wi->XOrgX; + bb[0].y1 = bb[2].y2 = bb[3].y1 = bb[3].y2 = wi->XOrgY; + bb[1].x2 = bb[2].x1 = bb[2].x2 = bb[3].x1 = wi->XOppX; + bb[0].y2 = bb[1].y1 = bb[1].y2 = bb[2].y1 = wi->XOppY; + wi->dev_info.xg_seg(wi->dev_info.user_state, + 4, bb, PM_INT("GridSize"), L_AXIS, 0, 0); + } +} + +static double gridBase, + gridStep, + gridJuke[101]; +static int gridNJuke, + gridCurJuke; + +#define ADD_GRID(val) (gridJuke[gridNJuke++] = log10(val)) + +static double +initGrid(low, step, logFlag) +double low; /* desired low value */ +double step; /* desired step (user coords) */ +int logFlag; /* is axis logarithmic? */ +{ + double ratio, + x; + double RoundUp(), + stepGrid(); + + gridNJuke = gridCurJuke = 0; + gridJuke[gridNJuke++] = 0.0; + + if (logFlag) { + ratio = pow(10.0, step); + gridBase = floor(low); + gridStep = ceil(step); + if (ratio <= 3.0) { + if (ratio > 2.0) { + ADD_GRID(3.0); + } + else if (ratio > 1.333) { + ADD_GRID(2.0); + ADD_GRID(5.0); + } + else if (ratio > 1.25) { + ADD_GRID(1.5); + ADD_GRID(2.0); + ADD_GRID(3.0); + ADD_GRID(5.0); + ADD_GRID(7.0); + } + else { + for (x = 1.0; x < 10.0 && (x + .5) / (x + .4) >= ratio; x += .5) { + ADD_GRID(x + .1); + ADD_GRID(x + .2); + ADD_GRID(x + .3); + ADD_GRID(x + .4); + ADD_GRID(x + .5); + } + if (floor(x) != x) + ADD_GRID(x += .5); + for (; x < 10.0 && (x + 1.0) / (x + .5) >= ratio; x += 1.0) { + ADD_GRID(x + .5); + ADD_GRID(x + 1.0); + } + for (; x < 10.0 && (x + 1.0) / x >= ratio; x += 1.0) { + ADD_GRID(x + 1.0); + } + if (x == 7.0) { + gridNJuke--; + x = 6.0; + } + if (x < 7.0) { + ADD_GRID(x + 2.0); + } + if (x == 10.0) + gridNJuke--; + } + x = low - gridBase; + for (gridCurJuke = -1; x >= gridJuke[gridCurJuke + 1]; gridCurJuke++) { + } + } + } + else { + gridStep = RoundUp(step); + gridBase = floor(low / gridStep) * gridStep; + } + return (stepGrid()); +} + +static double +stepGrid() +{ + if (++gridCurJuke >= gridNJuke) { + gridCurJuke = 0; + gridBase += gridStep; + } + return (gridBase + gridJuke[gridCurJuke]); +} + +static double +RoundUp(val) +double val; /* Value */ + +/* + * This routine rounds up the given positive number such that + * it is some power of ten times either 1, 2, or 5. It is + * used to find increments for grid lines. + */ +{ + int exponent, + idx; + + exponent = (int) floor(nlog10(val)); + if (exponent < 0) { + for (idx = exponent; idx < 0; idx++) { + val *= 10.0; + } + } + else { + for (idx = 0; idx < exponent; idx++) { + val /= 10.0; + } + } + if (val > 5.0) + val = 10.0; + else if (val > 2.0) + val = 5.0; + else if (val > 1.0) + val = 2.0; + else + val = 1.0; + if (exponent < 0) { + for (idx = exponent; idx < 0; idx++) { + val /= 10.0; + } + } + else { + for (idx = 0; idx < exponent; idx++) { + val *= 10.0; + } + } + return val; +} + +static void +WriteValue(str, fmt, val, expv, logFlag) +char *str; /* String to write into */ +char *fmt; /* Format to print str */ +double val; /* Value to print */ +int expv; /* Exponent */ +int logFlag; /* Is this a log axis? */ + +/* + * Writes the value provided into the string in a fixed format + * consisting of seven characters. The format is: + * -ddd.dd + */ +{ + int idx; + + if (logFlag) { + if (val == floor(val)) { + if (strcmp(fmt, "%.2f") == 0) + fmt = "%.0e"; + val = pow(10.0, val); + } + else { + if (strcmp(fmt, "%.2f") == 0) + fmt = "%.2g"; + val = pow(10.0, val - floor(val)); + } + } + else { + if (expv < 0) { + for (idx = expv; idx < 0; idx++) { + val *= 10.0; + } + } + else { + for (idx = 0; idx < expv; idx++) { + val /= 10.0; + } + } + } + if (strchr(fmt, 'd') || strchr(fmt, 'x')) + (void) sprintf(str, fmt, (int) val); + else + (void) sprintf(str, fmt, val); +} + + +#define LEFT_CODE 0x01 +#define RIGHT_CODE 0x02 +#define BOTTOM_CODE 0x04 +#define TOP_CODE 0x08 + +/* Clipping algorithm from Neumann and Sproull by Cohen and Sutherland */ +#define C_CODE(xval, yval, rtn) \ +rtn = 0; \ +if ((xval) < wi->UsrOrgX) rtn = LEFT_CODE; \ +else if ((xval) > wi->UsrOppX) rtn = RIGHT_CODE; \ +if ((yval) < wi->UsrOrgY) rtn |= BOTTOM_CODE; \ +else if ((yval) > wi->UsrOppY) rtn |= TOP_CODE + +void +EraseData(wi) +LocalWin *wi; + +/* + * This routine draws the data sets themselves using the macros + * for translating coordinates. + */ +{ + double sx1, + sy1, + sx2, + sy2, + tx = 0, + ty = 0; + int idx, + subindex; + int code1, + code2, + cd, + mark_inside; + int X_idx, StoreIDX; /* PW */ + XSegment *ptr; + PointList *thisList, + *lastList; + int markFlag, + pixelMarks, + bigPixel, + colorMark; + int noLines = PM_BOOL("NoLines"); + int lineWidth = PM_INT("LineWidth"); + + /* PW Suggests we Flush and set first */ + set_mark_flags(&markFlag, &pixelMarks, &bigPixel, &colorMark); + for (idx = 0; idx < MAXSETS; idx++) { + if (wi->DOrder == 0) + thisList = PlotData[idx].list; + else if (wi->DOrder == 1) + thisList = DataD1[idx].list; + else if (wi->DOrder == 2) + thisList = DataD2[idx].list; + else { + printf ("Internal Error differentiating - order > 2!\n"); + exit (1); + } + while (thisList) { + X_idx = 0; + for (subindex = 0; subindex < thisList->numPoints - 1; subindex++) { + /* Put segment in (sx1,sy1) (sx2,sy2) */ + sx1 = thisList->xvec[subindex]; + sy1 = thisList->yvec[subindex]; + sx2 = thisList->xvec[subindex + 1]; + sy2 = thisList->yvec[subindex + 1]; + /* Now clip to current window boundary */ + C_CODE(sx1, sy1, code1); + C_CODE(sx2, sy2, code2); + mark_inside = (code1 == 0); + while (code1 || code2) { + if (code1 & code2) + break; + cd = (code1 ? code1 : code2); + if (cd & LEFT_CODE) { /* Crosses left edge */ + ty = sy1 + (sy2 - sy1) * (wi->UsrOrgX - sx1) / + (sx2 - sx1); + tx = wi->UsrOrgX; + } + else if (cd & RIGHT_CODE) { /* Crosses right edge */ + ty = sy1 + (sy2 - sy1) * (wi->UsrOppX - sx1) / + (sx2 - sx1); + tx = wi->UsrOppX; + } + else if (cd & BOTTOM_CODE) {/* Crosses bottom edge */ + tx = sx1 + (sx2 - sx1) * (wi->UsrOrgY - sy1) / + (sy2 - sy1); + ty = wi->UsrOrgY; + } + else if (cd & TOP_CODE) { /* Crosses top edge */ + tx = sx1 + (sx2 - sx1) * (wi->UsrOppY - sy1) / + (sy2 - sy1); + ty = wi->UsrOppY; + } + if (cd == code1) { + sx1 = tx; + sy1 = ty; + C_CODE(sx1, sy1, code1); + } + else { + sx2 = tx; + sy2 = ty; + C_CODE(sx2, sy2, code2); + } + } + if (!code1 && !code2) { + /* Add segment to list */ + Xsegs[0][X_idx].x1 = Xsegs[1][X_idx].x1; + Xsegs[0][X_idx].y1 = Xsegs[1][X_idx].y1; + Xsegs[0][X_idx].x2 = Xsegs[1][X_idx].x2; + Xsegs[0][X_idx].y2 = Xsegs[1][X_idx].y2; + Xsegs[1][X_idx].x1 = SCREENX(wi, sx1); + Xsegs[1][X_idx].y1 = SCREENY(wi, sy1); + Xsegs[1][X_idx].x2 = SCREENX(wi, sx2); + Xsegs[1][X_idx].y2 = SCREENY(wi, sy2); + X_idx++; + } + + /* Draw markers if requested and they are in drawing region */ + if (markFlag && mark_inside) { + if (pixelMarks) { + if (bigPixel) { + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x1, + Xsegs[1][X_idx - 1].y1, + P_DOT, 0, idx % MAXATTR); + } + else { + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x1, + Xsegs[1][X_idx - 1].y1, + P_PIXEL, 0, PIXVALUE(idx)); + } + } + else { + /* Distinctive markers */ + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x1, + Xsegs[1][X_idx - 1].y1, + P_MARK, MARKSTYLE(idx), + PIXVALUE(idx)); + } + } + + /* Draw bar elements if requested */ + if (PM_BOOL("BarGraph")) { + int barPixels, + baseSpot; + XSegment line; + + barPixels = (int) ((PM_DBL("BarWidth") / + wi->XUnitsPerPixel) + 0.5); + if (barPixels <= 0) + barPixels = 1; + baseSpot = SCREENY(wi, PM_DBL("BarBase")); + line.x1 = line.x2 = Xsegs[1][X_idx - 1].x1 + + (int) ((PM_DBL("BarOffset") * idx / + wi->XUnitsPerPixel) + 0.5); + if (PM_BOOL("StackGraph") && idx != 0) + line.y1 = Xsegs[0][X_idx - 1].y1; + else + line.y1 = baseSpot; + line.y2 = Xsegs[1][X_idx - 1].y1; + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &line, barPixels, L_VAR, + LINESTYLE(idx), PIXVALUE(idx)); + } + } + /* Handle last marker */ + if (markFlag && (thisList->numPoints > 0)) { + C_CODE(thisList->xvec[thisList->numPoints - 1], + thisList->yvec[thisList->numPoints - 1], + mark_inside); + if (mark_inside == 0) { + if (pixelMarks) { + if (bigPixel) { + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x2, + Xsegs[1][X_idx - 1].y2, + P_DOT, 0, idx % MAXATTR); + } + else { + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x2, + Xsegs[1][X_idx - 1].y2, + P_PIXEL, 0, PIXVALUE(idx)); + } + } + else { + /* Distinctive markers */ + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x2, + Xsegs[1][X_idx - 1].y2, + P_MARK, MARKSTYLE(idx), + PIXVALUE(idx)); + } + } + } + /* Handle last bar */ + if ((thisList->numPoints > 0) && PM_BOOL("BarGraph")) { + int barPixels, + baseSpot; + XSegment line; + + barPixels = (int) ((PM_DBL("BarWidth") / + wi->XUnitsPerPixel) + 0.5); + if (barPixels <= 0) + barPixels = 1; + baseSpot = SCREENY(wi, PM_DBL("BarBase")); + line.x1 = line.x2 = Xsegs[1][X_idx - 1].x2 + + (int) ((PM_DBL("BarOffset") * idx / + wi->XUnitsPerPixel) + 0.5); + if (PM_BOOL("StackGraph") && idx != 0) + line.y1 = Xsegs[0][X_idx - 1].y2; + else + line.y1 = baseSpot; + line.y2 = Xsegs[1][X_idx - 1].y2; + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &line, barPixels, L_VAR, + LINESTYLE(idx), PIXVALUE(idx)); + } + + /* Erase segments */ + if ((thisList->numPoints > 0) && (!noLines) && (X_idx > 0)) { + ptr = Xsegs[1]; + while (X_idx > wi->dev_info.max_segs) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + wi->dev_info.max_segs, ptr, + lineWidth, L_VAR, + 16, (int)(1)); + /*LINESTYLE(8), (int)(1));*/ + ptr += wi->dev_info.max_segs; + X_idx -= wi->dev_info.max_segs; + } + wi->dev_info.xg_seg(wi->dev_info.user_state, + X_idx, ptr, + lineWidth, L_VAR, + 16,(int)(1)); + } + /* Next subset */ + thisList = thisList->next; + } + } + XFlush (disp); +} + + +static void +DrawData(wi) +LocalWin *wi; + +/* + * This routine draws the data sets themselves using the macros + * for translating coordinates. + */ +{ + double sx1, + sy1, + sx2, + sy2, + tx = 0, + ty = 0; + int idx, + subindex; + int code1, + code2, + cd, + mark_inside; + int X_idx, StoreIDX; /* PW */ + XSegment *ptr; + PointList *thisList, + *lastList; + int markFlag, + pixelMarks, + bigPixel, + colorMark; + int noLines = PM_BOOL("NoLines"); + int lineWidth = PM_INT("LineWidth"); + /* PW */ + int theDelay; + + /* PW Suggests we Flush and set first */ + theDelay = PM_INT("DelayValue")*100000; + XFlush(disp); + if (PM_BOOL("Animate")) sleep(1); + set_mark_flags(&markFlag, &pixelMarks, &bigPixel, &colorMark); + for (idx = 0; idx < MAXSETS; idx++) { + if (wi->DOrder == 0) + thisList = PlotData[idx].list; + else if (wi->DOrder == 1) + thisList = DataD1[idx].list; + else if (wi->DOrder == 2) + thisList = DataD2[idx].list; + else { + printf ("Internal Error differentiating - order > 2!\n"); + exit (1); + } + while (thisList) { + X_idx = 0; + for (subindex = 0; subindex < thisList->numPoints - 1; subindex++) { + /* Put segment in (sx1,sy1) (sx2,sy2) */ + sx1 = thisList->xvec[subindex]; + sy1 = thisList->yvec[subindex]; + sx2 = thisList->xvec[subindex + 1]; + sy2 = thisList->yvec[subindex + 1]; + /* Now clip to current window boundary */ + C_CODE(sx1, sy1, code1); + C_CODE(sx2, sy2, code2); + mark_inside = (code1 == 0); + while (code1 || code2) { + if (code1 & code2) + break; + cd = (code1 ? code1 : code2); + if (cd & LEFT_CODE) { /* Crosses left edge */ + ty = sy1 + (sy2 - sy1) * (wi->UsrOrgX - sx1) / + (sx2 - sx1); + tx = wi->UsrOrgX; + } + else if (cd & RIGHT_CODE) { /* Crosses right edge */ + ty = sy1 + (sy2 - sy1) * (wi->UsrOppX - sx1) / + (sx2 - sx1); + tx = wi->UsrOppX; + } + else if (cd & BOTTOM_CODE) {/* Crosses bottom edge */ + tx = sx1 + (sx2 - sx1) * (wi->UsrOrgY - sy1) / + (sy2 - sy1); + ty = wi->UsrOrgY; + } + else if (cd & TOP_CODE) { /* Crosses top edge */ + tx = sx1 + (sx2 - sx1) * (wi->UsrOppY - sy1) / + (sy2 - sy1); + ty = wi->UsrOppY; + } + if (cd == code1) { + sx1 = tx; + sy1 = ty; + C_CODE(sx1, sy1, code1); + } + else { + sx2 = tx; + sy2 = ty; + C_CODE(sx2, sy2, code2); + } + } + if (!code1 && !code2) { + /* Add segment to list */ + Xsegs[0][X_idx].x1 = Xsegs[1][X_idx].x1; + Xsegs[0][X_idx].y1 = Xsegs[1][X_idx].y1; + Xsegs[0][X_idx].x2 = Xsegs[1][X_idx].x2; + Xsegs[0][X_idx].y2 = Xsegs[1][X_idx].y2; + Xsegs[1][X_idx].x1 = SCREENX(wi, sx1); + Xsegs[1][X_idx].y1 = SCREENY(wi, sy1); + Xsegs[1][X_idx].x2 = SCREENX(wi, sx2); + Xsegs[1][X_idx].y2 = SCREENY(wi, sy2); + X_idx++; + } + + /* Draw markers if requested and they are in drawing region */ + if (markFlag && mark_inside) { + if (pixelMarks) { + if (bigPixel) { + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x1, + Xsegs[1][X_idx - 1].y1, + P_DOT, 0, idx % MAXATTR); + } + else { + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x1, + Xsegs[1][X_idx - 1].y1, + P_PIXEL, 0, PIXVALUE(idx)); + } + } + else { + /* Distinctive markers */ + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x1, + Xsegs[1][X_idx - 1].y1, + P_MARK, MARKSTYLE(idx), + PIXVALUE(idx)); + } + } + + /* Draw bar elements if requested */ + if (PM_BOOL("BarGraph")) { + int barPixels, + baseSpot; + XSegment line; + + barPixels = (int) ((PM_DBL("BarWidth") / + wi->XUnitsPerPixel) + 0.5); + if (barPixels <= 0) + barPixels = 1; + baseSpot = SCREENY(wi, PM_DBL("BarBase")); + line.x1 = line.x2 = Xsegs[1][X_idx - 1].x1 + + (int) ((PM_DBL("BarOffset") * idx / + wi->XUnitsPerPixel) + 0.5); + if (PM_BOOL("StackGraph") && idx != 0) + line.y1 = Xsegs[0][X_idx - 1].y1; + else + line.y1 = baseSpot; + line.y2 = Xsegs[1][X_idx - 1].y1; + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &line, barPixels, L_VAR, + LINESTYLE(idx), PIXVALUE(idx)); + } + } + /* Handle last marker */ + if (markFlag && (thisList->numPoints > 0)) { + C_CODE(thisList->xvec[thisList->numPoints - 1], + thisList->yvec[thisList->numPoints - 1], + mark_inside); + if (mark_inside == 0) { + if (pixelMarks) { + if (bigPixel) { + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x2, + Xsegs[1][X_idx - 1].y2, + P_DOT, 0, idx % MAXATTR); + } + else { + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x2, + Xsegs[1][X_idx - 1].y2, + P_PIXEL, 0, PIXVALUE(idx)); + } + } + else { + /* Distinctive markers */ + wi->dev_info.xg_dot(wi->dev_info.user_state, + Xsegs[1][X_idx - 1].x2, + Xsegs[1][X_idx - 1].y2, + P_MARK, MARKSTYLE(idx), + PIXVALUE(idx)); + } + } + } + /* Handle last bar */ + if ((thisList->numPoints > 0) && PM_BOOL("BarGraph")) { + int barPixels, + baseSpot; + XSegment line; + + barPixels = (int) ((PM_DBL("BarWidth") / + wi->XUnitsPerPixel) + 0.5); + if (barPixels <= 0) + barPixels = 1; + baseSpot = SCREENY(wi, PM_DBL("BarBase")); + line.x1 = line.x2 = Xsegs[1][X_idx - 1].x2 + + (int) ((PM_DBL("BarOffset") * idx / + wi->XUnitsPerPixel) + 0.5); + if (PM_BOOL("StackGraph") && idx != 0) + line.y1 = Xsegs[0][X_idx - 1].y2; + else + line.y1 = baseSpot; + line.y2 = Xsegs[1][X_idx - 1].y2; + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &line, barPixels, L_VAR, + LINESTYLE(idx), PIXVALUE(idx)); + } + + /* Draw segments */ + if (!PM_BOOL("Animate")) { + if (thisList->numPoints > 0 && (!noLines) && (X_idx > 0)) { + ptr = Xsegs[1]; + while (X_idx > wi->dev_info.max_segs) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + wi->dev_info.max_segs, ptr, + lineWidth, L_VAR, + LINESTYLE(idx), PIXVALUE(idx)); + ptr += wi->dev_info.max_segs; + X_idx -= wi->dev_info.max_segs; + } + wi->dev_info.xg_seg(wi->dev_info.user_state, + X_idx, ptr, + lineWidth, L_VAR, + LINESTYLE(idx), PIXVALUE(idx)); + } + } else { + StoreIDX = X_idx; + if (thisList->numPoints > 0 && (!noLines) && (X_idx > 0)) { + ptr = Xsegs[1]; + while (X_idx > wi->dev_info.max_segs) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + wi->dev_info.max_segs, ptr, + lineWidth, L_VAR, + LINESTYLE(1), PIXVALUE(2)); + ptr += wi->dev_info.max_segs; + X_idx -= wi->dev_info.max_segs; + } + wi->dev_info.xg_seg(wi->dev_info.user_state, + X_idx, ptr, + lineWidth, L_VAR, + LINESTYLE(1), PIXVALUE(2)); + } + XFlush (disp); + for (X_idx=1;X_idxnumPoints > 0) && (!noLines) && (X_idx > 0)) { + ptr = Xsegs[1]; + while (X_idx > wi->dev_info.max_segs) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + wi->dev_info.max_segs, ptr, + lineWidth, L_VAR, + 16, (int)(1)); + /*LINESTYLE(8), (int)(1));*/ + ptr += wi->dev_info.max_segs; + X_idx -= wi->dev_info.max_segs; + } + wi->dev_info.xg_seg(wi->dev_info.user_state, + X_idx, ptr, + lineWidth, L_VAR, + 16,(int)(1)); + } + } + /* Next subset */ + lastList = thisList; + thisList = thisList->next; + } /* End While */ + } + if (PM_BOOL("Animate")) { + X_idx = StoreIDX; + thisList = lastList; + if (thisList->numPoints > 0 && (!noLines) && (X_idx > 0)) { + ptr = Xsegs[1]; + while (X_idx > wi->dev_info.max_segs) { + wi->dev_info.xg_seg(wi->dev_info.user_state, + wi->dev_info.max_segs, ptr, + lineWidth, L_VAR, + LINESTYLE(1), PIXVALUE(2)); + ptr += wi->dev_info.max_segs; + X_idx -= wi->dev_info.max_segs; + } + wi->dev_info.xg_seg(wi->dev_info.user_state, + X_idx, ptr, + lineWidth, L_VAR, + LINESTYLE(1), PIXVALUE(2)); + } + } + XFlush (disp); +} + + + +static void +DrawLegend(wi) +LocalWin *wi; + +/* + * This draws a legend of the data sets displayed. Only those that + * will fit are drawn. + */ +{ + int idx, + spot, + lineLen, + oneLen, + incr; + XSegment leg_line; + int markFlag, + pixelMarks, + bigPixel, + colorMark; + + set_mark_flags(&markFlag, &pixelMarks, &bigPixel, &colorMark); + spot = wi->XOrgY; + lineLen = 0; + incr = 2 + wi->dev_info.axis_height + wi->dev_info.bdr_pad; + /* First pass draws the text */ + for (idx = 0; idx < MAXSETS; idx++) { + if ((PlotData[idx].list) && + (spot + wi->dev_info.axis_height + 2 < wi->XOppY)) { + /* Meets the criteria */ + oneLen = strlen(PlotData[idx].setName); + if (oneLen > lineLen) + lineLen = oneLen; + wi->dev_info.xg_text(wi->dev_info.user_state, + wi->XOppX + wi->dev_info.bdr_pad, + spot + 2, + PlotData[idx].setName, + T_UPPERLEFT, T_AXIS); + spot += incr; + } + } + lineLen = lineLen * wi->dev_info.axis_width; + leg_line.x1 = wi->XOppX + wi->dev_info.bdr_pad; + leg_line.x2 = leg_line.x1 + lineLen; + spot = wi->XOrgY; + /* second pass draws the lines */ + for (idx = 0; idx < MAXSETS; idx++) { + if ((PlotData[idx].list) && + (spot + wi->dev_info.axis_height + 2 < wi->XOppY)) { + leg_line.y1 = leg_line.y2 = spot - wi->dev_info.legend_pad; + if (PM_BOOL("BarGraph")) + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &leg_line, + incr / 4, + L_VAR, LINESTYLE(idx), PIXVALUE(idx)); + if (!PM_BOOL("NoLines")) + wi->dev_info.xg_seg(wi->dev_info.user_state, + 1, &leg_line, 1, L_VAR, + LINESTYLE(idx), PIXVALUE(idx)); + if (markFlag && !pixelMarks) { + wi->dev_info.xg_dot(wi->dev_info.user_state, + leg_line.x1, leg_line.y1, + P_MARK, MARKSTYLE(idx), PIXVALUE(idx)); + + } + spot += incr; + } + } +} +static void +set_mark_flags(markFlag, pixelMarks, bigPixel, colorMark) +int *markFlag; +int *pixelMarks; +int *bigPixel; +int *colorMark; + +/* + * Determines the values of the old boolean flags based on the + * new values in the parameters database. + */ +{ + *markFlag = 0; + *pixelMarks = 0; + *colorMark = 0; + *bigPixel = 0; + if (PM_BOOL("Markers")) { + *markFlag = 1; + *pixelMarks = 0; + *colorMark = 0; + } + if (PM_BOOL("PixelMarkers")) { + *markFlag = 1; + *pixelMarks = 1; + *bigPixel = 0; + } + if (PM_BOOL("LargePixels")) { + *markFlag = 1; + *pixelMarks = 1; + *bigPixel = 1; + } + if (PM_BOOL("StyleMarkers")) { + *markFlag = 1; + *pixelMarks = 0; + *colorMark = 1; + } +} + +#undef DELAY diff --git a/xgraph/examples/Animation.xg b/xgraph/examples/Animation.xg new file mode 100644 index 000000000..28b57c714 --- /dev/null +++ b/xgraph/examples/Animation.xg @@ -0,0 +1,2047 @@ +"z gxx 0.0000 +-0.05 0.997641723566 +0.05 0.997641723566 +0.15 0.997688420568 +0.25 0.997779058894 +0.35 0.997908396435 +0.45 0.998069206559 +0.55 0.998252945848 +0.65 0.998450501969 +0.75 0.998652931126 +0.85 0.998852103626 +0.95 0.999041196353 +1.05 0.999214997968 +1.15 0.999370021113 +1.25 0.999504441055 +1.35 0.99961789849 +1.45 0.999711213891 +1.55 0.999786061989 +1.65 0.999844649119 +1.75 0.999889425853 +1.85 0.999922855036 +1.95 0.999947243536 +2.05 0.999964636285 +2.15 0.999976764383 +2.25 0.999985035417 +2.35 0.999990553103 +2.45 0.999994154417 +2.55 0.999996454475 +2.65 0.999997892112 +2.75 0.999998771632 +2.85 0.999999298345 +2.95 0.999999607145 +3.05 0.999999784396 +3.15 0.999999884017 +3.25 0.999999938843 +3.35 0.999999968391 +3.45 0.999999983986 +3.55 0.999999992048 +3.65 0.999999996129 +3.75 0.999999998153 +3.85 0.999999999136 +3.95 0.999999999604 +4.05 0.999999999822 +4.15 0.999999999922 +4.25 0.999999999966 +4.35 0.999999999986 +4.45 0.999999999994 +4.55 0.999999999998 +4.65 0.999999999999 +4.75 1 +4.85 1 +4.95 1 +5.05 1 +5.15 1 +5.25 1 +5.35 1 +5.45 1 +5.55 1 +5.65 1 +5.75 1 +5.85 1 +5.95 1 +6.05 1 +6.15 1 +6.25 1 + +"z gxx 0.4000 +-0.05 0.999706545368 +0.05 0.999706545368 +0.15 0.999703189866 +0.25 0.999697158584 +0.35 0.999689702454 +0.45 0.999682446531 +0.55 0.99967713991 +0.65 0.999675396322 +0.75 0.999678468315 +0.85 0.999687088943 +0.95 0.999701400259 +1.05 0.999720971099 +1.15 0.999744891364 +1.25 0.999771918998 +1.35 0.999800650755 +1.45 0.99982968859 +1.55 0.999857779075 +1.65 0.999883911568 +1.75 0.999907369953 +1.85 0.999927740814 +1.95 0.999944886619 +2.05 0.999958895546 +2.15 0.99997001998 +2.25 0.999978614149 +2.35 0.999985078609 +2.45 0.999989816136 +2.55 0.9999932007 +2.65 0.999995558932 +2.75 0.999997162077 +2.85 0.999998225739 +2.95 0.999998914708 +3.05 0.999999350481 +3.15 0.999999619677 +3.25 0.999999782118 +3.35 0.999999877881 +3.45 0.999999933038 +3.55 0.999999964081 +3.65 0.999999981153 +3.75 0.999999990328 +3.85 0.999999995145 +3.95 0.999999997617 +4.05 0.999999998857 +4.15 0.999999999464 +4.25 0.999999999754 +4.35 0.99999999989 +4.45 0.999999999952 +4.55 0.999999999979 +4.65 0.999999999991 +4.75 0.999999999997 +4.85 0.999999999999 +4.95 0.999999999999 +5.05 1 +5.15 1 +5.25 1 +5.35 1 +5.45 1 +5.55 1 +5.65 1 +5.75 1 +5.85 1 +5.95 1 +6.05 1 +6.15 1 +6.25 1 + +"z gxx 0.8000 +-0.05 1.00168649912 +0.05 1.00168649912 +0.15 1.00165315178 +0.25 1.00158810871 +0.35 1.00149456166 +0.45 1.00137702664 +0.55 1.0012410381 +0.65 1.00109277503 +0.75 1.0009386473 +0.85 1.0007848762 +0.95 1.00063710507 +1.05 1.00050007451 +1.15 1.00037739036 +1.25 1.00027140257 +1.35 1.0001831999 +1.45 1.00011271162 +1.55 1.00005889523 +1.65 1.00001998058 +1.75 0.999993737256 +1.85 0.99997773346 +1.95 0.999969560755 +2.05 0.999967007472 +2.15 0.999968173395 +2.25 0.99997152711 +2.35 0.999975914157 +2.45 0.999980528192 +2.55 0.999984858695 +2.65 0.999988627862 +2.75 0.999991726898 +2.85 0.99999415883 +2.95 0.999995991794 +3.05 0.999997324147 +3.15 0.999998260776 +3.25 0.999998898827 +3.35 0.999999320622 +3.45 0.999999591481 +3.55 0.999999760565 +3.65 0.999999863223 +3.75 0.999999923859 +3.85 0.999999958708 +3.95 0.999999978195 +4.05 0.999999988795 +4.15 0.999999994402 +4.25 0.999999997284 +4.35 0.999999998723 +4.45 0.999999999419 +4.55 0.999999999745 +4.65 0.999999999893 +4.75 0.999999999957 +4.85 0.999999999984 +4.95 0.999999999994 +5.05 0.999999999998 +5.15 1 +5.25 1 +5.35 1 +5.45 1 +5.55 1 +5.65 1 +5.75 1 +5.85 1 +5.95 1 +6.05 1 +6.15 1 +6.25 1 + +"z gxx 1.2000 +-0.05 1.00056326055 +0.05 1.00056326055 +0.15 1.00056743515 +0.25 1.0005748418 +0.35 1.00058372348 +0.45 1.00059174651 +0.55 1.00059631438 +0.65 1.00059491387 +0.75 1.00058544618 +0.85 1.00056649945 +0.95 1.00053752851 +1.05 1.00049892181 +1.15 1.00045195153 +1.25 1.00039861908 +1.35 1.00034142147 +1.45 1.00028307379 +1.55 1.00022622675 +1.65 1.00017321584 +1.75 1.00012587166 +1.85 1.00008540902 +1.95 1.00005239935 +2.05 1.00002681844 +2.15 1.00000815161 +2.25 0.999995533173 +2.35 0.999987896122 +2.45 0.999984111019 +2.55 0.999983099283 +2.65 0.999983912836 +2.75 0.999985778855 +2.85 0.999988113565 +2.95 0.999990512212 +3.05 0.999992723594 +3.15 0.999994617089 +3.25 0.999996148637 +3.35 0.999997330097 +3.45 0.99999820445 +3.55 0.999998827603 +3.65 0.999999256404 +3.75 0.999999541783 +3.85 0.999999725685 +3.95 0.999999840513 +4.05 0.999999910005 +4.15 0.999999950763 +4.25 0.999999973921 +4.35 0.999999986657 +4.45 0.999999993427 +4.55 0.999999996897 +4.65 0.999999998608 +4.75 0.999999999414 +4.85 0.999999999774 +4.95 0.999999999925 +5.05 0.999999999983 +5.15 1 +5.25 1.00000000001 +5.35 1 +5.45 1 +5.55 1 +5.65 1 +5.75 1 +5.85 1 +5.95 1 +6.05 1 +6.15 1 +6.25 1 + +"z gxx 1.6000 +-0.05 0.999439372017 +0.05 0.999439372017 +0.15 0.999453567533 +0.25 0.999481407271 +0.35 0.999521800571 +0.45 0.999573143429 +0.55 0.999633362661 +0.65 0.999699983451 +0.75 0.99977022529 +0.85 0.999841129161 +0.95 0.999909714406 +1.05 0.999973157638 +1.15 1.00002897955 +1.25 1.00007522019 +1.35 1.00011058077 +1.45 1.0001345119 +1.55 1.00014723342 +1.65 1.00014968017 +1.75 1.00014337862 +1.85 1.00013026949 +1.95 1.00011249951 +2.05 1.00009220946 +2.15 1.00007134506 +2.25 1.00005151225 +2.35 1.00003388989 +2.45 1.00001920321 +2.55 1.00000775189 +2.65 0.999999479451 +2.75 0.999994067159 +2.85 0.999991034962 +2.95 0.999989834944 +3.05 0.999989927085 +3.15 0.999990832307 +3.25 0.999992162374 +3.35 0.999993629722 +3.45 0.999995042252 +3.55 0.999996288714 +3.65 0.999997319823 +3.75 0.999998129102 +3.85 0.999998736058 +3.95 0.999999173002 +4.05 0.999999475802 +4.15 0.999999678169 +4.25 0.999999808737 +4.35 0.999999890099 +4.45 0.999999939057 +4.55 0.99999996748 +4.65 0.999999983377 +4.75 0.999999991918 +4.85 0.999999996308 +4.95 0.999999998452 +5.05 0.999999999435 +5.15 0.999999999848 +5.25 0.999999999999 +5.35 1.00000000004 +5.45 1.00000000004 +5.55 1.00000000003 +5.65 1.00000000002 +5.75 1.00000000001 +5.85 1.00000000001 +5.95 1 +6.05 1 +6.15 1 +6.25 1 + +"z gxx 2.0000 +-0.05 0.999647797461 +0.05 0.999647797461 +0.15 0.999648883773 +0.25 0.999651219097 +0.35 0.999655123308 +0.45 0.999661057802 +0.55 0.999669592669 +0.65 0.999681350727 +0.75 0.999696927112 +0.85 0.999716790007 +0.95 0.999741175181 +1.05 0.999769991953 +1.15 0.999802759484 +1.25 0.999838589201 +1.35 0.999876222335 +1.45 0.999914122325 +1.55 0.999950612281 +1.65 0.999984039629 +1.75 1.00001294507 +1.85 1.00003621191 +1.95 1.00005317472 +2.05 1.00006367259 +2.15 1.00006804087 +2.25 1.00006704475 +2.35 1.00006176663 +2.45 1.00005346586 +2.55 1.00004343213 +2.65 1.00003285338 +2.75 1.00002271447 +2.85 1.00001373638 +2.95 1.0000063577 +3.05 1.00000075358 +3.15 0.999996882125 +3.25 0.999994545918 +3.35 0.999993456697 +3.45 0.999993293575 +3.55 0.999993748489 +3.65 0.999994556316 +3.75 0.999995510115 +3.85 0.999996464086 +3.95 0.999997327898 +4.05 0.999998056119 +4.15 0.999998635963 +4.25 0.999999075652 +4.35 0.999999394767 +4.45 0.999999617133 +4.55 0.99999976617 +4.65 0.999999862331 +4.75 0.999999922058 +4.85 0.999999957737 +4.95 0.999999978194 +5.05 0.999999989413 +5.15 0.999999995263 +5.25 0.999999998134 +5.35 0.999999999434 +5.45 0.999999999956 +5.55 1.00000000012 +5.65 1.00000000014 +5.75 1.00000000011 +5.85 1.00000000008 +5.95 1.00000000005 +6.05 1.00000000003 +6.15 1.00000000002 +6.25 1 + +"z gxx 2.4000 +-0.05 0.999971670716 +0.05 0.999971670716 +0.15 0.999970619145 +0.25 0.999968416496 +0.35 0.999964900001 +0.45 0.999959907436 +0.55 0.999953353536 +0.65 0.999945301631 +0.75 0.999936014799 +0.85 0.999925975673 +0.95 0.999915870222 +1.05 0.999906536952 +1.15 0.999898887826 +1.25 0.99989381065 +1.35 0.999892064732 +1.45 0.999894182731 +1.55 0.999900391572 +1.65 0.999910564035 +1.75 0.999924209704 +1.85 0.999940509292 +1.95 0.99995839044 +2.05 0.999976636775 +2.15 0.999994016513 +2.25 1.00000941336 +2.35 1.00002194167 +2.45 1.00003103015 +2.55 1.00003646304 +2.65 1.0000383748 +2.75 1.00003720147 +2.85 1.00003359874 +2.95 1.00002834128 +3.05 1.00002221983 +3.15 1.00001595126 +3.25 1.00001011283 +3.35 1.00000510622 +3.45 1.00000115137 +3.55 0.999998304968 +3.65 0.999996495651 +3.75 0.999995566862 +3.85 0.999995319215 +3.95 0.999995546402 +4.05 0.999996061278 +4.15 0.999996711312 +4.25 0.9999973845 +4.35 0.999998008024 +4.45 0.999998542315 +4.55 0.999998972993 +4.65 0.999999302614 +4.75 0.999999543468 +4.85 0.999999712041 +4.95 0.999999825249 +5.05 0.999999898238 +5.15 0.99999994339 +5.25 0.999999970139 +5.35 0.99999998526 +5.45 0.999999993364 +5.55 0.999999997434 +5.65 0.999999999308 +5.75 1.00000000006 +5.85 1.00000000029 +5.95 1.0000000003 +6.05 1.00000000024 +6.15 1.0000000002 +6.25 1 + +"z gxx 2.8000 +-0.05 0.99999067393 +0.05 0.99999067393 +0.15 0.999992393611 +0.25 0.999995579289 +0.35 0.999999763045 +0.45 1.00000433299 +0.55 1.00000861973 +0.65 1.00001198277 +0.75 1.00001388345 +0.85 1.00001393635 +0.95 1.00001193788 +1.05 1.00000787509 +1.15 1.00000192024 +1.25 0.999994415846 +1.35 0.999985852584 +1.45 0.999976839757 +1.55 0.999968066438 +1.65 0.999960251596 +1.75 0.999954083659 +1.85 0.999950153304 +1.95 0.99994888674 +2.05 0.999950489182 +2.15 0.999954908649 +2.25 0.999961828295 +2.35 0.999970691494 +2.45 0.999980758539 +2.55 0.999991188335 +2.65 1.00000113398 +2.75 1.00000983842 +2.85 1.00001671631 +2.95 1.00002141018 +3.05 1.00002381374 +3.15 1.00002406029 +3.25 1.00002248054 +3.35 1.0000195385 +3.45 1.00001575764 +3.55 1.00001164953 +3.65 1.00000765556 +3.75 1.00000410859 +3.85 1.00000121676 +3.95 0.999999067613 +4.05 0.999997647523 +4.15 0.999996869989 +4.25 0.999996606254 +4.35 0.999996713074 +4.45 0.99999705428 +4.55 0.999997514752 +4.65 0.99999800708 +4.75 0.999998472312 +4.85 0.999998876656 +4.95 0.999999206048 +5.05 0.999999460156 +5.15 0.999999646895 +5.25 0.999999778065 +5.35 0.999999866276 +5.45 0.999999923079 +5.55 0.999999958063 +5.65 0.999999978606 +5.75 0.99999999005 +5.85 0.999999996052 +5.95 0.999999998998 +6.05 1.00000000039 +6.15 1.00000000119 +6.25 1 + +"z gxx 3.2000 +-0.05 0.999936182767 +0.05 0.999936182767 +0.15 0.999938960441 +0.25 0.999944256037 +0.35 0.999951590966 +0.45 0.999960339755 +0.55 0.999969816366 +0.65 0.999979356473 +0.75 0.999988380691 +0.85 0.999996430752 +0.95 1.00000317856 +1.05 1.00000841463 +1.15 1.00001202569 +1.25 1.00001397149 +1.35 1.00001426813 +1.45 1.00001298137 +1.55 1.00001022964 +1.65 1.00000619339 +1.75 1.00000112542 +1.85 0.99999535672 +1.95 0.999989292589 +2.05 0.999983395616 +2.15 0.999978154431 +2.25 0.999974040183 +2.35 0.999971455666 +2.45 0.999970684522 +2.55 0.999971849181 +2.65 0.999974885766 +2.75 0.999979541959 +2.85 0.999985400178 +2.95 0.99999192407 +3.05 0.999998522128 +3.15 1.00000461908 +3.25 1.00000972412 +3.35 1.00001348559 +3.45 1.00001572392 +3.55 1.00001643866 +3.65 1.00001579008 +3.75 1.00001406014 +3.85 1.00001160101 +3.95 1.00000878075 +4.05 1.00000593516 +4.15 1.00000333256 +4.25 1.00000115467 +4.35 0.999999493715 +4.45 0.999998362612 +4.55 0.999997713744 +4.65 0.999997461281 +4.75 0.999997502656 +4.85 0.999997736136 +4.95 0.999998072949 +5.05 0.999998443791 +5.15 0.999998800528 +5.25 0.999999114455 +5.35 0.999999372556 +5.45 0.999999573051 +5.55 0.999999721152 +5.65 0.999999825587 +5.75 0.99999989609 +5.85 0.999999941847 +5.95 0.999999970746 +6.05 0.9999999892 +6.15 1.00000000236 +6.25 1 + +"z gxx 3.6000 +-0.05 0.999905094072 +0.05 0.999905094072 +0.15 0.999908125223 +0.25 0.999913910281 +0.35 0.999921940887 +0.45 0.99993155871 +0.55 0.999942052773 +0.65 0.999952752025 +0.75 0.999963095834 +0.85 0.999972672736 +0.95 0.999981226621 +1.05 0.999988636927 +1.15 0.999994883417 +1.25 1.0000000066 +1.35 1.00000407248 +1.45 1.0000071468 +1.55 1.00000928041 +1.65 1.00001050495 +1.75 1.00001083704 +1.85 1.00001028851 +1.95 1.00000888084 +2.05 1.00000666153 +2.15 1.00000372015 +2.25 1.00000020141 +2.35 0.999996311803 +2.45 0.999992317179 +2.55 0.999988528802 +2.65 0.999985277873 +2.75 0.999982880538 +2.85 0.999981598024 +2.95 0.999981598348 +3.05 0.999982926681 +3.15 0.999985490607 +3.25 0.9999890642 +3.35 0.999993311643 +3.45 0.999997827525 +3.55 1.00000218786 +3.65 1.00000600377 +3.75 1.00000896911 +3.85 1.00001089446 +3.95 1.00001172242 +4.05 1.00001152254 +4.15 1.00001046836 +4.25 1.00000880172 +4.35 1.00000679182 +4.45 1.00000469632 +4.55 1.0000027307 +4.65 1.00000104935 +4.75 0.999999739381 +4.85 0.999998825401 +4.95 0.999998282122 +5.05 0.999998050828 +5.15 0.999998056127 +5.25 0.999998220279 +5.35 0.99999847357 +5.45 0.999998760341 +5.55 0.999999041141 +5.65 0.999999291968 +5.75 0.999999501757 +5.85 0.999999669152 +5.95 0.999999799345 +6.05 0.999999901475 +6.15 0.999999986749 +6.25 1 + +"z gxx 4.0000 +-0.05 0.999887068806 +0.05 0.999887068806 +0.15 0.99989038182 +0.25 0.999896700184 +0.35 0.999905459624 +0.45 0.999915929261 +0.55 0.999927320036 +0.65 0.999938888575 +0.75 0.99995001735 +0.85 0.999960260166 +0.95 0.999969351697 +1.05 0.999977187847 +1.15 0.999983788285 +1.25 0.99998925306 +1.35 0.999993722721 +1.45 0.999997347295 +1.55 1.00000026563 +1.65 1.00000259378 +1.75 1.00000441998 +1.85 1.00000580359 +1.95 1.00000677657 +2.05 1.0000073465 +2.15 1.00000750155 +2.25 1.00000721763 +2.35 1.00000646836 +2.45 1.00000523736 +2.55 1.00000353225 +2.65 1.00000139816 +2.75 0.999998928116 +2.85 0.999996267459 +2.95 0.999993609619 +3.05 0.999991181971 +3.15 0.999989222373 +3.25 0.99998794911 +3.35 0.999987528878 +3.45 0.999988048492 +3.55 0.99998949591 +3.65 0.999991754847 +3.75 0.999994614956 +3.85 0.999997796739 +3.95 1.00000098759 +4.05 1.00000388314 +4.15 1.00000622709 +4.25 1.00000784265 +4.35 1.00000865068 +4.45 1.00000867185 +4.55 1.00000801368 +4.65 1.00000684572 +4.75 1.00000536856 +4.85 1.00000378255 +4.95 1.00000226174 +5.05 1.00000093638 +5.15 0.999999885442 +5.25 0.999999138304 +5.35 0.999998683371 +5.45 0.999998480517 +5.55 0.999998474455 +5.65 0.999998606641 +5.75 0.999998824274 +5.85 0.999999085814 +5.95 0.99999936319 +6.05 0.99999964128 +6.15 0.999999915417 +6.25 1 + +"z gxx 4.4000 +-0.05 0.999871536909 +0.05 0.999871536909 +0.15 0.9998751867 +0.25 0.999882149165 +0.35 0.999891805215 +0.45 0.999903351211 +0.55 0.999915916701 +0.65 0.999928677858 +0.75 0.999940945863 +0.85 0.999952218184 +0.95 0.999962190985 +1.05 0.999970739672 +1.15 0.99997787965 +1.25 0.999983720181 +1.35 0.999988421646 +1.45 0.999992162246 +1.55 0.999995115892 +1.65 0.999997439936 +1.75 0.999999269909 +1.85 1.00000071826 +1.95 1.00000187481 +2.05 1.00000280764 +2.15 1.00000356372 +2.25 1.00000416956 +2.35 1.00000463195 +2.45 1.00000493943 +2.55 1.00000506493 +2.65 1.00000497021 +2.75 1.00000461229 +2.85 1.00000395232 +2.95 1.00000296608 +3.05 1.00000165528 +3.15 1.00000005757 +3.25 0.999998252937 +3.35 0.999996364103 +3.45 0.999994549236 +3.55 0.999992986618 +3.65 0.999991852687 +3.75 0.999991296576 +3.85 0.999991415496 +3.95 0.999992235639 +4.05 0.999993702668 +4.15 0.999995684271 +4.25 0.999997985135 +4.35 1.00000037233 +4.45 1.00000260702 +4.55 1.00000447715 +4.65 1.00000582533 +4.75 1.00000656718 +4.85 1.00000669732 +4.95 1.00000628262 +5.05 1.000005445 +5.15 1.00000433783 +5.25 1.00000312092 +5.35 1.00000193848 +5.45 1.00000090355 +5.55 1.00000009016 +5.65 0.99999953288 +5.75 0.999999232061 +5.85 0.999999162263 +5.95 0.999999281317 +6.05 0.999999538058 +6.15 0.999999877572 +6.25 1 + +"z gxx 4.8000 +-0.05 0.999856338212 +0.05 0.999856338212 +0.15 0.999860328384 +0.25 0.999867944926 +0.35 0.999878518913 +0.45 0.99989118013 +0.55 0.999904982996 +0.65 0.999919028504 +0.75 0.999932560057 +0.85 0.99994502005 +0.95 0.999956064921 +1.05 0.999965545749 +1.15 0.999973467098 +1.25 0.999979937842 +1.35 0.999985125216 +1.45 0.999989218767 +1.55 0.999992406346 +1.65 0.999994860816 +1.75 0.999996734494 +1.85 0.999998158102 +1.95 0.999999241725 +2.05 1.00000007629 +2.15 1.00000073499 +2.25 1.00000127451 +2.35 1.00000173618 +2.45 1.00000214724 +2.55 1.00000252192 +2.65 1.00000286254 +2.75 1.00000316035 +2.85 1.00000339637 +2.95 1.00000354238 +3.05 1.00000356283 +3.15 1.00000341806 +3.25 1.00000306942 +3.35 1.0000024864 +3.45 1.0000016552 +3.55 1.00000058737 +3.65 0.999999326702 +3.75 0.999997952101 +3.85 0.999996574686 +3.95 0.999995328208 +4.05 0.99999435333 +4.15 0.999993777828 +4.25 0.999993695956 +4.35 0.999994150843 +4.45 0.99999512355 +4.55 0.999996531417 +4.65 0.999998236692 +4.75 1.0000000645 +4.85 1.00000182736 +4.95 1.00000335196 +5.05 1.00000450342 +5.15 1.00000520272 +5.25 1.00000543411 +5.35 1.00000524172 +5.45 1.00000471661 +5.55 1.00000397717 +5.65 1.00000314702 +5.75 1.00000233447 +5.85 1.00000161672 +5.95 1.00000103106 +6.05 1.00000057349 +6.15 1.00000020438 +6.25 1 + +"z gxx 5.2000 +-0.05 0.999841264524 +0.05 0.999841264524 +0.15 0.999845585263 +0.25 0.999853838519 +0.35 0.99986530956 +0.45 0.999879066563 +0.55 0.999894093793 +0.65 0.999909421303 +0.75 0.999924227793 +0.85 0.999937902465 +0.95 0.999950062941 +1.05 0.999960536286 +1.15 0.999969316207 +1.25 0.999976510986 +1.35 0.999982294179 +1.45 0.999986865523 +1.55 0.999990424601 +1.65 0.999993156099 +1.75 0.999995223575 +1.85 0.999996768283 +1.95 0.99999791032 +2.05 0.999998750413 +2.15 0.999999371606 +2.25 0.999999840775 +2.35 1.00000021007 +2.45 1.00000051852 +2.55 1.00000079373 +2.65 1.00000105379 +2.75 1.00000130905 +2.85 1.00000156366 +2.95 1.00000181668 +3.05 1.00000206266 +3.15 1.00000229157 +3.25 1.00000248838 +3.35 1.00000263253 +3.45 1.00000269794 +3.55 1.00000265409 +3.65 1.00000246886 +3.75 1.00000211336 +3.85 1.00000156861 +3.95 1.00000083297 +4.05 0.999999928967 +4.15 0.99999890747 +4.25 0.999997847563 +4.35 0.999996850903 +4.45 0.999996030636 +4.55 0.999995496134 +4.65 0.999995335957 +4.75 0.999995602121 +4.85 0.99999629877 +4.95 0.999997377727 +5.05 0.999998742173 +5.15 1.00000025817 +5.25 1.00000177214 +5.35 1.00000313115 +5.45 1.00000420232 +5.55 1.00000488788 +5.65 1.00000513351 +5.75 1.00000492946 +5.85 1.00000430555 +5.95 1.00000332246 +6.05 1.00000206235 +6.15 1.00000062106 +6.25 1 + +"z gxx 5.6000 +-0.05 0.999826307736 +0.05 0.999826307736 +0.15 0.999830947464 +0.25 0.999839816339 +0.35 0.999852157454 +0.45 0.99986698176 +0.55 0.999883207585 +0.65 0.999899797336 +0.75 0.99991586699 +0.85 0.999930753191 +0.95 0.999944034379 +1.05 0.999955512725 +1.15 0.999965170218 +1.25 0.999973114069 +1.35 0.999979524257 +1.45 0.999984611345 +1.55 0.999988587606 +1.65 0.999991650506 +1.75 0.999993975435 +1.85 0.999995714086 +1.95 0.99999699554 +2.05 0.99999792821 +2.15 0.999998601796 +2.25 0.99999908907 +2.35 0.999999447599 +2.45 0.99999972154 +2.55 0.999999943556 +2.65 1.00000013678 +2.75 1.00000031676 +2.85 1.00000049315 +2.95 1.00000067133 +3.05 1.00000085357 +3.15 1.00000104 +3.25 1.00000122925 +3.35 1.00000141872 +3.45 1.00000160438 +3.55 1.00000178027 +3.65 1.00000193749 +3.75 1.00000206322 +3.85 1.00000214 +3.95 1.00000214584 +4.05 1.00000205594 +4.15 1.00000184606 +4.25 1.00000149778 +4.35 1.00000100484 +4.45 1.00000037927 +4.55 0.999999655616 +4.65 0.999998891719 +4.75 0.999998164588 +4.85 0.999997561304 +4.95 0.999997165783 +5.05 0.999997043446 +5.15 0.999997226696 +5.25 0.999997704364 +5.35 0.999998417943 +5.45 0.999999266414 +5.55 1.00000011993 +5.65 1.00000084071 +5.75 1.00000130785 +5.85 1.00000144117 +5.95 1.00000121929 +6.05 1.00000068742 +6.15 0.999999952513 +6.25 1 + +"z gxx 6.0000 +-0.05 0.999811469634 +0.05 0.999811469634 +0.15 0.999816416617 +0.25 0.99982587964 +0.35 0.99983906315 +0.45 0.999854925126 +0.55 0.999872322037 +0.65 0.999890151797 +0.75 0.999907469428 +0.85 0.999923559367 +0.95 0.999937960057 +1.05 0.999950447274 +1.15 0.99996098962 +1.25 0.99996969183 +1.35 0.999976739436 +1.45 0.9999823536 +1.55 0.999986759651 +1.65 0.999990168665 +1.75 0.999992768969 +1.85 0.999994723877 +1.95 0.999996172515 +2.05 0.999997231739 +2.15 0.999997998177 +2.25 0.999998550161 +2.35 0.999998949642 +2.45 0.999999244212 +2.55 0.999999469286 +2.65 0.999999650348 +2.75 0.999999805134 +2.85 0.999999945583 +2.95 1.00000007946 +3.05 1.00000021163 +3.15 1.00000034494 +3.25 1.00000048085 +3.35 1.00000061994 +3.45 1.00000076222 +3.55 1.00000090746 +3.65 1.00000105546 +3.75 1.00000120613 +3.85 1.00000135927 +3.95 1.00000151403 +4.05 1.00000166781 +4.15 1.0000018148 +4.25 1.00000194436 +4.35 1.00000203985 +4.45 1.00000207833 +4.55 1.00000203177 +4.65 1.00000187011 +4.75 1.000001566 +4.85 1.00000110068 +4.95 1.00000047002 +5.05 0.999999689382 +5.15 0.999998796383 +5.25 0.99999785056 +5.35 0.999996929747 +5.45 0.999996123291 +5.55 0.999995522758 +5.65 0.999995211099 +5.75 0.99999525152 +5.85 0.999995677462 +5.95 0.999996485177 +6.05 0.999997630221 +6.15 0.999999028875 +6.25 1 + +"z gxx 6.4000 +-0.05 0.999796751607 +0.05 0.999796751607 +0.15 0.999801994152 +0.25 0.999812029882 +0.35 0.999826028034 +0.45 0.999842897789 +0.55 0.999861437799 +0.65 0.99988048465 +0.75 0.999899034248 +0.85 0.999916319229 +0.95 0.99993183725 +1.05 0.999945336124 +1.15 0.999956769209 +1.25 0.999966237049 +1.35 0.999973929428 +1.45 0.999980077342 +1.55 0.999984918939 +1.65 0.999988679093 +1.75 0.99999155956 +1.85 0.999993735954 +1.95 0.999995358222 +2.05 0.999996552475 +2.15 0.999997423064 +2.25 0.999998054614 +2.35 0.999998514047 +2.45 0.999998852746 +2.55 0.999999108883 +2.65 0.999999309856 +2.75 0.999999474685 +2.85 0.999999616221 +2.95 0.999999743036 +3.05 0.999999860945 +3.15 0.999999974139 +3.25 1.00000008596 +3.35 1.00000019937 +3.45 1.00000031717 +3.55 1.00000044205 +3.65 1.00000057642 +3.75 1.00000072219 +3.85 1.00000088033 +3.95 1.00000105038 +4.05 1.00000122974 +4.15 1.00000141282 +4.25 1.00000159013 +4.35 1.00000174736 +4.45 1.00000186476 +4.55 1.00000191727 +4.65 1.00000187577 +4.75 1.00000170996 +4.85 1.00000139316 +4.95 1.00000090863 +5.05 1.00000025689 +5.15 0.999999462225 +5.25 0.99999857681 +5.35 0.999997680271 +5.45 0.999996873505 +5.55 0.999996266551 +5.65 0.999995961846 +5.75 0.999996035684 +5.85 0.999996521584 +5.95 0.999997399381 +6.05 0.999998592963 +6.15 0.999999977902 +6.25 1 + +"z gxx 6.8000 +-0.05 0.999782154508 +0.05 0.999782154508 +0.15 0.999787681046 +0.25 0.999798268212 +0.35 0.999813053361 +0.45 0.999830900941 +0.55 0.999850555774 +0.65 0.999870796299 +0.75 0.999890561234 +0.85 0.999909031949 +0.95 0.999925664641 +1.05 0.999940177674 +1.15 0.999952507313 +1.25 0.99996274812 +1.35 0.999971092698 +1.45 0.999977780926 +1.55 0.999983063317 +1.65 0.999987178484 +1.75 0.999990341838 +1.85 0.999992741656 +1.95 0.999994539134 +2.05 0.999995870065 +2.15 0.999996846946 +2.25 0.999997561122 +2.35 0.999998084955 +2.45 0.999998474151 +2.55 0.999998770264 +2.65 0.999999003304 +2.75 0.99999919431 +2.85 0.999999357724 +2.95 0.999999503429 +3.05 0.999999638376 +3.15 0.999999767772 +3.25 0.999999895816 +3.35 1.00000002601 +3.45 1.00000016109 +3.55 1.00000030257 +3.65 1.00000045005 +3.75 1.00000060038 +3.85 1.00000074679 +3.95 1.00000087847 +4.05 1.00000098063 +4.15 1.00000103565 +4.25 1.00000102528 +4.35 1.00000093402 +4.45 1.00000075329 +4.55 1.0000004858 +4.65 1.00000014893 +4.75 0.999999776076 +4.85 0.999999414899 +4.95 0.999999121756 +5.05 0.999998952748 +5.15 0.999998952538 +5.25 0.999999143188 +5.35 0.999999515758 +5.45 1.00000002724 +5.55 1.00000060453 +5.65 1.00000115544 +5.75 1.00000158516 +5.85 1.00000181467 +5.95 1.00000179719 +6.05 1.00000152872 +6.15 1.00000105003 +6.25 1 + +"z gxx 7.2000 +-0.05 0.999767678796 +0.05 0.999767678796 +0.15 0.999773477942 +0.25 0.999784595563 +0.35 0.999800140316 +0.45 0.999818935847 +0.55 0.999839677048 +0.65 0.999861087396 +0.75 0.999882050422 +0.85 0.999901696905 +0.95 0.999919441057 +1.05 0.999934970412 +1.15 0.999948202349 +1.25 0.999959223646 +1.35 0.999968228212 +1.45 0.999975463755 +1.55 0.999981192581 +1.65 0.999985666893 +1.75 0.999989115894 +1.85 0.999991740852 +1.95 0.999993714607 +2.05 0.99999518305 +2.15 0.999996267242 +2.25 0.999997065672 +2.35 0.99999765662 +2.45 0.999998100679 +2.55 0.999998443449 +2.65 0.999998718304 +2.75 0.999998949043 +2.85 0.999999152241 +2.95 0.999999339129 +3.05 0.999999516916 +3.15 0.999999689545 +3.25 0.999999857946 +3.35 1.00000001994 +3.45 1.00000016999 +3.55 1.00000029916 +3.65 1.00000039538 +3.75 1.00000044457 +3.85 1.00000043254 +3.95 1.00000034775 +4.05 1.00000018479 +4.15 0.999999947806 +4.25 0.999999653354 +4.35 0.999999331579 +4.45 0.999999025033 +4.55 0.999998784608 +4.65 0.9999986627 +4.75 0.999998704429 +4.85 0.999998938409 +4.95 0.99999936899 +5.05 0.999999971876 +5.15 1.00000069451 +5.25 1.00000146163 +5.35 1.00000218524 +5.45 1.00000277721 +5.55 1.00000316213 +5.65 1.00000328799 +5.75 1.00000313298 +5.85 1.00000270743 +5.95 1.00000205124 +6.05 1.00000122764 +6.15 1.00000031464 +6.25 1 + +"z gxx 7.6000 +-0.05 0.99975332464 +0.05 0.99975332464 +0.15 0.999759385254 +0.25 0.999771012738 +0.35 0.999787290086 +0.45 0.999807003906 +0.55 0.999828802953 +0.65 0.999851358899 +0.75 0.999873502161 +0.85 0.999894313733 +0.95 0.999913165475 +1.05 0.999929712849 +1.15 0.999943852633 +1.25 0.99995566203 +1.35 0.999965334704 +1.45 0.999973125071 +1.55 0.999979306597 +1.65 0.999984144896 +1.75 0.999987883156 +1.85 0.999990736088 +1.95 0.999992888798 +2.05 0.999994497996 +2.15 0.999995694054 +2.25 0.999996583327 +2.35 0.999997250593 +2.45 0.999997761611 +2.55 0.999998165775 +2.65 0.99999849872 +2.75 0.999998784718 +2.85 0.999999038715 +2.95 0.999999267949 +3.05 0.999999473211 +3.15 0.999999649938 +3.25 0.999999789379 +3.35 0.999999880139 +3.45 0.999999910274 +3.55 0.999999870018 +3.65 0.999999754955 +3.75 0.999999569193 +3.85 0.999999327882 +3.95 0.999999058287 +4.05 0.999998798691 +4.15 0.999998594715 +4.25 0.999998493139 +4.35 0.999998533986 +4.45 0.999998742219 +4.55 0.999999120847 +4.65 0.999999647201 +4.75 1.00000027371 +4.85 1.00000093357 +4.95 1.0000015506 +5.05 1.00000205152 +5.15 1.00000237822 +5.25 1.0000024974 +5.35 1.00000240577 +5.45 1.00000212962 +5.55 1.00000171906 +5.65 1.00000123823 +5.75 1.00000075332 +5.85 1.00000032103 +5.95 0.999999979407 +6.05 0.999999742832 +6.15 0.999999601983 +6.25 1 + +"z gxx 8.0000 +-0.05 0.99973909285 +0.05 0.99973909285 +0.15 0.999745404078 +0.25 0.999757521302 +0.35 0.999774504712 +0.45 0.999795107469 +0.55 0.999817935843 +0.65 0.999841612819 +0.75 0.999864917828 +0.85 0.999886883019 +0.95 0.999906837705 +1.05 0.999924404207 +1.15 0.999939457127 +1.25 0.999952062399 +1.35 0.99996241197 +1.45 0.999970765913 +1.55 0.99997740833 +1.65 0.999982618239 +1.75 0.999986653217 +1.85 0.99998974208 +1.95 0.999992082922 +2.05 0.999993843798 +2.15 0.999995164444 +2.25 0.999996158324 +2.35 0.999996914819 +2.45 0.999997501568 +2.55 0.999997966978 +2.65 0.999998342909 +2.75 0.999998647513 +2.85 0.999998888225 +2.95 0.999999064966 +3.05 0.999999173573 +3.15 0.999999209454 +3.25 0.99999917129 +3.35 0.999999064426 +3.45 0.999998903425 +3.55 0.999998713162 +3.65 0.999998527863 +3.75 0.999998387822 +3.85 0.999998333902 +3.95 0.999998400553 +4.05 0.999998608597 +4.15 0.999998959346 +4.25 0.999999431639 +4.35 0.999999982889 +4.45 1.00000055443 +4.55 1.00000108046 +4.65 1.00000149884 +4.75 1.00000176165 +4.85 1.00000184322 +4.95 1.00000174396 +5.05 1.00000148934 +5.15 1.00000112447 +5.25 1.00000070549 +5.35 1.00000028979 +5.45 0.999999926992 +5.55 0.999999652338 +5.65 0.999999483455 +5.75 0.999999420687 +5.85 0.999999450398 +5.95 0.999999550041 +6.05 0.999999693578 +6.15 0.999999855935 +6.25 1 + +"z gxx 8.4000 +-0.05 0.999724995636 +0.05 0.999724995636 +0.15 0.999731546881 +0.25 0.999744134131 +0.35 0.999761797456 +0.45 0.999783259964 +0.55 0.999807088963 +0.65 0.999831861823 +0.75 0.999856309196 +0.85 0.99987941551 +0.95 0.999900467606 +1.05 0.999919053898 +1.15 0.999935025553 +1.25 0.999948435851 +1.35 0.999959473797 +1.45 0.999968404251 +1.55 0.999975521445 +1.65 0.999981117512 +1.75 0.999985464087 +1.85 0.99998880334 +1.95 0.999991344798 +2.05 0.999993265174 +2.15 0.999994709595 +2.25 0.999995793537 +2.35 0.999996605369 +2.45 0.999997209586 +2.55 0.999997650827 +2.65 0.999997958618 +2.75 0.999998152618 +2.85 0.999998247977 +2.95 0.999998260265 +3.05 0.999998209366 +3.15 0.999998121696 +3.25 0.99999803025 +3.35 0.999997972262 +3.45 0.999997984688 +3.55 0.999998098222 +3.65 0.999998331059 +3.75 0.999998683823 +3.85 0.999999137128 +3.95 0.999999652708 +4.05 1.00000017838 +4.15 1.00000065611 +4.25 1.00000103174 +4.35 1.00000126426 +4.45 1.0000013328 +4.55 1.00000123976 +4.65 1.00000100969 +4.75 1.00000068415 +4.85 1.000000314 +4.95 0.999999950605 +5.05 0.999999637946 +5.15 0.999999406762 +5.25 0.999999271761 +5.35 0.999999231934 +5.45 0.999999273514 +5.55 0.999999374618 +5.65 0.99999951042 +5.75 0.999999657764 +5.85 0.999999798452 +5.95 0.999999920891 +6.05 1.00000002018 +6.15 1.00000009703 +6.25 1 + +"z gxx 8.8000 +-0.05 0.99971114024 +0.05 0.99971114024 +0.15 0.999717920806 +0.25 0.999730958077 +0.35 0.999749274542 +0.45 0.999771566515 +0.55 0.999796365803 +0.65 0.999822207308 +0.75 0.999847775331 +0.85 0.999872008068 +0.95 0.999894150391 +1.05 0.999913756458 +1.15 0.999930653007 +1.25 0.999944879226 +1.35 0.999956619412 +1.45 0.999966141111 +1.55 0.99997374611 +1.65 0.999979736431 +1.75 0.999984393759 +1.85 0.999987968942 +1.95 0.999990678032 +2.05 0.999992702195 +2.15 0.999994189828 +2.25 0.999995260098 +2.35 0.999996007537 +2.45 0.999996507377 +2.55 0.999996821172 +2.65 0.999997002026 +2.75 0.999997098651 +2.85 0.999997157569 +2.95 0.999997223034 +3.05 0.999997334732 +3.15 0.999997523841 +3.25 0.99999780852 +3.35 0.999998190184 +3.45 0.999998651894 +3.55 0.999999159789 +3.65 0.999999667815 +3.75 1.00000012511 +3.85 1.00000048475 +3.95 1.00000071195 +4.05 1.00000079016 +4.15 1.00000072357 +4.25 1.00000053579 +4.35 1.00000026505 +4.45 0.999999957062 +4.55 0.999999657215 +4.65 0.999999403591 +4.75 0.999999222011 +4.85 0.999999123846 +4.95 0.999999106622 +5.05 0.999999156942 +5.15 0.999999254844 +5.25 0.9999993785 +5.35 0.999999508308 +5.45 0.999999629643 +5.55 0.999999734009 +5.65 0.999999818707 +5.75 0.999999885467 +5.85 0.999999938592 +5.95 0.999999983163 +6.05 1.00000002366 +6.15 1.00000006317 +6.25 1 + +"z gxx 9.2000 +-0.05 0.999698109438 +0.05 0.999698109438 +0.15 0.999705107486 +0.25 0.999718572456 +0.35 0.999737511753 +0.45 0.999760598163 +0.55 0.999786331528 +0.65 0.999813207575 +0.75 0.999839866835 +0.85 0.99986520278 +0.95 0.999888418519 +1.05 0.999909032767 +1.15 0.999926845258 +1.25 0.999941877256 +1.35 0.999954303489 +1.45 0.999964388696 +1.55 0.999972436739 +1.65 0.999978755022 +1.75 0.999983633029 +1.85 0.999987331763 +1.95 0.999990080479 +2.05 0.999992077622 +2.15 0.999993493833 +2.25 0.999994475576 +2.35 0.999995148496 +2.45 0.999995619876 +2.55 0.999995979816 +2.65 0.999996301032 +2.75 0.999996637586 +2.85 0.999997023228 +2.95 0.999997470335 +3.05 0.999997970469 +3.15 0.999998497308 +3.25 0.999999012116 +3.35 0.999999471238 +3.45 0.99999983443 +3.55 1.00000007249 +3.65 1.00000017265 +3.75 1.00000014075 +3.85 0.99999999977 +3.95 0.999999785279 +4.05 0.999999538955 +4.15 0.999999301509 +4.25 0.999999106507 +4.35 0.999998976124 +4.45 0.999998919397 +4.55 0.999998932991 +4.65 0.999999003985 +4.75 0.999999113867 +4.85 0.999999242786 +4.95 0.999999373165 +5.05 0.999999492107 +5.15 0.999999592331 +5.25 0.99999967181 +5.35 0.999999732503 +5.45 0.999999778705 +5.55 0.999999815479 +5.65 0.999999847481 +5.75 0.999999878301 +5.85 0.999999910264 +5.95 0.999999944574 +6.05 0.999999981611 +6.15 1.00000002124 +6.25 1 + +"z gxx 9.6000 +-0.05 0.999687569929 +0.05 0.999687569929 +0.15 0.999694773473 +0.25 0.99970864338 +0.35 0.99972817416 +0.45 0.9997520178 +0.55 0.999778644868 +0.65 0.999806513941 +0.75 0.999834222549 +0.85 0.99986061853 +0.95 0.999884860514 +1.05 0.999906427479 +1.15 0.99992508696 +1.25 0.999940837301 +1.35 0.999953840333 +1.45 0.999964357971 +1.55 0.999972700983 +1.65 0.999979192833 +1.75 0.999984147351 +1.85 0.99998785673 +1.95 0.999990585894 +2.05 0.999992569922 +2.15 0.99999401242 +2.25 0.999995083904 +2.35 0.999995920203 +2.45 0.999996621455 +2.55 0.999997252528 +2.65 0.9999978456 +2.75 0.999998405295 +2.85 0.999998916227 +2.95 0.999999352176 +3.05 0.999999685654 +3.15 0.999999896343 +3.25 0.999999977035 +3.35 0.999999936195 +3.45 0.999999796955 +3.55 0.999999593131 +3.65 0.999999363362 +3.75 0.99999914479 +3.85 0.99999896757 +3.95 0.999998851186 +4.05 0.999998803064 +4.15 0.999998819429 +4.25 0.999998887974 +4.35 0.999998991545 +4.45 0.999999112008 +4.55 0.9999992335 +4.65 0.999999344535 +4.75 0.999999438784 +4.85 0.999999514661 +4.95 0.999999574106 +5.05 0.999999621044 +5.15 0.999999659947 +5.25 0.999999694778 +5.35 0.999999728419 +5.45 0.999999762543 +5.55 0.999999797791 +5.65 0.999999834098 +5.75 0.999999871046 +5.85 0.99999990815 +5.95 0.999999945047 +6.05 0.999999981592 +6.15 1.00000001786 +6.25 1 + +"z gxx 10.0000 +-0.05 0.99967974117 +0.05 0.99967974117 +0.15 0.999687151956 +0.25 0.999701430438 +0.35 0.999721558327 +0.45 0.999746166539 +0.55 0.999773695383 +0.65 0.99980256438 +0.75 0.999831325322 +0.85 0.999858777354 +0.95 0.999884032213 +1.05 0.999906528685 +1.15 0.999926005031 +1.25 0.999942444068 +1.35 0.999956006895 +1.45 0.999966968566 +1.55 0.999975664022 +1.65 0.999982447419 +1.75 0.999987664069 +1.85 0.99999163224 +1.95 0.999994631835 +2.05 0.999996897801 +2.15 0.999998617236 +2.25 0.999999929953 +2.35 1.00000093255 +2.45 1.00000168567 +2.55 1.00000222379 +2.65 1.00000256591 +2.75 1.00000272569 +2.85 1.00000271943 +2.95 1.00000257063 +3.05 1.00000231112 +3.15 1.00000197893 +3.25 1.00000161413 +3.35 1.00000125393 +3.45 1.00000092825 +3.55 1.00000065678 +3.65 1.00000044801 +3.75 1.00000030012 +3.85 1.00000020352 +3.95 1.00000014422 +4.05 1.00000010724 +4.15 1.00000007957 +4.25 1.000000052 +4.35 1.00000001975 +4.45 0.999999982038 +4.55 0.999999940986 +4.65 0.999999900171 +4.75 0.99999986336 +4.85 0.999999833588 +4.95 0.999999812698 +5.05 0.999999801293 +5.15 0.999999798951 +5.25 0.999999804586 +5.35 0.999999816794 +5.45 0.999999834142 +5.55 0.999999855347 +5.65 0.999999879348 +5.75 0.999999905322 +5.85 0.999999932642 +5.95 0.999999960826 +6.05 0.999999989488 +6.15 1.0000000183 +6.25 1 + +"z gxx 10.4000 +-0.05 0.999661510652 +0.05 0.999661510652 +0.15 0.999669161311 +0.25 0.999683912976 +0.35 0.999704733553 +0.45 0.999730232096 +0.55 0.999758818897 +0.65 0.999788876641 +0.75 0.999818916474 +0.85 0.999847697398 +0.95 0.999874296149 +1.05 0.99989812547 +1.15 0.999918908439 +1.25 0.999936622919 +1.35 0.999951432147 +1.45 0.999963615432 +1.55 0.9999735085 +1.65 0.999981458072 +1.75 0.999987791267 +1.85 0.999992798022 +1.95 0.999996723742 +2.05 0.99999976933 +2.15 1.00000209608 +2.25 1.00000383324 +2.35 1.00000508632 +2.45 1.0000059446 +2.55 1.00000648664 +2.65 1.0000067834 +2.75 1.00000689892 +2.85 1.00000688933 +2.95 1.00000680105 +3.05 1.0000066692 +3.15 1.00000651684 +3.25 1.00000635558 +3.35 1.00000618745 +3.45 1.0000060078 +3.55 1.00000580869 +3.65 1.00000558204 +3.75 1.00000532225 +3.85 1.00000502765 +3.95 1.0000047009 +4.05 1.00000434834 +4.15 1.00000397874 +4.25 1.00000360189 +4.35 1.00000322721 +4.45 1.00000286288 +4.55 1.00000251531 +4.65 1.0000021891 +4.75 1.00000188719 +4.85 1.00000161119 +4.95 1.00000136173 +5.05 1.00000113872 +5.15 1.00000094156 +5.25 1.00000076926 +5.35 1.00000062048 +5.45 1.00000049359 +5.55 1.00000038667 +5.65 1.00000029753 +5.75 1.00000022373 +5.85 1.00000016261 +5.95 1.00000011135 +6.05 1.00000006699 +6.15 1.00000002646 +6.25 1 + +"z gxx 10.8000 +-0.05 0.999607100909 +0.05 0.999607100909 +0.15 0.999614985494 +0.25 0.999630203631 +0.35 0.999651719789 +0.45 0.999678136545 +0.55 0.999707853895 +0.65 0.999739240211 +0.75 0.999770788753 +0.85 0.999801237802 +0.95 0.999829641081 +1.05 0.999855385981 +1.15 0.999878167242 +1.25 0.999897930645 +1.35 0.999914803497 +1.45 0.999929026709 +1.55 0.999940898399 +1.65 0.999950733379 +1.75 0.999958838129 +1.85 0.999965497962 +1.95 0.999970972033 +2.05 0.999975492257 +2.15 0.999979263379 +2.25 0.999982462813 +2.35 0.99998523996 +2.45 0.999987715453 +2.55 0.999989980972 +2.65 0.999992100241 +2.75 0.999994111473 +2.85 0.999996031228 +2.95 0.999997859342 +3.05 0.999999584394 +3.15 1.00000118909 +3.25 1.00000265502 +3.35 1.00000396626 +3.45 1.00000511165 +3.55 1.0000060857 +3.65 1.00000688836 +3.75 1.00000752408 +3.85 1.00000800054 +3.95 1.0000083274 +4.05 1.00000851544 +4.15 1.00000857601 +4.25 1.00000852074 +4.35 1.0000083616 +4.45 1.00000811085 +4.55 1.00000778111 +4.65 1.00000738524 +4.75 1.00000693614 +4.85 1.00000644653 +4.95 1.00000592855 +5.05 1.0000053935 +5.15 1.0000048515 +5.25 1.00000431124 +5.35 1.00000377981 +5.45 1.00000326252 +5.55 1.00000276292 +5.65 1.00000228275 +5.75 1.00000182207 +5.85 1.0000013794 +5.95 1.00000095189 +6.05 1.00000053561 +6.15 1.00000012581 +6.25 1 + +"z gxx 11.2000 +-0.05 0.999549794955 +0.05 0.999549794955 +0.15 0.999557734773 +0.25 0.999573070538 +0.35 0.999594778296 +0.45 0.999621471841 +0.55 0.999651556473 +0.65 0.999683395065 +0.75 0.999715461559 +0.85 0.999746460811 +0.95 0.999775401745 +1.05 0.999801621066 +1.15 0.999824764439 +1.25 0.999844738487 +1.35 0.999861648937 +1.45 0.999875738193 +1.55 0.999887330993 +1.65 0.999896791842 +1.75 0.999904494005 +1.85 0.999910797827 +1.95 0.99991603579 +2.05 0.999920502363 +2.15 0.999924447612 +2.25 0.999928074176 +2.35 0.999931537466 +2.45 0.999934948774 +2.55 0.999938380753 +2.65 0.999941874409 +2.75 0.99994544668 +2.85 0.999949097645 +2.95 0.999952816665 +3.05 0.999956586982 +3.15 0.999960388689 +3.25 0.999964200269 +3.35 0.999967999098 +3.45 0.999971761408 +3.55 0.999975462136 +3.65 0.99997907495 +3.75 0.999982572586 +3.85 0.999985927477 +3.95 0.999989112585 +4.05 0.999992102303 +4.15 0.999994873309 +4.25 0.99999740531 +4.35 0.999999681621 +4.45 1.00000168957 +4.55 1.00000342075 +4.65 1.00000487108 +4.75 1.00000604077 +4.85 1.00000693415 +4.95 1.00000755936 +5.05 1.00000792797 +5.15 1.00000805456 +5.25 1.0000079562 +5.35 1.00000765192 +5.45 1.00000716223 +5.55 1.00000650862 +5.65 1.00000571312 +5.75 1.00000479801 +5.85 1.00000378555 +5.95 1.00000269784 +6.05 1.00000155679 +6.15 1.00000038413 +6.25 1 + +"z gxx 11.6000 +-0.05 0.999617325266 +0.05 0.999617325266 +0.15 0.999625195866 +0.25 0.99964038506 +0.35 0.999661851034 +0.45 0.99968817782 +0.55 0.999717727803 +0.65 0.99974880897 +0.75 0.999779832796 +0.85 0.999809441388 +0.95 0.999836589496 +1.05 0.999860576606 +1.15 0.999881033961 +1.25 0.999897878361 +1.35 0.999911247703 +1.45 0.999921432244 +1.55 0.999928811966 +1.65 0.999933805774 +1.75 0.999936834209 +1.85 0.999938294599 +1.95 0.999938546338 +2.05 0.999937903772 +2.15 0.999936634538 +2.25 0.999934961648 +2.35 0.999933067989 +2.45 0.999931102128 +2.55 0.999929184458 +2.65 0.999927412915 +2.75 0.999925867733 +2.85 0.999924614997 +2.95 0.999923709018 +3.05 0.99992319375 +3.15 0.999923103545 +3.25 0.999923463513 +3.35 0.999924289696 +3.45 0.999925589143 +3.55 0.999927359967 +3.65 0.999929591379 +3.75 0.999932263739 +3.85 0.999935348663 +3.95 0.999938809237 +4.05 0.999942600394 +4.15 0.99994666952 +4.25 0.9999509573 +4.35 0.999955398853 +4.45 0.999959925125 +4.55 0.999964464538 +4.65 0.999968944848 +4.75 0.999973295152 +4.85 0.999977447996 +4.95 0.999981341495 +5.05 0.999984921399 +5.15 0.999988143014 +5.25 0.999990972897 +5.35 0.99999339024 +5.45 0.999995387873 +5.55 0.999996972817 +5.65 0.999998166343 +5.75 0.999999003511 +5.85 0.99999953218 +5.95 0.999999811525 +6.05 0.999999910053 +6.15 0.999999903314 +6.25 1 + +"z gxx 12.0000 +-0.05 0.999773503672 +0.05 0.999773503672 +0.15 0.999781679199 +0.25 0.999797455811 +0.35 0.999819749692 +0.45 0.999847088574 +0.55 0.999877771043 +0.65 0.999910040817 +0.75 0.999942250536 +0.85 0.999972992454 +0.95 1.000001181 +1.05 1.00002608256 +1.15 1.00004729822 +1.25 1.00006471277 +1.35 1.00007842636 +1.45 1.00008868379 +1.55 1.00009581247 +1.65 1.00010017415 +1.75 1.00010213162 +1.85 1.00010202812 +1.95 1.00010017638 +2.05 1.00009685401 +2.15 1.00009230289 +2.25 1.00008673082 +2.35 1.00008031468 +2.45 1.00007320422 +2.55 1.00006552654 +2.65 1.00005739071 +2.75 1.00004889241 +2.85 1.00004011835 +2.95 1.00003115021 +3.05 1.00002206778 +3.15 1.00001295133 +3.25 1.00000388301 +3.35 0.999994947383 +3.45 0.99998623113 +3.55 0.999977822162 +3.65 0.999969808202 +3.75 0.999962275071 +3.85 0.99995530478 +3.95 0.999948973605 +4.05 0.999943350206 +4.15 0.999938493938 +4.25 0.999934453392 +4.35 0.999931265273 +4.45 0.999928953633 +4.55 0.999927529524 +4.65 0.999926991077 +4.75 0.999927324001 +4.85 0.999928502484 +4.95 0.999930490434 +5.05 0.999933243002 +5.15 0.999936708286 +5.25 0.999940829122 +5.35 0.999945544844 +5.45 0.999950792912 +5.55 0.999956510306 +5.65 0.99996263462 +5.75 0.99996910477 +5.85 0.999975861351 +5.95 0.999982846565 +6.05 0.999990003805 +6.15 0.999997277148 +6.25 1 + + diff --git a/xgraph/examples/bar.xg b/xgraph/examples/bar.xg new file mode 100644 index 000000000..69a64122d --- /dev/null +++ b/xgraph/examples/bar.xg @@ -0,0 +1,21 @@ +TitleText: Sample Bar Graph +BarGraph: true +BarBase: 0.0 +BarWidth: 0.25 +NoLines: true +YUnitText: Widgets/Year +XUnitText: Year +"Frobs" +79.75 5.6 +80.75 8.3 +81.75 2.2 + +"Blobs" +80 8.0 +81 6.4 +82 1.2 + +"Zygotes" +80.25 9.1 +81.25 10.8 +82.25 8.3 diff --git a/xgraph/examples/surface.xg b/xgraph/examples/surface.xg new file mode 100644 index 000000000..cec827652 --- /dev/null +++ b/xgraph/examples/surface.xg @@ -0,0 +1,1805 @@ +TitleText: Surface Plot +Ticks: true +BoundBox: on +move 319.000000 317.000000 +draw 351.000000 336.000000 +move 319.000000 317.000000 +draw 351.000000 336.000000 +move 265.000000 348.000000 +draw 319.000000 317.000000 +move 265.000000 348.000000 +draw 319.000000 317.000000 +move 351.000000 336.000000 +draw 384.000000 354.000000 +move 351.000000 336.000000 +draw 384.000000 354.000000 +move 298.000000 367.000000 +draw 351.000000 336.000000 +move 351.000000 336.000000 +draw 351.000000 336.000000 +move 384.000000 354.000000 +draw 417.000000 372.000000 +move 384.000000 354.000000 +draw 417.000000 372.000000 +move 331.000000 385.000000 +draw 384.000000 354.000000 +move 384.000000 354.000000 +draw 384.000000 354.000000 +move 417.000000 372.000000 +draw 433.000000 381.000000 +move 417.000000 372.000000 +draw 433.000000 381.000000 +move 364.000000 403.000000 +draw 417.000000 372.000000 +move 417.000000 372.000000 +draw 417.000000 372.000000 +move 433.000000 381.000000 +draw 458.000000 395.000000 +move 433.000000 381.000000 +draw 458.000000 395.000000 +move 380.000000 412.000000 +draw 433.000000 381.000000 +move 433.000000 381.000000 +draw 433.000000 381.000000 +move 458.000000 395.000000 +draw 482.000000 408.000000 +move 458.000000 395.000000 +draw 482.000000 408.000000 +move 404.000000 425.000000 +draw 458.000000 395.000000 +move 458.000000 395.000000 +draw 458.000000 395.000000 +move 482.000000 408.000000 +draw 490.000000 413.000000 +move 482.000000 408.000000 +draw 490.000000 413.000000 +move 428.000000 439.000000 +draw 482.000000 408.000000 +move 482.000000 408.000000 +draw 482.000000 408.000000 +move 490.000000 413.000000 +draw 498.000000 417.000000 +move 490.000000 413.000000 +draw 498.000000 417.000000 +move 437.000000 443.000000 +draw 490.000000 413.000000 +move 490.000000 413.000000 +draw 490.000000 413.000000 +move 498.000000 417.000000 +draw 506.000000 422.000000 +move 498.000000 417.000000 +draw 506.000000 422.000000 +move 445.000000 448.000000 +draw 498.000000 417.000000 +move 498.000000 417.000000 +draw 498.000000 417.000000 +move 506.000000 422.000000 +draw 514.000000 426.000000 +move 506.000000 422.000000 +draw 514.000000 426.000000 +move 453.000000 452.000000 +draw 506.000000 422.000000 +move 506.000000 422.000000 +draw 506.000000 422.000000 +move 514.000000 426.000000 +draw 546.000000 444.000000 +move 514.000000 426.000000 +draw 546.000000 444.000000 +move 461.000000 457.000000 +draw 514.000000 426.000000 +move 514.000000 426.000000 +draw 514.000000 426.000000 +move 546.000000 444.000000 +draw 578.000000 462.000000 +move 546.000000 444.000000 +draw 578.000000 462.000000 +move 493.000000 475.000000 +draw 546.000000 444.000000 +move 546.000000 444.000000 +draw 546.000000 444.000000 +move 578.000000 462.000000 +draw 610.000000 480.000000 +move 578.000000 462.000000 +draw 610.000000 480.000000 +move 525.000000 492.000000 +draw 578.000000 462.000000 +move 578.000000 462.000000 +draw 578.000000 462.000000 +move 610.000000 480.000000 +draw 642.000000 498.000000 +move 610.000000 480.000000 +draw 642.000000 498.000000 +move 557.000000 510.000000 +draw 610.000000 480.000000 +move 610.000000 480.000000 +draw 610.000000 480.000000 +move 642.000000 498.000000 +draw 674.000000 515.000000 +move 642.000000 498.000000 +draw 674.000000 515.000000 +move 589.000000 528.000000 +draw 642.000000 498.000000 +move 642.000000 498.000000 +draw 642.000000 498.000000 +move 674.000000 515.000000 +draw 705.000000 533.000000 +move 674.000000 515.000000 +draw 705.000000 533.000000 +move 620.000000 545.000000 +draw 674.000000 515.000000 +move 674.000000 515.000000 +draw 674.000000 515.000000 +move 705.000000 533.000000 +draw 737.000000 550.000000 +move 705.000000 533.000000 +draw 737.000000 550.000000 +move 652.000000 563.000000 +draw 705.000000 533.000000 +move 705.000000 533.000000 +draw 705.000000 533.000000 +move 737.000000 550.000000 +draw 768.000000 568.000000 +move 737.000000 550.000000 +draw 768.000000 568.000000 +move 683.000000 580.000000 +draw 737.000000 550.000000 +move 737.000000 550.000000 +draw 737.000000 550.000000 +move 768.000000 568.000000 +draw 799.000000 585.000000 +move 768.000000 568.000000 +draw 799.000000 585.000000 +move 714.000000 597.000000 +draw 768.000000 568.000000 +move 768.000000 568.000000 +draw 768.000000 568.000000 +move 799.000000 585.000000 +draw 830.000000 602.000000 +move 799.000000 585.000000 +draw 830.000000 602.000000 +move 746.000000 615.000000 +draw 799.000000 585.000000 +move 799.000000 585.000000 +draw 799.000000 585.000000 +move 830.000000 602.000000 +draw 838.000000 607.000000 +move 830.000000 602.000000 +draw 838.000000 607.000000 +move 777.000000 632.000000 +draw 830.000000 602.000000 +move 830.000000 602.000000 +draw 830.000000 602.000000 +move 838.000000 607.000000 +draw 846.000000 611.000000 +move 838.000000 607.000000 +draw 846.000000 611.000000 +move 784.000000 636.000000 +draw 838.000000 607.000000 +move 838.000000 607.000000 +draw 838.000000 607.000000 +move 846.000000 611.000000 +draw 853.000000 615.000000 +move 846.000000 611.000000 +draw 853.000000 615.000000 +move 792.000000 640.000000 +draw 846.000000 611.000000 +move 846.000000 611.000000 +draw 846.000000 611.000000 +move 853.000000 615.000000 +draw 861.000000 620.000000 +move 853.000000 615.000000 +draw 861.000000 620.000000 +move 800.000000 645.000000 +draw 853.000000 615.000000 +move 853.000000 615.000000 +draw 853.000000 615.000000 +move 861.000000 620.000000 +draw 884.000000 633.000000 +move 861.000000 620.000000 +draw 884.000000 633.000000 +move 808.000000 649.000000 +draw 861.000000 620.000000 +move 861.000000 620.000000 +draw 861.000000 620.000000 +move 884.000000 633.000000 +draw 907.000000 645.000000 +move 884.000000 633.000000 +draw 907.000000 645.000000 +move 831.000000 662.000000 +draw 884.000000 633.000000 +move 884.000000 633.000000 +draw 884.000000 633.000000 +move 907.000000 645.000000 +draw 923.000000 654.000000 +move 907.000000 645.000000 +draw 923.000000 654.000000 +move 854.000000 675.000000 +draw 907.000000 645.000000 +move 907.000000 645.000000 +draw 907.000000 645.000000 +move 923.000000 654.000000 +draw 953.000000 671.000000 +move 923.000000 654.000000 +draw 953.000000 671.000000 +move 869.000000 683.000000 +draw 923.000000 654.000000 +move 923.000000 654.000000 +draw 923.000000 654.000000 +move 953.000000 671.000000 +draw 984.000000 688.000000 +move 953.000000 671.000000 +draw 984.000000 688.000000 +move 900.000000 700.000000 +draw 953.000000 671.000000 +move 953.000000 671.000000 +draw 953.000000 671.000000 +move 984.000000 688.000000 +draw 1014.000000 705.000000 +move 984.000000 688.000000 +draw 1014.000000 705.000000 +move 930.000000 717.000000 +draw 984.000000 688.000000 +move 984.000000 688.000000 +draw 984.000000 688.000000 +move 961.000000 734.000000 +draw 1014.000000 705.000000 +move 1014.000000 705.000000 +draw 1014.000000 705.000000 +move 265.000000 348.000000 +draw 298.000000 367.000000 +move 265.000000 348.000000 +draw 266.000000 349.000000 +move 212.000000 379.000000 +draw 265.000000 348.000000 +move 212.000000 379.000000 +draw 265.000000 348.000000 +move 298.000000 367.000000 +draw 331.000000 385.000000 +move 245.000000 397.000000 +draw 298.000000 367.000000 +move 331.000000 385.000000 +draw 364.000000 403.000000 +move 278.000000 415.000000 +draw 331.000000 385.000000 +move 364.000000 403.000000 +draw 380.000000 412.000000 +move 311.000000 433.000000 +draw 364.000000 403.000000 +move 380.000000 412.000000 +draw 404.000000 425.000000 +move 327.000000 442.000000 +draw 380.000000 412.000000 +move 404.000000 425.000000 +draw 428.000000 439.000000 +move 351.000000 456.000000 +draw 404.000000 425.000000 +move 428.000000 439.000000 +draw 437.000000 443.000000 +move 376.000000 469.000000 +draw 428.000000 439.000000 +move 437.000000 443.000000 +draw 445.000000 448.000000 +move 384.000000 474.000000 +draw 437.000000 443.000000 +move 445.000000 448.000000 +draw 453.000000 452.000000 +move 392.000000 478.000000 +draw 445.000000 448.000000 +move 453.000000 452.000000 +draw 461.000000 457.000000 +move 400.000000 483.000000 +draw 453.000000 452.000000 +move 461.000000 457.000000 +draw 493.000000 475.000000 +move 408.000000 487.000000 +draw 461.000000 457.000000 +move 493.000000 475.000000 +draw 525.000000 492.000000 +move 440.000000 505.000000 +draw 493.000000 475.000000 +move 525.000000 492.000000 +draw 557.000000 510.000000 +move 472.000000 522.000000 +draw 525.000000 492.000000 +move 557.000000 510.000000 +draw 589.000000 528.000000 +move 504.000000 540.000000 +draw 557.000000 510.000000 +move 589.000000 528.000000 +draw 620.000000 545.000000 +move 536.000000 557.000000 +draw 589.000000 528.000000 +move 620.000000 545.000000 +draw 652.000000 563.000000 +move 567.000000 575.000000 +draw 620.000000 545.000000 +move 652.000000 563.000000 +draw 683.000000 580.000000 +move 599.000000 592.000000 +draw 652.000000 563.000000 +move 683.000000 580.000000 +draw 714.000000 597.000000 +move 630.000000 609.000000 +draw 683.000000 580.000000 +move 714.000000 597.000000 +draw 746.000000 615.000000 +move 661.000000 627.000000 +draw 714.000000 597.000000 +move 746.000000 615.000000 +draw 777.000000 632.000000 +move 693.000000 644.000000 +draw 746.000000 615.000000 +move 777.000000 632.000000 +draw 784.000000 636.000000 +move 724.000000 661.000000 +draw 777.000000 632.000000 +move 784.000000 636.000000 +draw 792.000000 640.000000 +move 731.000000 665.000000 +draw 784.000000 636.000000 +move 792.000000 640.000000 +draw 800.000000 645.000000 +move 739.000000 669.000000 +draw 792.000000 640.000000 +move 800.000000 645.000000 +draw 808.000000 649.000000 +move 747.000000 674.000000 +draw 800.000000 645.000000 +move 808.000000 649.000000 +draw 831.000000 662.000000 +move 755.000000 678.000000 +draw 808.000000 649.000000 +move 831.000000 662.000000 +draw 854.000000 675.000000 +move 778.000000 691.000000 +draw 831.000000 662.000000 +move 854.000000 675.000000 +draw 869.000000 683.000000 +move 801.000000 703.000000 +draw 854.000000 675.000000 +move 869.000000 683.000000 +draw 900.000000 700.000000 +move 816.000000 712.000000 +draw 869.000000 683.000000 +move 900.000000 700.000000 +draw 930.000000 717.000000 +move 847.000000 729.000000 +draw 900.000000 700.000000 +move 930.000000 717.000000 +draw 961.000000 734.000000 +move 877.000000 745.000000 +draw 930.000000 717.000000 +move 908.000000 762.000000 +draw 961.000000 734.000000 +move 212.000000 379.000000 +draw 245.000000 397.000000 +move 212.000000 379.000000 +draw 213.000000 380.000000 +move 160.000000 410.000000 +draw 212.000000 379.000000 +move 160.000000 410.000000 +draw 212.000000 379.000000 +move 245.000000 397.000000 +draw 278.000000 415.000000 +move 193.000000 428.000000 +draw 245.000000 397.000000 +move 278.000000 415.000000 +draw 311.000000 433.000000 +move 225.000000 446.000000 +draw 278.000000 415.000000 +move 311.000000 433.000000 +draw 327.000000 442.000000 +move 258.000000 464.000000 +draw 311.000000 433.000000 +move 327.000000 442.000000 +draw 351.000000 456.000000 +move 274.000000 473.000000 +draw 327.000000 442.000000 +move 351.000000 456.000000 +draw 376.000000 469.000000 +move 299.000000 486.000000 +draw 351.000000 456.000000 +move 376.000000 469.000000 +draw 384.000000 474.000000 +move 323.000000 499.000000 +draw 376.000000 469.000000 +move 384.000000 474.000000 +draw 392.000000 478.000000 +move 331.000000 504.000000 +draw 384.000000 474.000000 +move 392.000000 478.000000 +draw 400.000000 483.000000 +move 339.000000 508.000000 +draw 392.000000 478.000000 +move 400.000000 483.000000 +draw 408.000000 487.000000 +move 347.000000 513.000000 +draw 400.000000 483.000000 +move 408.000000 487.000000 +draw 440.000000 505.000000 +move 355.000000 517.000000 +draw 408.000000 487.000000 +move 440.000000 505.000000 +draw 472.000000 522.000000 +move 387.000000 535.000000 +draw 440.000000 505.000000 +move 472.000000 522.000000 +draw 504.000000 540.000000 +move 419.000000 552.000000 +draw 472.000000 522.000000 +move 504.000000 540.000000 +draw 536.000000 557.000000 +move 451.000000 570.000000 +draw 504.000000 540.000000 +move 536.000000 557.000000 +draw 567.000000 575.000000 +move 483.000000 587.000000 +draw 536.000000 557.000000 +move 567.000000 575.000000 +draw 599.000000 592.000000 +move 515.000000 604.000000 +draw 567.000000 575.000000 +move 599.000000 592.000000 +draw 630.000000 609.000000 +move 546.000000 621.000000 +draw 599.000000 592.000000 +move 630.000000 609.000000 +draw 661.000000 627.000000 +move 578.000000 639.000000 +draw 630.000000 609.000000 +move 661.000000 627.000000 +draw 693.000000 644.000000 +move 609.000000 656.000000 +draw 661.000000 627.000000 +move 693.000000 644.000000 +draw 724.000000 661.000000 +move 640.000000 673.000000 +draw 693.000000 644.000000 +move 724.000000 661.000000 +draw 731.000000 665.000000 +move 671.000000 690.000000 +draw 724.000000 661.000000 +move 731.000000 665.000000 +draw 739.000000 669.000000 +move 679.000000 694.000000 +draw 731.000000 665.000000 +move 739.000000 669.000000 +draw 747.000000 674.000000 +move 687.000000 698.000000 +draw 739.000000 669.000000 +move 747.000000 674.000000 +draw 755.000000 678.000000 +move 694.000000 703.000000 +draw 747.000000 674.000000 +move 755.000000 678.000000 +draw 778.000000 691.000000 +move 702.000000 707.000000 +draw 755.000000 678.000000 +move 778.000000 691.000000 +draw 801.000000 703.000000 +move 725.000000 719.000000 +draw 778.000000 691.000000 +move 801.000000 703.000000 +draw 816.000000 712.000000 +move 748.000000 732.000000 +draw 801.000000 703.000000 +move 816.000000 712.000000 +draw 847.000000 729.000000 +move 764.000000 740.000000 +draw 816.000000 712.000000 +move 847.000000 729.000000 +draw 877.000000 745.000000 +move 794.000000 757.000000 +draw 847.000000 729.000000 +move 877.000000 745.000000 +draw 908.000000 762.000000 +move 825.000000 774.000000 +draw 877.000000 745.000000 +move 855.000000 790.000000 +draw 908.000000 762.000000 +move 160.000000 410.000000 +draw 193.000000 428.000000 +move 160.000000 410.000000 +draw 161.000000 411.000000 +move 107.000000 441.000000 +draw 160.000000 410.000000 +move 107.000000 441.000000 +draw 160.000000 410.000000 +move 193.000000 428.000000 +draw 225.000000 446.000000 +move 140.000000 458.000000 +draw 193.000000 428.000000 +move 225.000000 446.000000 +draw 258.000000 464.000000 +move 173.000000 476.000000 +draw 225.000000 446.000000 +move 258.000000 464.000000 +draw 274.000000 473.000000 +move 206.000000 494.000000 +draw 258.000000 464.000000 +move 274.000000 473.000000 +draw 299.000000 486.000000 +move 222.000000 503.000000 +draw 274.000000 473.000000 +move 299.000000 486.000000 +draw 323.000000 499.000000 +move 246.000000 516.000000 +draw 299.000000 486.000000 +move 323.000000 499.000000 +draw 331.000000 504.000000 +move 271.000000 529.000000 +draw 323.000000 499.000000 +move 331.000000 504.000000 +draw 339.000000 508.000000 +move 279.000000 534.000000 +draw 331.000000 504.000000 +move 339.000000 508.000000 +draw 347.000000 513.000000 +move 287.000000 538.000000 +draw 339.000000 508.000000 +move 347.000000 513.000000 +draw 355.000000 517.000000 +move 295.000000 542.000000 +draw 347.000000 513.000000 +move 355.000000 517.000000 +draw 387.000000 535.000000 +move 303.000000 547.000000 +draw 355.000000 517.000000 +move 387.000000 535.000000 +draw 419.000000 552.000000 +move 335.000000 564.000000 +draw 387.000000 535.000000 +move 419.000000 552.000000 +draw 451.000000 570.000000 +move 367.000000 582.000000 +draw 419.000000 552.000000 +move 451.000000 570.000000 +draw 483.000000 587.000000 +move 399.000000 599.000000 +draw 451.000000 570.000000 +move 483.000000 587.000000 +draw 515.000000 604.000000 +move 431.000000 616.000000 +draw 483.000000 587.000000 +move 515.000000 604.000000 +draw 546.000000 621.000000 +move 462.000000 633.000000 +draw 515.000000 604.000000 +move 546.000000 621.000000 +draw 578.000000 639.000000 +move 494.000000 651.000000 +draw 546.000000 621.000000 +move 578.000000 639.000000 +draw 609.000000 656.000000 +move 525.000000 668.000000 +draw 578.000000 639.000000 +move 609.000000 656.000000 +draw 640.000000 673.000000 +move 557.000000 684.000000 +draw 609.000000 656.000000 +move 640.000000 673.000000 +draw 671.000000 690.000000 +move 588.000000 701.000000 +draw 640.000000 673.000000 +move 671.000000 690.000000 +draw 679.000000 694.000000 +move 619.000000 717.000000 +draw 671.000000 690.000000 +move 679.000000 694.000000 +draw 687.000000 698.000000 +move 626.000000 721.000000 +draw 679.000000 694.000000 +move 687.000000 698.000000 +draw 694.000000 703.000000 +move 634.000000 725.000000 +draw 687.000000 698.000000 +move 694.000000 703.000000 +draw 702.000000 707.000000 +move 642.000000 729.000000 +draw 694.000000 703.000000 +move 702.000000 707.000000 +draw 725.000000 719.000000 +move 650.000000 734.000000 +draw 702.000000 707.000000 +move 725.000000 719.000000 +draw 748.000000 732.000000 +move 673.000000 747.000000 +draw 725.000000 719.000000 +move 748.000000 732.000000 +draw 764.000000 740.000000 +move 696.000000 760.000000 +draw 748.000000 732.000000 +move 764.000000 740.000000 +draw 794.000000 757.000000 +move 711.000000 769.000000 +draw 764.000000 740.000000 +move 794.000000 757.000000 +draw 825.000000 774.000000 +move 742.000000 785.000000 +draw 794.000000 757.000000 +move 825.000000 774.000000 +draw 855.000000 790.000000 +move 772.000000 802.000000 +draw 825.000000 774.000000 +move 803.000000 819.000000 +draw 855.000000 790.000000 +move 107.000000 441.000000 +draw 140.000000 458.000000 +move 107.000000 441.000000 +draw 108.000000 442.000000 +move 56.000000 471.000000 +draw 107.000000 441.000000 +move 56.000000 471.000000 +draw 107.000000 441.000000 +move 140.000000 458.000000 +draw 173.000000 476.000000 +move 88.000000 489.000000 +draw 140.000000 458.000000 +move 173.000000 476.000000 +draw 206.000000 494.000000 +move 121.000000 506.000000 +draw 173.000000 476.000000 +move 206.000000 494.000000 +draw 222.000000 503.000000 +move 154.000000 524.000000 +draw 206.000000 494.000000 +move 222.000000 503.000000 +draw 246.000000 516.000000 +move 170.000000 533.000000 +draw 222.000000 503.000000 +move 246.000000 516.000000 +draw 271.000000 529.000000 +move 194.000000 547.000000 +draw 246.000000 516.000000 +move 271.000000 529.000000 +draw 279.000000 534.000000 +move 218.000000 564.000000 +draw 271.000000 529.000000 +move 279.000000 534.000000 +draw 287.000000 538.000000 +move 227.000000 571.000000 +draw 279.000000 534.000000 +move 287.000000 538.000000 +draw 295.000000 542.000000 +move 235.000000 578.000000 +draw 287.000000 538.000000 +move 295.000000 542.000000 +draw 303.000000 547.000000 +move 243.000000 582.000000 +draw 295.000000 542.000000 +move 303.000000 547.000000 +draw 335.000000 564.000000 +move 251.000000 583.000000 +draw 303.000000 547.000000 +move 335.000000 564.000000 +draw 367.000000 582.000000 +move 283.000000 594.000000 +draw 335.000000 564.000000 +move 367.000000 582.000000 +draw 399.000000 599.000000 +move 315.000000 611.000000 +draw 367.000000 582.000000 +move 399.000000 599.000000 +draw 431.000000 616.000000 +move 347.000000 628.000000 +draw 399.000000 599.000000 +move 431.000000 616.000000 +draw 462.000000 633.000000 +move 379.000000 645.000000 +draw 431.000000 616.000000 +move 462.000000 633.000000 +draw 494.000000 651.000000 +move 410.000000 662.000000 +draw 462.000000 633.000000 +move 494.000000 651.000000 +draw 525.000000 668.000000 +move 442.000000 679.000000 +draw 494.000000 651.000000 +move 525.000000 668.000000 +draw 557.000000 684.000000 +move 473.000000 694.000000 +draw 525.000000 668.000000 +move 557.000000 684.000000 +draw 588.000000 701.000000 +move 505.000000 679.000000 +draw 557.000000 684.000000 +move 588.000000 701.000000 +draw 619.000000 717.000000 +move 588.000000 701.000000 +draw 588.000000 701.000000 +move 619.000000 717.000000 +draw 626.000000 721.000000 +move 619.000000 717.000000 +draw 619.000000 717.000000 +move 626.000000 721.000000 +draw 634.000000 725.000000 +move 626.000000 721.000000 +draw 626.000000 721.000000 +move 634.000000 725.000000 +draw 642.000000 729.000000 +move 634.000000 725.000000 +draw 634.000000 725.000000 +move 642.000000 729.000000 +draw 650.000000 734.000000 +move 642.000000 729.000000 +draw 642.000000 729.000000 +move 650.000000 734.000000 +draw 673.000000 747.000000 +move 650.000000 734.000000 +draw 650.000000 734.000000 +move 673.000000 747.000000 +draw 696.000000 760.000000 +move 621.000000 747.000000 +draw 673.000000 747.000000 +move 696.000000 760.000000 +draw 711.000000 769.000000 +move 644.000000 779.000000 +draw 696.000000 760.000000 +move 711.000000 769.000000 +draw 742.000000 785.000000 +move 659.000000 792.000000 +draw 711.000000 769.000000 +move 742.000000 785.000000 +draw 772.000000 802.000000 +move 690.000000 813.000000 +draw 742.000000 785.000000 +move 772.000000 802.000000 +draw 803.000000 819.000000 +move 720.000000 830.000000 +draw 772.000000 802.000000 +move 751.000000 847.000000 +draw 803.000000 819.000000 +move 56.000000 471.000000 +draw 88.000000 489.000000 +move 56.000000 471.000000 +draw 57.000000 472.000000 +move 48.000000 475.000000 +draw 56.000000 471.000000 +move 48.000000 475.000000 +draw 56.000000 471.000000 +move 88.000000 489.000000 +draw 121.000000 506.000000 +move 81.000000 493.000000 +draw 88.000000 489.000000 +move 121.000000 506.000000 +draw 154.000000 524.000000 +move 114.000000 511.000000 +draw 121.000000 506.000000 +move 154.000000 524.000000 +draw 170.000000 533.000000 +move 146.000000 528.000000 +draw 154.000000 524.000000 +move 170.000000 533.000000 +draw 194.000000 547.000000 +move 162.000000 537.000000 +draw 170.000000 533.000000 +move 194.000000 547.000000 +draw 218.000000 564.000000 +move 187.000000 551.000000 +draw 194.000000 547.000000 +move 218.000000 564.000000 +draw 227.000000 571.000000 +move 211.000000 571.000000 +draw 218.000000 564.000000 +move 227.000000 571.000000 +draw 235.000000 578.000000 +move 219.000000 585.000000 +draw 227.000000 571.000000 +move 235.000000 578.000000 +draw 243.000000 582.000000 +move 226.000000 627.000000 +draw 235.000000 578.000000 +move 243.000000 582.000000 +draw 251.000000 583.000000 +move 233.000000 650.000000 +draw 243.000000 582.000000 +move 251.000000 583.000000 +draw 283.000000 594.000000 +move 242.000000 634.000000 +draw 251.000000 583.000000 +move 283.000000 594.000000 +draw 315.000000 611.000000 +move 275.000000 602.000000 +draw 283.000000 594.000000 +move 315.000000 611.000000 +draw 347.000000 628.000000 +move 307.000000 615.000000 +draw 315.000000 611.000000 +move 347.000000 628.000000 +draw 379.000000 645.000000 +move 339.000000 632.000000 +draw 347.000000 628.000000 +move 379.000000 645.000000 +draw 410.000000 662.000000 +move 371.000000 649.000000 +draw 379.000000 645.000000 +move 410.000000 662.000000 +draw 442.000000 679.000000 +move 403.000000 665.000000 +draw 410.000000 662.000000 +move 442.000000 679.000000 +draw 473.000000 694.000000 +move 434.000000 680.000000 +draw 442.000000 679.000000 +move 473.000000 694.000000 +draw 505.000000 679.000000 +move 466.000000 691.000000 +draw 473.000000 694.000000 +move 505.000000 679.000000 +draw 506.000000 677.000000 +move 505.000000 679.000000 +draw 505.000000 679.000000 +move 569.000000 418.000000 +draw 572.000000 459.000000 +move 610.000000 713.000000 +draw 621.000000 747.000000 +move 590.000000 706.000000 +draw 591.000000 702.000000 +move 621.000000 747.000000 +draw 644.000000 779.000000 +move 613.000000 764.000000 +draw 621.000000 747.000000 +move 644.000000 779.000000 +draw 659.000000 792.000000 +move 636.000000 788.000000 +draw 644.000000 779.000000 +move 659.000000 792.000000 +draw 690.000000 813.000000 +move 652.000000 799.000000 +draw 659.000000 792.000000 +move 690.000000 813.000000 +draw 720.000000 830.000000 +move 682.000000 817.000000 +draw 690.000000 813.000000 +move 720.000000 830.000000 +draw 751.000000 847.000000 +move 713.000000 834.000000 +draw 720.000000 830.000000 +move 743.000000 851.000000 +draw 751.000000 847.000000 +move 48.000000 475.000000 +draw 81.000000 493.000000 +move 48.000000 475.000000 +draw 49.000000 476.000000 +move 40.000000 480.000000 +draw 48.000000 475.000000 +move 40.000000 480.000000 +draw 48.000000 475.000000 +move 81.000000 493.000000 +draw 114.000000 511.000000 +move 73.000000 498.000000 +draw 81.000000 493.000000 +move 114.000000 511.000000 +draw 146.000000 528.000000 +move 106.000000 515.000000 +draw 114.000000 511.000000 +move 146.000000 528.000000 +draw 162.000000 537.000000 +move 139.000000 533.000000 +draw 146.000000 528.000000 +move 162.000000 537.000000 +draw 187.000000 551.000000 +move 155.000000 542.000000 +draw 162.000000 537.000000 +move 187.000000 551.000000 +draw 211.000000 571.000000 +move 179.000000 555.000000 +draw 187.000000 551.000000 +move 211.000000 571.000000 +draw 219.000000 585.000000 +move 203.000000 568.000000 +draw 211.000000 571.000000 +move 219.000000 585.000000 +draw 226.000000 627.000000 +move 211.000000 572.000000 +draw 219.000000 585.000000 +move 226.000000 627.000000 +draw 233.000000 650.000000 +move 217.000000 693.000000 +draw 226.000000 627.000000 +move 233.000000 650.000000 +draw 242.000000 634.000000 +move 223.000000 761.000000 +draw 233.000000 650.000000 +move 242.000000 634.000000 +draw 275.000000 602.000000 +move 233.000000 689.000000 +draw 242.000000 634.000000 +move 275.000000 602.000000 +draw 307.000000 615.000000 +move 268.000000 612.000000 +draw 275.000000 602.000000 +move 307.000000 615.000000 +draw 339.000000 632.000000 +move 300.000000 619.000000 +draw 307.000000 615.000000 +move 339.000000 632.000000 +draw 371.000000 649.000000 +move 332.000000 634.000000 +draw 339.000000 632.000000 +move 371.000000 649.000000 +draw 403.000000 665.000000 +move 363.000000 650.000000 +draw 371.000000 649.000000 +move 403.000000 665.000000 +draw 434.000000 680.000000 +move 395.000000 666.000000 +draw 403.000000 665.000000 +move 434.000000 680.000000 +draw 466.000000 691.000000 +move 427.000000 680.000000 +draw 434.000000 680.000000 +move 466.000000 691.000000 +draw 467.000000 690.000000 +move 458.000000 688.000000 +draw 466.000000 691.000000 +move 562.000000 450.000000 +draw 569.000000 418.000000 +move 555.000000 332.000000 +draw 561.000000 452.000000 +move 569.000000 418.000000 +draw 573.000000 459.000000 +move 564.000000 153.000000 +draw 569.000000 418.000000 +move 570.000000 389.000000 +draw 574.000000 460.000000 +move 590.000000 706.000000 +draw 590.000000 706.000000 +move 575.000000 768.000000 +draw 581.000000 697.000000 +move 590.000000 706.000000 +draw 613.000000 764.000000 +move 582.000000 772.000000 +draw 590.000000 706.000000 +move 613.000000 764.000000 +draw 636.000000 788.000000 +move 606.000000 785.000000 +draw 613.000000 764.000000 +move 636.000000 788.000000 +draw 652.000000 799.000000 +move 629.000000 797.000000 +draw 636.000000 788.000000 +move 652.000000 799.000000 +draw 682.000000 817.000000 +move 644.000000 805.000000 +draw 652.000000 799.000000 +move 682.000000 817.000000 +draw 713.000000 834.000000 +move 675.000000 822.000000 +draw 682.000000 817.000000 +move 713.000000 834.000000 +draw 743.000000 851.000000 +move 705.000000 838.000000 +draw 713.000000 834.000000 +move 735.000000 855.000000 +draw 743.000000 851.000000 +move 40.000000 480.000000 +draw 73.000000 498.000000 +move 40.000000 480.000000 +draw 41.000000 481.000000 +move 33.000000 484.000000 +draw 40.000000 480.000000 +move 33.000000 484.000000 +draw 40.000000 480.000000 +move 73.000000 498.000000 +draw 106.000000 515.000000 +move 66.000000 502.000000 +draw 73.000000 498.000000 +move 106.000000 515.000000 +draw 139.000000 533.000000 +move 98.000000 520.000000 +draw 106.000000 515.000000 +move 139.000000 533.000000 +draw 155.000000 542.000000 +move 131.000000 537.000000 +draw 139.000000 533.000000 +move 155.000000 542.000000 +draw 179.000000 555.000000 +move 147.000000 546.000000 +draw 155.000000 542.000000 +move 179.000000 555.000000 +draw 203.000000 568.000000 +move 172.000000 559.000000 +draw 179.000000 555.000000 +move 203.000000 568.000000 +draw 211.000000 572.000000 +move 196.000000 572.000000 +draw 203.000000 568.000000 +move 211.000000 572.000000 +draw 217.000000 693.000000 +move 204.000000 576.000000 +draw 211.000000 572.000000 +move 217.000000 693.000000 +draw 223.000000 761.000000 +move 210.000000 671.000000 +draw 217.000000 693.000000 +move 223.000000 761.000000 +draw 233.000000 689.000000 +move 216.000000 736.000000 +draw 223.000000 761.000000 +move 233.000000 689.000000 +draw 268.000000 612.000000 +move 233.000000 689.000000 +draw 233.000000 689.000000 +move 268.000000 612.000000 +draw 300.000000 619.000000 +move 268.000000 612.000000 +draw 268.000000 612.000000 +move 300.000000 619.000000 +draw 332.000000 634.000000 +move 292.000000 621.000000 +draw 300.000000 619.000000 +move 332.000000 634.000000 +draw 363.000000 650.000000 +move 324.000000 636.000000 +draw 332.000000 634.000000 +move 363.000000 650.000000 +draw 395.000000 666.000000 +move 356.000000 652.000000 +draw 363.000000 650.000000 +move 395.000000 666.000000 +draw 427.000000 680.000000 +move 388.000000 667.000000 +draw 395.000000 666.000000 +move 427.000000 680.000000 +draw 458.000000 688.000000 +move 419.000000 681.000000 +draw 427.000000 680.000000 +move 458.000000 688.000000 +draw 459.000000 687.000000 +move 451.000000 688.000000 +draw 458.000000 688.000000 +move 542.000000 442.000000 +draw 555.000000 332.000000 +move 555.000000 332.000000 +draw 564.000000 153.000000 +move 547.000000 345.000000 +draw 555.000000 332.000000 +move 564.000000 153.000000 +draw 570.000000 389.000000 +move 556.000000 239.000000 +draw 564.000000 153.000000 +move 575.000000 768.000000 +draw 575.000000 768.000000 +move 570.000000 389.000000 +draw 571.000000 407.000000 +move 570.000000 389.000000 +draw 570.000000 389.000000 +move 575.000000 768.000000 +draw 582.000000 772.000000 +move 567.000000 772.000000 +draw 575.000000 768.000000 +move 582.000000 772.000000 +draw 606.000000 785.000000 +move 575.000000 776.000000 +draw 582.000000 772.000000 +move 606.000000 785.000000 +draw 629.000000 797.000000 +move 598.000000 789.000000 +draw 606.000000 785.000000 +move 629.000000 797.000000 +draw 644.000000 805.000000 +move 621.000000 801.000000 +draw 629.000000 797.000000 +move 644.000000 805.000000 +draw 675.000000 822.000000 +move 636.000000 809.000000 +draw 644.000000 805.000000 +move 675.000000 822.000000 +draw 705.000000 838.000000 +move 667.000000 826.000000 +draw 675.000000 822.000000 +move 705.000000 838.000000 +draw 735.000000 855.000000 +move 697.000000 842.000000 +draw 705.000000 838.000000 +move 728.000000 859.000000 +draw 735.000000 855.000000 +move 33.000000 484.000000 +draw 66.000000 502.000000 +move 33.000000 484.000000 +draw 34.000000 485.000000 +move 25.000000 489.000000 +draw 33.000000 484.000000 +move 25.000000 489.000000 +draw 33.000000 484.000000 +move 66.000000 502.000000 +draw 98.000000 520.000000 +move 58.000000 506.000000 +draw 66.000000 502.000000 +move 98.000000 520.000000 +draw 131.000000 537.000000 +move 91.000000 524.000000 +draw 98.000000 520.000000 +move 131.000000 537.000000 +draw 147.000000 546.000000 +move 123.000000 542.000000 +draw 131.000000 537.000000 +move 147.000000 546.000000 +draw 172.000000 559.000000 +move 140.000000 550.000000 +draw 147.000000 546.000000 +move 172.000000 559.000000 +draw 196.000000 572.000000 +move 164.000000 563.000000 +draw 172.000000 559.000000 +move 196.000000 572.000000 +draw 204.000000 576.000000 +move 188.000000 576.000000 +draw 196.000000 572.000000 +move 204.000000 576.000000 +draw 210.000000 671.000000 +move 196.000000 581.000000 +draw 204.000000 576.000000 +move 210.000000 671.000000 +draw 216.000000 736.000000 +move 203.000000 656.000000 +draw 210.000000 671.000000 +move 216.000000 736.000000 +draw 217.000000 731.000000 +move 209.000000 707.000000 +draw 216.000000 736.000000 +move 266.000000 617.000000 +draw 292.000000 621.000000 +move 292.000000 621.000000 +draw 324.000000 636.000000 +move 285.000000 622.000000 +draw 292.000000 621.000000 +move 324.000000 636.000000 +draw 356.000000 652.000000 +move 317.000000 637.000000 +draw 324.000000 636.000000 +move 356.000000 652.000000 +draw 388.000000 667.000000 +move 348.000000 653.000000 +draw 356.000000 652.000000 +move 388.000000 667.000000 +draw 419.000000 681.000000 +move 380.000000 668.000000 +draw 388.000000 667.000000 +move 419.000000 681.000000 +draw 451.000000 688.000000 +move 412.000000 681.000000 +draw 419.000000 681.000000 +move 451.000000 688.000000 +draw 452.000000 687.000000 +move 443.000000 688.000000 +draw 451.000000 688.000000 +move 535.000000 438.000000 +draw 547.000000 345.000000 +move 547.000000 345.000000 +draw 556.000000 239.000000 +move 540.000000 384.000000 +draw 547.000000 345.000000 +move 556.000000 239.000000 +draw 557.000000 228.000000 +move 548.000000 298.000000 +draw 556.000000 239.000000 +move 566.000000 689.000000 +draw 567.000000 772.000000 +move 567.000000 772.000000 +draw 575.000000 776.000000 +move 560.000000 776.000000 +draw 567.000000 772.000000 +move 575.000000 776.000000 +draw 598.000000 789.000000 +move 567.000000 780.000000 +draw 575.000000 776.000000 +move 598.000000 789.000000 +draw 621.000000 801.000000 +move 590.000000 793.000000 +draw 598.000000 789.000000 +move 621.000000 801.000000 +draw 636.000000 809.000000 +move 613.000000 805.000000 +draw 621.000000 801.000000 +move 636.000000 809.000000 +draw 667.000000 826.000000 +move 629.000000 814.000000 +draw 636.000000 809.000000 +move 667.000000 826.000000 +draw 697.000000 842.000000 +move 659.000000 830.000000 +draw 667.000000 826.000000 +move 697.000000 842.000000 +draw 728.000000 859.000000 +move 690.000000 846.000000 +draw 697.000000 842.000000 +move 720.000000 863.000000 +draw 728.000000 859.000000 +move 25.000000 489.000000 +draw 58.000000 506.000000 +move 25.000000 489.000000 +draw 26.000000 490.000000 +move 18.000000 493.000000 +draw 25.000000 489.000000 +move 18.000000 493.000000 +draw 25.000000 489.000000 +move 58.000000 506.000000 +draw 91.000000 524.000000 +move 50.000000 511.000000 +draw 58.000000 506.000000 +move 91.000000 524.000000 +draw 123.000000 542.000000 +move 83.000000 528.000000 +draw 91.000000 524.000000 +move 123.000000 542.000000 +draw 140.000000 550.000000 +move 116.000000 546.000000 +draw 123.000000 542.000000 +move 140.000000 550.000000 +draw 164.000000 563.000000 +move 132.000000 555.000000 +draw 140.000000 550.000000 +move 164.000000 563.000000 +draw 188.000000 576.000000 +move 156.000000 568.000000 +draw 164.000000 563.000000 +move 188.000000 576.000000 +draw 196.000000 581.000000 +move 181.000000 581.000000 +draw 188.000000 576.000000 +move 196.000000 581.000000 +draw 203.000000 656.000000 +move 189.000000 585.000000 +draw 196.000000 581.000000 +move 203.000000 656.000000 +draw 209.000000 707.000000 +move 195.000000 643.000000 +draw 203.000000 656.000000 +move 209.000000 707.000000 +draw 210.000000 703.000000 +move 203.000000 672.000000 +draw 209.000000 707.000000 +move 266.000000 619.000000 +draw 285.000000 622.000000 +move 285.000000 622.000000 +draw 317.000000 637.000000 +move 277.000000 623.000000 +draw 285.000000 622.000000 +move 317.000000 637.000000 +draw 348.000000 653.000000 +move 309.000000 639.000000 +draw 317.000000 637.000000 +move 348.000000 653.000000 +draw 380.000000 668.000000 +move 341.000000 654.000000 +draw 348.000000 653.000000 +move 380.000000 668.000000 +draw 412.000000 681.000000 +move 373.000000 669.000000 +draw 380.000000 668.000000 +move 412.000000 681.000000 +draw 443.000000 688.000000 +move 404.000000 682.000000 +draw 412.000000 681.000000 +move 443.000000 688.000000 +draw 445.000000 687.000000 +move 436.000000 691.000000 +draw 443.000000 688.000000 +move 533.000000 437.000000 +draw 540.000000 384.000000 +move 540.000000 384.000000 +draw 548.000000 298.000000 +move 532.000000 430.000000 +draw 540.000000 384.000000 +move 548.000000 298.000000 +draw 549.000000 291.000000 +move 540.000000 336.000000 +draw 548.000000 298.000000 +move 558.000000 685.000000 +draw 560.000000 776.000000 +move 560.000000 776.000000 +draw 567.000000 780.000000 +move 552.000000 780.000000 +draw 560.000000 776.000000 +move 567.000000 780.000000 +draw 590.000000 793.000000 +move 560.000000 785.000000 +draw 567.000000 780.000000 +move 590.000000 793.000000 +draw 613.000000 805.000000 +move 583.000000 797.000000 +draw 590.000000 793.000000 +move 613.000000 805.000000 +draw 629.000000 814.000000 +move 606.000000 809.000000 +draw 613.000000 805.000000 +move 629.000000 814.000000 +draw 659.000000 830.000000 +move 621.000000 818.000000 +draw 629.000000 814.000000 +move 659.000000 830.000000 +draw 690.000000 846.000000 +move 652.000000 834.000000 +draw 659.000000 830.000000 +move 690.000000 846.000000 +draw 720.000000 863.000000 +move 682.000000 851.000000 +draw 690.000000 846.000000 +move 713.000000 867.000000 +draw 720.000000 863.000000 +move 18.000000 493.000000 +draw 50.000000 511.000000 +move 18.000000 493.000000 +draw 19.000000 494.000000 +move 16.000000 494.000000 +draw 18.000000 493.000000 +move 16.000000 494.000000 +draw 18.000000 493.000000 +move 50.000000 511.000000 +draw 83.000000 528.000000 +move 49.000000 512.000000 +draw 50.000000 511.000000 +move 83.000000 528.000000 +draw 116.000000 546.000000 +move 81.000000 530.000000 +draw 83.000000 528.000000 +move 116.000000 546.000000 +draw 132.000000 555.000000 +move 114.000000 547.000000 +draw 116.000000 546.000000 +move 132.000000 555.000000 +draw 156.000000 568.000000 +move 130.000000 556.000000 +draw 132.000000 555.000000 +move 156.000000 568.000000 +draw 181.000000 581.000000 +move 154.000000 569.000000 +draw 156.000000 568.000000 +move 181.000000 581.000000 +draw 189.000000 585.000000 +move 179.000000 582.000000 +draw 181.000000 581.000000 +move 189.000000 585.000000 +draw 195.000000 643.000000 +move 187.000000 586.000000 +draw 189.000000 585.000000 +move 195.000000 643.000000 +draw 203.000000 672.000000 +move 194.000000 638.000000 +draw 195.000000 643.000000 +move 203.000000 672.000000 +draw 204.000000 668.000000 +move 203.000000 672.000000 +draw 203.000000 672.000000 +move 266.000000 620.000000 +draw 277.000000 623.000000 +move 277.000000 623.000000 +draw 309.000000 639.000000 +move 275.000000 623.000000 +draw 277.000000 623.000000 +move 309.000000 639.000000 +draw 341.000000 654.000000 +move 307.000000 639.000000 +draw 309.000000 639.000000 +move 341.000000 654.000000 +draw 373.000000 669.000000 +move 339.000000 654.000000 +draw 341.000000 654.000000 +move 373.000000 669.000000 +draw 404.000000 682.000000 +move 371.000000 669.000000 +draw 373.000000 669.000000 +move 404.000000 682.000000 +draw 436.000000 691.000000 +move 402.000000 683.000000 +draw 404.000000 682.000000 +move 436.000000 691.000000 +draw 447.000000 687.000000 +move 434.000000 691.000000 +draw 436.000000 691.000000 +move 532.000000 430.000000 +draw 532.000000 430.000000 +move 532.000000 430.000000 +draw 540.000000 336.000000 +move 532.000000 430.000000 +draw 532.000000 430.000000 +move 540.000000 336.000000 +draw 541.000000 331.000000 +move 538.000000 344.000000 +draw 540.000000 336.000000 +move 550.000000 683.000000 +draw 552.000000 780.000000 +move 552.000000 780.000000 +draw 560.000000 785.000000 +move 550.000000 781.000000 +draw 552.000000 780.000000 +move 560.000000 785.000000 +draw 583.000000 797.000000 +move 558.000000 786.000000 +draw 560.000000 785.000000 +move 583.000000 797.000000 +draw 606.000000 809.000000 +move 581.000000 798.000000 +draw 583.000000 797.000000 +move 606.000000 809.000000 +draw 621.000000 818.000000 +move 604.000000 810.000000 +draw 606.000000 809.000000 +move 621.000000 818.000000 +draw 652.000000 834.000000 +move 619.000000 819.000000 +draw 621.000000 818.000000 +move 652.000000 834.000000 +draw 682.000000 851.000000 +move 650.000000 835.000000 +draw 652.000000 834.000000 +move 682.000000 851.000000 +draw 713.000000 867.000000 +move 680.000000 852.000000 +draw 682.000000 851.000000 +move 711.000000 868.000000 +draw 713.000000 867.000000 +move 16.000000 494.000000 +draw 49.000000 512.000000 +move 16.000000 494.000000 +draw 17.000000 495.000000 +move 14.000000 495.000000 +draw 16.000000 494.000000 +move 14.000000 495.000000 +draw 16.000000 494.000000 +move 49.000000 512.000000 +draw 81.000000 530.000000 +move 47.000000 513.000000 +draw 49.000000 512.000000 +move 81.000000 530.000000 +draw 114.000000 547.000000 +move 79.000000 531.000000 +draw 81.000000 530.000000 +move 114.000000 547.000000 +draw 130.000000 556.000000 +move 112.000000 548.000000 +draw 114.000000 547.000000 +move 130.000000 556.000000 +draw 154.000000 569.000000 +move 128.000000 557.000000 +draw 130.000000 556.000000 +move 154.000000 569.000000 +draw 179.000000 582.000000 +move 153.000000 570.000000 +draw 154.000000 569.000000 +move 179.000000 582.000000 +draw 187.000000 586.000000 +move 177.000000 583.000000 +draw 179.000000 582.000000 +move 187.000000 586.000000 +draw 194.000000 638.000000 +move 185.000000 587.000000 +draw 187.000000 586.000000 +move 194.000000 638.000000 +draw 195.000000 641.000000 +move 192.000000 633.000000 +draw 194.000000 638.000000 +move 265.000000 620.000000 +draw 275.000000 623.000000 +move 275.000000 623.000000 +draw 307.000000 639.000000 +move 273.000000 624.000000 +draw 275.000000 623.000000 +move 307.000000 639.000000 +draw 339.000000 654.000000 +move 305.000000 639.000000 +draw 307.000000 639.000000 +move 339.000000 654.000000 +draw 371.000000 669.000000 +move 337.000000 655.000000 +draw 339.000000 654.000000 +move 371.000000 669.000000 +draw 402.000000 683.000000 +move 369.000000 670.000000 +draw 371.000000 669.000000 +move 402.000000 683.000000 +draw 434.000000 691.000000 +move 400.000000 683.000000 +draw 402.000000 683.000000 +move 434.000000 691.000000 +draw 437.000000 690.000000 +move 432.000000 692.000000 +draw 434.000000 691.000000 +move 531.000000 436.000000 +draw 538.000000 344.000000 +move 538.000000 344.000000 +draw 539.000000 340.000000 +move 536.000000 352.000000 +draw 538.000000 344.000000 +move 548.000000 683.000000 +draw 550.000000 781.000000 +move 550.000000 781.000000 +draw 558.000000 786.000000 +move 548.000000 782.000000 +draw 550.000000 781.000000 +move 558.000000 786.000000 +draw 581.000000 798.000000 +move 556.000000 787.000000 +draw 558.000000 786.000000 +move 581.000000 798.000000 +draw 604.000000 810.000000 +move 579.000000 799.000000 +draw 581.000000 798.000000 +move 604.000000 810.000000 +draw 619.000000 819.000000 +move 602.000000 811.000000 +draw 604.000000 810.000000 +move 619.000000 819.000000 +draw 650.000000 835.000000 +move 617.000000 820.000000 +draw 619.000000 819.000000 +move 650.000000 835.000000 +draw 680.000000 852.000000 +move 648.000000 836.000000 +draw 650.000000 835.000000 +move 680.000000 852.000000 +draw 711.000000 868.000000 +move 679.000000 853.000000 +draw 680.000000 852.000000 +move 709.000000 869.000000 +draw 711.000000 868.000000 +move 14.000000 495.000000 +draw 47.000000 513.000000 +move 14.000000 495.000000 +draw 15.000000 496.000000 +move 12.000000 496.000000 +draw 14.000000 495.000000 +move 12.000000 496.000000 +draw 14.000000 495.000000 +move 47.000000 513.000000 +draw 79.000000 531.000000 +move 45.000000 514.000000 +draw 47.000000 513.000000 +move 79.000000 531.000000 +draw 112.000000 548.000000 +move 77.000000 532.000000 +draw 79.000000 531.000000 +move 112.000000 548.000000 +draw 128.000000 557.000000 +move 110.000000 549.000000 +draw 112.000000 548.000000 +move 128.000000 557.000000 +draw 153.000000 570.000000 +move 126.000000 558.000000 +draw 128.000000 557.000000 +move 153.000000 570.000000 +draw 177.000000 583.000000 +move 151.000000 571.000000 +draw 153.000000 570.000000 +move 177.000000 583.000000 +draw 185.000000 587.000000 +move 175.000000 584.000000 +draw 177.000000 583.000000 +move 185.000000 587.000000 +draw 192.000000 633.000000 +move 183.000000 588.000000 +draw 185.000000 587.000000 +move 192.000000 633.000000 +draw 193.000000 635.000000 +move 190.000000 625.000000 +draw 192.000000 633.000000 +move 265.000000 621.000000 +draw 273.000000 624.000000 +move 273.000000 624.000000 +draw 305.000000 639.000000 +move 272.000000 624.000000 +draw 273.000000 624.000000 +move 305.000000 639.000000 +draw 337.000000 655.000000 +move 303.000000 640.000000 +draw 305.000000 639.000000 +move 337.000000 655.000000 +draw 369.000000 670.000000 +move 335.000000 655.000000 +draw 337.000000 655.000000 +move 369.000000 670.000000 +draw 400.000000 683.000000 +move 367.000000 670.000000 +draw 369.000000 670.000000 +move 400.000000 683.000000 +draw 432.000000 692.000000 +move 398.000000 683.000000 +draw 400.000000 683.000000 +move 432.000000 692.000000 +draw 456.000000 687.000000 +move 430.000000 693.000000 +draw 432.000000 692.000000 +move 461.000000 689.000000 +draw 462.000000 688.000000 +move 530.000000 435.000000 +draw 536.000000 352.000000 +move 536.000000 352.000000 +draw 537.000000 348.000000 +move 534.000000 361.000000 +draw 536.000000 352.000000 +move 546.000000 683.000000 +draw 548.000000 782.000000 +move 548.000000 782.000000 +draw 556.000000 787.000000 +move 546.000000 783.000000 +draw 548.000000 782.000000 +move 556.000000 787.000000 +draw 579.000000 799.000000 +move 554.000000 788.000000 +draw 556.000000 787.000000 +move 579.000000 799.000000 +draw 602.000000 811.000000 +move 577.000000 800.000000 +draw 579.000000 799.000000 +move 602.000000 811.000000 +draw 617.000000 820.000000 +move 600.000000 812.000000 +draw 602.000000 811.000000 +move 617.000000 820.000000 +draw 648.000000 836.000000 +move 616.000000 821.000000 +draw 617.000000 820.000000 +move 648.000000 836.000000 +draw 679.000000 853.000000 +move 646.000000 837.000000 +draw 648.000000 836.000000 +move 679.000000 853.000000 +draw 709.000000 869.000000 +move 677.000000 854.000000 +draw 679.000000 853.000000 +move 707.000000 870.000000 +draw 709.000000 869.000000 +move 12.000000 496.000000 +draw 45.000000 514.000000 +move 12.000000 496.000000 +draw 13.000000 497.000000 +move 10.000000 498.000000 +draw 12.000000 496.000000 +move 10.000000 498.000000 +draw 12.000000 496.000000 +move 45.000000 514.000000 +draw 77.000000 532.000000 +move 43.000000 515.000000 +draw 45.000000 514.000000 +move 77.000000 532.000000 +draw 110.000000 549.000000 +move 76.000000 533.000000 +draw 77.000000 532.000000 +move 110.000000 549.000000 +draw 126.000000 558.000000 +move 108.000000 550.000000 +draw 110.000000 549.000000 +move 126.000000 558.000000 +draw 151.000000 571.000000 +move 124.000000 559.000000 +draw 126.000000 558.000000 +move 151.000000 571.000000 +draw 175.000000 584.000000 +move 149.000000 572.000000 +draw 151.000000 571.000000 +move 175.000000 584.000000 +draw 183.000000 588.000000 +move 173.000000 585.000000 +draw 175.000000 584.000000 +move 183.000000 588.000000 +draw 190.000000 625.000000 +move 181.000000 589.000000 +draw 183.000000 588.000000 +move 190.000000 625.000000 +draw 191.000000 626.000000 +move 190.000000 625.000000 +draw 190.000000 625.000000 +move 271.000000 624.000000 +draw 272.000000 624.000000 +move 272.000000 624.000000 +draw 303.000000 640.000000 +move 270.000000 624.000000 +draw 272.000000 624.000000 +move 303.000000 640.000000 +draw 335.000000 655.000000 +move 302.000000 640.000000 +draw 303.000000 640.000000 +move 335.000000 655.000000 +draw 367.000000 670.000000 +move 333.000000 655.000000 +draw 335.000000 655.000000 +move 367.000000 670.000000 +draw 398.000000 683.000000 +move 365.000000 670.000000 +draw 367.000000 670.000000 +move 398.000000 683.000000 +draw 430.000000 693.000000 +move 397.000000 684.000000 +draw 398.000000 683.000000 +move 430.000000 693.000000 +draw 461.000000 689.000000 +move 428.000000 694.000000 +draw 430.000000 693.000000 +move 461.000000 689.000000 +draw 463.000000 686.000000 +move 459.000000 692.000000 +draw 461.000000 689.000000 +move 529.000000 434.000000 +draw 534.000000 361.000000 +move 534.000000 361.000000 +draw 535.000000 357.000000 +move 532.000000 374.000000 +draw 534.000000 361.000000 +move 545.000000 683.000000 +draw 546.000000 783.000000 +move 546.000000 783.000000 +draw 554.000000 788.000000 +move 544.000000 784.000000 +draw 546.000000 783.000000 +move 554.000000 788.000000 +draw 577.000000 800.000000 +move 552.000000 789.000000 +draw 554.000000 788.000000 +move 577.000000 800.000000 +draw 600.000000 812.000000 +move 575.000000 801.000000 +draw 577.000000 800.000000 +move 600.000000 812.000000 +draw 616.000000 821.000000 +move 598.000000 814.000000 +draw 600.000000 812.000000 +move 616.000000 821.000000 +draw 646.000000 837.000000 +move 614.000000 822.000000 +draw 616.000000 821.000000 +move 646.000000 837.000000 +draw 677.000000 854.000000 +move 644.000000 838.000000 +draw 646.000000 837.000000 +move 677.000000 854.000000 +draw 707.000000 870.000000 +move 675.000000 855.000000 +draw 677.000000 854.000000 +move 705.000000 871.000000 +draw 707.000000 870.000000 +move 10.000000 498.000000 +draw 43.000000 515.000000 +move 10.000000 498.000000 +draw 11.000000 499.000000 +move 43.000000 515.000000 +draw 76.000000 533.000000 +move 76.000000 533.000000 +draw 108.000000 550.000000 +move 108.000000 550.000000 +draw 124.000000 559.000000 +move 124.000000 559.000000 +draw 149.000000 572.000000 +move 149.000000 572.000000 +draw 173.000000 585.000000 +move 173.000000 585.000000 +draw 181.000000 589.000000 +move 181.000000 589.000000 +draw 186.000000 601.000000 +move 265.000000 622.000000 +draw 270.000000 624.000000 +move 270.000000 624.000000 +draw 302.000000 640.000000 +move 302.000000 640.000000 +draw 333.000000 655.000000 +move 333.000000 655.000000 +draw 365.000000 670.000000 +move 365.000000 670.000000 +draw 397.000000 684.000000 +move 397.000000 684.000000 +draw 428.000000 694.000000 +move 428.000000 694.000000 +draw 459.000000 692.000000 +move 459.000000 692.000000 +draw 464.000000 686.000000 +move 528.000000 434.000000 +draw 532.000000 374.000000 +move 532.000000 374.000000 +draw 533.000000 368.000000 +move 542.000000 683.000000 +draw 544.000000 784.000000 +move 544.000000 784.000000 +draw 552.000000 789.000000 +move 552.000000 789.000000 +draw 575.000000 801.000000 +move 575.000000 801.000000 +draw 598.000000 814.000000 +move 598.000000 814.000000 +draw 614.000000 822.000000 +move 614.000000 822.000000 +draw 644.000000 838.000000 +move 644.000000 838.000000 +draw 675.000000 855.000000 +move 675.000000 855.000000 +draw 705.000000 871.000000 diff --git a/xgraph/examples/surface2.xg b/xgraph/examples/surface2.xg new file mode 100644 index 000000000..8738208d2 --- /dev/null +++ b/xgraph/examples/surface2.xg @@ -0,0 +1,631 @@ +TitleText: Another Surface Plot +ticks: on +boundbox: on +move 367.000000 10.000000 +draw 390.000000 22.000000 +move 367.000000 10.000000 +draw 390.000000 22.000000 +move 320.000000 188.000000 +draw 367.000000 10.000000 +move 320.000000 188.000000 +draw 367.000000 10.000000 +move 390.000000 22.000000 +draw 412.000000 33.000000 +move 390.000000 22.000000 +draw 412.000000 33.000000 +move 343.000000 200.000000 +draw 390.000000 22.000000 +move 390.000000 22.000000 +draw 390.000000 22.000000 +move 412.000000 33.000000 +draw 457.000000 56.000000 +move 412.000000 33.000000 +draw 457.000000 56.000000 +move 365.000000 211.000000 +draw 412.000000 33.000000 +move 412.000000 33.000000 +draw 412.000000 33.000000 +move 457.000000 56.000000 +draw 523.000000 91.000000 +move 457.000000 56.000000 +draw 523.000000 91.000000 +move 410.000000 234.000000 +draw 457.000000 56.000000 +move 457.000000 56.000000 +draw 457.000000 56.000000 +move 523.000000 91.000000 +draw 545.000000 102.000000 +move 523.000000 91.000000 +draw 545.000000 102.000000 +move 477.000000 267.000000 +draw 523.000000 91.000000 +move 523.000000 91.000000 +draw 523.000000 91.000000 +move 545.000000 102.000000 +draw 589.000000 125.000000 +move 545.000000 102.000000 +draw 589.000000 125.000000 +move 500.000000 258.000000 +draw 545.000000 102.000000 +move 545.000000 102.000000 +draw 545.000000 102.000000 +move 589.000000 125.000000 +draw 632.000000 147.000000 +move 589.000000 125.000000 +draw 632.000000 147.000000 +move 544.000000 246.000000 +draw 589.000000 125.000000 +move 589.000000 125.000000 +draw 589.000000 125.000000 +move 632.000000 147.000000 +draw 675.000000 170.000000 +move 632.000000 147.000000 +draw 675.000000 170.000000 +move 588.000000 242.000000 +draw 632.000000 147.000000 +move 632.000000 147.000000 +draw 632.000000 147.000000 +move 675.000000 170.000000 +draw 718.000000 192.000000 +move 675.000000 170.000000 +draw 718.000000 192.000000 +move 631.000000 290.000000 +draw 675.000000 170.000000 +move 675.000000 170.000000 +draw 675.000000 170.000000 +move 718.000000 192.000000 +draw 739.000000 203.000000 +move 718.000000 192.000000 +draw 739.000000 203.000000 +move 674.000000 345.000000 +draw 718.000000 192.000000 +move 718.000000 192.000000 +draw 718.000000 192.000000 +move 739.000000 203.000000 +draw 803.000000 235.000000 +move 739.000000 203.000000 +draw 803.000000 235.000000 +move 695.000000 376.000000 +draw 739.000000 203.000000 +move 739.000000 203.000000 +draw 739.000000 203.000000 +move 803.000000 235.000000 +draw 845.000000 257.000000 +move 803.000000 235.000000 +draw 845.000000 257.000000 +move 759.000000 409.000000 +draw 803.000000 235.000000 +move 803.000000 235.000000 +draw 803.000000 235.000000 +move 845.000000 257.000000 +draw 865.000000 268.000000 +move 845.000000 257.000000 +draw 865.000000 268.000000 +move 801.000000 430.000000 +draw 845.000000 257.000000 +move 845.000000 257.000000 +draw 845.000000 257.000000 +move 865.000000 268.000000 +draw 886.000000 279.000000 +move 865.000000 268.000000 +draw 886.000000 279.000000 +move 822.000000 440.000000 +draw 865.000000 268.000000 +move 865.000000 268.000000 +draw 865.000000 268.000000 +move 843.000000 451.000000 +draw 886.000000 279.000000 +move 886.000000 279.000000 +draw 886.000000 279.000000 +move 320.000000 188.000000 +draw 343.000000 200.000000 +move 320.000000 188.000000 +draw 321.000000 189.000000 +move 287.000000 245.000000 +draw 320.000000 188.000000 +move 287.000000 245.000000 +draw 320.000000 188.000000 +move 343.000000 200.000000 +draw 365.000000 211.000000 +move 310.000000 257.000000 +draw 343.000000 200.000000 +move 365.000000 211.000000 +draw 410.000000 234.000000 +move 332.000000 268.000000 +draw 365.000000 211.000000 +move 410.000000 234.000000 +draw 477.000000 267.000000 +move 378.000000 290.000000 +draw 410.000000 234.000000 +move 477.000000 267.000000 +draw 500.000000 258.000000 +move 445.000000 323.000000 +draw 477.000000 267.000000 +move 500.000000 258.000000 +draw 544.000000 246.000000 +move 467.000000 311.000000 +draw 500.000000 258.000000 +move 544.000000 246.000000 +draw 588.000000 242.000000 +move 511.000000 297.000000 +draw 544.000000 246.000000 +move 588.000000 242.000000 +draw 631.000000 290.000000 +move 555.000000 287.000000 +draw 588.000000 242.000000 +move 631.000000 290.000000 +draw 674.000000 345.000000 +move 599.000000 340.000000 +draw 631.000000 290.000000 +move 674.000000 345.000000 +draw 695.000000 376.000000 +move 642.000000 398.000000 +draw 674.000000 345.000000 +move 695.000000 376.000000 +draw 759.000000 409.000000 +move 663.000000 431.000000 +draw 695.000000 376.000000 +move 759.000000 409.000000 +draw 801.000000 430.000000 +move 727.000000 463.000000 +draw 759.000000 409.000000 +move 801.000000 430.000000 +draw 822.000000 440.000000 +move 769.000000 484.000000 +draw 801.000000 430.000000 +move 822.000000 440.000000 +draw 843.000000 451.000000 +move 790.000000 495.000000 +draw 822.000000 440.000000 +move 811.000000 505.000000 +draw 843.000000 451.000000 +move 287.000000 245.000000 +draw 310.000000 257.000000 +move 287.000000 245.000000 +draw 288.000000 246.000000 +move 222.000000 329.000000 +draw 287.000000 245.000000 +move 222.000000 329.000000 +draw 287.000000 245.000000 +move 310.000000 257.000000 +draw 332.000000 268.000000 +move 245.000000 340.000000 +draw 310.000000 257.000000 +move 332.000000 268.000000 +draw 378.000000 290.000000 +move 267.000000 351.000000 +draw 332.000000 268.000000 +move 378.000000 290.000000 +draw 445.000000 323.000000 +move 313.000000 373.000000 +draw 378.000000 290.000000 +move 445.000000 323.000000 +draw 467.000000 311.000000 +move 380.000000 405.000000 +draw 445.000000 323.000000 +move 467.000000 311.000000 +draw 511.000000 297.000000 +move 403.000000 389.000000 +draw 467.000000 311.000000 +move 511.000000 297.000000 +draw 555.000000 287.000000 +move 447.000000 371.000000 +draw 511.000000 297.000000 +move 555.000000 287.000000 +draw 599.000000 340.000000 +move 491.000000 359.000000 +draw 555.000000 287.000000 +move 599.000000 340.000000 +draw 642.000000 398.000000 +move 535.000000 414.000000 +draw 599.000000 340.000000 +move 642.000000 398.000000 +draw 663.000000 431.000000 +move 578.000000 475.000000 +draw 642.000000 398.000000 +move 663.000000 431.000000 +draw 727.000000 463.000000 +move 599.000000 512.000000 +draw 663.000000 431.000000 +move 727.000000 463.000000 +draw 769.000000 484.000000 +move 663.000000 543.000000 +draw 727.000000 463.000000 +move 769.000000 484.000000 +draw 790.000000 495.000000 +move 705.000000 564.000000 +draw 769.000000 484.000000 +move 790.000000 495.000000 +draw 811.000000 505.000000 +move 727.000000 574.000000 +draw 790.000000 495.000000 +move 748.000000 584.000000 +draw 811.000000 505.000000 +move 222.000000 329.000000 +draw 245.000000 340.000000 +move 222.000000 329.000000 +draw 223.000000 329.000000 +move 190.000000 748.000000 +draw 222.000000 329.000000 +move 190.000000 748.000000 +draw 222.000000 329.000000 +move 245.000000 340.000000 +draw 267.000000 351.000000 +move 213.000000 759.000000 +draw 245.000000 340.000000 +move 267.000000 351.000000 +draw 313.000000 373.000000 +move 237.000000 769.000000 +draw 267.000000 351.000000 +move 313.000000 373.000000 +draw 380.000000 405.000000 +move 283.000000 790.000000 +draw 313.000000 373.000000 +move 380.000000 405.000000 +draw 403.000000 389.000000 +move 352.000000 821.000000 +draw 380.000000 405.000000 +move 403.000000 389.000000 +draw 447.000000 371.000000 +move 381.000000 430.000000 +draw 403.000000 389.000000 +move 447.000000 371.000000 +draw 491.000000 359.000000 +move 426.000000 407.000000 +draw 447.000000 371.000000 +move 491.000000 359.000000 +draw 535.000000 414.000000 +move 470.000000 392.000000 +draw 491.000000 359.000000 +move 535.000000 414.000000 +draw 578.000000 475.000000 +move 513.000000 450.000000 +draw 535.000000 414.000000 +move 578.000000 475.000000 +draw 599.000000 512.000000 +move 556.000000 514.000000 +draw 578.000000 475.000000 +move 599.000000 512.000000 +draw 663.000000 543.000000 +move 576.000000 922.000000 +draw 599.000000 512.000000 +move 663.000000 543.000000 +draw 705.000000 564.000000 +move 641.000000 952.000000 +draw 663.000000 543.000000 +move 705.000000 564.000000 +draw 727.000000 574.000000 +move 684.000000 971.000000 +draw 705.000000 564.000000 +move 727.000000 574.000000 +draw 748.000000 584.000000 +move 706.000000 981.000000 +draw 727.000000 574.000000 +move 727.000000 991.000000 +draw 748.000000 584.000000 +move 190.000000 748.000000 +draw 213.000000 759.000000 +move 190.000000 748.000000 +draw 191.000000 748.000000 +move 168.000000 759.000000 +draw 190.000000 748.000000 +move 168.000000 759.000000 +draw 190.000000 748.000000 +move 213.000000 759.000000 +draw 237.000000 769.000000 +move 192.000000 769.000000 +draw 213.000000 759.000000 +move 237.000000 769.000000 +draw 283.000000 790.000000 +move 215.000000 780.000000 +draw 237.000000 769.000000 +move 283.000000 790.000000 +draw 352.000000 821.000000 +move 261.000000 800.000000 +draw 283.000000 790.000000 +move 352.000000 821.000000 +draw 381.000000 430.000000 +move 330.000000 831.000000 +draw 352.000000 821.000000 +move 381.000000 430.000000 +draw 426.000000 407.000000 +move 381.000000 430.000000 +draw 381.000000 430.000000 +move 426.000000 407.000000 +draw 470.000000 392.000000 +move 405.000000 419.000000 +draw 426.000000 407.000000 +move 470.000000 392.000000 +draw 513.000000 450.000000 +move 449.000000 404.000000 +draw 470.000000 392.000000 +move 513.000000 450.000000 +draw 556.000000 514.000000 +move 492.000000 461.000000 +draw 513.000000 450.000000 +move 556.000000 514.000000 +draw 576.000000 922.000000 +move 535.000000 525.000000 +draw 556.000000 514.000000 +move 576.000000 922.000000 +draw 641.000000 952.000000 +move 554.000000 932.000000 +draw 576.000000 922.000000 +move 641.000000 952.000000 +draw 684.000000 971.000000 +move 620.000000 962.000000 +draw 641.000000 952.000000 +move 684.000000 971.000000 +draw 706.000000 981.000000 +move 663.000000 981.000000 +draw 684.000000 971.000000 +move 706.000000 981.000000 +draw 727.000000 991.000000 +move 684.000000 991.000000 +draw 706.000000 981.000000 +move 706.000000 1000.000000 +draw 727.000000 991.000000 +move 168.000000 759.000000 +draw 192.000000 769.000000 +move 168.000000 759.000000 +draw 170.000000 760.000000 +move 145.000000 770.000000 +draw 168.000000 759.000000 +move 145.000000 770.000000 +draw 168.000000 759.000000 +move 192.000000 769.000000 +draw 215.000000 780.000000 +move 168.000000 781.000000 +draw 192.000000 769.000000 +move 215.000000 780.000000 +draw 261.000000 800.000000 +move 191.000000 791.000000 +draw 215.000000 780.000000 +move 261.000000 800.000000 +draw 330.000000 831.000000 +move 238.000000 812.000000 +draw 261.000000 800.000000 +move 330.000000 831.000000 +draw 331.000000 831.000000 +move 306.000000 843.000000 +draw 330.000000 831.000000 +move 381.000000 431.000000 +draw 405.000000 419.000000 +move 405.000000 419.000000 +draw 449.000000 404.000000 +move 381.000000 488.000000 +draw 405.000000 419.000000 +move 449.000000 404.000000 +draw 492.000000 461.000000 +move 425.000000 509.000000 +draw 449.000000 404.000000 +move 492.000000 461.000000 +draw 535.000000 525.000000 +move 468.000000 530.000000 +draw 492.000000 461.000000 +move 535.000000 525.000000 +draw 554.000000 932.000000 +move 512.000000 553.000000 +draw 535.000000 525.000000 +move 554.000000 932.000000 +draw 620.000000 962.000000 +move 530.000000 943.000000 +draw 554.000000 932.000000 +move 620.000000 962.000000 +draw 663.000000 981.000000 +move 596.000000 972.000000 +draw 620.000000 962.000000 +move 663.000000 981.000000 +draw 684.000000 991.000000 +move 639.000000 992.000000 +draw 663.000000 981.000000 +move 684.000000 991.000000 +draw 706.000000 1000.000000 +move 661.000000 1001.000000 +draw 684.000000 991.000000 +move 682.000000 1011.000000 +draw 706.000000 1000.000000 +move 145.000000 770.000000 +draw 168.000000 781.000000 +move 145.000000 770.000000 +draw 147.000000 771.000000 +move 141.000000 772.000000 +draw 145.000000 770.000000 +move 141.000000 772.000000 +draw 145.000000 770.000000 +move 168.000000 781.000000 +draw 191.000000 791.000000 +move 165.000000 782.000000 +draw 168.000000 781.000000 +move 191.000000 791.000000 +draw 238.000000 812.000000 +move 188.000000 793.000000 +draw 191.000000 791.000000 +move 238.000000 812.000000 +draw 306.000000 843.000000 +move 234.000000 813.000000 +draw 238.000000 812.000000 +move 306.000000 843.000000 +draw 307.000000 843.000000 +move 303.000000 844.000000 +draw 306.000000 843.000000 +move 377.000000 486.000000 +draw 381.000000 488.000000 +move 381.000000 488.000000 +draw 425.000000 509.000000 +move 377.000000 492.000000 +draw 381.000000 488.000000 +move 425.000000 509.000000 +draw 468.000000 530.000000 +move 421.000000 513.000000 +draw 425.000000 509.000000 +move 468.000000 530.000000 +draw 512.000000 553.000000 +move 465.000000 534.000000 +draw 468.000000 530.000000 +move 512.000000 553.000000 +draw 530.000000 943.000000 +move 508.000000 556.000000 +draw 512.000000 553.000000 +move 530.000000 943.000000 +draw 596.000000 972.000000 +move 527.000000 944.000000 +draw 530.000000 943.000000 +move 596.000000 972.000000 +draw 639.000000 992.000000 +move 592.000000 974.000000 +draw 596.000000 972.000000 +move 639.000000 992.000000 +draw 661.000000 1001.000000 +move 636.000000 993.000000 +draw 639.000000 992.000000 +move 661.000000 1001.000000 +draw 682.000000 1011.000000 +move 657.000000 1003.000000 +draw 661.000000 1001.000000 +move 679.000000 1012.000000 +draw 682.000000 1011.000000 +move 141.000000 772.000000 +draw 165.000000 782.000000 +move 141.000000 772.000000 +draw 143.000000 773.000000 +move 139.000000 773.000000 +draw 141.000000 772.000000 +move 139.000000 773.000000 +draw 141.000000 772.000000 +move 165.000000 782.000000 +draw 188.000000 793.000000 +move 162.000000 783.000000 +draw 165.000000 782.000000 +move 188.000000 793.000000 +draw 234.000000 813.000000 +move 186.000000 794.000000 +draw 188.000000 793.000000 +move 234.000000 813.000000 +draw 303.000000 844.000000 +move 232.000000 815.000000 +draw 234.000000 813.000000 +move 303.000000 844.000000 +draw 304.000000 844.000000 +move 301.000000 845.000000 +draw 303.000000 844.000000 +move 377.000000 492.000000 +draw 377.000000 492.000000 +move 377.000000 492.000000 +draw 421.000000 513.000000 +move 377.000000 492.000000 +draw 377.000000 492.000000 +move 421.000000 513.000000 +draw 465.000000 534.000000 +move 419.000000 517.000000 +draw 421.000000 513.000000 +move 465.000000 534.000000 +draw 508.000000 556.000000 +move 463.000000 538.000000 +draw 465.000000 534.000000 +move 508.000000 556.000000 +draw 527.000000 944.000000 +move 506.000000 559.000000 +draw 508.000000 556.000000 +move 527.000000 944.000000 +draw 592.000000 974.000000 +move 525.000000 946.000000 +draw 527.000000 944.000000 +move 592.000000 974.000000 +draw 636.000000 993.000000 +move 590.000000 975.000000 +draw 592.000000 974.000000 +move 636.000000 993.000000 +draw 657.000000 1003.000000 +move 634.000000 994.000000 +draw 636.000000 993.000000 +move 657.000000 1003.000000 +draw 679.000000 1012.000000 +move 655.000000 1004.000000 +draw 657.000000 1003.000000 +move 677.000000 1013.000000 +draw 679.000000 1012.000000 +move 139.000000 773.000000 +draw 162.000000 783.000000 +move 139.000000 773.000000 +draw 141.000000 774.000000 +move 138.000000 774.000000 +draw 139.000000 773.000000 +move 138.000000 774.000000 +draw 139.000000 773.000000 +move 162.000000 783.000000 +draw 186.000000 794.000000 +move 161.000000 784.000000 +draw 162.000000 783.000000 +move 186.000000 794.000000 +draw 232.000000 815.000000 +move 185.000000 794.000000 +draw 186.000000 794.000000 +move 232.000000 815.000000 +draw 301.000000 845.000000 +move 231.000000 815.000000 +draw 232.000000 815.000000 +move 301.000000 845.000000 +draw 302.000000 845.000000 +move 300.000000 846.000000 +draw 301.000000 845.000000 +move 377.000000 497.000000 +draw 419.000000 517.000000 +move 419.000000 517.000000 +draw 463.000000 538.000000 +move 418.000000 519.000000 +draw 419.000000 517.000000 +move 463.000000 538.000000 +draw 506.000000 559.000000 +move 462.000000 540.000000 +draw 463.000000 538.000000 +move 506.000000 559.000000 +draw 525.000000 946.000000 +move 505.000000 562.000000 +draw 506.000000 559.000000 +move 525.000000 946.000000 +draw 590.000000 975.000000 +move 523.000000 946.000000 +draw 525.000000 946.000000 +move 590.000000 975.000000 +draw 634.000000 994.000000 +move 589.000000 975.000000 +draw 590.000000 975.000000 +move 634.000000 994.000000 +draw 655.000000 1004.000000 +move 632.000000 995.000000 +draw 634.000000 994.000000 +move 655.000000 1004.000000 +draw 677.000000 1013.000000 +move 654.000000 1004.000000 +draw 655.000000 1004.000000 +move 675.000000 1014.000000 +draw 677.000000 1013.000000 +move 138.000000 774.000000 +draw 161.000000 784.000000 +move 138.000000 774.000000 +draw 139.000000 774.000000 +move 161.000000 784.000000 +draw 185.000000 794.000000 +move 185.000000 794.000000 +draw 231.000000 815.000000 +move 231.000000 815.000000 +draw 300.000000 846.000000 +move 300.000000 846.000000 +draw 301.000000 845.000000 +move 376.000000 499.000000 +draw 418.000000 519.000000 +move 418.000000 519.000000 +draw 462.000000 540.000000 +move 462.000000 540.000000 +draw 505.000000 562.000000 +move 505.000000 562.000000 +draw 523.000000 946.000000 +move 523.000000 946.000000 +draw 589.000000 975.000000 +move 589.000000 975.000000 +draw 632.000000 995.000000 +move 632.000000 995.000000 +draw 654.000000 1004.000000 +move 654.000000 1004.000000 +draw 675.000000 1014.000000 diff --git a/xgraph/examples/surface3.xg b/xgraph/examples/surface3.xg new file mode 100644 index 000000000..f07492ec6 --- /dev/null +++ b/xgraph/examples/surface3.xg @@ -0,0 +1,667 @@ +TitleText: Last Surface Plot +ticks: on +Boundbox: on +move 641.000000 167.000000 +draw 664.000000 156.000000 +move 641.000000 167.000000 +draw 664.000000 156.000000 +move 664.000000 156.000000 +draw 664.000000 156.000000 +move 661.000000 10.000000 +draw 664.000000 156.000000 +move 614.000000 32.000000 +draw 641.000000 167.000000 +move 614.000000 32.000000 +draw 641.000000 167.000000 +move 641.000000 167.000000 +draw 641.000000 167.000000 +move 638.000000 21.000000 +draw 641.000000 167.000000 +move 568.000000 55.000000 +draw 614.000000 32.000000 +move 568.000000 55.000000 +draw 614.000000 32.000000 +move 614.000000 32.000000 +draw 615.000000 33.000000 +move 614.000000 32.000000 +draw 615.000000 33.000000 +move 501.000000 89.000000 +draw 568.000000 55.000000 +move 501.000000 89.000000 +draw 568.000000 55.000000 +move 568.000000 55.000000 +draw 570.000000 56.000000 +move 568.000000 55.000000 +draw 569.000000 56.000000 +move 478.000000 100.000000 +draw 501.000000 89.000000 +move 478.000000 100.000000 +draw 501.000000 89.000000 +move 501.000000 89.000000 +draw 502.000000 90.000000 +move 501.000000 89.000000 +draw 502.000000 90.000000 +move 434.000000 122.000000 +draw 478.000000 100.000000 +move 434.000000 122.000000 +draw 478.000000 100.000000 +move 478.000000 100.000000 +draw 479.000000 101.000000 +move 478.000000 100.000000 +draw 479.000000 101.000000 +move 389.000000 145.000000 +draw 434.000000 122.000000 +move 389.000000 145.000000 +draw 434.000000 122.000000 +move 434.000000 122.000000 +draw 435.000000 123.000000 +move 434.000000 122.000000 +draw 435.000000 123.000000 +move 345.000000 167.000000 +draw 389.000000 145.000000 +move 345.000000 167.000000 +draw 389.000000 145.000000 +move 389.000000 145.000000 +draw 391.000000 145.000000 +move 389.000000 145.000000 +draw 391.000000 145.000000 +move 302.000000 188.000000 +draw 345.000000 167.000000 +move 302.000000 188.000000 +draw 345.000000 167.000000 +move 345.000000 167.000000 +draw 347.000000 167.000000 +move 345.000000 167.000000 +draw 347.000000 167.000000 +move 280.000000 199.000000 +draw 302.000000 188.000000 +move 280.000000 199.000000 +draw 302.000000 188.000000 +move 302.000000 188.000000 +draw 303.000000 189.000000 +move 302.000000 188.000000 +draw 303.000000 189.000000 +move 215.000000 232.000000 +draw 280.000000 199.000000 +move 215.000000 232.000000 +draw 280.000000 199.000000 +move 280.000000 199.000000 +draw 281.000000 200.000000 +move 280.000000 199.000000 +draw 281.000000 200.000000 +move 173.000000 253.000000 +draw 215.000000 232.000000 +move 173.000000 253.000000 +draw 215.000000 232.000000 +move 215.000000 232.000000 +draw 217.000000 232.000000 +move 215.000000 232.000000 +draw 217.000000 232.000000 +move 152.000000 406.000000 +draw 173.000000 253.000000 +move 152.000000 406.000000 +draw 173.000000 253.000000 +move 173.000000 253.000000 +draw 174.000000 254.000000 +move 173.000000 253.000000 +draw 174.000000 254.000000 +move 130.000000 417.000000 +draw 152.000000 406.000000 +move 130.000000 417.000000 +draw 152.000000 406.000000 +move 152.000000 406.000000 +draw 153.000000 399.000000 +move 152.000000 406.000000 +draw 153.000000 264.000000 +move 130.000000 417.000000 +draw 131.000000 417.000000 +move 130.000000 417.000000 +draw 131.000000 275.000000 +move 638.000000 21.000000 +draw 661.000000 10.000000 +move 661.000000 10.000000 +draw 663.000000 11.000000 +move 615.000000 33.000000 +draw 616.000000 32.000000 +move 615.000000 33.000000 +draw 638.000000 21.000000 +move 638.000000 21.000000 +draw 639.000000 22.000000 +move 570.000000 56.000000 +draw 615.000000 33.000000 +move 615.000000 33.000000 +draw 615.000000 33.000000 +move 615.000000 33.000000 +draw 617.000000 34.000000 +move 615.000000 33.000000 +draw 616.000000 34.000000 +move 502.000000 90.000000 +draw 570.000000 56.000000 +move 502.000000 90.000000 +draw 503.000000 90.000000 +move 570.000000 56.000000 +draw 572.000000 57.000000 +move 479.000000 101.000000 +draw 502.000000 90.000000 +move 479.000000 101.000000 +draw 502.000000 90.000000 +move 502.000000 90.000000 +draw 504.000000 91.000000 +move 502.000000 90.000000 +draw 503.000000 91.000000 +move 435.000000 123.000000 +draw 479.000000 101.000000 +move 435.000000 123.000000 +draw 479.000000 101.000000 +move 479.000000 101.000000 +draw 482.000000 102.000000 +move 479.000000 101.000000 +draw 481.000000 102.000000 +move 391.000000 145.000000 +draw 435.000000 123.000000 +move 391.000000 145.000000 +draw 435.000000 123.000000 +move 435.000000 123.000000 +draw 437.000000 124.000000 +move 435.000000 123.000000 +draw 436.000000 124.000000 +move 347.000000 167.000000 +draw 391.000000 145.000000 +move 347.000000 167.000000 +draw 391.000000 145.000000 +move 391.000000 145.000000 +draw 393.000000 146.000000 +move 391.000000 145.000000 +draw 392.000000 146.000000 +move 303.000000 189.000000 +draw 347.000000 167.000000 +move 303.000000 189.000000 +draw 347.000000 167.000000 +move 347.000000 167.000000 +draw 349.000000 168.000000 +move 347.000000 167.000000 +draw 348.000000 168.000000 +move 281.000000 200.000000 +draw 303.000000 189.000000 +move 281.000000 200.000000 +draw 303.000000 189.000000 +move 303.000000 189.000000 +draw 305.000000 190.000000 +move 303.000000 189.000000 +draw 304.000000 190.000000 +move 217.000000 232.000000 +draw 281.000000 200.000000 +move 217.000000 232.000000 +draw 281.000000 200.000000 +move 281.000000 200.000000 +draw 283.000000 201.000000 +move 281.000000 200.000000 +draw 282.000000 201.000000 +move 174.000000 254.000000 +draw 217.000000 232.000000 +move 174.000000 254.000000 +draw 217.000000 232.000000 +move 217.000000 232.000000 +draw 219.000000 233.000000 +move 217.000000 232.000000 +draw 218.000000 233.000000 +move 173.000000 254.000000 +draw 174.000000 254.000000 +move 153.000000 264.000000 +draw 174.000000 254.000000 +move 174.000000 254.000000 +draw 176.000000 255.000000 +move 174.000000 254.000000 +draw 175.000000 255.000000 +move 131.000000 275.000000 +draw 153.000000 264.000000 +move 153.000000 264.000000 +draw 154.000000 265.000000 +move 131.000000 275.000000 +draw 133.000000 276.000000 +move 663.000000 11.000000 +draw 663.000000 11.000000 +move 665.000000 12.000000 +draw 667.000000 13.000000 +move 663.000000 11.000000 +draw 667.000000 13.000000 +move 617.000000 34.000000 +draw 618.000000 34.000000 +move 572.000000 57.000000 +draw 617.000000 34.000000 +move 617.000000 34.000000 +draw 619.000000 35.000000 +move 504.000000 91.000000 +draw 572.000000 57.000000 +move 572.000000 57.000000 +draw 575.000000 59.000000 +move 482.000000 102.000000 +draw 504.000000 91.000000 +move 504.000000 91.000000 +draw 507.000000 93.000000 +move 437.000000 124.000000 +draw 482.000000 102.000000 +move 482.000000 102.000000 +draw 485.000000 104.000000 +move 393.000000 146.000000 +draw 437.000000 124.000000 +move 437.000000 124.000000 +draw 440.000000 126.000000 +move 349.000000 168.000000 +draw 393.000000 146.000000 +move 393.000000 146.000000 +draw 396.000000 148.000000 +move 305.000000 190.000000 +draw 349.000000 168.000000 +move 349.000000 168.000000 +draw 352.000000 170.000000 +move 283.000000 201.000000 +draw 305.000000 190.000000 +move 305.000000 190.000000 +draw 308.000000 192.000000 +move 219.000000 233.000000 +draw 283.000000 201.000000 +move 283.000000 201.000000 +draw 287.000000 203.000000 +move 176.000000 255.000000 +draw 219.000000 233.000000 +move 219.000000 233.000000 +draw 222.000000 235.000000 +move 173.000000 256.000000 +draw 176.000000 255.000000 +move 176.000000 255.000000 +draw 179.000000 256.000000 +move 665.000000 14.000000 +draw 667.000000 13.000000 +move 667.000000 13.000000 +draw 667.000000 13.000000 +move 667.000000 13.000000 +draw 690.000000 26.000000 +move 667.000000 13.000000 +draw 690.000000 26.000000 +move 665.000000 36.000000 +draw 667.000000 37.000000 +move 575.000000 59.000000 +draw 620.000000 37.000000 +move 507.000000 93.000000 +draw 575.000000 59.000000 +move 575.000000 59.000000 +draw 598.000000 71.000000 +move 485.000000 104.000000 +draw 507.000000 93.000000 +move 507.000000 93.000000 +draw 531.000000 105.000000 +move 440.000000 126.000000 +draw 485.000000 104.000000 +move 485.000000 104.000000 +draw 508.000000 116.000000 +move 396.000000 148.000000 +draw 440.000000 126.000000 +move 440.000000 126.000000 +draw 476.000000 790.000000 +move 352.000000 170.000000 +draw 396.000000 148.000000 +move 396.000000 148.000000 +draw 430.000000 812.000000 +move 308.000000 192.000000 +draw 352.000000 170.000000 +move 352.000000 170.000000 +draw 384.000000 831.000000 +move 287.000000 203.000000 +draw 308.000000 192.000000 +move 308.000000 192.000000 +draw 332.000000 204.000000 +move 222.000000 235.000000 +draw 287.000000 203.000000 +move 287.000000 203.000000 +draw 310.000000 215.000000 +move 179.000000 256.000000 +draw 222.000000 235.000000 +move 222.000000 235.000000 +draw 245.000000 247.000000 +move 173.000000 259.000000 +draw 179.000000 256.000000 +move 179.000000 256.000000 +draw 203.000000 268.000000 +move 171.000000 274.000000 +draw 181.000000 279.000000 +move 667.000000 37.000000 +draw 690.000000 26.000000 +move 690.000000 26.000000 +draw 690.000000 26.000000 +move 690.000000 26.000000 +draw 711.000000 37.000000 +move 690.000000 26.000000 +draw 711.000000 37.000000 +move 665.000000 38.000000 +draw 667.000000 37.000000 +move 667.000000 37.000000 +draw 688.000000 49.000000 +move 598.000000 71.000000 +draw 621.000000 60.000000 +move 665.000000 60.000000 +draw 665.000000 60.000000 +move 531.000000 105.000000 +draw 598.000000 71.000000 +move 598.000000 71.000000 +draw 619.000000 82.000000 +move 508.000000 116.000000 +draw 531.000000 105.000000 +move 531.000000 105.000000 +draw 552.000000 116.000000 +move 476.000000 790.000000 +draw 508.000000 116.000000 +move 508.000000 116.000000 +draw 529.000000 127.000000 +move 430.000000 812.000000 +draw 476.000000 790.000000 +move 476.000000 790.000000 +draw 497.000000 801.000000 +move 384.000000 831.000000 +draw 430.000000 812.000000 +move 430.000000 812.000000 +draw 451.000000 822.000000 +move 332.000000 204.000000 +draw 384.000000 831.000000 +move 384.000000 831.000000 +draw 406.000000 841.000000 +move 310.000000 215.000000 +draw 332.000000 204.000000 +move 332.000000 204.000000 +draw 333.000000 205.000000 +move 245.000000 247.000000 +draw 310.000000 215.000000 +move 310.000000 215.000000 +draw 331.000000 225.000000 +move 203.000000 268.000000 +draw 245.000000 247.000000 +move 245.000000 247.000000 +draw 266.000000 257.000000 +move 181.000000 279.000000 +draw 203.000000 268.000000 +move 203.000000 268.000000 +draw 224.000000 279.000000 +move 169.000000 285.000000 +draw 181.000000 279.000000 +move 181.000000 279.000000 +draw 202.000000 289.000000 +move 168.000000 293.000000 +draw 181.000000 300.000000 +move 688.000000 49.000000 +draw 711.000000 37.000000 +move 711.000000 37.000000 +draw 711.000000 37.000000 +move 711.000000 37.000000 +draw 732.000000 49.000000 +move 711.000000 37.000000 +draw 732.000000 49.000000 +move 665.000000 60.000000 +draw 688.000000 49.000000 +move 688.000000 49.000000 +draw 709.000000 60.000000 +move 619.000000 82.000000 +draw 665.000000 60.000000 +move 665.000000 60.000000 +draw 686.000000 71.000000 +move 552.000000 116.000000 +draw 619.000000 82.000000 +move 619.000000 82.000000 +draw 640.000000 94.000000 +move 529.000000 127.000000 +draw 552.000000 116.000000 +move 552.000000 116.000000 +draw 587.000000 732.000000 +move 497.000000 801.000000 +draw 529.000000 127.000000 +move 529.000000 127.000000 +draw 565.000000 787.000000 +move 451.000000 822.000000 +draw 497.000000 801.000000 +move 497.000000 801.000000 +draw 519.000000 812.000000 +move 406.000000 841.000000 +draw 451.000000 822.000000 +move 451.000000 822.000000 +draw 473.000000 832.000000 +move 406.000000 841.000000 +draw 406.000000 841.000000 +move 406.000000 841.000000 +draw 428.000000 852.000000 +move 331.000000 225.000000 +draw 334.000000 224.000000 +move 377.000000 747.000000 +draw 382.000000 868.000000 +move 266.000000 257.000000 +draw 331.000000 225.000000 +move 331.000000 225.000000 +draw 359.000000 833.000000 +move 224.000000 279.000000 +draw 266.000000 257.000000 +move 266.000000 257.000000 +draw 287.000000 268.000000 +move 202.000000 289.000000 +draw 224.000000 279.000000 +move 224.000000 279.000000 +draw 245.000000 289.000000 +move 181.000000 300.000000 +draw 202.000000 289.000000 +move 202.000000 289.000000 +draw 223.000000 300.000000 +move 181.000000 300.000000 +draw 202.000000 310.000000 +move 709.000000 60.000000 +draw 732.000000 49.000000 +move 732.000000 49.000000 +draw 732.000000 49.000000 +move 732.000000 49.000000 +draw 818.000000 739.000000 +move 732.000000 49.000000 +draw 818.000000 739.000000 +move 686.000000 71.000000 +draw 709.000000 60.000000 +move 709.000000 60.000000 +draw 794.000000 750.000000 +move 640.000000 94.000000 +draw 686.000000 71.000000 +move 686.000000 71.000000 +draw 770.000000 760.000000 +move 587.000000 732.000000 +draw 640.000000 94.000000 +move 640.000000 94.000000 +draw 723.000000 781.000000 +move 565.000000 787.000000 +draw 587.000000 732.000000 +move 587.000000 732.000000 +draw 653.000000 812.000000 +move 519.000000 812.000000 +draw 565.000000 787.000000 +move 565.000000 787.000000 +draw 630.000000 822.000000 +move 473.000000 832.000000 +draw 519.000000 812.000000 +move 519.000000 812.000000 +draw 583.000000 843.000000 +move 428.000000 852.000000 +draw 473.000000 832.000000 +move 473.000000 832.000000 +draw 538.000000 863.000000 +move 382.000000 868.000000 +draw 428.000000 852.000000 +move 428.000000 852.000000 +draw 492.000000 882.000000 +move 359.000000 833.000000 +draw 382.000000 868.000000 +move 382.000000 868.000000 +draw 447.000000 902.000000 +move 287.000000 268.000000 +draw 359.000000 833.000000 +move 359.000000 833.000000 +draw 424.000000 912.000000 +move 245.000000 289.000000 +draw 287.000000 268.000000 +move 287.000000 268.000000 +draw 357.000000 941.000000 +move 223.000000 300.000000 +draw 245.000000 289.000000 +move 245.000000 289.000000 +draw 313.000000 960.000000 +move 202.000000 310.000000 +draw 223.000000 300.000000 +move 223.000000 300.000000 +draw 291.000000 970.000000 +move 202.000000 310.000000 +draw 269.000000 979.000000 +move 794.000000 750.000000 +draw 818.000000 739.000000 +move 818.000000 739.000000 +draw 818.000000 739.000000 +move 818.000000 739.000000 +draw 850.000000 756.000000 +move 818.000000 739.000000 +draw 850.000000 756.000000 +move 770.000000 760.000000 +draw 794.000000 750.000000 +move 794.000000 750.000000 +draw 826.000000 766.000000 +move 723.000000 781.000000 +draw 770.000000 760.000000 +move 770.000000 760.000000 +draw 802.000000 776.000000 +move 653.000000 812.000000 +draw 723.000000 781.000000 +move 723.000000 781.000000 +draw 755.000000 797.000000 +move 630.000000 822.000000 +draw 653.000000 812.000000 +move 653.000000 812.000000 +draw 685.000000 827.000000 +move 583.000000 843.000000 +draw 630.000000 822.000000 +move 630.000000 822.000000 +draw 662.000000 837.000000 +move 538.000000 863.000000 +draw 583.000000 843.000000 +move 583.000000 843.000000 +draw 615.000000 858.000000 +move 492.000000 882.000000 +draw 538.000000 863.000000 +move 538.000000 863.000000 +draw 570.000000 878.000000 +move 447.000000 902.000000 +draw 492.000000 882.000000 +move 492.000000 882.000000 +draw 524.000000 897.000000 +move 424.000000 912.000000 +draw 447.000000 902.000000 +move 447.000000 902.000000 +draw 479.000000 917.000000 +move 357.000000 941.000000 +draw 424.000000 912.000000 +move 424.000000 912.000000 +draw 456.000000 927.000000 +move 313.000000 960.000000 +draw 357.000000 941.000000 +move 357.000000 941.000000 +draw 389.000000 956.000000 +move 291.000000 970.000000 +draw 313.000000 960.000000 +move 313.000000 960.000000 +draw 345.000000 975.000000 +move 269.000000 979.000000 +draw 291.000000 970.000000 +move 291.000000 970.000000 +draw 323.000000 985.000000 +move 269.000000 979.000000 +draw 301.000000 994.000000 +move 826.000000 766.000000 +draw 850.000000 756.000000 +move 850.000000 756.000000 +draw 850.000000 756.000000 +move 850.000000 756.000000 +draw 894.000000 777.000000 +move 850.000000 756.000000 +draw 894.000000 777.000000 +move 802.000000 776.000000 +draw 826.000000 766.000000 +move 826.000000 766.000000 +draw 870.000000 787.000000 +move 755.000000 797.000000 +draw 802.000000 776.000000 +move 802.000000 776.000000 +draw 846.000000 798.000000 +move 685.000000 827.000000 +draw 755.000000 797.000000 +move 755.000000 797.000000 +draw 799.000000 818.000000 +move 662.000000 837.000000 +draw 685.000000 827.000000 +move 685.000000 827.000000 +draw 729.000000 848.000000 +move 615.000000 858.000000 +draw 662.000000 837.000000 +move 662.000000 837.000000 +draw 706.000000 858.000000 +move 570.000000 878.000000 +draw 615.000000 858.000000 +move 615.000000 858.000000 +draw 659.000000 878.000000 +move 524.000000 897.000000 +draw 570.000000 878.000000 +move 570.000000 878.000000 +draw 614.000000 898.000000 +move 479.000000 917.000000 +draw 524.000000 897.000000 +move 524.000000 897.000000 +draw 568.000000 918.000000 +move 456.000000 927.000000 +draw 479.000000 917.000000 +move 479.000000 917.000000 +draw 523.000000 937.000000 +move 389.000000 956.000000 +draw 456.000000 927.000000 +move 456.000000 927.000000 +draw 500.000000 947.000000 +move 345.000000 975.000000 +draw 389.000000 956.000000 +move 389.000000 956.000000 +draw 433.000000 976.000000 +move 323.000000 985.000000 +draw 345.000000 975.000000 +move 345.000000 975.000000 +draw 389.000000 995.000000 +move 301.000000 994.000000 +draw 323.000000 985.000000 +move 323.000000 985.000000 +draw 367.000000 1005.000000 +move 301.000000 994.000000 +draw 345.000000 1014.000000 +move 870.000000 787.000000 +draw 894.000000 777.000000 +move 894.000000 777.000000 +draw 894.000000 777.000000 +move 846.000000 798.000000 +draw 870.000000 787.000000 +move 799.000000 818.000000 +draw 846.000000 798.000000 +move 729.000000 848.000000 +draw 799.000000 818.000000 +move 706.000000 858.000000 +draw 729.000000 848.000000 +move 659.000000 878.000000 +draw 706.000000 858.000000 +move 614.000000 898.000000 +draw 659.000000 878.000000 +move 568.000000 918.000000 +draw 614.000000 898.000000 +move 523.000000 937.000000 +draw 568.000000 918.000000 +move 500.000000 947.000000 +draw 523.000000 937.000000 +move 433.000000 976.000000 +draw 500.000000 947.000000 +move 389.000000 995.000000 +draw 433.000000 976.000000 +move 367.000000 1005.000000 +draw 389.000000 995.000000 +move 345.000000 1014.000000 +draw 367.000000 1005.000000 diff --git a/xgraph/examples/xgtest.xg b/xgraph/examples/xgtest.xg new file mode 100644 index 000000000..3fddf3cc4 --- /dev/null +++ b/xgraph/examples/xgtest.xg @@ -0,0 +1,725 @@ +Device: Postscript +Disposition: To File +FileOrDev: /usr/tmp/hpgl.out +TitleText: Sample Xgraph Data +"Alpha +-5 29 +-4.9 27.91 +-4.8 26.84 +-4.7 25.79 +-4.6 24.76 +-4.5 23.75 +-4.4 22.76 +-4.3 21.79 +-4.2 20.84 +-4.1 19.91 +-4 19 +-3.9 18.11 +-3.8 17.24 +-3.7 16.39 +-3.6 15.56 +-3.5 14.75 +-3.4 13.96 +-3.3 13.19 +-3.2 12.44 +-3.1 11.71 +-3 11 +-2.9 10.31 +-2.8 9.64 +-2.7 8.99 +-2.6 8.36 +-2.5 7.75 +-2.4 7.16 +-2.3 6.59 +-2.2 6.04 +-2.1 5.51 +-2 5 +-1.9 4.51 +-1.8 4.04 +-1.7 3.59 +-1.6 3.16 +-1.5 2.75 +-1.4 2.36 +-1.3 1.99 +-1.2 1.64 +-1.1 1.31 +-1 1 +-0.9 0.71 +-0.8 0.44 +-0.7 0.19 +-0.6 -0.04 +-0.5 -0.25 +-0.4 -0.44 +-0.3 -0.61 +-0.2 -0.76 +-0.1 -0.89 +-1.02696E-15 -1 +0.1 -1.09 +0.2 -1.16 +0.3 -1.21 +0.4 -1.24 +0.5 -1.25 +0.6 -1.24 +0.7 -1.21 +0.8 -1.16 +0.9 -1.09 +1 -1 +1.1 -0.89 +1.2 -0.76 +1.3 -0.61 +1.4 -0.44 +1.5 -0.25 +1.6 -0.04 +1.7 0.19 +1.8 0.44 +1.9 0.71 +2 1 +2.1 1.31 +2.2 1.64 +2.3 1.99 +2.4 2.36 +2.5 2.75 +2.6 3.16 +2.7 3.59 +2.8 4.04 +2.9 4.51 +3 5 +3.1 5.51 +3.2 6.04 +3.3 6.59 +3.4 7.16 +3.5 7.75 +3.6 8.36 +3.7 8.99 +3.8 9.64 +3.9 10.31 +4 11 +4.1 11.71 +4.2 12.44 +4.3 13.19 +4.4 13.96 +4.5 14.75 +4.6 15.56 +4.7 16.39 +4.8 17.24 +4.9 18.11 +5 19 + +"Beta +-5 33 +-4.9 31.81 +-4.8 30.64 +-4.7 29.49 +-4.6 28.36 +-4.5 27.25 +-4.4 26.16 +-4.3 25.09 +-4.2 24.04 +-4.1 23.01 +-4 22 +-3.9 21.01 +-3.8 20.04 +-3.7 19.09 +-3.6 18.16 +-3.5 17.25 +-3.4 16.36 +-3.3 15.49 +-3.2 14.64 +-3.1 13.81 +-3 13 +-2.9 12.21 +-2.8 11.44 +-2.7 10.69 +-2.6 9.96 +-2.5 9.25 +-2.4 8.56 +-2.3 7.89 +-2.2 7.24 +-2.1 6.61 +-2 6 +-1.9 5.41 +-1.8 4.84 +-1.7 4.29 +-1.6 3.76 +-1.5 3.25 +-1.4 2.76 +-1.3 2.29 +-1.2 1.84 +-1.1 1.41 +-1 1 +-0.9 0.61 +-0.8 0.24 +-0.7 -0.11 +-0.6 -0.44 +-0.5 -0.75 +-0.4 -1.04 +-0.3 -1.31 +-0.2 -1.56 +-0.1 -1.79 +-1.02696E-15 -2 +0.1 -2.19 +0.2 -2.36 +0.3 -2.51 +0.4 -2.64 +0.5 -2.75 +0.6 -2.84 +0.7 -2.91 +0.8 -2.96 +0.9 -2.99 +1 -3 +1.1 -2.99 +1.2 -2.96 +1.3 -2.91 +1.4 -2.84 +1.5 -2.75 +1.6 -2.64 +1.7 -2.51 +1.8 -2.36 +1.9 -2.19 +2 -2 +2.1 -1.79 +2.2 -1.56 +2.3 -1.31 +2.4 -1.04 +2.5 -0.75 +2.6 -0.44 +2.7 -0.11 +2.8 0.24 +2.9 0.61 +3 1 +3.1 1.41 +3.2 1.84 +3.3 2.29 +3.4 2.76 +3.5 3.25 +3.6 3.76 +3.7 4.29 +3.8 4.84 +3.9 5.41 +4 6 +4.1 6.61 +4.2 7.24 +4.3 7.89 +4.4 8.56 +4.5 9.25 +4.6 9.96 +4.7 10.69 +4.8 11.44 +4.9 12.21 +5 13 + +"Gamma +-5 37 +-4.9 35.71 +-4.8 34.44 +-4.7 33.19 +-4.6 31.96 +-4.5 30.75 +-4.4 29.56 +-4.3 28.39 +-4.2 27.24 +-4.1 26.11 +-4 25 +-3.9 23.91 +-3.8 22.84 +-3.7 21.79 +-3.6 20.76 +-3.5 19.75 +-3.4 18.76 +-3.3 17.79 +-3.2 16.84 +-3.1 15.91 +-3 15 +-2.9 14.11 +-2.8 13.24 +-2.7 12.39 +-2.6 11.56 +-2.5 10.75 +-2.4 9.96 +-2.3 9.19 +-2.2 8.44 +-2.1 7.71 +-2 7 +-1.9 6.31 +-1.8 5.64 +-1.7 4.99 +-1.6 4.36 +-1.5 3.75 +-1.4 3.16 +-1.3 2.59 +-1.2 2.04 +-1.1 1.51 +-1 1 +-0.9 0.51 +-0.8 0.04 +-0.7 -0.41 +-0.6 -0.84 +-0.5 -1.25 +-0.4 -1.64 +-0.3 -2.01 +-0.2 -2.36 +-0.1 -2.69 +-1.02696E-15 -3 +0.1 -3.29 +0.2 -3.56 +0.3 -3.81 +0.4 -4.04 +0.5 -4.25 +0.6 -4.44 +0.7 -4.61 +0.8 -4.76 +0.9 -4.89 +1 -5 +1.1 -5.09 +1.2 -5.16 +1.3 -5.21 +1.4 -5.24 +1.5 -5.25 +1.6 -5.24 +1.7 -5.21 +1.8 -5.16 +1.9 -5.09 +2 -5 +2.1 -4.89 +2.2 -4.76 +2.3 -4.61 +2.4 -4.44 +2.5 -4.25 +2.6 -4.04 +2.7 -3.81 +2.8 -3.56 +2.9 -3.29 +3 -3 +3.1 -2.69 +3.2 -2.36 +3.3 -2.01 +3.4 -1.64 +3.5 -1.25 +3.6 -0.84 +3.7 -0.41 +3.8 0.04 +3.9 0.51 +4 1 +4.1 1.51 +4.2 2.04 +4.3 2.59 +4.4 3.16 +4.5 3.75 +4.6 4.36 +4.7 4.99 +4.8 5.64 +4.9 6.31 +5 7 + +"Delta +-5 41 +-4.9 39.61 +-4.8 38.24 +-4.7 36.89 +-4.6 35.56 +-4.5 34.25 +-4.4 32.96 +-4.3 31.69 +-4.2 30.44 +-4.1 29.21 +-4 28 +-3.9 26.81 +-3.8 25.64 +-3.7 24.49 +-3.6 23.36 +-3.5 22.25 +-3.4 21.16 +-3.3 20.09 +-3.2 19.04 +-3.1 18.01 +-3 17 +-2.9 16.01 +-2.8 15.04 +-2.7 14.09 +-2.6 13.16 +-2.5 12.25 +-2.4 11.36 +-2.3 10.49 +-2.2 9.64 +-2.1 8.81 +-2 8 +-1.9 7.21 +-1.8 6.44 +-1.7 5.69 +-1.6 4.96 +-1.5 4.25 +-1.4 3.56 +-1.3 2.89 +-1.2 2.24 +-1.1 1.61 +-1 1 +-0.9 0.41 +-0.8 -0.16 +-0.7 -0.71 +-0.6 -1.24 +-0.5 -1.75 +-0.4 -2.24 +-0.3 -2.71 +-0.2 -3.16 +-0.1 -3.59 +-1.02696E-15 -4 +0.1 -4.39 +0.2 -4.76 +0.3 -5.11 +0.4 -5.44 +0.5 -5.75 +0.6 -6.04 +0.7 -6.31 +0.8 -6.56 +0.9 -6.79 +1 -7 +1.1 -7.19 +1.2 -7.36 +1.3 -7.51 +1.4 -7.64 +1.5 -7.75 +1.6 -7.84 +1.7 -7.91 +1.8 -7.96 +1.9 -7.99 +2 -8 +2.1 -7.99 +2.2 -7.96 +2.3 -7.91 +2.4 -7.84 +2.5 -7.75 +2.6 -7.64 +2.7 -7.51 +2.8 -7.36 +2.9 -7.19 +3 -7 +3.1 -6.79 +3.2 -6.56 +3.3 -6.31 +3.4 -6.04 +3.5 -5.75 +3.6 -5.44 +3.7 -5.11 +3.8 -4.76 +3.9 -4.39 +4 -4 +4.1 -3.59 +4.2 -3.16 +4.3 -2.71 +4.4 -2.24 +4.5 -1.75 +4.6 -1.24 +4.7 -0.71 +4.8 -0.16 +4.9 0.41 +5 1 + +"Epsilon +-5 45 +-4.9 43.51 +-4.8 42.04 +-4.7 40.59 +-4.6 39.16 +-4.5 37.75 +-4.4 36.36 +-4.3 34.99 +-4.2 33.64 +-4.1 32.31 +-4 31 +-3.9 29.71 +-3.8 28.44 +-3.7 27.19 +-3.6 25.96 +-3.5 24.75 +-3.4 23.56 +-3.3 22.39 +-3.2 21.24 +-3.1 20.11 +-3 19 +-2.9 17.91 +-2.8 16.84 +-2.7 15.79 +-2.6 14.76 +-2.5 13.75 +-2.4 12.76 +-2.3 11.79 +-2.2 10.84 +-2.1 9.91 +-2 9 +-1.9 8.11 +-1.8 7.24 +-1.7 6.39 +-1.6 5.56 +-1.5 4.75 +-1.4 3.96 +-1.3 3.19 +-1.2 2.44 +-1.1 1.71 +-1 1 +-0.9 0.31 +-0.8 -0.36 +-0.7 -1.01 +-0.6 -1.64 +-0.5 -2.25 +-0.4 -2.84 +-0.3 -3.41 +-0.2 -3.96 +-0.1 -4.49 +-1.02696E-15 -5 +0.1 -5.49 +0.2 -5.96 +0.3 -6.41 +0.4 -6.84 +0.5 -7.25 +0.6 -7.64 +0.7 -8.01 +0.8 -8.36 +0.9 -8.69 +1 -9 +1.1 -9.29 +1.2 -9.56 +1.3 -9.81 +1.4 -10.04 +1.5 -10.25 +1.6 -10.44 +1.7 -10.61 +1.8 -10.76 +1.9 -10.89 +2 -11 +2.1 -11.09 +2.2 -11.16 +2.3 -11.21 +2.4 -11.24 +2.5 -11.25 +2.6 -11.24 +2.7 -11.21 +2.8 -11.16 +2.9 -11.09 +3 -11 +3.1 -10.89 +3.2 -10.76 +3.3 -10.61 +3.4 -10.44 +3.5 -10.25 +3.6 -10.04 +3.7 -9.81 +3.8 -9.56 +3.9 -9.29 +4 -9 +4.1 -8.69 +4.2 -8.36 +4.3 -8.01 +4.4 -7.64 +4.5 -7.25 +4.6 -6.84 +4.7 -6.41 +4.8 -5.96 +4.9 -5.49 +5 -5 + +"Zeta +-5 49 +-4.9 47.41 +-4.8 45.84 +-4.7 44.29 +-4.6 42.76 +-4.5 41.25 +-4.4 39.76 +-4.3 38.29 +-4.2 36.84 +-4.1 35.41 +-4 34 +-3.9 32.61 +-3.8 31.24 +-3.7 29.89 +-3.6 28.56 +-3.5 27.25 +-3.4 25.96 +-3.3 24.69 +-3.2 23.44 +-3.1 22.21 +-3 21 +-2.9 19.81 +-2.8 18.64 +-2.7 17.49 +-2.6 16.36 +-2.5 15.25 +-2.4 14.16 +-2.3 13.09 +-2.2 12.04 +-2.1 11.01 +-2 10 +-1.9 9.01 +-1.8 8.04 +-1.7 7.09 +-1.6 6.16 +-1.5 5.25 +-1.4 4.36 +-1.3 3.49 +-1.2 2.64 +-1.1 1.81 +-1 1 +-0.9 0.21 +-0.8 -0.56 +-0.7 -1.31 +-0.6 -2.04 +-0.5 -2.75 +-0.4 -3.44 +-0.3 -4.11 +-0.2 -4.76 +-0.1 -5.39 +-1.02696E-15 -6 +0.1 -6.59 +0.2 -7.16 +0.3 -7.71 +0.4 -8.24 +0.5 -8.75 +0.6 -9.24 +0.7 -9.71 +0.8 -10.16 +0.9 -10.59 +1 -11 +1.1 -11.39 +1.2 -11.76 +1.3 -12.11 +1.4 -12.44 +1.5 -12.75 +1.6 -13.04 +1.7 -13.31 +1.8 -13.56 +1.9 -13.79 +2 -14 +2.1 -14.19 +2.2 -14.36 +2.3 -14.51 +2.4 -14.64 +2.5 -14.75 +2.6 -14.84 +2.7 -14.91 +2.8 -14.96 +2.9 -14.99 +3 -15 +3.1 -14.99 +3.2 -14.96 +3.3 -14.91 +3.4 -14.84 +3.5 -14.75 +3.6 -14.64 +3.7 -14.51 +3.8 -14.36 +3.9 -14.19 +4 -14 +4.1 -13.79 +4.2 -13.56 +4.3 -13.31 +4.4 -13.04 +4.5 -12.75 +4.6 -12.44 +4.7 -12.11 +4.8 -11.76 +4.9 -11.39 +5 -11 + +"Eta +-5 53 +-4.9 51.31 +-4.8 49.64 +-4.7 47.99 +-4.6 46.36 +-4.5 44.75 +-4.4 43.16 +-4.3 41.59 +-4.2 40.04 +-4.1 38.51 +-4 37 +-3.9 35.51 +-3.8 34.04 +-3.7 32.59 +-3.6 31.16 +-3.5 29.75 +-3.4 28.36 +-3.3 26.99 +-3.2 25.64 +-3.1 24.31 +-3 23 +-2.9 21.71 +-2.8 20.44 +-2.7 19.19 +-2.6 17.96 +-2.5 16.75 +-2.4 15.56 +-2.3 14.39 +-2.2 13.24 +-2.1 12.11 +-2 11 +-1.9 9.91 +-1.8 8.84 +-1.7 7.79 +-1.6 6.76 +-1.5 5.75 +-1.4 4.76 +-1.3 3.79 +-1.2 2.84 +-1.1 1.91 +-1 1 +-0.9 0.11 +-0.8 -0.76 +-0.7 -1.61 +-0.6 -2.44 +-0.5 -3.25 +-0.4 -4.04 +-0.3 -4.81 +-0.2 -5.56 +-0.1 -6.29 +-1.02696E-15 -7 +0.1 -7.69 +0.2 -8.36 +0.3 -9.01 +0.4 -9.64 +0.5 -10.25 +0.6 -10.84 +0.7 -11.41 +0.8 -11.96 +0.9 -12.49 +1 -13 +1.1 -13.49 +1.2 -13.96 +1.3 -14.41 +1.4 -14.84 +1.5 -15.25 +1.6 -15.64 +1.7 -16.01 +1.8 -16.36 +1.9 -16.69 +2 -17 +2.1 -17.29 +2.2 -17.56 +2.3 -17.81 +2.4 -18.04 +2.5 -18.25 +2.6 -18.44 +2.7 -18.61 +2.8 -18.76 +2.9 -18.89 +3 -19 +3.1 -19.09 +3.2 -19.16 +3.3 -19.21 +3.4 -19.24 +3.5 -19.25 +3.6 -19.24 +3.7 -19.21 +3.8 -19.16 +3.9 -19.09 +4 -19 +4.1 -18.89 +4.2 -18.76 +4.3 -18.61 +4.4 -18.44 +4.5 -18.25 +4.6 -18.04 +4.7 -17.81 +4.8 -17.56 +4.9 -17.29 +5 -17 + diff --git a/xgraph/general.h b/xgraph/general.h new file mode 100644 index 000000000..e69de29bb diff --git a/xgraph/hard_devices.c b/xgraph/hard_devices.c new file mode 100644 index 000000000..4bf54c9ad --- /dev/null +++ b/xgraph/hard_devices.c @@ -0,0 +1,97 @@ +/* $Header$ */ +/* + * Hardcopy Devices + * + * This file contains the basic output device table. The hardcopy + * dialog is automatically constructed from this table. + * + * $Log$ + * Revision 1.1 2004-01-25 09:00:49 pnenzi + * + * Added xgraph plotting program. + * + * Revision 1.1.1.1 1999/12/03 23:15:52 heideman + * xgraph-12.0 + * + */ +#ifndef lint +static char rcsid[] = "$Id$"; + +#endif + +#include +#include "copyright.h" +#include "xgout.h" +#include "hard_devices.h" +#include "params.h" + +extern int hpglInit(); +extern int psInit(); +extern int idrawInit(); +extern int tgifInit(); + +struct hard_dev hard_devices[] = +{ + {"HPGL", hpglInit, "lpr -P%s", "xgraph.hpgl", "paper", + 27.5, "1", 14.0, "1", 12.0, NONE}, + {"Postscript", psInit, "lpr -P%s", "xgraph.ps", "$PRINTER", + 19.0, "Times-Bold", 18.0, "Times-Roman", 12.0, NO}, + {"Idraw", idrawInit, + "cat > /usr/tmp/idraw.tmp.ps; %s /usr/tmp/idraw.tmp.ps&", + "~/.clipboard", "/usr/bin/X11/idraw", 19.0, "Times-Bold", 18.0, + "Times-Roman", 12.0, NONE}, + {"Tgif", tgifInit, + "cat > /usr/tmp/xgraph.obj; %s /usr/tmp/xgraph &", + "xgraph.obj", "/usr/bin/X11/tgif", 19.0, "Times-Bold", 18.0, + "Times-Roman", 12.0, NONE} +}; + +int hard_count = sizeof(hard_devices) / sizeof(struct hard_dev); + +#define CHANGE_D(name, field) \ +if (param_get(name, &val)) { \ + if (val.type == DBL) { \ + hard_devices[idx].field = val.dblv.value; \ + } \ +} + +#define CHANGE_S(name, field) \ +if (param_get(name, &val)) { \ + if (val.type == STR) { \ + (void) strcpy(hard_devices[idx].field, val.strv.value); \ + } \ +} + + +void +hard_init() +/* + * Changes values in hard_devices structures in accordance with + * parameters set using the parameters module. + */ +{ + char nn[BUFSIZ]; + int idx; + params val; + + for (idx = 0; idx < hard_count; idx++) { + (void) sprintf(nn, "%s.Dimension", hard_devices[idx].dev_name); + CHANGE_D(nn, dev_max_dim); + (void) sprintf(nn, "%s.OutputTitleFont", hard_devices[idx].dev_name); + CHANGE_S(nn, dev_title_font); + (void) sprintf(nn, "%s.OutputTitleSize", hard_devices[idx].dev_name); + CHANGE_D(nn, dev_title_size); + (void) sprintf(nn, "%s.OutputAxisFont", hard_devices[idx].dev_name); + CHANGE_S(nn, dev_axis_font); + (void) sprintf(nn, "%s.OutputAxisSize", hard_devices[idx].dev_name); + CHANGE_D(nn, dev_axis_size); + if (hard_devices[idx].dev_printer[0] == '$') { + extern char *getenv(); + char *ptr; + if ((ptr = getenv(&hard_devices[idx].dev_printer[1]))) { + (void) strncpy(hard_devices[idx].dev_printer, ptr, MFNAME - 1); + hard_devices[idx].dev_printer[MFNAME - 1] = '\0'; + } + } + } +} diff --git a/xgraph/hard_devices.h b/xgraph/hard_devices.h new file mode 100644 index 000000000..c56f755c7 --- /dev/null +++ b/xgraph/hard_devices.h @@ -0,0 +1,41 @@ +/* + * Hardcopy Device Header + * + * This file declares the types required for the hardcopy table + * found in hard_devices.c. + */ + +#ifndef _h_hard_devices +#define _h_hard_devices + +#define MFNAME 25 + +typedef enum hard_dev_docu_defn { + NONE, NO, YES +} hard_dev_docu; + +struct hard_dev { + char *dev_name; /* Device name */ + int (*dev_init) (); /* Initialization function */ + char *dev_spec; /* Default pipe program */ + char dev_file[MFNAME]; /* Default file name */ + char dev_printer[MFNAME];/* Default printer name */ + double dev_max_dim; /* Default maximum dimension (cm) */ + char dev_title_font[MFNAME]; /* Default name of title font */ + double dev_title_size; /* Default size of title font (pnts) */ + char dev_axis_font[MFNAME]; /* Default name of axis font */ + double dev_axis_size; /* Default size of axis font (pnts) */ + hard_dev_docu dev_docu; /* Document predicate */ +}; + +extern int hard_count; +extern struct hard_dev hard_devices[]; + +#define D_HPGL 0 +#define D_POSTSCRIPT 1 +#define D_IDRAW 2 +#define D_TGIF 3 +#define D_XWINDOWS 4 + +extern void hard_init(); +#endif /* _h_hard_devices */ diff --git a/xgraph/hpgl.c b/xgraph/hpgl.c new file mode 100644 index 000000000..bab16ccc6 --- /dev/null +++ b/xgraph/hpgl.c @@ -0,0 +1,337 @@ +/* + * HPGL Output + * + * Tom Quarles + */ + +#define MAPX(state,x) ( (x) + P1X + state->clipminX ) +#define MAPY(state,y) ( MAXY - (y) + P1Y - state->clipminY) + +#include "copyright.h" +#include "xgraph.h" +#include "plotter.h" +#include +#include + +static void hpglText(); +static void hpglSeg(); +static void hpglDot(); +static void hpglEnd(); + +static xgOut hpglInfo = +{ + D_COLOR, /* device characteristics */ + MAXX, /* width */ + MAXY, /* height */ + 200, /* border padding */ + 0, /* extra space around axis labels */ + 250, /* tick length - approx 1/4 inch */ + 50, /* spacing above legend lables */ + 0, /* axis font width */ + 0, /* axis font height */ + 0, /* title font width */ + 0, /* title font height */ + 1000000, /* maximum number of segments */ + + hpglText, /* text output function */ + hpglSeg, /* segment drawing function */ + hpglDot, /* dot/marker drawing function */ + hpglEnd, /* end of plot function */ + + NULL, /* userInfo */ +}; + +typedef struct { + double axis_w; + double axis_h; + double title_w; + double title_h; + FILE *plotterFile; + int clipminX; + int clipminY; + int clipmaxX; + int clipmaxY; +} mydata; + +/*ARGSUSED*/ +int +hpglInit(stream, width, height, title_family, title_size, + axis_family, axis_size, flags, outInfo, errmsg) +FILE *stream; /* output stream */ +int width; /* desired width of space in microns */ +int height; /* desired height in microns */ +char *title_family; /* name of font for titles */ +double title_size; /* size of font for titles */ +char *axis_family; /* name of font for axes */ +double axis_size; /* size of font for axes */ +int flags; /* predicate values (ignored) */ +xgOut *outInfo; /* my structure */ +char errmsg[ERRBUFSIZE]; /* a place to complain to */ +{ + mydata *myInfo; + + myInfo = (mydata *) Malloc(sizeof(mydata)); + if (myInfo == NULL) + return 0; + *outInfo = hpglInfo; + outInfo->area_w = MIN(MAXX, width / 25); + outInfo->area_h = MIN(MAXY, height / 25); + /* magic formulas: input sizes are in points = 1/72 inch */ + /* my sizes are in cm */ + /* plotter units are in units of .025mm ~= 1/1016 inch */ + /* + * have to warn of height 1.5 times larger or get bitten by plotter's + * internal padding + */ + /* widths are (arbitrarily) selected to be 2/3 of the height */ + /* (cancels with width factor) */ + myInfo->axis_w = axis_size * .666 * 2.54 / 72.; + myInfo->axis_h = axis_size * 2.54 / 72.; + myInfo->title_w = title_size * .666 * 2.54 / 72.; + myInfo->title_h = title_size * 2.54 / 72.; + + outInfo->axis_pad = axis_size * 1016. * 1.5 / 72.; + outInfo->axis_width = axis_size * 1016. * 1.5 / 72.; + outInfo->axis_height = axis_size * 1016. * .666 / 72.; + outInfo->title_width = title_size * 1016. * 1.5 / 72.; + outInfo->title_height = title_size * 1016. * .666 / 72.; + outInfo->user_state = (char *) myInfo; + myInfo->plotterFile = stream; + myInfo->clipminX = 0; + myInfo->clipminY = 0; + myInfo->clipmaxX = MAXX; + myInfo->clipmaxY = MAXY; + fprintf(myInfo->plotterFile, "PG;IN;\n"); + fprintf(myInfo->plotterFile, "DI1,0;\n"); + fprintf(myInfo->plotterFile, "IW%d,%d,%d,%d;\n", MAPX(myInfo, 0), + MAPY(myInfo, myInfo->clipmaxY - myInfo->clipminY), + MAPX(myInfo, myInfo->clipmaxX - myInfo->clipminX), + MAPY(myInfo, 0)); + return (1); +} + +static void +hpglText(userState, x, y, text, just, style) +mydata *userState; /* my state information */ +int x, + y; /* coords of text origin */ +char *text; /* what to put there */ +int just; /* how to justify */ + + /* + * where the origin is relative to where the text should go as a function of + * the various values of just + * + * T_UPPERLEFT T_TOP T_UPPERRIGHT T_LEFT T_CENTER T_RIGHT + * T_LOWERLEFT T_BOTTOM T_LOWERRIGHT + * + */ +int style; /* T_AXIS = axis font, T_TITLE = title font */ + +{ + fprintf(userState->plotterFile, "PU;SP%d;", TEXTCOLOR); + fprintf(userState->plotterFile, "PA%d,%d;", MAPX(userState, x), MAPY(userState, y)); + switch (style) { + case T_AXIS: + fprintf(userState->plotterFile, "SI%f,%f;", userState->axis_w, userState->axis_h); + break; + case T_TITLE: + fprintf(userState->plotterFile, "SI%f,%f;", userState->title_w, userState->title_h); + break; + default: + printf("bad text style %d in hpglText\n", style); + exit(1); + break; + } + switch (just) { + case T_UPPERLEFT: + fprintf(userState->plotterFile, "LO3;\n"); + break; + case T_TOP: + fprintf(userState->plotterFile, "LO6;\n"); + break; + case T_UPPERRIGHT: + fprintf(userState->plotterFile, "LO9;\n"); + break; + case T_LEFT: + fprintf(userState->plotterFile, "LO2;\n"); + break; + case T_CENTER: + fprintf(userState->plotterFile, "LO5;\n"); + break; + case T_RIGHT: + fprintf(userState->plotterFile, "LO8;\n"); + break; + case T_LOWERLEFT: + fprintf(userState->plotterFile, "LO1;\n"); + break; + case T_BOTTOM: + fprintf(userState->plotterFile, "LO4;\n"); + break; + case T_LOWERRIGHT: + fprintf(userState->plotterFile, "LO7;\n"); + break; + default: + printf("bad justification type %d in hpglText\n", just); + exit(1); + break; + } + fprintf(userState->plotterFile, "LB%s\03;", text); +} + + + +static int penselect[8] = +{PEN1, PEN2, PEN3, PEN4, PEN5, PEN6, PEN7, PEN8}; +static int lineselect[8] = +{LINE1, LINE2, LINE3, LINE4, LINE5, LINE6, + LINE7, LINE8}; + + + +static void +hpglSeg(userState, ns, segs, width, style, lappr, color) +mydata *userState; /* my state information (not used) */ +int ns; /* number of segments */ +XSegment *segs; /* X array of segments */ +int width; /* width of lines in pixels */ +int style; /* L_VAR = dotted, L_AXIS = grid, L_ZERO = axis */ +int lappr; /* line style */ +int color; /* line color */ +{ + int i; + + if (style == L_ZERO) { + fprintf(userState->plotterFile, "SP%d;", PENAXIS); /* select correct pen */ + fprintf(userState->plotterFile, "LT;"); /* solid line style */ + } + else if (style == L_AXIS) { + fprintf(userState->plotterFile, "SP%d;", PENGRID); /* select correct pen */ + fprintf(userState->plotterFile, "LT;"); /* solid line style */ + } + else if (style == L_VAR) { + if ((color < 0) || (color > 7)) { + printf("out of range line color %d in hpglLine\n", color); + exit(1); + } + fprintf(userState->plotterFile, "SP%d;", penselect[color]); /* select correct pen */ + if ((lappr < 0) || (lappr > 7)) { + printf("out of range line style %d in hpglLine\n", lappr); + exit(1); + } + if (lappr == 0) { + fprintf(userState->plotterFile, "LT;"); /* select solid line + * type */ + } + else { + fprintf(userState->plotterFile, "LT%d;", lineselect[lappr]); /* select line type */ + } + } + else { + printf("unknown style %d in hpglLine\n", style); + exit(1); + } + for (i = 0; i < ns; i++) { + if (!i || ((segs[i].x1 != segs[i - 1].x2) || (segs[i].y1 != segs[i - 1].y2))) { + /* MOVE */ + fprintf(userState->plotterFile, "PU;PA%d,%d;\n", MAPX(userState, segs[i].x1), + MAPY(userState, segs[i].y1)); + } + /* DRAW */ + if (width <= 1) { + fprintf(userState->plotterFile, "PD;PA%d,%d;\n", MAPX(userState, segs[i].x2), + MAPY(userState, segs[i].y2)); + } + else { /* ugly - wide lines -> rectangles */ + double frac; + int lx, + ly; + int urx, + ury, + ulx, + uly, + llx, + lly, + lrx, + lry; + + frac = (width / 2) / sqrt((double) + ((segs[i].x1 - segs[i].x2) * + (segs[i].x1 - segs[i].x2)) + + ((segs[i].y1 - segs[i].y2) * + (segs[i].y1 - segs[i].y2))); + lx = frac * (segs[i].y2 - segs[i].y1); + ly = -frac * (segs[i].x2 - segs[i].x1); + urx = segs[i].x2 + lx; + ury = segs[i].y2 + ly; + ulx = segs[i].x2 - lx; + uly = segs[i].y2 - ly; + llx = segs[i].x1 - lx; + lly = segs[i].y1 - ly; + lrx = segs[i].x1 + lx; + lry = segs[i].y1 + ly; + fprintf(userState->plotterFile, "PU;PA%d,%d;", MAPX(userState, llx), + MAPY(userState, lly)); + fprintf(userState->plotterFile, "PM0;"); + fprintf(userState->plotterFile, "PD,PA%d,%D;PA%d,%D;PA%d,%d;\n", + MAPX(userState, lrx), MAPY(userState, lry), + MAPX(userState, urx), MAPY(userState, ury), + MAPX(userState, ulx), MAPY(userState, uly)); + fprintf(userState->plotterFile, "PM2;FP;EP;"); + } + } + fprintf(userState->plotterFile, "PU;"); +} + +static char *markselect[8] = +{MARK1, MARK2, MARK3, MARK4, MARK5, MARK6, + MARK7, MARK8}; + +static void +hpglDot(userState, x, y, style, type, color) +mydata *userState; /* my state information (not used) */ +int x, + y; /* coord of dot */ +int style; /* type of dot */ +int type; /* dot style variation */ +int color; /* color of dot */ +{ + /* move to given coord */ + fprintf(userState->plotterFile, "PU;PA%d,%d;\n", MAPX(userState, x), MAPY(userState, y)); + if ((color < 0) || (color > 7)) { + printf("unknown color %d in hpglDot\n", color); + exit(1); + } + fprintf(userState->plotterFile, "SP%d;", penselect[color]); + if (style == P_PIXEL) { + fprintf(userState->plotterFile, "PD;PU;\n"); + } + else if (style == P_DOT) { + fprintf(userState->plotterFile, "LT;PM0;CI40;PM2;FT;EP;\n"); + } + else if (style == P_MARK) { + if ((type < 0) || (type > 7)) { + printf("unknown marker type %d in hpglDot\n", type); + exit(1); + } + /* + * fprintf(userState->plotterFile,"LT;CA5;LO4;SI0.1;LB%s\03;\n",marksele + * ct[type]); + */ + fprintf(userState->plotterFile, "LT;CS5;LO4;SI0.15;SM%s;PR0,0;SM;CS;\n", markselect[type]); + } + else { + printf("unknown marker style %d in hpglDot\n", style); + exit(1); + } +} + +static void +hpglEnd(userState) +mydata *userState; /* my state information (not used) */ + +{ + fprintf(userState->plotterFile, "SP;PG;IN;\n"); + fflush(userState->plotterFile); + return; +} diff --git a/xgraph/idraw.c b/xgraph/idraw.c new file mode 100644 index 000000000..c411c58c1 --- /dev/null +++ b/xgraph/idraw.c @@ -0,0 +1,498 @@ +/* + * Idraw Output + * + * Beorn Johnson + * Alan Kramer + * David Harrison + */ + +#include +#include +#include "hard_devices.h" +#include "xgout.h" + +#define HEIGHT 792 +#define FIX(X) X = HEIGHT - X; + +typedef struct { + char *title_font; + char *axis_font; + int title_size; + int axis_size; + FILE *strm; +} Info; + +char *idraw_prologue[] = +{ + "%I Idraw 4", + "Begin", + "%I b u", + "%I cfg u", + "%I cbg u", + "%I f u", + "%I p u", + "%I t", + "[ 1 0 0 1 0 0 ] concat", + "/originalCTM matrix currentmatrix def", + 0 +}; + +/* + * Hardcopy Interface for Xgraph + * + * Major differences from first version: + * Four new parameters are passed to the device initialization routine: + * title_family, title_size, axis_family, and axis_size. See the + * description of xg_init() for details. + * + * Clipping is done automatically by xgraph. The xg_clip() routine + * is obsolete. + * + * The xg_line() routine has become the xg_seg() routine. It now + * draws segments rather than a series of lines. + * + * A new field (max_segs) in the device structure now specifies + * the maximum number of segments the device can handle in a group. + */ + + +/* + * Adding an output device to xgraph + * + * Step 1 + * Write versions of the following routines for your device: + * xg_init(), xg_text(), xg_seg(), xg_dot(), and xg_end(). + * The interface and function of these routines are described + * in detail below. These routines should be named according + * to your device. For example, the initialization routine + * for the Postscript output device is psInit(). Also, name + * your source file after your device (e.g. the postscript + * routines are in the file ps.c). Instructions continue + * after the description of the interface routines. + */ + + +void idrawText(); +void idrawDot(); +void idrawSeg(); +void idrawEnd(); + +int +idrawInit(strm, width, height, title_family, title_size, + axis_family, axis_size, flags, out_info, errmsg) +FILE *strm; /* Output stream */ +int width, + height; /* Size of space (microns) */ +char *title_family; /* Name of title font family */ +double title_size; /* Title font height (points) */ +char *axis_family; /* Name of axis font family */ +double axis_size; /* Axis font height (points) */ +int flags; /* Flags */ +xgOut *out_info; /* Device info (RETURN) */ +char errmsg[ERRBUFSIZE]; /* Error message area */ + +/* + * This routine is called by xgraph just before drawing is to + * begin. The desired size of the plot is given by `width' + * and `height'. The parameters `title_family', `title_size', + * `axis_family', and `axis_size' specify the names of the + * title and axis fonts and their vertical sizes (in points). + * These parameters can be ignored if your device does not + * support multiple fonts. Binary flags are specified in + * the `flags' field. These include: + * D_DOCU: + * If this flag is set, it indicates the user has specified that + * the output will be included in some larger document. Devices + * may choose to use this information to produce output that + * can be integrated into documents with less effort. For example, + * the Postscript output routines produce bounding box information + * when this flag is set. + * The routine should fill in all of the fields of `out_info' with + * appropriate values. The values are described below: + * area_w, area_h: + * Size of the drawing space in device coordinates. + * This should take in account the requested area + * given by `width', and `height'. + * bdr_pad: + * Xgraph will leave this number of device coordinates around + * all of the outer edges of the graph. + * axis_pad: + * Additional space around axis labels (in devcoords) + * so that the labels do not appear crowded. + * legend_pad: + * Space (in devcoords) from the top of legend text to + * the representative line drawn above the legend text. + * tick_len: + * Size of a tick mark placed on axis (in devcoords) + * axis_width: + * An estimate of the width of a large character in + * the axis font (in devcoords). This can be an overestimate. An + * underestimate may produce bad results. + * axis_height: + * An estimate of the height of a large character in + * the axis labeling font (in devcoords). + * title_width, title_height: + * Same as above except for the title font. + * max_segs: + * Due to buffering constraints, some devices may not be able to + * handle massive segment lists. This parameter tells xgraph not + * to send more than `max_segs' segments in one request. + * Output to the device should be written to the stream `strm'. + * The functions are described individually below. After filling + * in the parameters and setting the function pointers, the routine + * should initialize its drawing state and store any extra needed + * information in `user_state'. This value will be passed to all + * other routines during the drawing sequence. If the device + * cannot initialize, it should return a zero status and fill + * `errmsg' with an informative error message. + */ +{ + Info *idraw_info; + char **l; + double scx, + scy; + + idraw_info = (Info *) Malloc(sizeof(*idraw_info)); + + for (l = idraw_prologue; *l; l++) + fprintf(strm, "%s\n", *l); + + out_info->dev_flags = 0; + scx = width / 612; + scy = height / 792.0; + if (scx > scy) { + scy /= scx; + scx = 1; + } + else { + scx /= scy; + scy = 1; + } + out_info->bdr_pad = title_size / 4; + out_info->axis_pad = 2.0 * axis_size; + out_info->legend_pad = 0; + + out_info->area_w = width * 0.00283; /* pts per micron */ + out_info->area_h = height * 0.00283; + + out_info->tick_len = axis_size; + out_info->axis_height = axis_size; + out_info->title_height = title_size; + out_info->axis_width = (axis_size * 5.0) / 12.0; + out_info->title_width = (title_size * 5.0) / 12.0; + out_info->max_segs = 100; + out_info->xg_text = idrawText; + out_info->xg_seg = idrawSeg; + out_info->xg_dot = idrawDot; + out_info->xg_end = idrawEnd; + out_info->user_state = (char *) idraw_info; + + idraw_info->title_font = title_family; + idraw_info->axis_font = axis_family; + idraw_info->title_size = title_size; + idraw_info->axis_size = axis_size; + idraw_info->strm = strm; + return 1; +} + +/* Text justifications */ +#define T_CENTER 0 +#define T_LEFT 1 +#define T_UPPERLEFT 2 +#define T_TOP 3 +#define T_UPPERRIGHT 4 +#define T_RIGHT 5 +#define T_LOWERRIGHT 6 +#define T_BOTTOM 7 +#define T_LOWERLEFT 8 + +/* Text styles */ +#define T_AXIS 0 +#define T_TITLE 1 + +static void +idraw_just(x, y, just, size, len) +int *x, + *y; /* Given location (lower left) */ +int just; /* Justification */ +int size; /* Size in points */ +int len; /* Number of chars */ + +/* + * Unfortunately, idraw really can't display text with a justification. + * This is a horrible hack to try to get around the problem. It tries + * to compute a rough bounding box for the text based on the text height + * and the string length and offset `x,y' appropriately for the justification. + * This is only a hack... + */ +{ + int t_width, + t_height; + + t_height = size; + t_width = (size * len * 5) / 12; /* Horrible estimate */ + + switch (just) { + case T_CENTER: + *x -= t_width / 2; + *y += t_height / 2; + break; + case T_LEFT: + *y += t_height / 2; + break; + case T_UPPERLEFT: + /* nothing */ + break; + case T_TOP: + *x -= t_width / 2; + break; + case T_UPPERRIGHT: + *x -= t_width; + break; + case T_RIGHT: + *x -= t_width; + *y += t_height / 2; + break; + case T_LOWERRIGHT: + *x -= t_width; + *y += t_height; + break; + case T_BOTTOM: + *x -= t_width / 2; + *y += t_height; + break; + case T_LOWERLEFT: + *y += t_height; + break; + } + + /* + * Also, idraw seems to put a space above all text it draws. The + * computation below compensates for this. + */ + *y += (size / 3); +} + +void +idrawText(user_state, x, y, text, just, style) +char *user_state; /* Value set in xg_init */ +int x, + y; /* Text position (pixels) */ +char *text; /* Null terminated text */ +int just; /* Justification (above) */ +int style; /* Text style (above) */ + +/* + * This routine should draw text at the indicated position using + * the indicated justification and style. The justification refers + * to the location of the point in reference to the text. For example, + * if just is T_LOWERLEFT, (x,y) should be located at the lower left + * edge of the text string. + */ +{ + char *font; + int size; + Info *idraw = (Info *) user_state; + + FIX(y); + font = style == T_AXIS ? idraw->axis_font : + idraw->title_font; + size = style == T_AXIS ? idraw->axis_size : + idraw->title_size; + + idraw_just(&x, &y, just, size, strlen(text)); + + fprintf(idraw->strm, "Begin %%I Text\n"); + fprintf(idraw->strm, "%%I cfg Black\n"); + fprintf(idraw->strm, "0 0 0 SetCFg\n"); + fprintf(idraw->strm, "%%I f *%s*-%d-*\n", font, size); + fprintf(idraw->strm, "/%s %d SetF\n", font, size); + fprintf(idraw->strm, "%%I t\n"); + fprintf(idraw->strm, "[ 1 0 0 1 %d %d ] concat\n", x, y); + fprintf(idraw->strm, "%%I\n"); + fprintf(idraw->strm, "[\n"); + fprintf(idraw->strm, "(%s)\n", text); + fprintf(idraw->strm, "] Text\n"); + fprintf(idraw->strm, "End\n"); + +} + +/* Line Styles */ +#define L_AXIS 0 +#define L_ZERO 1 +#define L_VAR 2 + +void +idrawSeg(user_state, ns, seglist, width, style, lappr, color) +char *user_state; /* Value set in xg_init */ +int ns; /* Number of segments */ +XSegment *seglist; /* X array of segments */ +int width; /* Width of lines */ +int style; /* See above */ +int lappr; /* Line appearence */ +int color; /* Line color (if any) */ + +/* + * This routine draws a number of line segments at the points + * given in `seglist'. Note that contiguous segments need not share + * endpoints but often do. All segments should be `width' devcoords wide + * and drawn in style `style'. If `style' is L_VAR, the parameters + * `color' and `lappr' should be used to draw the line. Both + * parameters vary from 0 to 7. If the device is capable of + * color, `color' varies faster than `style'. If the device + * has no color, `style' will vary faster than `color' and + * `color' can be safely ignored. However, if the + * the device has more than 8 line appearences, the two can + * be combined to specify 64 line style variations. + * Xgraph promises not to send more than the `max_segs' in the + * xgOut structure passed back from xg_init(). + */ +{ + Info *idraw = (Info *) user_state; + short to_style; + int i, + j, + k; + + static unsigned short style_list[] = + { + 0xffff, 0xf0f0, 0xcccc, 0xaaaa, + 0xf060, 0xf198, 0x7f55, 0x0000, + }; + + to_style = style == L_AXIS ? 65535 + : style == L_ZERO ? 65535 + : style_list[lappr]; + + for (i = 0; i < ns; i++) { + FIX(seglist[i].y1); + FIX(seglist[i].y2); + } + + for (i = 0; i < ns; i = j) { + + for (j = i + 1; j < ns + && seglist[j - 1].x2 == seglist[j].x1 + && seglist[j - 1].y2 == seglist[j].y1; + j++); + + fprintf(idraw->strm, "Begin %%I MLine\n"); + fprintf(idraw->strm, "%%I b %d\n", to_style); + fprintf(idraw->strm, "%d 0 0 [", width); + /* fprintf(idraw -> strm, "%d"); */ + fprintf(idraw->strm, "] 0 SetB\n"); + fprintf(idraw->strm, "%%I cfg Black\n"); + fprintf(idraw->strm, "0 0 0 SetCFg\n"); + fprintf(idraw->strm, "%%I cbg White\n"); + fprintf(idraw->strm, "1 1 1 SetCBg\n"); + fprintf(idraw->strm, "none SetP %%I p n\n"); + fprintf(idraw->strm, "%%I t u\n"); + + fprintf(idraw->strm, "%%I %d\n", j - i + 1); + + for (k = i; k < j; k++) + fprintf(idraw->strm, "%d %d\n", + seglist[k].x1, seglist[k].y1); + + fprintf(idraw->strm, "%d %d\n", + seglist[k - 1].x2, seglist[k - 1].y2); + + fprintf(idraw->strm, "%d MLine\n", j - i + 1); + fprintf(idraw->strm, "End\n"); + } + + +} + +/* Marker styles */ +#define P_PIXEL 0 +#define P_DOT 1 +#define P_MARK 2 + +void +idrawDot(user_state, x, y, style, type, color) +char *user_state; /* Value set in xg_init */ +int x, + y; /* Location in pixel units */ +int style; /* Dot style */ +int type; /* Type of marker */ +int color; /* Marker color (if any) */ + +/* + * This routine should draw a marker at location `x,y'. If the + * style is P_PIXEL, the dot should be a single pixel. If + * the style is P_DOT, the dot should be a reasonably large + * dot. If the style is P_MARK, it should be a distinguished + * mark which is specified by `type' (0-7). If the output + * device is capable of color, the marker should be drawn in + * `color' (0-7) which corresponds with the color for xg_line. + */ +{ +} + +void +idrawEnd(user_state) +char *user_state; + +/* + * This routine is called after a drawing sequence is complete. + * It can be used to clean up the user state and set the device + * state appropriately. This routine is optional in the structure. + */ +{ + Info *idraw = (Info *) user_state; + + fprintf(idraw->strm, "End %%I eop\n"); + fclose(idraw->strm); +} + +/* + * Adding an output device to xgraph + * + * Step 2 + * Edit the file hard_devices.c. Declare your initialization + * function and add your device to the list of devices, + * hard_devices[]. The structure hard_dev is described below: + */ + +#ifdef notdef +extern int idrawInit(); + +struct hard_dev idraw = +{ + "idraw format", idrawInit, + 0, ".clipboard", 0, + 25, "Times-Bold", 18, "Times", 12 +}; + +#endif + +/* + * dev_spec: + * The dev_spec field should be a command that directly outputs to + * your device. The command should contain one %s directive that + * will be filled in with the name of the device from the hardcopy + * dialog. + * dev_file: + * The default file to write output to if the user selects `To File'. + * dev_printer: + * The default printer to write output to if the user selects + * `To Device'. + * dev_max_dim: + * The default maximum dimension for the device in centimeters. + * dev_title_font, dev_title_size: + * The default title font and size. Sizes are specified in + * points (1/72 inch). + * dev_axis_font, dev_axis_size: + * The default axis font and size. + */ + +/* + * Adding an output device to xgraph + * + * Step 3 + * Edit the file Makefile. Add your source file to the SRC variable + * and the corresponding object file to the OBJ variable. Finally, + * remake xgraph. Your device should now be available in the + * hardcopy dialog. + */ diff --git a/xgraph/init.c b/xgraph/init.c new file mode 100644 index 000000000..bd38273c4 --- /dev/null +++ b/xgraph/init.c @@ -0,0 +1,622 @@ +/* $Header$ */ +/* + * init.c: xgraph initialization code + * + * Routines: + * InitSets(); + * ParseArgs(); + * ReadDefaults(); + * + * $Log$ + * Revision 1.1 2004-01-25 09:00:49 pnenzi + * + * Added xgraph plotting program. + * + * Revision 1.2 1999/12/19 00:52:06 heideman + * warning suppresion, slightly different flot ahndling + * + * Revision 1.1.1.1 1999/12/03 23:15:53 heideman + * xgraph-12.0 + * + */ +#ifndef lint +static char rcsid[] = "$Id$"; +#endif + +#include "copyright.h" +#include +#include +#include +#include +#include "xgraph.h" +#include "xtb.h" +#include "hard_devices.h" +#include "params.h" + +/* + * Default settings for xgraph parameters + */ + +/* PW */ +#define DEF_ANIMATE "off" +#define DEF_DELAY_VALUE "2" +#define DEF_BORDER_WIDTH "2" +#define DEF_BORDER_COLOR "Black" +#define DEF_TITLE_TEXT "X Graph" +#define DEF_XUNIT_TEXT "X" +#define DEF_YUNIT_TEXT "Y" +#define DEF_TICK_FLAG "off" +#define DEF_TICKAXIS_FLAG "off" +#define DEF_MARK_FLAG "off" +#define DEF_PIXMARK_FLAG "off" +#define DEF_LARGEPIX_FLAG "off" +#define DEF_DIFFMARK_FLAG "off" +#define DEF_BB_FLAG "off" +#define DEF_NOLINE_FLAG "off" +#define DEF_NOLEGEND_FLAG "off" +#define DEF_NOBUTTON_FLAG "off" +#define DEF_LOGX_FLAG "off" +#define DEF_LOGY_FLAG "off" +#define DEF_BAR_FLAG "off" +#define DEF_STK_FLAG "off" +#define DEF_FITX_FLAG "off" +#define DEF_FITY_FLAG "off" +#define DEF_BAR_BASE "0.0" +#define DEF_BAR_OFFS "0.0" +#define DEF_BAR_WIDTH "-1.0" +#define DEF_LINE_WIDTH "0" +#define DEF_GRID_SIZE "0" +#define DEF_GRID_STYLE "10" +#define DEF_LABEL_FONT "helvetica-10" +#define DEF_TITLE_FONT "helvetica-18" +#define DEF_GEOMETRY "" +#define DEF_REVERSE "off" +/* PW Changes these to please JM */ +#define DEF_FMT_X "%.4f" +#define DEF_FMT_Y "%.4f" +#define DEF_DEVICE "" +#define DEF_OUTPUT_DEVICE D_XWINDOWS +#define DEF_DISPOSITION "To Device" +#define DEF_FILEORDEV "" +#define DEF_DOCUMENT "off" +#define DEF_SCALE "1.0" + +#define DEF_MARKER_FLAG "off" +#define DEF_DIFFMARK_FLAG "off" +#define DEF_PIXMARK_FLAG "off" +#define DEF_LARGEPIX_FLAG "off" + +/* Low > High means set it based on the data */ +#define DEF_LOW_LIMIT "1.0" +#define DEF_HIGH_LIMIT "0.0" + +/* Black and white defaults */ +#define DEF_BW_BACKGROUND "white" +#define DEF_BW_BORDER "black" +#define DEF_BW_ZEROCOLOR "black" +#define DEF_BW_ZEROWIDTH "3" +#define DEF_BW_ZEROSTYLE "1" +#define DEF_BW_FOREGROUND "black" + +/* Color defaults */ +#define DEF_COL_BACKGROUND "#ccc" +#define DEF_COL_BORDER "black" +#define DEF_COL_ZEROCOLOR "white" +#define DEF_COL_ZEROWIDTH "0" +#define DEF_COL_ZEROSTYLE "1" +#define DEF_COL_FOREGROUND "black" +#define DEF_COL_FIRSTSTYLE "1" + +/* Default line styles */ +static char *defStyle[MAXATTR] = +{ + "1", "10", "11110000", "010111", "1110", + "1111111100000000", "11001111", "0011000111" +}; + +/* Default color names */ +/*static char *defColors[MAXATTR] = +{ + "red", "SpringGreen", "blue", "yellow", + "cyan", "sienna", "orange", "coral" +};*/ +static char *defColors[MAXATTR] = +{ + "red", "SpringGreen", "blue", "yellow", + "purple", "orange", "hotpink", "cyan" +}; + +void +InitSets(o) +int o; + +/* + * Initializes the data sets with default information. Sets up + * original values for parameters in parameters package. + */ +{ + int idx; + char buf[1024]; + + if (o == D_XWINDOWS) { + /* + * Used to do all kinds of searching through visuals, etc. Got + * complaints -- so back to the simple version. + */ + vis = DefaultVisual(disp, DefaultScreen(disp)); + cmap = DefaultColormap(disp, DefaultScreen(disp)); + screen = DefaultScreen(disp); + depth = DefaultDepth(disp, DefaultScreen(disp)); + param_init(disp, cmap); + } + else + param_init(NULL, 0); + + + param_set("Debug", BOOL, "false"); + param_set("Geometry", STR, DEF_GEOMETRY); + param_set("ReverseVideo", BOOL, DEF_REVERSE); + + param_set("BorderSize", INT, DEF_BORDER_WIDTH); + param_set("TitleText", STR, DEF_TITLE_TEXT); + param_set("XUnitText", STR, DEF_XUNIT_TEXT); + param_set("YUnitText", STR, DEF_YUNIT_TEXT); /* YUnits */ + param_set("Ticks", BOOL, DEF_TICK_FLAG); + param_set("TickAxis", BOOL, DEF_TICKAXIS_FLAG); + + param_set("Markers", BOOL, DEF_MARKER_FLAG); /* markFlag (-m) */ + param_set("StyleMarkers", BOOL, DEF_DIFFMARK_FLAG); /* colorMark (-M) */ + param_set("PixelMarkers", BOOL, DEF_PIXMARK_FLAG); /* pixelMarks (-p) */ + param_set("LargePixels", BOOL, DEF_LARGEPIX_FLAG); /* bigPixel (-P) */ + + param_set("BoundBox", BOOL, DEF_BB_FLAG); + param_set("NoLines", BOOL, DEF_NOLINE_FLAG); + param_set("NoLegend", BOOL, DEF_NOLEGEND_FLAG); + param_set("NoButton", BOOL, DEF_NOBUTTON_FLAG); + param_set("LogX", BOOL, DEF_LOGX_FLAG); + param_set("LogY", BOOL, DEF_LOGY_FLAG); /* logYFlag */ + param_set("BarGraph", BOOL, DEF_BAR_FLAG); + param_set("StackGraph", BOOL, DEF_STK_FLAG); + param_set("FitX", BOOL, DEF_FITX_FLAG); + param_set("FitY", BOOL, DEF_FITY_FLAG); + param_set("BarBase", DBL, DEF_BAR_BASE); + param_set("BarWidth", DBL, DEF_BAR_WIDTH); + param_set("BarOffset", DBL, DEF_BAR_OFFS); + param_set("LineWidth", INT, DEF_LINE_WIDTH); + param_set("GridSize", INT, DEF_GRID_SIZE); + param_set("GridStyle", STYLE, DEF_GRID_STYLE); + param_set("Format X", STR, DEF_FMT_X); + param_set("Format Y", STR, DEF_FMT_Y); + + param_set("Device", STR, DEF_DEVICE); + param_set("Disposition", STR, DEF_DISPOSITION); + param_set("FileOrDev", STR, DEF_FILEORDEV); + sprintf(buf, "%d", o); + param_set("Output Device", INT, buf); + param_set("Document", BOOL, DEF_DOCUMENT); + param_set("Scale", DBL, DEF_SCALE); + + /* Set the user bounding box */ + param_set("XLowLimit", DBL, DEF_LOW_LIMIT); + param_set("YLowLimit", DBL, DEF_LOW_LIMIT); + param_set("XHighLimit", DBL, DEF_HIGH_LIMIT); + param_set("YHighLimit", DBL, DEF_HIGH_LIMIT); + + /* Depends critically on whether the display has color */ + if (depth < 4) { + /* Its black and white */ + param_set("Background", PIXEL, DEF_BW_BACKGROUND); + param_set("Border", PIXEL, DEF_BW_BORDER); + param_set("ZeroColor", PIXEL, DEF_BW_ZEROCOLOR); + param_set("ZeroWidth", INT, DEF_BW_ZEROWIDTH); + param_set("ZeroStyle", STYLE, DEF_BW_ZEROSTYLE); + param_set("Foreground", PIXEL, DEF_BW_FOREGROUND); + /* Initialize set defaults */ + for (idx = 0; idx < MAXATTR; idx++) { + (void) sprintf(buf, "%d.Style", idx); + param_set(buf, STYLE, defStyle[idx]); + (void) sprintf(buf, "%d.Color", idx); + param_set(buf, PIXEL, DEF_BW_FOREGROUND); + } + } + else { + /* Its color */ + param_set("Background", PIXEL, DEF_COL_BACKGROUND); + param_set("Border", PIXEL, DEF_COL_BORDER); + param_set("ZeroColor", PIXEL, DEF_COL_ZEROCOLOR); + param_set("ZeroWidth", INT, DEF_COL_ZEROWIDTH); + param_set("ZeroStyle", STYLE, DEF_COL_ZEROSTYLE); + param_set("Foreground", PIXEL, DEF_COL_FOREGROUND); + /* Initalize attribute colors defaults */ + for (idx = 0; idx < MAXATTR; idx++) { + (void) sprintf(buf, "%d.Style", idx); + param_set(buf, STYLE, defStyle[idx]); + (void) sprintf(buf, "%d.Color", idx); + param_set(buf, PIXEL, defColors[idx]); + } + } + + param_set("LabelFont", FONT, DEF_LABEL_FONT); + param_set("TitleFont", FONT, DEF_TITLE_FONT); + /* PW */ + param_set("Animate", BOOL, DEF_ANIMATE); + param_set("DelayValue", INT, DEF_DELAY_VALUE); + + /* Initialize the data sets */ + for (idx = 0; idx < MAXSETS; idx++) { + (void) sprintf(buf, "Set %d", idx); + PlotData[idx].setName = STRDUP(buf); + PlotData[idx].list = (PointList *) 0; + } +} + + + +static char *def_str; + +#define DEF(name, type) \ +if (def_str = XGetDefault(disp, Prog_Name, name)) { \ + param_set(name, type, def_str); \ +} + +void +ReadDefaults() +/* + * Reads X default values which override the hard-coded defaults + * set up by InitSets. + */ +{ + char newname[100]; + int idx; + + DEF("Debug", BOOL); + DEF("Geometry", STR); + DEF("Background", PIXEL); + DEF("BorderSize", INT); + DEF("Border", PIXEL); + DEF("GridSize", INT); + DEF("GridStyle", STYLE); + DEF("Foreground", PIXEL); + DEF("ZeroColor", PIXEL); + DEF("ZeroStyle", STYLE); + DEF("ZeroWidth", INT); + DEF("LabelFont", FONT); + DEF("TitleFont", FONT); + DEF("Ticks", BOOL); + DEF("TickAxis", BOOL); + DEF("Device", STR); + DEF("Disposition", STR); + DEF("FileOrDev", STR); + DEF("PixelMarkers", BOOL); + DEF("LargePixels", BOOL); + DEF("Markers", BOOL); + DEF("StyleMarkers", BOOL); + DEF("BoundBox", BOOL); + DEF("NoLines", BOOL); + DEF("LineWidth", INT); + /* PW */ + DEF("Animate",BOOL); + DEF("DelayValue",INT); + /* End PW */ + + /* Read device specific parameters */ + for (idx = 0; idx < hard_count; idx++) { + sprintf(newname, "%s.Dimension", hard_devices[idx].dev_name); + DEF(newname, DBL); /* hard_devices[idx].dev_max_dim */ + sprintf(newname, "%s.OutputTitleFont", hard_devices[idx].dev_name); + DEF(newname, STR); /* hard_devices[idx].dev_title_font */ + sprintf(newname, "%s.OutputTitleSize", hard_devices[idx].dev_name); + DEF(newname, DBL); /* hard_devices[idx].dev_title_size */ + sprintf(newname, "%s.OutputAxisFont", hard_devices[idx].dev_name); + DEF(newname, STR); /* hard_devices[idx].dev_axis_font */ + sprintf(newname, "%s.OutputAxisSize", hard_devices[idx].dev_name); + DEF(newname, DBL); /* hard_devices[idx].dev_axis_size */ + } + + + /* Read the default line and color attributes */ + for (idx = 0; idx < MAXATTR; idx++) { + (void) sprintf(newname, "%d.Style", idx); + DEF(newname, STYLE); /* AllAttrs[idx].lineStyleLen */ + (void) sprintf(newname, "%d.Color", idx); + DEF(newname, PIXEL); /* AllAttrs[idx].pixelValue */ + } + + DEF("ReverseVideo", BOOL); +} + + +#define FS(str) (void) fprintf(stderr, str) + +static void +argerror(err, val) +char *err, + *val; +{ + (void) fprintf(stderr, "Error: %s: %s\n\n", val, err); + + FS("Usage: xgraph [-device ]\n"); + FS("\t[-bd border_color] [-bg background_color] [-fg foreground_color]\n"); + FS("\t[-bar] [-brb bar_base] [-brw bar_width] [-bof bar_offset] [-stk]\n"); + FS("\t[-bw bdr_width] [-db] [-gw grid_size] [-fitx] [-fity]\n"); + FS("\t[-gs grid_style] [-lf label_font] [-lnx] [-lny] [-lw line_width]\n"); + FS("\t[-lx x1,x2] [-ly y1,y2] [-m] [-M] [-nl] [-ng] [-nb] [-p] [-P]\n"); + FS("\t[-rv] [-t title] [-tf title_font] [-tk] [-scale factor]\n"); + FS("\t[-x x_unit_name] [-y y_unit_name] [-fmtx format] [-fmty format]\n"); + FS("\t[[-geometry |=]W=H+X+Y] [[-display] :.]\n"); + FS("\t[-Pprinter|-o output_file|-O output_file] [[- set_name]\n"); + FS("\t[-zg zero_color] [-zw zero_size] [-a] [-dl ] input_files...\n\n"); + FS("-bar Draw bar graph with base -brb, width -brw, and offset -bof\n"); + FS("-stk Draw bar graph stacking data sets.\n"); + FS("-fitx Scale all sets to fit the x-axis [0,1].\n"); + FS("-fity Scale all sets to fit the y-axis [0,1].\n"); + FS("-fmtx Printf format for the x-axis\n"); + FS("-fmty Printf format for the y-axis\n"); + FS("-scale Scale the output file with factor\n"); + FS("-O fn Printer ready output file\n"); + FS("-o fn Encapsulated (document) output file\n"); + FS("-bb Draw bounding box around data\n"); + FS("-db Turn on debugging\n"); + FS("-lnx Logarithmic scale for X axis\n"); + FS("-lny Logarithmic scale for Y axis\n"); + FS("-m -M Mark points distinctively (M varies with color)\n"); + FS("-nl Don't draw lines (scatter plot)\n"); + FS("-ng Don't draw legend\n"); + FS("-nb Don't draw buttons\n"); + FS("-p -P Mark points with dot (P means big dot)\n"); + FS("-rv Reverse video on black and white displays\n"); + FS("-tk Draw tick marks instead of full grid\n"); + FS("-a Start in animation mode\n"); + FS("-dl Animation delay. Default is 2\n"); + + exit(1); +} + +#define ARG(opt, name) \ +if (strcmp(argv[idx], opt) == 0) { \ + if (do_it) param_set(name, BOOL, "on"); \ + idx++; continue; \ +} + +#define ARG2(opt, name, type, missing) \ +if (strcmp(argv[idx], opt) == 0) { \ + if (idx+1 >= argc) argerror(missing, argv[idx]); \ + if (do_it) param_set(name, type, argv[idx+1]); \ + idx += 2; continue;\ +} + +#define MAXLO 30 + +int +ParseArgs(argc, argv, do_it) +int argc; +char *argv[]; +int do_it; + +/* + * This routine parses the argument list for xgraph. There are too + * many to mention here so I won't. If `do_it' is non-zero, options + * are actually changed. If `do_it' is zero, the argument list + * is parsed but the options aren't set. The routine is called + * once to obtain the input files then again after the data is + * read to set the options. + */ +{ + int idx, + set, + dflag; + char *hi; + + dflag = DEF_OUTPUT_DEVICE; + + idx = 1; + while (idx < argc) { + if (argv[idx][0] == '-') { + /* Check to see if its a data set name */ + if (sscanf(argv[idx], "-%d", &set) == 1) { + /* The next string is a set name */ + if (idx + 1 >= argc) + argerror("missing set name", argv[idx]); + if (do_it) { + PlotData[set].setName = argv[idx + 1]; + } + idx += 2; + } + else { + /* Some non-dataset option */ + ARG2("-x", "XUnitText", STR, "missing axis name"); + ARG2("-y", "YUnitText", STR, "missing axis name"); + ARG2("-t", "TitleText", STR, "missing plot title"); + ARG2("-fg", "Foreground", PIXEL, "missing color name"); + ARG2("-bg", "Background", PIXEL, "missing color name"); + ARG2("-bd", "Border", PIXEL, "missing color name"); + ARG2("-bw", "BorderSize", INT, "missing border size"); + ARG2("-zg", "ZeroColor", PIXEL, "missing color name"); + ARG2("-zw", "ZeroWidth", INT, "missing width"); + ARG2("-tf", "TitleFont", FONT, "missing font name"); + ARG2("-lf", "LabelFont", FONT, "missing font name"); + /* PW */ + ARG2("-dl", "DelayValue", INT, "missing delay value"); + /* Doesn't make much sense to PW why this must be + switched, but it must. */ + ARG2("-digy", "Format X", STR, "Missing C-String"); + ARG2("-digx", "Format Y", STR, "Missing C-String"); + ARG("-a", "Animate"); + /* End PW */ + ARG("-rv", "ReverseVideo"); + ARG("-tk", "Ticks"); + ARG("-tkax", "TickAxis"); + ARG("-bb", "BoundBox"); + if (strcmp(argv[idx], "-lx") == 0) { + /* Limit the X coordinates */ + if (idx + 1 >= argc) + argerror("missing coordinate(s)", + argv[idx]); + if (hi = index(argv[idx + 1], ',')) { + char low[MAXLO]; + + (void) strncpy(low, argv[idx + 1], hi - argv[idx + 1]); + low[hi - argv[idx + 1]] = '\0'; + hi++; + if (do_it) { + param_set("XLowLimit", DBL, argv[idx + 1]); + param_set("XHighLimit", DBL, hi); + } + } + else { + argerror("limit coordinates not specified right", + argv[idx]); + } + idx += 2; + continue; + } + if (strcmp(argv[idx], "-ly") == 0) { + /* Limit the Y coordinates */ + if (idx + 1 >= argc) + argerror("missing coordinate(s)", + argv[idx]); + if (hi = index(argv[idx + 1], ',')) { + char low[MAXLO]; + + (void) strncpy(low, argv[idx + 1], hi - argv[idx + 1]); + low[hi - argv[idx + 1]] = '\0'; + hi++; + if (do_it) { + param_set("YLowLimit", DBL, argv[idx + 1]); + param_set("YHighLimit", DBL, hi); + } + } + else { + argerror("limit coordinates not specified right", + argv[idx]); + } + idx += 2; + continue; + } + ARG2("-lw", "LineWidth", INT, "missing line width"); + ARG("-nl", "NoLines"); + ARG("-ng", "NoLegend"); + ARG("-nb", "NoButton"); + ARG("-m", "Markers"); + ARG("-M", "StyleMarkers"); + ARG("-p", "PixelMarkers"); + ARG("-P", "LargePixels"); + ARG("-lnx", "LogX"); + ARG("-lny", "LogY"); + ARG("-bar", "BarGraph"); + ARG("-stk", "StackGraph"); + ARG("-fitx", "FitX"); + ARG("-fity", "FitY"); + ARG2("-brw", "BarWidth", DBL, "missing width"); + ARG2("-bof", "BarOffset", DBL, "missing offset"); + ARG2("-brb", "BarBase", DBL, "missing base"); + ARG("-db", "Debug"); + ARG2("-gw", "GridSize", INT, "missing grid size"); + ARG2("-gs", "GridStyle", STYLE, "missing grid style"); + if (strcmp(argv[idx], "-display") == 0) { + /* Harmless display specification */ + dflag = D_XWINDOWS; + disp_name = argv[idx+1]; + idx += 2; + continue; + } + if (strcmp(argv[idx], "-geometry") == 0) { + if (do_it) + param_set("Geometry", STR, argv[idx + 1]); + idx += 2; + continue; + } + if (strcmp(argv[idx], "-device") == 0) { + if (idx + 1 >= argc) + argerror("missing device", argv[idx]); + if (strcmp(argv[++idx], "hpgl") == 0) + dflag = D_HPGL; + else if (strcmp(argv[idx], "idraw") == 0) + dflag = D_IDRAW; + else if (strcmp(argv[idx], "x") == 0) + dflag = D_XWINDOWS; + else if (strcmp(argv[idx], "ps") == 0) + dflag = D_POSTSCRIPT; + else if (strcmp(argv[idx], "tgif") == 0) + dflag = D_TGIF; + else + argerror("bad device specification", argv[idx]); + idx++; + continue; + } + if (strncmp(argv[idx], "-P", 2) == 0) { + /* Printer spec */ + if (do_it) + param_set("Disposition", STR, "To Device"); + if (do_it) + param_set("FileOrDev", STR, &(argv[idx][2])); + idx++; + continue; + } + if (strcmp(argv[idx], "-o") == 0) { + if (do_it) + param_set("Disposition", STR, "To File"); + if (idx + 1 >= argc) + argerror("missing file", argv[idx]); + if (do_it) + param_set("FileOrDev", STR, argv[idx + 1]); + idx += 2; + continue; + } + if (strcmp(argv[idx], "-O") == 0) { + if (do_it) + param_set("Disposition", STR, "To File"); + if (do_it) + param_set("Document", BOOL, "on"); + if (idx + 1 >= argc) + argerror("missing file", argv[idx]); + if (do_it) + param_set("FileOrDev", STR, argv[idx + 1]); + idx += 2; + continue; + } + if (strcmp(argv[idx], "-fmtx") == 0) { + if (idx + 1 >= argc) + argerror("missing x format", argv[idx]); + if (do_it) + param_set("Format Y", STR, argv[idx + 1]); + idx += 2; + continue; + } + if (strcmp(argv[idx], "-fmty") == 0) { + if (idx + 1 >= argc) + argerror("missing y format", argv[idx]); + if (do_it) + param_set("Format X", STR, argv[idx + 1]); + idx += 2; + continue; + } + if (strcmp(argv[idx], "-scale") == 0) { + if (idx + 1 >= argc) + argerror("scale factor", argv[idx]); + if (do_it) + param_set("Scale", DBL, argv[idx + 1]); + idx += 2; + continue; + } + argerror("unknown option", argv[idx]); + } + } + else if (argv[idx][0] == '=') { + /* Its a geometry specification */ + if (do_it) + param_set("Geometry", STR, argv[idx] + 1); + idx++; + } + else { + /* It might be the host:display string */ + if (rindex(argv[idx], ':') == (char *) 0) { + /* Should be an input file */ + inFileNames[numFiles] = argv[idx]; + numFiles++; + } + idx++; + } + } + return (dflag); +} diff --git a/xgraph/install-sh b/xgraph/install-sh new file mode 100755 index 000000000..e9de23842 --- /dev/null +++ b/xgraph/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/xgraph/missing b/xgraph/missing new file mode 100755 index 000000000..7789652e8 --- /dev/null +++ b/xgraph/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/xgraph/mkinstalldirs b/xgraph/mkinstalldirs new file mode 100755 index 000000000..6b3b5fc5d --- /dev/null +++ b/xgraph/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/xgraph/params.c b/xgraph/params.c new file mode 100644 index 000000000..84c8fdbb0 --- /dev/null +++ b/xgraph/params.c @@ -0,0 +1,567 @@ +/* $Header$ */ +/* + * Xgraph Parameters + * + * This file contains routines for setting and retrieving + * various X style display parameters for xgraph. + * + * $Log$ + * Revision 1.1 2004-01-25 09:00:49 pnenzi + * + * Added xgraph plotting program. + * + * Revision 1.2 1999/12/08 19:32:41 heideman + * strcasecmp portability fix + * + * Revision 1.1.1.1 1999/12/03 23:15:52 heideman + * xgraph-12.0 + * + */ +#ifndef lint +static char rcsid[] = "$Id$"; + +#endif + +#include +#include +#include "st.h" +#include "params.h" +#include "hard_devices.h" +#include "xgraph.h" /* for string.h */ + +/* For use by convenience macros */ +params param_temp, + *param_temp_ptr; +XColor param_null_color = +{0, 0, 0, 0, 0, 0}; +param_style param_null_style = +{STYLE, 0, (char *) 0}; + +static st_table *param_table = (st_table *) 0; + +typedef struct param_full_defn { + param_types type; + char *text_form; + params *real_form; +} param_full; + + +#define ISO_FONT "*-*-%s-medium-r-normal-*-*-%d-*-*-*-*-iso8859-*" +static Display *param_disp; +static Colormap param_cmap; +static int param_scrn; + +static void free_resource(); +static params *resolve_entry(); +static int strihash(); +static int do_color(); +static int do_font(); +static int do_style(); +static int do_bool(); + +#define DEF_INT "0" +#define DEF_STR "" +#define DEF_FONT "fixed" +#define DEF_PIXEL "black" +#define DEF_STYLE "1" +#define DEF_BOOL "false" +#define DEF_DBL "0.0" + +#define DEF_MAX_FONT 1024 +#define DEF_MAX_NAMES 10 + +#define DUP(str) \ +strcpy((char *) Malloc((unsigned) (strlen(str)+1)), (str)) + + +void +param_init(disp, cmap) +Display *disp; /* X Connection */ +Colormap cmap; /* Colormap for colors */ + +/* + * Initializes parameter package. The display and colormap arguments + * are used to resolve font and pixel values. + */ +{ + param_table = st_init_table(stricmp, strihash); + if (disp != NULL) { + param_disp = disp; + param_cmap = cmap; + /* This could also be a parameter for greater generality */ + param_scrn = DefaultScreen(disp); + } +} + + + +void +param_set(name, type, val) +char *name; /* Name of parameter */ +param_types type; /* Type */ +char *val; /* Text form for value */ + +/* + * Sets the parameter with the given name to have the type + * `type' and the text value `value'. This will be evaluated + * to its full form the first time it is referenced using + * param_get(). If it is already filled, the old value + * will be reclaimed. + */ +{ + param_full *entry; + + if (!param_table) { + (void) fprintf(stderr, "Parameter table not initialized\n"); + return; + } + if (st_lookup(param_table, name, (char **) &entry)) { + if (entry->real_form) + free_resource(entry->real_form); + entry->real_form = (params *) 0; + } + else { + entry = (param_full *) Malloc(sizeof(param_full)); + entry->text_form = (char *) 0; + entry->real_form = (params *) 0; + (void) st_insert(param_table, DUP(name), (char *) entry); + } + entry->type = type; + if (entry->text_form) + (void) Free((char *) (entry->text_form)); + entry->text_form = DUP(val); +} + + +void +param_reset(name, val) +char *name; /* Name of parameter */ +char *val; /* Text form for value */ + +/* + * This routine sets the value of an existing parameter to a new + * value. The type of the parameter remains the same. Changes + * in type should be done by using param_set() directly. + */ +{ + param_full *entry; + + if (!param_table) { + (void) fprintf(stderr, "Parameter table not initialized\n"); + return; + } + if (st_lookup(param_table, name, (char **) &entry)) + param_set(name, entry->type, val); + else + (void) fprintf(stderr, "Cannot reset unknown parameter `%s'\n", name); +} + + + + +params * +param_get(name, val) +char *name; /* Name of parameter */ +params *val; /* Result value */ + +/* + * Retrieves a value from the parameter table. The value + * is placed in `val'. If successful, the routine will + * return `val'. Otherwise, it will return zero. + */ +{ + param_full *entry; + + if (!param_table) { + (void) fprintf(stderr, "Parameter table not initialized\n"); + return (params *) 0; + } + if (st_lookup(param_table, name, (char **) &entry)) { + if (!entry->real_form) + entry->real_form = resolve_entry(name, entry->type, + entry->text_form); + *val = *(entry->real_form); + return val; + } + else { + return (params *) 0; + } +} + + +static void +free_resource(val) +params *val; /* Value to free */ + +/* + * Reclaims a resource based on its type. + */ +{ + switch (val->type) { + case INT: + case STR: + case BOOL: + case DBL: + /* No reclaimation necessary */ + break; + case PIXEL: + if ((val->pixv.value.pixel != WhitePixel(param_disp, param_scrn)) && + (val->pixv.value.pixel != BlackPixel(param_disp, param_scrn))) + XFreeColors(param_disp, param_cmap, &(val->pixv.value.pixel), 1, 0); + break; + case FONT: + XFreeFont(param_disp, val->fontv.value); + break; + case STYLE: + (void) Free(val->stylev.dash_list); + break; + } + (void) Free((char *) val); +} + + + +static params * +resolve_entry(name, type, form) +char *name; /* Name of item for errors */ +param_types type; /* What type of thing */ +char *form; /* Textual form */ + +/* + * Allocates and returns an appropriate parameter structure + * by translating `form' into its native type as given by `type'. + * If it can't translate the given form, it will fall back onto + * the default. + */ +{ + static char paramstr[] = + "Parameter %s: can't translate `%s' into a %s (defaulting to `%s')\n"; + params *result = (params *) Malloc(sizeof(params)); + + result->type = type; + switch (type) { + case INT: + if (sscanf(form, "%d", &result->intv.value) != 1) { + (void) fprintf(stderr, paramstr, name, form, "integer", DEF_INT); + result->intv.value = atoi(DEF_INT); + } + break; + case STR: + result->strv.value = form; + break; + case PIXEL: + if (!do_color(form, &result->pixv.value)) { + (void) fprintf(stderr, paramstr, name, form, "color", DEF_PIXEL); + (void) do_color(DEF_PIXEL, &result->pixv.value); + } + break; + case FONT: + if (!do_font(form, &result->fontv.value)) { + (void) fprintf(stderr, paramstr, name, form, "font", DEF_FONT); + (void) do_font(DEF_FONT, &result->fontv.value); + } + break; + case STYLE: + if (!do_style(form, &result->stylev)) { + (void) fprintf(stderr, paramstr, name, form, "line style", + DEF_STYLE); + (void) do_style(DEF_STYLE, &result->stylev); + } + break; + case BOOL: + if (!do_bool(form, &result->boolv.value)) { + (void) fprintf(stderr, paramstr, name, form, "boolean flag", + DEF_BOOL); + (void) do_bool(DEF_BOOL, &result->boolv.value); + } + break; + case DBL: + if (sscanf(form, "%lf", &result->dblv.value) != 1) { + (void) fprintf(stderr, paramstr, name, form, "double", DEF_DBL); + result->dblv.value = atof(DEF_DBL); + } + break; + } + return result; +} + + + +static int +do_color(name, color) +char *name; /* Name for color */ +XColor *color; /* Returned color */ + +/* + * Translates `name' into a color and attempts to get the pixel + * for the color using XAllocColor(). + */ +{ + int result = 1; + + if (PM_INT("Output Device") == D_XWINDOWS) { + if (XParseColor(param_disp, param_cmap, name, color)) { + if (stricmp(name, "black") == 0) { + color->pixel = BlackPixel(param_disp, param_scrn); + XQueryColor(param_disp, param_cmap, color); + } + else if (stricmp(name, "white") == 0) { + color->pixel = WhitePixel(param_disp, param_scrn); + XQueryColor(param_disp, param_cmap, color); + } + else + result = XAllocColor(param_disp, param_cmap, color); + } + else + result = 0; + } + return result; +} + + + +static int +do_font(name, font_info) +char *name; /* Name of desired font */ +XFontStruct **font_info; /* Returned font information */ + +/* + * This routine translates a font name into a font structure. The + * font name can be in two forms. The first form is -. + * The family is a family name (like helvetica) and the size is + * in points (like 12). If the font is not in this form, it + * is assumed to be a regular X font name specification and + * is looked up using the standard means. + */ +{ + char name_copy[DEF_MAX_FONT], + query_spec[DEF_MAX_FONT]; + char *font_family, + *font_size, + **font_list; + int font_size_value, + font_count, + i; + + /* First attempt to interpret as font family/size */ + if (PM_INT("Output Device") == D_XWINDOWS) { + (void) strcpy(name_copy, name); + if (font_size = index(name_copy, '-')) { + *font_size = '\0'; + font_family = name_copy; + font_size++; + font_size_value = atoi(font_size); + if (font_size_value > 0) { + /* + * Still a little iffy -- what about weight and roman vs. other + */ + (void) sprintf(query_spec, ISO_FONT, + font_family, font_size_value * 10); + font_list = XListFonts(param_disp, query_spec, + DEF_MAX_NAMES, &font_count); + + /* Load first one that you can */ + for (i = 0; i < font_count; i++) + if (*font_info = XLoadQueryFont(param_disp, font_list[i])) + break; + if (*font_info) + return 1; + } + } + /* Assume normal font name */ + return (int) (*font_info = XLoadQueryFont(param_disp, name)); + } +} + + +static int +do_style(list, val) +char *list; /* List of ones and zeros */ +param_style *val; /* Line style returned */ + +/* + * Translates a string representation of a dash specification into + * a form suitable for use in XSetDashes(). Assumes `list' + * is a null terminated string of ones and zeros. + */ +{ + char *i, + *spot, + last_char; + int count; + + for (i = list; *i; i++) + if ((*i != '0') && (*i != '1')) + break; + + if (!*i) { + val->len = 0; + last_char = '\0'; + for (i = list; *i; i++) { + if (*i != last_char) { + val->len += 1; + last_char = *i; + } + } + val->dash_list = (char *) Malloc((unsigned) + (sizeof(char) * val->len + 1)); + last_char = *list; + spot = val->dash_list; + count = 0; + for (i = list; *i; i++) { + if (*i != last_char) { + *spot++ = (char) count; + last_char = *i; + count = 1; + } + else + count++; + } + *spot = (char) count; + return 1; + } + else { + return 0; + } +} + + +static char *positive[] = +{"on", "yes", "true", "1", "affirmative", (char *) 0}; +static char *negative[] = +{"off", "no", "false", "0", "negative", (char *) 0}; + +static int +do_bool(name, val) +char *name; /* String representation */ +int *val; /* Returned value */ + +/* + * Translates a string representation into a suitable binary value. + * Can parse all kinds of interesting boolean type words. + */ +{ + char **term; + + for (term = positive; *term; term++) { + if (stricmp(name, *term) == 0) + break; + } + if (*term) { + *val = 1; + return 1; + } + for (term = negative; *term; term++) + if (stricmp(name, *term) == 0) + break; + + if (*term) { + *val = 0; + return 1; + } + return 0; +} + + + +/*ARGSUSED*/ +static enum st_retval +dump_it(key, value, arg) +char *key, + *value, + *arg; +{ + param_full *val = (param_full *) value; + + (void) fprintf(stdout, "%s (", key); + switch (val->type) { + case INT: + (void) fprintf(stdout, "INT"); + break; + case STR: + (void) fprintf(stdout, "STR"); + break; + case PIXEL: + (void) fprintf(stdout, "PIXEL"); + break; + case FONT: + (void) fprintf(stdout, "FONT"); + break; + case STYLE: + (void) fprintf(stdout, "STYLE"); + break; + case BOOL: + (void) fprintf(stdout, "BOOL"); + break; + case DBL: + (void) fprintf(stdout, "DBL"); + break; + } + (void) fprintf(stdout, ") = %s\n", val->text_form); + return ST_CONTINUE; +} + +void +param_dump() +/* + * Dumps all of the parameter values to standard output. + */ +{ + st_foreach(param_table, dump_it, (char *) 0); +} + + + +#ifdef HAVE_STRCASECMP +int +stricmp(a, b) + char *a, *b; +{ + return strcasecmp(a, b); +} +#else +int +stricmp(a, b) +register char *a, + *b; + +/* + * This routine compares two strings disregarding case. + */ +{ + register int value; + + if ((a == (char *) 0) || (b == (char *) 0)) { + return a - b; + } + + for ( /* nothing */ ; + ((*a | *b) && + !(value = ((isupper(*a) ? *a - 'A' + 'a' : *a) - + (isupper(*b) ? *b - 'A' + 'a' : *b)))); + a++, b++) + /* Empty Body */ ; + + return value; +} + +#endif + +static int +strihash(string, modulus) +register char *string; +int modulus; + +/* Case insensitive computation */ +{ + register int val = 0; + register int c; + + while ((c = *string++) != '\0') { + if (isupper(c)) + c = tolower(c); + val = val * 997 + c; + } + + return ((val < 0) ? -val : val) % modulus; +} diff --git a/xgraph/params.h b/xgraph/params.h new file mode 100644 index 000000000..3fff8f935 --- /dev/null +++ b/xgraph/params.h @@ -0,0 +1,127 @@ +/* + * Xgraph parameters + */ + +#ifndef _PARAMS_H_ +#define _PARAMS_H_ + +#include "xgraph.h" + +/* If you have an ANSI compiler, some checking will be done */ +#ifdef __STDC__ +#define DECLARE(func, rtn, args) extern rtn func args +#else +#define DECLARE(func, rtn, args) extern rtn func () +#endif + +typedef enum param_types_defn { + INT, STR, PIXEL, FONT, STYLE, BOOL, DBL +} param_types; + +typedef struct params_int_defn { + param_types type; /* INT */ + int value; +} param_int; + +typedef struct params_str_defn { + param_types type; /* STR */ + char *value; +} param_str; + +typedef struct params_pix_defn { + param_types type; /* PIXEL */ + XColor value; +} param_pix; + +typedef struct params_font_defn { + param_types type; /* FONT */ + XFontStruct *value; +} param_font; + +typedef struct params_style_defn { + param_types type; /* STYLE */ + int len; + char *dash_list; +} param_style; + +typedef struct params_bool_defn { + param_types type; /* BOOL */ + int value; +} param_bool; + +typedef struct params_dbl_defn { + param_types type; /* DBL */ + double value; +} param_dbl; + +typedef union params_defn { + param_types type; + param_int intv; /* INT */ + param_str strv; /* STR */ + param_pix pixv; /* PIXEL */ + param_font fontv; /* FONT */ + param_style stylev; /* STYLE */ + param_bool boolv; /* BOOL */ + param_dbl dblv; /* DBL */ +} params; + +DECLARE(param_init, void, (Display * disp, Colormap cmap)); +DECLARE(param_set, void, (char *name, param_types type, char *val)); +DECLARE(param_reset, void, (char *name, char *val)); +DECLARE(param_get, params *, (char *name, params * val)); +DECLARE(param_dump, void, ()); + +#ifdef stricmp +#undef stricmp +#endif +DECLARE(stricmp, int, (char *a, char *b)); + +/* Some convenience macros */ + +extern params param_temp, + *param_temp_ptr; +extern XColor param_null_color; +extern param_style param_null_style; + +#define PM_INT(name) \ +((param_temp_ptr = param_get(name, ¶m_temp)) ? \ + param_temp_ptr->intv.value : \ + (abort(), (int) 0)) + +#define PM_STR(name) \ +((param_temp_ptr = param_get(name, ¶m_temp)) ? \ + param_temp_ptr->strv.value : \ + (abort(), (char *) 0)) + +#define PM_COLOR(name) \ +((param_temp_ptr = param_get(name, ¶m_temp)) ? \ + param_temp_ptr->pixv.value : \ + (abort(), param_null_color)) + +#define PM_PIXEL(name) \ +((param_temp_ptr = param_get(name, ¶m_temp)) ? \ + param_temp_ptr->pixv.value.pixel : \ + (abort(), (Pixel) 0)) + +#define PM_FONT(name) \ +((param_temp_ptr = param_get(name, ¶m_temp)) ? \ + param_temp_ptr->fontv.value : \ + (abort(), (XFontStruct *) 0)) + +#define PM_STYLE(name) \ +((param_temp_ptr = param_get(name, ¶m_temp)) ? \ + param_temp_ptr->stylev : \ + (abort(), param_null_style)) + +#define PM_BOOL(name) \ +((param_temp_ptr = param_get(name, ¶m_temp)) ? \ + param_temp_ptr->boolv.value : \ + (abort(), 0)) + +#define PM_DBL(name) \ +((param_temp_ptr = param_get(name, ¶m_temp)) ? \ + param_temp_ptr->dblv.value : \ + (abort(), 0.0)) + + +#endif /* _PARAMS_H_ */ diff --git a/xgraph/plotter.h b/xgraph/plotter.h new file mode 100644 index 000000000..54662056d --- /dev/null +++ b/xgraph/plotter.h @@ -0,0 +1,60 @@ +#ifndef _h_plotter +#define _h_plotter + /* + * HP plotter definition - these are dependent on the SPECIFIC MODEL of HP + * plotter used, and should always be modified when going to a new + * plotter. + * + * all dimensions are in plotter units. + * + * MINX and MINY are the smallest x and y values that are inside the soft + * clip limits of the plotter MAXX and MAXY are the largest x and y values + * that are inside the soft clip limits of the plotter MINUS MINX and + * MINY, so they give the dimension of the soft clip area. + * + * PLOTTERTYPE is a character string which identifies the plotter that should + * be used. control information will be read for + * ~cad/lib/technology/$TECHNOLOGY/$PLOTTERTYPE.map and output will go to + * /usr/ucb/lpr -Pplt$PLOTTERTYPE + * + */ +#define PLOTTERTYPE "7550" +#define P1X 80 +#define P1Y 320 +#define P2X 10080 +#define P2Y 7520 +#define MAXX 10000 +#define MAXY 7200 + +#define PLOTTERNAME "paper" + +#define PENGRID 1 +#define PENAXIS 2 +#define TEXTCOLOR 1 +#define PEN1 3 +#define PEN2 4 +#define PEN3 5 +#define PEN4 6 +#define PEN5 7 +#define PEN6 8 +#define PEN7 2 +#define PEN8 1 + +#define LINE1 2 +#define LINE2 4 +#define LINE3 5 +#define LINE4 6 +#define LINE5 2 +#define LINE6 4 +#define LINE7 5 +#define LINE8 6 + +#define MARK1 "L" +#define MARK2 "K" +#define MARK3 "M" +#define MARK4 "O" +#define MARK5 "G" +#define MARK6 "F" +#define MARK7 "E" +#define MARK8 "A" +#endif /* _h_plotter */ diff --git a/xgraph/ps.c b/xgraph/ps.c new file mode 100644 index 000000000..cab6f9648 --- /dev/null +++ b/xgraph/ps.c @@ -0,0 +1,620 @@ +/* + * Postscript output for xgraph + * + * Rick Spickelmier + * David Harrison + */ + +#include "copyright.h" +#include +#include "xgraph.h" + +/* + * Basic scaling parameters + */ + +#define VDPI 1200.0 +#define LDIM 11.0 +#define SDIM 8.5 +#define MICRONS_PER_INCH 2.54E+04 +#define POINTS_PER_INCH 72.0 +#define INCHES_PER_POINT 1.0/72.0 + +/* + * Aesthetic parameters (inches) + */ + +#define PS_BDR_PAD 0.075 +#define PS_AXIS_PAD 0.1 +#define PS_LEG_PAD 0.025 +#define PS_TICK_LEN 0.125 +#define BASE_DASH (1.0/48.0) + +#define BASE_WIDTH (1.0/8.0) +#define PS_AXIS_WBASE 1 +#define PS_ZERO_WBASE 4 +#define PS_DATA_WBASE 7 +#define PS_PIXEL 4 +#define PS_DOT 12 +#define PS_MARK 12 + +/* + * Other constants + */ + +#define FONT_WIDTH_EST 0.55 +#define PS_MAX_SEGS 1000 +#define PS_NO_TSTYLE -1 +#define PS_NO_DSTYLE -1 +#define PS_NO_WIDTH -1 +#define PS_NO_LSTYLE -1 +#define PS_NO_COLOR -1 + +/* + * Working macros + */ + +#define OUT (void) fprintf +#define PS(str) OUT(psFile, str) +#define PSU(str) OUT(ui->psFile, str) +#define IY(val) (ui->height_devs - val) + +#define TEXTCOLOR 0 +#define MAXCOLOR 8 /* Number of gray scales supported */ + +/* + * Globals + */ + +static double PS_scale; /* devs/micron */ + +/* + * Externals and forwards + */ + +static void psScale(), psFonts(), psMarks(), psText(), psSeg(), psDot(), psEnd(); + + +/* + * Local structures + */ + +struct userInfo { + FILE *psFile; + int currentTextStyle; + int currentDashStyle; + int currentWidth; + int currentLStyle; + int currentColor; + int baseWidth; + int height_devs; + char *title_family; + double title_size; + char *axis_family; + double axis_size; + int flags; +}; + + + +int +rd(dbl) +double dbl; + +/* Short and sweet rounding function */ +{ + if (dbl < 0.0) { + return ((int) (dbl - 0.5)); + } + else { + return ((int) (dbl + 0.5)); + } +} + +/*ARGSUSED*/ +int +psInit(psFile, width, height, tf, ts, af, as, flags, outInfo, errmsg) +FILE *psFile; /* Output file */ +int width, + height; /* In microns */ +char *tf, + *af; /* Title and axis font */ +double ts, + as; /* Title and axis size */ +int flags; /* Predicate flags */ +xgOut *outInfo; /* Returned device info */ +char errmsg[ERRBUFSIZE]; /* Returned error message */ + +/* + * The basic coordinate system is points (roughly 1/72 inch). + * However, most laser printers can do much better than that. + * We invent a coordinate system based on VDPI dots per inch. + * This goes along the long side of the page. The long side + * of the page is LDIM inches in length, the short side + * SDIM inches in length. We we call this unit a `dev'. + * We map `width' and `height' into devs. + */ +{ + struct userInfo *ui; + double font_size; + + ui = (struct userInfo *) Malloc(sizeof(struct userInfo)); + ui->psFile = psFile; + ui->currentTextStyle = PS_NO_TSTYLE; + ui->currentDashStyle = PS_NO_DSTYLE; + ui->currentWidth = PS_NO_WIDTH; + ui->currentLStyle = PS_NO_LSTYLE; + ui->currentColor = PS_NO_COLOR; + ui->title_family = tf; + ui->title_size = ts; + ui->axis_family = af; + ui->axis_size = as; + /* Roughly, one-eighth a point in devs */ + ui->baseWidth = rd(VDPI / POINTS_PER_INCH * BASE_WIDTH); + ui->flags = flags; + + PS_scale = VDPI / MICRONS_PER_INCH; + + outInfo->dev_flags = 0; + outInfo->area_w = rd(((double) width) * PS_scale); + outInfo->area_h = rd(((double) height) * PS_scale); + ui->height_devs = outInfo->area_h; + outInfo->bdr_pad = rd(PS_BDR_PAD * VDPI); + outInfo->axis_pad = rd(PS_AXIS_PAD * VDPI); + outInfo->legend_pad = rd(PS_LEG_PAD * VDPI); + outInfo->tick_len = rd(PS_TICK_LEN * VDPI); + + /* Font estimates */ + font_size = as * INCHES_PER_POINT * VDPI; + outInfo->axis_height = rd(font_size); + outInfo->axis_width = rd(font_size * FONT_WIDTH_EST); + font_size = ts * INCHES_PER_POINT * VDPI; + outInfo->title_height = rd(font_size); + outInfo->title_width = rd(font_size * FONT_WIDTH_EST); + + outInfo->max_segs = PS_MAX_SEGS; + + outInfo->xg_text = psText; + outInfo->xg_seg = psSeg; + outInfo->xg_dot = psDot; + outInfo->xg_end = psEnd; + outInfo->user_state = (char *) ui; + + /* Postscript file identification */ + PS("%%!\n"); + + /* Definitions */ + psScale(psFile, width, height, flags); + psFonts(psFile); + psMarks(psFile); + + PS("%%\n%% Main body begins here\n%%\n"); + return 1; +} + + + + +static void +psHeader(psFile, docu_flag) +FILE *psFile; +int docu_flag; + +/* + * Prints out a standard greeting to the Postscript file. + */ +{ + PS("%%%%EndComments\n"); + PS("%%\n"); + PS("%% Xgraph postscript output\n"); + PS("%% Rick Spickelmier and David Harrison\n"); + PS("%% University of California, Berkeley\n"); + if (docu_flag) { + PS("%%\n"); + PS("%% Output produced for inclusion in another document.\n"); + PS("%% This file will not work properly if sent directly to a printer.\n"); + } + PS("%%\n"); +} + + +static void +psScale(psFile, width, height, flags) +FILE *psFile; /* Output stream */ +int width; /* Output width */ +int height; /* Output height */ +int flags; /* Output options */ + +/* + * This routine figures out how transform the basic postscript + * transformation into one suitable for direct use by + * the drawing primitives. Two variables X-CENTER-PLOT + * and Y-CENTER-PLOT determine whether the plot is centered + * on the page. If `flags' has D_DOCU set, then the plot + * will not be rotated or centered and a bounding box will + * be displayed. + */ +{ + double factor; + double pnt_width, + pnt_height; + + if (flags & D_DOCU) { + OUT(psFile, "%%%%BoundingBox: %ld %ld %ld %ld\n", + 0, 0, + (int) (((double) width) / + (MICRONS_PER_INCH * INCHES_PER_POINT) + 0.5), + (int) (((double) height) / + (MICRONS_PER_INCH * INCHES_PER_POINT) + 0.5) + ); + psHeader(psFile, 1); + PS("%% Rotation and centering are turned off for inclusion in a document\n"); + } + else { + psHeader(psFile, 0); + PS("%% Scaling information\n"); + PS("%%\n"); + PS("%% Change these if you would like to change the centering\n"); + PS("%% of the plot in either dimension\n"); + PS("/X-CENTER-PLOT 1 def\n"); + PS("/Y-CENTER-PLOT 1 def\n"); + PS("%%\n"); + /* + * Determine page size + */ + PS("%% Page size computation\n"); + PS("clippath pathbbox\n"); + PS("/page-height exch def\n"); + PS("/page-width exch def\n"); + PS("pop pop\n"); + + /* + * First: rotation. If the width is greater than the short dimension, + * do the rotation. + */ + pnt_width = ((double) width) / MICRONS_PER_INCH * POINTS_PER_INCH; + pnt_height = ((double) height) / MICRONS_PER_INCH * POINTS_PER_INCH; + PS("%% Determine whether rotation is required\n"); + OUT(psFile, "%lg page-width gt\n", pnt_width); + PS("{ %% Rotation required\n"); + PS(" 90 rotate\n"); + PS(" 0 page-width neg translate\n"); + PS(" %% Handle centering\n"); + PS(" Y-CENTER-PLOT 1 eq { %% Center in y\n"); + OUT(psFile, " page-height %lg sub 2 div\n", pnt_width); + PS(" } { %% Don't center in y\n"); + PS(" 0\n"); + PS(" } ifelse\n"); + PS(" X-CENTER-PLOT 1 eq { %% Center in x\n"); + OUT(psFile, " page-width %lg sub 2 div\n", pnt_height); + PS(" } { %% Don't center in x\n"); + PS(" 0\n"); + PS(" } ifelse\n"); + PS(" translate\n"); + PS("} { %% No rotation - just handle centering\n"); + PS(" X-CENTER-PLOT 1 eq { %% Center in x\n"); + OUT(psFile, " page-width %lg sub 2 div\n", pnt_width); + PS(" } { %% Don't center in x\n"); + PS(" 0\n"); + PS(" } ifelse\n"); + PS(" Y-CENTER-PLOT 1 eq { %% Center in y\n"); + OUT(psFile, " page-height %lg sub 2 div\n", pnt_height); + PS(" } { %% Don't center in y\n"); + PS(" 0\n"); + PS(" } ifelse\n"); + PS(" translate\n"); + PS("} ifelse\n"); + } + + /* + * Now: scaling. We have points. We want devs. + */ + factor = POINTS_PER_INCH / VDPI; + PS("%% Set the scale\n"); + OUT(psFile, "%lg %lg scale\n", factor, factor); +} + + + +static void +psFonts(psFile) +FILE *psFile; /* Output stream */ + +/* + * Downloads code for drawing title and axis labels + */ +{ + PS("%% Font Handling Functions\n"); + PS("%%\n"); + PS("%% Function giving y-offset to center of font\n"); + PS("%% Assumes font is set and uses numbers to gauge center\n"); + PS("%%\n"); + PS("/choose-font %% stack: fontsize fontname => ---\n"); + PS("{\n"); + PS(" findfont \n"); + PS(" exch scalefont \n"); + PS(" setfont\n"); + PS(" newpath\n"); + PS(" 0 0 moveto (0) true charpath flattenpath pathbbox\n"); + PS(" /top exch def pop\n"); + PS(" /bottom exch def pop\n"); + PS(" bottom top bottom top add 2 div\n"); + PS(" /center-font-val exch def \n"); + PS(" /upper-font-val exch def \n"); + PS(" /lower-font-val exch def\n"); + PS("} def\n"); + PS("%%\n"); + PS("%% Justfication offset routines\n"); + PS("%%\n"); + PS("/center-x-just %% stack: (string) x y => (string) newx y\n"); + PS("{\n"); + PS(" exch 2 index stringwidth pop 2 div sub exch\n"); + PS("} def\n"); + PS("%%\n"); + PS("/left-x-just %% stack: (string) x y => (string) newx y\n"); + PS("{ \n"); + PS("} def\n"); + PS("%%\n"); + PS("/right-x-just %% stack: (string) x y => (string) newx y\n"); + PS("{\n"); + PS(" exch 2 index stringwidth pop sub exch\n"); + PS("} def\n"); + PS("%%\n"); + PS("/center-y-just %% stack: (string) x y => (string) x newy\n"); + PS("{\n"); + PS(" center-font-val sub\n"); + PS("} def\n"); + PS("%%\n"); + PS("/lower-y-just %% stack: (string) x y => (string) x newy\n"); + PS("{\n"); + PS(" lower-font-val sub\n"); + PS("} def\n"); + PS("%%\n"); + PS("/upper-y-just %% stack: (string) x y => (string) x newy\n"); + PS("{\n"); + PS(" upper-font-val sub\n"); + PS("} def\n"); + PS("%%\n"); + PS("%% Shows a string on the page subject to justification\n"); + PS("%% \n"); + PS("/just-string %% stack: (string) x y just => ---\n"); + PS("{\n"); + PS(" dup 0 eq { pop center-x-just center-y-just } if\n"); + PS(" dup 1 eq { pop left-x-just center-y-just } if\n"); + PS(" dup 2 eq { pop left-x-just upper-y-just } if\n"); + PS(" dup 3 eq { pop center-x-just upper-y-just } if\n"); + PS(" dup 4 eq { pop right-x-just upper-y-just } if\n"); + PS(" dup 5 eq { pop right-x-just center-y-just } if\n"); + PS(" dup 6 eq { pop right-x-just lower-y-just } if\n"); + PS(" dup 7 eq { pop center-x-just lower-y-just } if\n"); + PS(" dup 8 eq { pop left-x-just lower-y-just } if\n"); + PS(" moveto show\n"); + PS("} def\n"); + PS("%%\n"); +} + + + +static void +psMarks(psFile) +FILE *psFile; + +/* + * Writes out marker definitions + */ +{ + PS("%% Marker definitions\n"); + PS("/mark0 {/size exch def /y exch def /x exch def\n"); + PS("newpath x size sub y size sub moveto\n"); + PS("size size add 0 rlineto 0 size size add rlineto\n"); + PS("0 size size add sub 0 rlineto closepath fill} def\n"); + + PS("/mark1 {/size exch def /y exch def /x exch def\n"); + PS("newpath x size sub y size sub moveto\n"); + PS("size size add 0 rlineto 0 size size add rlineto\n"); + PS("0 size size add sub 0 rlineto closepath stroke} def\n"); + + PS("/mark2 {/size exch def /y exch def /x exch def\n"); + PS("newpath x y moveto x y size 0 360 arc stroke} def\n"); + + PS("/mark3 {/size exch def /y exch def /x exch def\n"); + PS("newpath x size sub y size sub moveto x size add y size add lineto\n"); + PS("x size sub y size add moveto x size add y size sub lineto stroke} def\n"); + + PS("/mark4 {/size exch def /y exch def /x exch def\n"); + PS("newpath x size sub y moveto x y size add lineto\n"); + PS("x size add y lineto x y size sub lineto\n"); + PS("closepath stroke} def\n"); + + PS("/mark5 {/size exch def /y exch def /x exch def\n"); + PS("x y size mark1\n"); + PS("newpath x size sub y moveto size size add 0 rlineto stroke} def\n"); + + PS("/mark6 {/size exch def /y exch def /x exch def\n"); + PS("newpath x y moveto x y size 0 360 arc fill} def\n"); + + PS("/mark7 {/size exch def /y exch def /x exch def\n"); + PS("newpath x y moveto x size sub y size sub lineto\n"); + PS("x size add y size sub lineto closepath fill\n"); + PS("newpath x y moveto x size add y size add lineto\n"); + PS("x size sub y size add lineto closepath fill} def\n"); +} + + + +static void +psText(state, x, y, text, just, style) +char *state; /* Really (struct userInfo *) */ +int x, + y; /* Text position (devs) */ +char *text; /* Text itself */ +int just; /* Justification */ +int style; /* Style */ + +/* + * Draws text at the given location with the given justification + * and style. + */ +{ + struct userInfo *ui = (struct userInfo *) state; + + if (TEXTCOLOR != ui->currentColor) { + OUT(ui->psFile, "%lg setgray\n", (double) TEXTCOLOR / 8); + ui->currentColor = TEXTCOLOR; + } + + if (style != ui->currentTextStyle) { + switch (style) { + case T_AXIS: + OUT(ui->psFile, "%lg /%s choose-font\n", + ui->axis_size * INCHES_PER_POINT * VDPI, ui->axis_family); + break; + case T_TITLE: + OUT(ui->psFile, "%lg /%s choose-font\n", + ui->title_size * INCHES_PER_POINT * VDPI, ui->title_family); + break; + } + ui->currentTextStyle = style; + } + OUT(ui->psFile, "(%s) %d %d %d just-string\n", text, x, IY(y), just); +} + + + +/*ARGSUSED*/ +static void +psSeg(state, ns, seglist, width, style, lappr, color) +char *state; /* Really (struct userInfo *) */ +int ns; /* Number of segments */ +XSegment *seglist; /* X array of segments */ +int width; /* Width of lines (devcoords) */ +int style; /* L_AXIS, L_ZERO, L_VAR */ +int lappr; /* Zero to seven */ +int color; /* Zero to seven */ + +/* + * Draws a number of line segments. Grid lines are drawn using + * light lines. Variable lines (L_VAR) are drawn wider. This + * version ignores the color argument. + */ +{ + struct userInfo *ui = (struct userInfo *) state; + int newwidth = 0, + i; + + if ((style != ui->currentLStyle) || (width != ui->currentWidth)) { + switch (style) { + case L_AXIS: + newwidth = PS_AXIS_WBASE * ui->baseWidth; + PSU("[] 0 setdash\n"); + break; + case L_ZERO: + newwidth = PS_ZERO_WBASE * ui->baseWidth; + PSU("[] 0 setdash\n"); + break; + case L_VAR: + newwidth = PS_DATA_WBASE * ui->baseWidth; + break; + } + ui->currentWidth = MAX(newwidth, width); + ui->currentLStyle = style; + OUT(ui->psFile, "%d setlinewidth\n", ui->currentWidth); + } + if (width > 4) { + if (color > MAXCOLOR) + color -= MAXCOLOR; + else + lappr = 0; + } + else + color = TEXTCOLOR; + + if ((lappr != ui->currentDashStyle) && (style == L_VAR)) { + if (lappr == 0) { + PSU("[] 0 setdash\n"); + } + else { + OUT(ui->psFile, "[%lg] 0 setdash\n", + ((double) lappr) * BASE_DASH * VDPI); + } + ui->currentDashStyle = lappr; + } + if ((color != ui->currentColor) && (style == L_VAR)) { + OUT(ui->psFile, "%lg setgray\n", (double) color / MAXCOLOR); + ui->currentColor = color; + } + PSU("newpath\n"); + OUT(ui->psFile, " %d %d moveto\n", seglist[0].x1, IY(seglist[0].y1)); + OUT(ui->psFile, " %d %d lineto\n", seglist[0].x2, IY(seglist[0].y2)); + for (i = 1; i < ns; i++) { + if ((seglist[i].x1 != seglist[i - 1].x2) || + (seglist[i].y1 != seglist[i - 1].y2)) { + OUT(ui->psFile, " %d %d moveto\n", seglist[i].x1, IY(seglist[i].y1)); + } + OUT(ui->psFile, " %d %d lineto\n", seglist[i].x2, IY(seglist[i].y2)); + } + PSU("stroke\n"); +} + + + +/*ARGSUSED*/ +static void +psDot(state, x, y, style, type, color) +char *state; /* state information */ +int x, + y; /* coord of dot */ +int style; /* type of dot */ +int type; /* dot style variation */ +int color; /* color of dot */ + +/* + * Prints out a dot at the given location + */ +{ + struct userInfo *ui = (struct userInfo *) state; + + if (ui->currentDashStyle != PS_NO_DSTYLE) { + OUT(ui->psFile, "[] 0 setdash "); + ui->currentDashStyle = PS_NO_DSTYLE; + } + if (ui->currentWidth != PS_ZERO_WBASE * ui->baseWidth) { + ui->currentWidth = PS_ZERO_WBASE * ui->baseWidth; + OUT(ui->psFile, "%d setlinewidth ", ui->currentWidth); + } + if (color > MAXCOLOR) + color -= MAXCOLOR; + if ((color != ui->currentColor)) { + OUT(ui->psFile, "%lg setgray\n", (double) color / MAXCOLOR); + ui->currentColor = color; + } + + switch (style) { + case P_PIXEL: + OUT(ui->psFile, "newpath %d %d moveto %d %d %d 0 360 arc fill\n", + x, IY(y), x, IY(y), PS_PIXEL * ui->baseWidth); + break; + case P_DOT: + OUT(ui->psFile, "newpath %d %d moveto %d %d %d 0 360 arc fill\n", + x, IY(y), x, IY(y), PS_DOT * ui->baseWidth); + break; + case P_MARK: + OUT(ui->psFile, "%d %d %d mark%d\n", + x, IY(y), PS_MARK * ui->baseWidth, type); + break; + } + return; +} + + +static void +psEnd(userState) +char *userState; /* state information */ +{ + struct userInfo *ui = (struct userInfo *) userState; + + if (!(ui->flags & D_DOCU)) { + PSU("showpage\n"); + } + PSU("%% End of xgraph output\n"); +} diff --git a/xgraph/read.c b/xgraph/read.c new file mode 100644 index 000000000..7c97b110b --- /dev/null +++ b/xgraph/read.c @@ -0,0 +1,365 @@ +/* $Header$ */ +/* + * read.c: Dataset read code + * + * Routines: + * int ReadData(); + * + * $Log$ + * Revision 1.1 2004-01-25 09:00:49 pnenzi + * + * Added xgraph plotting program. + * + * Revision 1.2 1999/12/03 23:17:45 heideman + * apply xgraph_no_animation.patch + * + * Revision 1.1.1.1 1999/12/03 23:15:53 heideman + * xgraph-12.0 + * + */ +#ifndef lint +static char rcsid[] = "$Id$"; +#endif + +#include "copyright.h" +#include +#include +#include +#include +#include "xgraph.h" +#include "xtb.h" +#include "hard_devices.h" +#include "params.h" +/* + * New dataset reading code + */ + +static int setNumber = 0; +static PointList **curSpot = (PointList **) 0; +static PointList *curList = (PointList *) 0; +static int newGroup = 0; +static int redundant_set = 0; + +#ifdef DO_DER +extern void Der1(); +#endif + +static int +rdSet(fn) +char *fn; /* Reading from file `fn' */ + +/* + * Set up new dataset. Will return zero if there are too many data sets. + */ +{ + char setname[100]; + + if (!redundant_set) { + if (setNumber < MAXSETS) { + (void) sprintf(setname, "Set %d", setNumber); + if ((strcmp(PlotData[setNumber].setName, setname) == 0) && fn) { + PlotData[setNumber].setName = fn; + } + curSpot = &(PlotData[setNumber].list); + PlotData[setNumber].list = (PointList *) 0; + newGroup = 1; + setNumber++; + redundant_set = 1; + return 1; + } + else { + return 0; + } + } + else { + return 1; + } +} + +static void +rdSetName(name) +char *name; /* New set name */ + +/* + * Sets the name of a data set. Automatically makes a copy. + */ +{ + PlotData[setNumber - 1].setName = STRDUP(name); +} + +static void +rdGroup() +/* + * Set up for reading new group of points within a dataset. + */ +{ + newGroup = 1; +} + +static void +rdPoint(xval, yval) +double xval, + yval; /* New point */ + +/* + * Adds a new point to the current group of the current + * data set. + */ +{ + if (newGroup) { + *curSpot = (PointList *) Malloc(sizeof(PointList)); + curList = *curSpot; + curSpot = &(curList->next); + curList->numPoints = 0; + curList->allocSize = INITSIZE; + curList->xvec = (double *) Malloc((unsigned) + (INITSIZE * sizeof(double))); + curList->yvec = (double *) Malloc((unsigned) + (INITSIZE * sizeof(double))); + curList->next = (PointList *) 0; + newGroup = 0; + } + if (curList->numPoints >= curList->allocSize) { + curList->allocSize *= 2; + curList->xvec = (double *) Realloc((char *) curList->xvec, + (unsigned) (curList->allocSize * + sizeof(double))); + curList->yvec = (double *) Realloc((char *) curList->yvec, + (unsigned) (curList->allocSize * + sizeof(double))); + } + + curList->xvec[curList->numPoints] = xval; + curList->yvec[curList->numPoints] = yval; + + (curList->numPoints)++; + redundant_set = 0; +} + +static int +rdFindMax() +/* + * Returns the maximum number of items in any one group of any + * data set. + */ +{ + int i; + PointList *list; + int max = -1; + + for (i = 0; i < setNumber; i++) { + for (list = PlotData[i].list; list; list = list->next) { + if (list->numPoints > max) + max = list->numPoints; + } + } + return max; +} + + +typedef enum line_type { + EMPTY, COMMENT, SETNAME, DRAWPNT, MOVEPNT, SETPARAM, ERROR +} LineType; + +typedef struct point_defn { + double xval, + yval; +} Point; + +typedef struct parmval_defn { + char *name, + *value; +} ParmVals; + +typedef struct line_info { + LineType type; + union val_defn { + char *str; /* SETNAME, ERROR */ + Point pnt; /* DRAWPNT, MOVEPNT */ + ParmVals parm; /* SETPARAM */ + } val; +} LineInfo; + +static LineType +parse_line(line, result) +char *line; /* Line to parse */ +LineInfo *result; /* Returned result */ + +/* + * Parses `line' into one of the types given in the definition + * of LineInfo. The appropriate values are filled into `result'. + * Below are the current formats for each type: + * EMPTY: All white space + * COMMENT: Starts with "#" + * SETNAME: A name enclosed in double quotes + * DRAWPNT: Two numbers optionally preceded by keyword "draw" + * MOVEPNT: Two numbers preceded by keyword "move" + * SETPARAM: Two non-null strings separated by ":" + * ERROR: Not any of the above (an error message is returned) + * Note that often the values are pointers into the line itself + * and should be copied if they are to be used over a long period. + */ +{ + char *first; + + /* Find first non-space character */ + while (*line && isspace(*line)) + line++; + if (*line) { + if (*line == '#') { + /* comment */ + result->type = COMMENT; + } + else if (*line == '"') { + /* setname */ + result->type = SETNAME; + line++; + result->val.str = line; + while (*line && (*line != '\n') && (*line != '"')) + line++; + if (*line) + *line = '\0'; + } + else { + first = line; + while (*line && !isspace(*line)) + line++; + if (*line) { + *line = '\0'; + if (stricmp(first, "move") == 0) { + /* MOVEPNT */ + if (sscanf(line + 1, "%lf %lf", + &result->val.pnt.xval, + &result->val.pnt.yval) == 2) { + result->type = MOVEPNT; + } + else { + result->type = ERROR; + result->val.str = "Cannot read move coordinates"; + } + } + else if (stricmp(first, "draw") == 0) { + /* DRAWPNT */ + if (sscanf(line + 1, "%lf %lf", + &result->val.pnt.xval, + &result->val.pnt.yval) == 2) { + result->type = DRAWPNT; + } + else { + result->type = ERROR; + result->val.str = "Cannot read draw coordinates"; + } + } + else if (first[strlen(first) - 1] == ':') { + /* SETPARAM */ + first[strlen(first) - 1] = '\0'; + result->val.parm.name = first; + line++; + while (*line && isspace(*line)) + line++; + /* may be a \n at end of it */ + if (line[strlen(line) - 1] == '\n') { + line[strlen(line) - 1] = '\0'; + } + result->val.parm.value = line; + result->type = SETPARAM; + } + else if (sscanf(first, "%lf", &result->val.pnt.xval) == 1) { + /* DRAWPNT */ + if (sscanf(line + 1, "%lf", &result->val.pnt.yval) == 1) { + result->type = DRAWPNT; + } + else { + result->type = ERROR; + result->val.str = "Cannot read second coordinate"; + } + } + else { + /* ERROR */ + result->type = ERROR; + result->val.str = "Unknown line type"; + } + } + else { + /* ERROR */ + result->type = ERROR; + result->val.str = "Premature end of line"; + } + } + } + else { + /* empty */ + result->type = EMPTY; + } + return result->type; +} + + +int +ReadData(stream, filename) +FILE *stream; +char *filename; + +/* + * Reads in the data sets from the supplied stream. If the format + * is correct, it returns the current maximum number of points across + * all data sets. If there is an error, it returns -1. + */ +{ + char buffer[MAXBUFSIZE]; + LineInfo info; + int line_count = 0; + int errors = 0; + + if (!rdSet(filename)) { + (void) fprintf(stderr, "Error in file `%s' at line %d:\n %s\n", + filename, line_count, + "Too many data sets - extra data ignored"); + return -1; + } + while (fgets(buffer, MAXBUFSIZE, stream)) { + line_count++; + switch (parse_line(buffer, &info)) { + case EMPTY: + if (!rdSet(filename)) { + (void) fprintf(stderr, "Error in file `%s' at line %d:\n %s\n", + filename, line_count, + "Too many data sets - extra data ignored"); + return -1; + } + break; + case COMMENT: + /* nothing */ + break; + case SETNAME: + rdSetName(info.val.str); + break; + case DRAWPNT: + rdPoint(info.val.pnt.xval, info.val.pnt.yval); + break; + case MOVEPNT: + rdGroup(); + rdPoint(info.val.pnt.xval, info.val.pnt.yval); + break; + case SETPARAM: + param_reset(info.val.parm.name, info.val.parm.value); + break; + default: + if (filename) { + (void) fprintf(stderr, "Error in file `%s' at line %d:\n %s\n", + filename, line_count, info.val.str); + errors++; + } + break; + } + } +#ifdef DO_DER + Der1(); +#endif + if (errors) + return -1; + else + return rdFindMax(); +} + + diff --git a/xgraph/st.c b/xgraph/st.c new file mode 100644 index 000000000..eb8bd67ec --- /dev/null +++ b/xgraph/st.c @@ -0,0 +1,571 @@ +/*LINTLIBRARY*/ +/* + * String Table (Hash) Package + * + * Peter Moore + * University of California, Berkeley + * 1985 + * + * This is a general purpose hash table package. + */ + +#include +#include "copyright.h" +#include "st.h" +#include "xgraph.h" + +#define max(a,b) ((a) > (b) ? (a) : (b)) +#define nil(type) ((type *) 0) +#define alloc(type) (type *) Malloc(sizeof(type)) + +#define ABS(x) ((x) < 0 ? -(x) : (x)) +#define ST_NUMCMP(x,y) ((int) (x) - (int) (y)) +#define ST_NUMHASH(x,size) (ABS((int)x)%(size)) +#define ST_PTRHASH(x,size) ((int)((unsigned)(x)>>2)%size) +#define EQUAL(func, x, y) \ + ((((func) == st_numcmp) || ((func) == st_ptrcmp)) ?\ + (ST_NUMCMP((x),(y)) == 0) : ((*func)((x), (y)) == 0)) + + +#define do_hash(key, table)\ + ((table->hash == st_ptrhash) ? ST_PTRHASH((key),(table)->num_bins) :\ + (table->hash == st_numhash) ? ST_NUMHASH((key), (table)->num_bins) :\ + (*table->hash)((key), (table)->num_bins)) + +char st_pkg_name[] = "st"; + +/* Possible error conditions */ +char *st_no_mem = "out of memory"; +char *st_bad_ret = "bad return code from function passed to st_foreach"; +char *st_bad_gen = "null or zero generator"; + +/* Forward declarations */ +int st_numhash(), st_ptrhash(), st_numcmp(), st_ptrcmp(); +static void rehash(); +static void errRaise(); + + +st_table * +st_init_table_with_params(compare, hash, size, density, grow_factor, + reorder_flag) +int (*compare) (); +int (*hash) (); +int size; +int density; +double grow_factor; +int reorder_flag; + +/* Detailed table allocator */ +{ + st_table *new; + + new = alloc(st_table); + if (!new) { + errRaise(st_pkg_name, ST_NO_MEM, st_no_mem); + /* NOTREACHED */ + } + new->compare = compare; + new->hash = hash; + new->num_entries = 0; + new->max_density = density; + new->grow_factor = grow_factor; + new->reorder_flag = reorder_flag; + if (size <= 0) { + size = 1; + } + new->num_bins = size; + new->bins = + (st_table_entry **) Calloc((unsigned) size, sizeof(st_table_entry *)); + if (!new->bins) { + Free((char *) new); + errRaise(st_pkg_name, ST_NO_MEM, st_no_mem); + /* NOTREACHED */ + } + return new; +} + +st_table * +st_init_table(compare, hash) +int (*compare) (); +int (*hash) (); + +/* Default table allocator */ +{ + return st_init_table_with_params(compare, hash, ST_DEFAULT_INIT_TABLE_SIZE, + ST_DEFAULT_MAX_DENSITY, + ST_DEFAULT_GROW_FACTOR, + ST_DEFAULT_REORDER_FLAG); +} + + +void +st_Free_table(table) +st_table *table; + +/* Destroy a table */ +{ + register st_table_entry *ptr, + *next; + int i; + + for (i = 0; i < table->num_bins; i++) { + ptr = table->bins[i]; + while (ptr != nil(st_table_entry)) { + next = ptr->next; + Free((char *) ptr); + ptr = next; + } + } + Free((char *) table->bins); + Free((char *) table); +} + + +#define PTR_NOT_EQUAL(table, ptr, user_key)\ +(ptr != nil(st_table_entry) && !EQUAL(table->compare, user_key, (ptr)->key)) + +#define FIND_ENTRY(table, hash_val, key, ptr, last) \ + (last) = &(table)->bins[hash_val];\ + (ptr) = *(last);\ + while (PTR_NOT_EQUAL((table), (ptr), (key))) {\ + (last) = &(ptr)->next; (ptr) = *(last);\ + }\ + if ((ptr) != nil(st_table_entry) && (table)->reorder_flag) {\ + *(last) = (ptr)->next;\ + (ptr)->next = (table)->bins[hash_val];\ + (table)->bins[hash_val] = (ptr);\ + } + +int +st_lookup(table, key, value) +st_table *table; +register char *key; +char **value; + +/* Look up item in table -- return zero if not found */ +{ + int hash_val; + register st_table_entry *ptr, + **last; + + hash_val = do_hash(key, table); + + FIND_ENTRY(table, hash_val, key, ptr, last); + + if (ptr == nil(st_table_entry)) { + return 0; + } + else { + if (value != nil(char *)) + *value = ptr->record; + return 1; + } +} + +#define ADD_DIRECT(table, key, value, hash_val, new)\ +{\ + if (table->num_entries/table->num_bins >= table->max_density) {\ + (void) rehash(table);\ + hash_val = do_hash(key,table);\ + }\ + \ + new = alloc(st_table_entry);\ + \ + if (new) {\ + new->key = key;\ + new->record = value;\ + new->next = table->bins[hash_val];\ + table->bins[hash_val] = new;\ + table->num_entries++;\ + } else {\ + errRaise(st_pkg_name, ST_NO_MEM, st_no_mem);\ + /* NOTREACHED */ \ + } \ +} + +int +st_insert(table, key, value) +register st_table *table; +register char *key; +char *value; + +/* Insert an item into the table - replacing if it already exists */ +{ + int hash_val; + st_table_entry *new; + register st_table_entry *ptr, + **last; + + hash_val = do_hash(key, table); + + FIND_ENTRY(table, hash_val, key, ptr, last); + + if (ptr == nil(st_table_entry)) { + ADD_DIRECT(table, key, value, hash_val, new); + return 0; + } + else { + ptr->record = value; + return 1; + } +} + +void +st_add_direct(table, key, value) +st_table *table; +char *key; +char *value; + +/* Add item to table without checking for existing item */ +{ + int hash_val; + st_table_entry *new; + + hash_val = do_hash(key, table); + ADD_DIRECT(table, key, value, hash_val, new); +} + +int +st_find_or_add(table, key, slot) +st_table *table; +char *key; +char ***slot; + +/* Return slot for key - make one if one doesn't exist */ +{ + int hash_val; + st_table_entry *new, + *ptr, + **last; + + hash_val = do_hash(key, table); + + FIND_ENTRY(table, hash_val, key, ptr, last); + + if (ptr == nil(st_table_entry)) { + ADD_DIRECT(table, key, (char *) 0, hash_val, new); + if (slot != nil(char **)) + *slot = &new->record; + return 0; + } + else { + if (slot != nil(char **)) + *slot = &ptr->record; + return 1; + } +} + +int +st_find(table, key, slot) +st_table *table; +char *key; +char ***slot; + +/* Finds an entry in table */ +{ + int hash_val; + st_table_entry *ptr, + **last; + + hash_val = do_hash(key, table); + + FIND_ENTRY(table, hash_val, key, ptr, last); + + if (ptr == nil(st_table_entry)) { + return 0; + } + else { + if (slot != nil(char **)) + *slot = &ptr->record; + return 1; + } +} + +static void +rehash(table) +register st_table *table; + +/* Grows table */ +{ + register st_table_entry *ptr, + *next, + **old_bins = table->bins; + int i, + old_num_bins = table->num_bins, + hash_val; + + table->num_bins = table->grow_factor * old_num_bins; + + if (table->num_bins % 2 == 0) { + table->num_bins += 1; + } + + table->bins = + (st_table_entry **) Calloc((unsigned) table->num_bins, + sizeof(st_table_entry *)); + + if (!table->bins) { + /* If out of memory: don't resize */ + table->bins = old_bins; + table->num_bins = old_num_bins; + return; + } + + table->num_entries = 0; + + for (i = 0; i < old_num_bins; i++) { + ptr = old_bins[i]; + while (ptr != nil(st_table_entry)) { + next = ptr->next; + hash_val = do_hash(ptr->key, table); + ptr->next = table->bins[hash_val]; + table->bins[hash_val] = ptr; + table->num_entries++; + ptr = next; + } + } + Free((char *) old_bins); +} + +st_table * +st_copy(old_table) +st_table *old_table; +{ + st_table *new_table; + st_table_entry *ptr, + *new; + int i, + num_bins = old_table->num_bins; + + new_table = alloc(st_table); + if (new_table == nil(st_table)) { + errRaise(st_pkg_name, ST_NO_MEM, st_no_mem); + /* NOTREACHED */ + } + + *new_table = *old_table; + new_table->bins = + (st_table_entry **) Calloc((unsigned) num_bins, sizeof(st_table_entry *)); + + if (new_table->bins == nil(st_table_entry *)) { + Free((char *) new_table); + errRaise(st_pkg_name, ST_NO_MEM, st_no_mem); + /* NOTREACHED */ + } + + for (i = 0; i < num_bins; i++) { + new_table->bins[i] = nil(st_table_entry); + ptr = old_table->bins[i]; + while (ptr != nil(st_table_entry)) { + new = alloc(st_table_entry); + if (new == nil(st_table_entry)) { + Free((char *) new_table->bins); + Free((char *) new_table); + errRaise(st_pkg_name, ST_NO_MEM, st_no_mem); + /* NOTREACHED */ + } + *new = *ptr; + new->next = new_table->bins[i]; + new_table->bins[i] = new; + ptr = ptr->next; + } + } + return new_table; +} + +int +st_delete(table, keyp, value) +register st_table *table; +register char **keyp; +char **value; +{ + int hash_val; + char *key = *keyp; + register st_table_entry *ptr, + **last; + + hash_val = do_hash(key, table); + + FIND_ENTRY(table, hash_val, key, ptr, last); + + if (ptr == nil(st_table_entry)) { + return 0; + } + + *last = ptr->next; + if (value != nil(char *)) + *value = ptr->record; + *keyp = ptr->key; + Free((char *) ptr); + table->num_entries--; + return 1; +} + +int +st_foreach(table, func, arg) +st_table *table; +enum st_retval (*func) (); +char *arg; +{ + st_table_entry *ptr, + **last; + enum st_retval retval; + int i; + + for (i = 0; i < table->num_bins; i++) { + last = &table->bins[i]; + ptr = *last; + while (ptr != nil(st_table_entry)) { + retval = (*func) (ptr->key, ptr->record, arg); + switch (retval) { + case ST_CONTINUE: + last = &ptr->next; + ptr = *last; + break; + case ST_STOP: + return 0; + case ST_DELETE: + *last = ptr->next; + Free((char *) ptr); + ptr = *last; + break; + default: + errRaise(st_pkg_name, ST_BAD_RET, st_bad_ret); + /* NOTREACHED */ + } + } + } + return 1; +} + +int +st_strhash(string, modulus) +register char *string; +int modulus; +{ + register int val = 0; + register int c; + + while ((c = *string++) != '\0') { + val = val * 997 + c; + } + + return ((val < 0) ? -val : val) % modulus; +} + +int +st_numhash(x, size) +char *x; +int size; +{ + return ST_NUMHASH(x, size); +} + +int +st_ptrhash(x, size) +char *x; +int size; +{ + return ST_PTRHASH(x, size); +} + +int +st_numcmp(x, y) +char *x; +char *y; +{ + return ST_NUMCMP(x, y); +} + +int +st_ptrcmp(x, y) +char *x; +char *y; +{ + return ST_NUMCMP(x, y); +} + +st_generator * +st_init_gen(table) +st_table *table; + +/* Initializes generation of items in table */ +{ + st_generator *gen; + + gen = alloc(st_generator); + if (!gen) { + errRaise(st_pkg_name, ST_NO_MEM, st_no_mem); + /* NOTREACHED */ + } + gen->table = table; + gen->entry = nil(st_table_entry); + gen->idx = 0; + return gen; +} + + +int +st_gen(gen, key_p, value_p) +st_generator *gen; +char **key_p; +char **value_p; + +/* Generates next item in generation sequence */ +{ + register int i; + + if (!gen) { + errRaise(st_pkg_name, ST_BAD_GEN, st_bad_gen); + /* NOTREACHED */ + } + + if (gen->entry == nil(st_table_entry)) { + /* try to find next entry */ + for (i = gen->idx; i < gen->table->num_bins; i++) { + if (gen->table->bins[i] != nil(st_table_entry)) { + gen->idx = i + 1; + gen->entry = gen->table->bins[i]; + break; + } + } + if (gen->entry == nil(st_table_entry)) { + return 0; /* that's all folks ! */ + } + } + *key_p = gen->entry->key; + if (value_p != 0) + *value_p = gen->entry->record; + gen->entry = gen->entry->next; + return 1; +} + + +void +st_Free_gen(gen) +st_generator *gen; +{ + if (gen) { + Free((char *) gen); + } + else { + errRaise(st_pkg_name, ST_BAD_GEN, st_bad_gen); + /* NOTREACHED */ + } +} + + +static void +errRaise(pkg, num, msg) +char *pkg; +int num; +char *msg; + +/* + * In this standalone version of st, and error raise causes + * an abort after printing a message. + */ +{ + (void) fprintf(stderr, "%s: %s\n", pkg, msg); + abort(); +} diff --git a/xgraph/st.h b/xgraph/st.h new file mode 100644 index 000000000..1e09a27ed --- /dev/null +++ b/xgraph/st.h @@ -0,0 +1,119 @@ +/* $Header$ */ + +#ifndef ST_INCLUDED +#define ST_INCLUDED + +/* Function prototypes */ +#ifdef __STDC__ +#define ARGS(args) args +#else +#define ARGS(args) () +#endif + +extern char st_pkg_name[]; + +/* Fatal error codes */ +#define ST_NO_MEM 0 +#define ST_BAD_RET 1 +#define ST_BAD_GEN 2 + +typedef struct st_table_entry st_table_entry; +struct st_table_entry { + char *key; + char *record; + st_table_entry *next; +}; + +typedef struct st_table st_table; +struct st_table { + int (*compare) (); + int (*hash) (); + int num_bins; + int num_entries; + int max_density; + int reorder_flag; + double grow_factor; + st_table_entry **bins; +}; + +typedef struct st_generator st_generator; +struct st_generator { + st_table *table; + st_table_entry *entry; + int idx; +}; + +#define st_is_member(table,key) st_lookup(table,key,(char **) 0) +#define st_count(table) ((table)->num_entries) + +enum st_retval { + ST_CONTINUE, ST_STOP, ST_DELETE +}; + +extern st_table *st_init_table_with_params + ARGS((int (*compare) (), int (*hash) (), int size, int density, + double grow_factor, int reorder_flag)); + +extern st_table *st_init_table + ARGS((int (*compare) (), int (*hash) ())); + +extern void st_free_table + ARGS((st_table * table)); + +extern int st_lookup + ARGS((st_table * table, char *key, char **value)); + +extern int st_insert + ARGS((st_table * table, char *key, char *value)); + +extern void st_add_direct + ARGS((st_table * table, char *key, char *value)); + +extern int st_find_or_add + ARGS((st_table * table, char *key, char ***slot)); + +extern int st_find + ARGS((st_table * table, char *key, char ***slot)); + +extern st_table *st_copy + ARGS((st_table * old_table)); + +extern int st_delete + ARGS((st_table * table, char **keyp, char **value)); + +extern int st_foreach + ARGS((st_table * table, enum st_retval(*func) (), char *arg)); + +extern int st_strhash + ARGS((char *string, int modulus)); + +extern int st_numhash + ARGS((char *x, int size)); + +extern int st_ptrhash + ARGS((char *x, int size)); + +extern int st_numcmp + ARGS((char *x, char *y)); + +extern int st_ptrcmp + ARGS((char *x, char *y)); + +extern st_generator *st_init_gen + ARGS((st_table * table)); + +extern int st_gen + ARGS((st_generator * gen, char **key_p, char **value_p)); + +extern void st_free_gen + ARGS((st_generator * gen)); + +#define ST_DEFAULT_MAX_DENSITY 5 +#define ST_DEFAULT_INIT_TABLE_SIZE 11 +#define ST_DEFAULT_GROW_FACTOR 2.0 +#define ST_DEFAULT_REORDER_FLAG 0 + +#define st_foreach_item(table, gen, key_p, value_p) \ + for(gen=st_init_gen(table); st_gen(gen,key_p,value_p) || (st_free_gen(gen),0);) + +#endif /* ST_INCLUDED */ diff --git a/xgraph/stamp-h.in b/xgraph/stamp-h.in new file mode 100644 index 000000000..9788f7023 --- /dev/null +++ b/xgraph/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/xgraph/tgif.c b/xgraph/tgif.c new file mode 100644 index 000000000..b4fac94ab --- /dev/null +++ b/xgraph/tgif.c @@ -0,0 +1,329 @@ +/* + * Tgif Output + * + * Christos Zoulas + */ + +#include +#include +#include "hard_devices.h" +#include "xgout.h" + +#define COLOR "DarkSlateGray" + +typedef struct { + char *title_font; + char *axis_font; + int title_size; + int axis_size; + FILE *strm; +} Info; + +char *tgif_prologue[] = +{ + "state(0,13,0,0,0,16,1,5,1,1,0,0,1,0,1,0,1,0,4,0,0,0,10,0).\n", + "%\n", + "% Tgif xgraph output.\n", + "%\n", + 0 +}; + +/* + * Hardcopy Interface for Xgraph + * + * Major differences from first version: + * Four new parameters are passed to the device initialization routine: + * title_family, title_size, axis_family, and axis_size. See the + * description of xg_init() for details. + * + * Clipping is done automatically by xgraph. The xg_clip() routine + * is obsolete. + * + * The xg_line() routine has become the xg_seg() routine. It now + * draws segments rather than a series of lines. + * + * A new field (max_segs) in the device structure now specifies + * the maximum number of segments the device can handle in a group. + */ + + + + +void tgifText(); +void tgifDot(); +void tgifSeg(); +void tgifEnd(); + +int +tgifInit(strm, width, height, title_family, title_size, + axis_family, axis_size, flags, out_info, errmsg) +FILE *strm; /* Output stream */ +int width, + height; /* Size of space (microns) */ +char *title_family; /* Name of title font family */ +double title_size; /* Title font height (points) */ +char *axis_family; /* Name of axis font family */ +double axis_size; /* Axis font height (points) */ +int flags; /* Flags */ +xgOut *out_info; /* Device info (RETURN) */ +char errmsg[ERRBUFSIZE]; /* Error message area */ + +{ + Info *tgif_info; + char **l; + double scx, + scy; + + tgif_info = (Info *) Malloc(sizeof(*tgif_info)); + + for (l = tgif_prologue; *l; l++) + fprintf(strm, "%s\n", *l); + + out_info->dev_flags = 0; + scx = width / 512.0; + scy = height / 512.0; + if (scx > scy) { + scy /= scx; + scx = 1; + } + else { + scx /= scy; + scy = 1; + } + out_info->bdr_pad = title_size / 4; + out_info->axis_pad = 2.0 * axis_size; + out_info->legend_pad = 0; + + out_info->area_w = width * 0.00283 * scx; /* pts per micron */ + out_info->area_h = height * 0.00283 * scy; + + out_info->tick_len = axis_size; + out_info->axis_height = axis_size; + out_info->title_height = title_size; + out_info->axis_width = (axis_size * 5.0) / 12.0; + out_info->title_width = (title_size * 5.0) / 12.0; + out_info->max_segs = 100; + out_info->xg_text = tgifText; + out_info->xg_seg = tgifSeg; + out_info->xg_dot = tgifDot; + out_info->xg_end = tgifEnd; + out_info->user_state = (char *) tgif_info; + + tgif_info->title_font = title_family; + tgif_info->axis_font = axis_family; + tgif_info->title_size = title_size; + tgif_info->axis_size = axis_size; + tgif_info->strm = strm; + return 1; +} + +/* Text justifications */ +#define T_CENTER 0 +#define T_LEFT 1 +#define T_UPPERLEFT 2 +#define T_TOP 3 +#define T_UPPERRIGHT 4 +#define T_RIGHT 5 +#define T_LOWERRIGHT 6 +#define T_BOTTOM 7 +#define T_LOWERLEFT 8 + +/* Text styles */ +#define T_AXIS 0 +#define T_TITLE 1 + +static void +tgif_just(x, y, just, size, len) +int *x, + *y; /* Given location (lower left) */ +int just; /* Justification */ +int size; /* Size in points */ +int len; /* Number of chars */ + +/* + * Unfortunately, tgif really can't display text with a justification. + * This is a horrible hack to try to get around the problem. It tries + * to compute a rough bounding box for the text based on the text height + * and the string length and offset `x,y' appropriately for the justification. + * This is only a hack... + */ +{ + int t_width, + t_height; + + t_height = size; + t_width = (size * len * 5) / 12; /* Horrible estimate */ + + switch (just) { + case T_CENTER: + *x -= t_width / 2; + *y -= t_height / 2; + break; + case T_LEFT: + *y -= t_height / 2; + break; + case T_UPPERLEFT: + /* nothing */ + break; + case T_TOP: + *x -= t_width / 2; + break; + case T_UPPERRIGHT: + *x -= t_width; + break; + case T_RIGHT: + *x -= t_width; + *y -= t_height / 2; + break; + case T_LOWERRIGHT: + *x -= t_width; + *y -= t_height; + break; + case T_BOTTOM: + *x -= t_width / 2; + *y -= t_height; + break; + case T_LOWERLEFT: + *y -= t_height; + break; + } + + /* + * Also, tgif seems to put a space above all text it draws. The + * computation below compensates for this. + */ + *y += (size / 3); +} + +void +tgifText(user_state, x, y, text, just, style) +char *user_state; /* Value set in xg_init */ +int x, + y; /* Text position (pixels) */ +char *text; /* Null terminated text */ +int just; /* Justification (above) */ +int style; /* Text style (above) */ + +/* + * This routine should draw text at the indicated position using + * the indicated justification and style. The justification refers + * to the location of the point in reference to the text. For example, + * if just is T_LOWERLEFT, (x,y) should be located at the lower left + * edge of the text string. + */ +{ + char *font; + int size; + Info *tgif = (Info *) user_state; + + /* + * Obj = text(_Color,_X,_Y,_Font,_TextStyle,_TextSize,_NumLines,_TextJust, + * _TextRotate,_PenPat,_BBoxW,_BBoxH,_Id,_TextDPI,_Asc,_Des, + * _ObjFill,_Vspace,StrList), + */ + /* font ok too */ + style == T_AXIS ? tgif->axis_font : + tgif->title_font; + /* ok 0, 1 as in tgif */ + size = style == T_AXIS ? tgif->axis_size : + tgif->title_size; + tgif_just(&x, &y, just, size, strlen(text)); + + if (size <= 8) + size = 0; + else if (size <= 10) + size = 1; + else if (size <= 12) + size = 2; + else if (size <= 14) + size = 3; + else if (size <= 18) + size = 4; + else + size = 5; + + fprintf(tgif->strm, + "text('%s',%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,[\n\t", + COLOR, x, y, 0, style, size, 1, 0, 0, 1, 0, 0, 0, 0, 18, 4, 0, 0); + fprintf(tgif->strm, + "\"%s\"]).\n", text); +} + +/* Line Styles */ +#define L_AXIS 0 +#define L_ZERO 1 +#define L_VAR 2 + +void +tgifSeg(user_state, ns, seglist, width, style, lappr, color) +char *user_state; /* Value set in xg_init */ +int ns; /* Number of segments */ +XSegment *seglist; /* X array of segments */ +int width; /* Width of lines */ +int style; /* See above */ +int lappr; /* Line appearence */ +int color; /* Line color (if any) */ +{ + Info *tgif = (Info *) user_state; + int i, + j, + k; + + /* + * poly(_Color,_NumVs,_Vs,_LineStyle,_LineWidth,_PenPat,_Id,_Spline, + * _ObjFill,_Dash,AttrList), + */ + static int style_list[] = + { + 1, 10, 7, 6, 5, 4, 3, 2 + }; + + for (i = 0; i < ns; i++) { + fprintf(tgif->strm, "poly('%s',2,[%d,%d,%d,%d],", COLOR, + seglist[i].x1, seglist[i].y1, + seglist[i].x2, seglist[i].y2); + fprintf(tgif->strm, "%d,%d,%d,%d,%d,%d,%d,[\n]).\n", 0, width, + style_list[lappr], 0, 0, style_list[lappr], 0); + } +} + +/* Marker styles */ +#define P_PIXEL 0 +#define P_DOT 1 +#define P_MARK 2 + +void +tgifDot(user_state, x, y, style, type, color) +char *user_state; /* Value set in xg_init */ +int x, + y; /* Location in pixel units */ +int style; /* Dot style */ +int type; /* Type of marker */ +int color; /* Marker color (if any) */ + +/* + * This routine should draw a marker at location `x,y'. If the + * style is P_PIXEL, the dot should be a single pixel. If + * the style is P_DOT, the dot should be a reasonably large + * dot. If the style is P_MARK, it should be a distinguished + * mark which is specified by `type' (0-7). If the output + * device is capable of color, the marker should be drawn in + * `color' (0-7) which corresponds with the color for xg_line. + */ +{ +} + +void +tgifEnd(user_state) +char *user_state; + +/* + * This routine is called after a drawing sequence is complete. + * It can be used to clean up the user state and set the device + * state appropriately. This routine is optional in the structure. + */ +{ + Info *tgif = (Info *) user_state; + + fclose(tgif->strm); +} diff --git a/xgraph/xgX.c b/xgraph/xgX.c new file mode 100644 index 000000000..5d20cf053 --- /dev/null +++ b/xgraph/xgX.c @@ -0,0 +1,480 @@ +/* + * Generic Output Driver for X + * X version 11 + * + * This is the primary output driver used by the new X graph + * to display output to the X server. It has been factored + * out of the original xgraph to allow mulitple hardcopy + * output devices to share xgraph's capabilities. Note: + * xgraph is still heavily X oriented. This is not intended + * for porting to other window systems. + */ + +#include "copyright.h" +#include "xgout.h" +#include "params.h" + +#define PADDING 2 +#define SPACE 10 +#define TICKLENGTH 5 +#define MAXSEGS 1000 + +struct x_state { + Window win; /* Primary window */ +}; + +void text_X(); +void seg_X(); +void dot_X(); + + +typedef struct attr_set { + char lineStyle[MAXLS]; + int lineStyleLen; + Pixel pixelValue; + Pixmap markStyle; +} AttrSet; + +static AttrSet AllAttrs[MAXATTR]; + +static Pixmap dotMap = (Pixmap) 0; + +/* + * Marker bitmaps + */ + +#include "bitmaps/dot.11" + +#include "bitmaps/mark1.11" +#include "bitmaps/mark2.11" +#include "bitmaps/mark3.11" +#include "bitmaps/mark4.11" +#include "bitmaps/mark5.11" +#include "bitmaps/mark6.11" +#include "bitmaps/mark7.11" +#include "bitmaps/mark8.11" + +/* Sizes exported for marker drawing */ +static unsigned int dot_w = dot_width; +static unsigned int dot_h = dot_height; +static unsigned int mark_w = mark1_width; +static unsigned int mark_h = mark1_height; +static int mark_cx = mark1_x_hot; +static int mark_cy = mark1_y_hot; + + + +void +set_X(new_win, out_info) +Window new_win; /* Newly created window */ +xgOut *out_info; /* Information to set */ + +/* + * Sets some of the common parameters for the X output device. + */ +{ + struct x_state *new_state; + XFontStruct *font; + + out_info->dev_flags = ((depth > 3) ? D_COLOR : 0); + out_info->area_w = out_info->area_h = 0; /* Set later */ + out_info->bdr_pad = PADDING; + out_info->axis_pad = SPACE; + out_info->legend_pad = 0; + out_info->tick_len = TICKLENGTH; + + font = PM_FONT("LabelFont"); +#ifdef OLD + out_info->axis_width = + font->max_bounds.rbearing - font->max_bounds.lbearing; +#endif + out_info->axis_width = XTextWidth(font, "8", 1); + out_info->axis_height = + font->max_bounds.ascent + font->max_bounds.descent; + + font = PM_FONT("TitleFont"); +#ifdef OLD + out_info->title_width = + font->max_bounds.rbearing - font->max_bounds.lbearing; +#endif + out_info->title_width = XTextWidth(font, "8", 1); + out_info->title_height = + font->max_bounds.ascent + font->max_bounds.descent; + out_info->max_segs = MAXSEGS; + + out_info->xg_text = text_X; + out_info->xg_seg = seg_X; + out_info->xg_dot = dot_X; + out_info->xg_end = (void (*) ()) 0; + new_state = (struct x_state *) Malloc(sizeof(struct x_state)); + new_state->win = new_win; + out_info->user_state = (char *) new_state; +} + + + +static void +init_once() +/* + * Initializes AllAttrs. + */ +{ + Window temp_win; + XSetWindowAttributes wattr; + char name[1024]; + int idx; + params style_val; + + /* Get attributes out parameters database */ + for (idx = 0; idx < MAXATTR; idx++) { + (void) sprintf(name, "%d.Style", idx); + (void) param_get(name, &style_val); + AllAttrs[idx].lineStyleLen = style_val.stylev.len; + (void) strncpy(AllAttrs[idx].lineStyle, style_val.stylev.dash_list, + style_val.stylev.len); + (void) sprintf(name, "%d.Color", idx); + AllAttrs[idx].pixelValue = PM_PIXEL(name); + } + + /* Create a temporary window for representing depth */ + temp_win = XCreateWindow(disp, RootWindow(disp, screen), + 0, 0, 10, 10, 0, depth, InputOutput, + vis, (unsigned long) 0, &wattr); + + /* Store bitmaps for dots and markers */ + dotMap = XCreateBitmapFromData(disp, temp_win, dot_bits, dot_w, dot_h); + + AllAttrs[0].markStyle = XCreateBitmapFromData(disp, temp_win, + mark1_bits, mark_w, mark_h); + AllAttrs[1].markStyle = XCreateBitmapFromData(disp, temp_win, + mark2_bits, mark_w, mark_h); + AllAttrs[2].markStyle = XCreateBitmapFromData(disp, temp_win, + mark3_bits, mark_w, mark_h); + AllAttrs[3].markStyle = XCreateBitmapFromData(disp, temp_win, + mark4_bits, mark_w, mark_h); + AllAttrs[4].markStyle = XCreateBitmapFromData(disp, temp_win, + mark5_bits, mark_w, mark_h); + AllAttrs[5].markStyle = XCreateBitmapFromData(disp, temp_win, + mark6_bits, mark_w, mark_h); + AllAttrs[6].markStyle = XCreateBitmapFromData(disp, temp_win, + mark7_bits, mark_w, mark_h); + AllAttrs[7].markStyle = XCreateBitmapFromData(disp, temp_win, + mark8_bits, mark_w, mark_h); + XDestroyWindow(disp, temp_win); +} + +/*ARGSUSED*/ +void +init_X(user_state) +char *user_state; + +/* + * Initializes for an X drawing sequence. Sets up drawing attributes + * by reading values from the parameter database. + */ +{ + static int initialized = 0; + + if (!initialized) { + init_once(); + initialized = 1; + } +} + +static GC +textGC(t_win, t_font) +Window t_win; /* Window for making GC */ +XFontStruct *t_font; /* Text font */ + +/* + * Sets the fields above in a global graphics context. If + * the graphics context does not exist, it is created. + */ +{ + static GC text_gc = (GC) 0; + XGCValues gcvals; + unsigned long gcmask; + + gcvals.font = t_font->fid; + gcmask = GCFont; + if (text_gc == (GC) 0) { + gcvals.foreground = PM_PIXEL("Foreground"); + gcmask |= GCForeground; + text_gc = XCreateGC(disp, t_win, gcmask, &gcvals); + } + else { + XChangeGC(disp, text_gc, gcmask, &gcvals); + } + return text_gc; +} + +static GC +segGC(l_win, l_fg, l_style, l_width, l_chars, l_len) +Window l_win; /* Window for making GC */ +Pixel l_fg; /* Foreground color */ +int l_style; /* Line style */ +int l_width; /* Line width */ +char *l_chars; /* Character spec */ +int l_len; /* Length of spec */ + +/* + * Sets the fields above in a global graphics context. If the + * graphics context does not exist, it is created. + */ +{ + static GC segment_gc = (GC) 0; + XGCValues gcvals; + unsigned long gcmask; + + gcvals.foreground = l_fg; + gcvals.line_style = l_style; + gcvals.line_width = l_width; + gcmask = GCForeground | GCLineStyle | GCLineWidth; + if (segment_gc == (GC) 0) { + segment_gc = XCreateGC(disp, l_win, gcmask, &gcvals); + } + else { + XChangeGC(disp, segment_gc, gcmask, &gcvals); + } + if (l_len > 0) { + XSetDashes(disp, segment_gc, 0, l_chars, l_len); + } + return segment_gc; +} + +static GC +dotGC(d_win, d_fg, d_clipmask, d_xorg, d_yorg) +Window d_win; /* Window for making GC */ +Pixel d_fg; /* Foreground color */ +Pixmap d_clipmask; /* Clipmask */ +int d_xorg, + d_yorg; /* Clipmask origin */ + +/* + * Sets the fields above in a global graphics context. If the + * graphics context does not exist, it is created. + */ +{ + static GC dot_gc = (GC) 0; + XGCValues gcvals; + unsigned long gcmask; + + gcvals.foreground = d_fg; + gcvals.clip_mask = d_clipmask; + gcvals.clip_x_origin = d_xorg; + gcvals.clip_y_origin = d_yorg; + gcmask = GCForeground | GCClipMask | GCClipXOrigin | GCClipYOrigin; + if (dot_gc == (GC) 0) { + dot_gc = XCreateGC(disp, d_win, gcmask, &gcvals); + } + else { + XChangeGC(disp, dot_gc, gcmask, &gcvals); + } + return dot_gc; +} + + + +void +text_X(user_state, x, y, text, just, style) +char *user_state; /* Value set in xg_init */ +int x, + y; /* Text position (pixels) */ +char *text; /* Null terminated text */ +int just; /* Justification (above) */ +int style; /* Text style (above) */ + +/* + * This routine should draw text at the indicated position using + * the indicated justification and style. The justification refers + * to the location of the point in reference to the text. For example, + * if just is T_LOWERLEFT, (x,y) should be located at the lower left + * edge of the text string. + */ +{ + struct x_state *st = (struct x_state *) user_state; + XCharStruct bb; + int rx = 0, + ry = 0, + len, + height, + width, + dir; + int ascent, + descent; + XFontStruct *font; + + len = strlen(text); + font = ((style == T_TITLE) ? PM_FONT("TitleFont") : PM_FONT("LabelFont")); + XTextExtents(font, text, len, &dir, &ascent, &descent, &bb); + width = bb.rbearing - bb.lbearing; + height = bb.ascent + bb.descent; + + switch (just) { + case T_CENTER: + rx = x - (width / 2); + ry = y - (height / 2); + break; + case T_LEFT: + rx = x; + ry = y - (height / 2); + break; + case T_UPPERLEFT: + rx = x; + ry = y; + break; + case T_TOP: + rx = x - (width / 2); + ry = y; + break; + case T_UPPERRIGHT: + rx = x - width; + ry = y; + break; + case T_RIGHT: + rx = x - width; + ry = y - (height / 2); + break; + case T_LOWERRIGHT: + rx = x - width; + ry = y - height; + break; + case T_BOTTOM: + rx = x - (width / 2); + ry = y - height; + break; + case T_LOWERLEFT: + rx = x; + ry = y - height; + break; + } + XDrawString(disp, st->win, + textGC(st->win, font), + rx, ry + bb.ascent, text, len); +} + + + +void +seg_X(user_state, ns, segs, width, style, lappr, color) +char *user_state; /* Value set in xg_init */ +int ns; /* Number of segments */ +XSegment *segs; /* X array of segments */ +int width; /* Width of lines */ +int style; /* See above */ +int lappr; /* Line appearence */ +int color; /* Line color (if any) */ + +/* + * This routine draws a number of line segments at the points + * given in `seglist'. Note that contiguous segments need not share + * endpoints but often do. All segments should be `width' devcoords wide + * and drawn in style `style'. If `style' is L_VAR, the parameters + * `color' and `lappr' should be used to draw the line. Both + * parameters vary from 0 to 7. If the device is capable of + * color, `color' varies faster than `style'. If the device + * has no color, `style' will vary faster than `color' and + * `color' can be safely ignored. However, if the + * the device has more than 8 line appearences, the two can + * be combined to specify 64 line style variations. + * Xgraph promises not to send more than the `max_segs' in the + * xgOut structure passed back from xg_init(). + */ +{ + struct x_state *st = (struct x_state *) user_state; + param_style ps; + GC gc; + + if (style == L_AXIS) { + ps = PM_STYLE("GridStyle"); + if (ps.len < 2) { + gc = segGC(st->win, PM_PIXEL("Foreground"), + LineSolid, PM_INT("GridSize"), (char *) 0, 0); + } + else { + gc = segGC(st->win, PM_PIXEL("Foreground"), + LineOnOffDash, PM_INT("GridSize"), + ps.dash_list, ps.len); + } + } + else if (style == L_ZERO) { + /* Set the color and line style */ + ps = PM_STYLE("ZeroStyle"); + if (ps.len < 2) { + gc = segGC(st->win, PM_PIXEL("ZeroColor"), + LineSolid, PM_INT("ZeroWidth"), (char *) 0, 0); + } + else { + gc = segGC(st->win, PM_PIXEL("ZeroColor"), + LineOnOffDash, PM_INT("ZeroWidth"), + ps.dash_list, ps.len); + } + } + else { + /* Color and line style vary */ + if (lappr == 0) { + gc = segGC(st->win, AllAttrs[color].pixelValue, LineSolid, + width, (char *) 0, 0); + } + else { + gc = segGC(st->win, AllAttrs[color].pixelValue, LineOnOffDash, + width, AllAttrs[lappr].lineStyle, AllAttrs[lappr].lineStyleLen); + } + /* PW */ + if (lappr == 16) { + gc = segGC(st->win, PM_PIXEL("BackGround"), LineSolid, + width, (char *) 0, 0); + } + } + XDrawSegments(disp, st->win, gc, segs, ns); +} + + +#define LAST_CHECK + +void +dot_X(user_state, x, y, style, type, color) +char *user_state; /* Value set in xg_init */ +int x, + y; /* Location in pixel units */ +int style; /* Dot style */ +int type; /* Type of marker */ +int color; /* Marker color (if any) */ + +/* + * This routine should draw a marker at location `x,y'. If the + * style is P_PIXEL, the dot should be a single pixel. If + * the style is P_DOT, the dot should be a reasonably large + * dot. If the style is P_MARK, it should be a distinguished + * mark which is specified by `type' (0-7). If the output + * device is capable of color, the marker should be drawn in + * `color' (0-7) which corresponds with the color for xg_line. + */ +{ + struct x_state *st = (struct x_state *) user_state; + + switch (style) { + case P_PIXEL: + XDrawPoint(disp, st->win, + dotGC(st->win, AllAttrs[color].pixelValue, (Pixmap) 0, 0, 0), + x, y); + break; + case P_DOT: + XFillRectangle(disp, st->win, + dotGC(st->win, AllAttrs[color].pixelValue, dotMap, + (int) (x - (dot_w >> 1)), + (int) (y - (dot_h >> 1))), + (int) (x - (dot_w >> 1)), (int) (y - (dot_h >> 1)), + dot_w, dot_h); + break; + case P_MARK: + XFillRectangle(disp, st->win, + dotGC(st->win, AllAttrs[color].pixelValue, + AllAttrs[type].markStyle, + (int) (x - mark_cx), + (int) (y - mark_cy)), + (int) (x - mark_cx), (int) (y - mark_cy), + mark_w, mark_h); + break; + } +} diff --git a/xgraph/xgout.h b/xgraph/xgout.h new file mode 100644 index 000000000..4e6a31d61 --- /dev/null +++ b/xgraph/xgout.h @@ -0,0 +1,65 @@ +/* + * Output Device Information + * + * This file contains definitions for output device interfaces + * to the graphing program xgraph. + */ +#ifndef _h_xgout +#define _h_xgout +/* Passed device option flags */ +#define D_DOCU 0x01 + +/* Returned device capability flags */ +#define D_COLOR 0x01 + +/* Text justifications */ +#define T_CENTER 0 +#define T_LEFT 1 +#define T_UPPERLEFT 2 +#define T_TOP 3 +#define T_UPPERRIGHT 4 +#define T_RIGHT 5 +#define T_LOWERRIGHT 6 +#define T_BOTTOM 7 +#define T_LOWERLEFT 8 + +/* Text styles */ +#define T_AXIS 0 +#define T_TITLE 1 + +/* Line Styles */ +#define L_AXIS 0 +#define L_ZERO 1 +#define L_VAR 2 + +/* Marker Styles */ +#define P_PIXEL 0 +#define P_DOT 1 +#define P_MARK 2 + +/* Output device information returned by initialization routine */ + +typedef struct xg_out { + int dev_flags; /* Device characteristic flags */ + int area_w, + area_h; /* Width and height in pixels */ + int bdr_pad; /* Padding from border */ + int axis_pad; /* Extra space around axis labels */ + int tick_len; /* Length of tick mark on axis */ + int legend_pad; /* Top of legend text to legend line */ + int axis_width; /* Width of big character of axis font */ + int axis_height; /* Height of big character of axis font */ + int title_width; /* Width of big character of title font */ + int title_height; /* Height of big character of title font */ + int max_segs; /* Maximum number of segments in group */ + + void (*xg_text) (); /* Draws text at a location */ + void (*xg_seg) (); /* Draws a series of segments */ + void (*xg_dot) (); /* Draws a dot or marker at a location */ + void (*xg_end) (); /* Stops the drawing sequence */ + + char *user_state; /* User supplied data */ +} xgOut; + +#define ERRBUFSIZE 2048 +#endif /* _h_xgout */ diff --git a/xgraph/xgraph.c b/xgraph/xgraph.c new file mode 100644 index 000000000..4a836e55e --- /dev/null +++ b/xgraph/xgraph.c @@ -0,0 +1,1279 @@ +/* $Header$ */ +/* + * xgraph - A Simple Plotter for X + * + * David Harrison + * University of California, Berkeley + * 1986, 1987, 1988, 1989 + * + * Please see copyright.h concerning the formal reproduction rights + * of this software. + * + * $Log$ + * Revision 1.1 2004-01-25 09:00:49 pnenzi + * + * Added xgraph plotting program. + * + * Revision 1.3 1999/12/19 00:52:07 heideman + * warning suppresion, slightly different flot ahndling + * + * Revision 1.2 1999/12/03 23:17:46 heideman + * apply xgraph_no_animation.patch + * + * Revision 1.1.1.1 1999/12/03 23:15:52 heideman + * xgraph-12.0 + * + */ +#ifndef lint +static char rcsid[] = "$Id$"; +#endif + +#include "copyright.h" +#include +#include +#include +#include +#include "xgraph.h" +#include "xtb.h" +#include "hard_devices.h" +#include "params.h" + + +extern void init_X(); +extern void do_error(); + +#ifdef DO_DER +extern void Bounds(); +#endif /* DO_DER */ + +static char *tildeExpand(); +static void ReverseIt(); +static void Traverse(); +static int XErrHandler(); + + +NewDataSet PlotData[MAXSETS], + DataD1[MAXSETS], + DataD2[MAXSETS]; + +XSegment *Xsegs[2]; /* Point space for X */ + +/* Basic transformation stuff */ +double llx, + lly, + urx, + ury; /* Bounding box of all data */ + +static XContext win_context = (XContext) 0; + +/* Other globally set defaults */ + +Display *disp; /* Open display */ +Visual *vis; /* Standard visual */ +Colormap cmap; /* Standard colormap */ +int screen; /* Screen number */ +int depth; /* Depth of screen */ + +int numFiles = 0; /* Number of input files */ +char *inFileNames[MAXSETS]; /* File names */ + +/* Total number of active windows */ +int Num_Windows = 0; +char *Prog_Name; +char *disp_name; + + + +main(argc, argv) +int argc; +char *argv[]; + +/* + * This sets up the hard-wired defaults and reads the X defaults. + * The command line format is: xgraph [host:display]. + */ +{ + Window primary, + NewWindow(); + XEvent theEvent; + LocalWin *win_info; + Cursor zoomCursor; + FILE *strm; + XColor fg_color, + bg_color; + char keys[MAXKEYS]; + int nbytes, + idx, + maxitems = 0, + flags; + int errs = 0; + + /* Open up new display */ + Prog_Name = argv[0]; + disp_name = ""; + + /* Parse the argument list looking for input files */ + flags = ParseArgs(argc, argv, 0); + + if (flags == D_XWINDOWS) { + disp = XOpenDisplay(disp_name); + if (!disp) { + (void) fprintf(stderr, + "%s: cannot open display `%s'\n", + argv[0], disp_name); + exit(1); + } + XSetErrorHandler(XErrHandler); + } + + /* Set up hard-wired defaults and allocate spaces */ + InitSets(flags); + + /* Read X defaults and override hard-coded defaults */ + if (PM_INT("Output Device") == D_XWINDOWS) + ReadDefaults(); + + + /* Read the data into the data sets */ + llx = lly = MAXFLOAT; + urx = ury = -MAXFLOAT; + for (idx = 0; idx < numFiles; idx++) { + strm = fopen(inFileNames[idx], "r"); + if (!strm) { + (void) fprintf(stderr, "Warning: cannot open file `%s'\n", + inFileNames[idx]); + } + else { + if ((maxitems = ReadData(strm, inFileNames[idx])) < 0) { + errs++; + } + (void) fclose(strm); + } + } + if (!numFiles) { + if ((maxitems = ReadData(stdin, (char *) 0)) < 0) { + errs++; + } + } + if (errs) { + (void) fprintf(stderr, "Problems found with input data.\n"); + exit(1); + } + + /* Parse the argument list to set options */ + (void) ParseArgs(argc, argv, 1); + if (PM_BOOL("Animate")) param_set("TitleText",STR,"Animated X Graph"); + + if (maxitems == 0) { + (void) fprintf(stderr, "Nothing to plot.\n"); + exit(1); + } + + Xsegs[0] = (XSegment *) Malloc((unsigned) (maxitems * sizeof(XSegment))); + Xsegs[1] = (XSegment *) Malloc((unsigned) (maxitems * sizeof(XSegment))); + + /* Reverse Video Hack */ + if (PM_BOOL("ReverseVideo")) + ReverseIt(); + hard_init(); + if (PM_BOOL("Debug")) { + if (PM_INT("Output Device") == D_XWINDOWS) + (void) XSynchronize(disp, 1); + param_dump(); + } + + /* Logarithmic and bounding box computation */ + flags = 0; + if (PM_BOOL("LogX")) + flags |= LOG_X; + if (PM_BOOL("LogY")) + flags |= LOG_Y; + if (PM_BOOL("StackGraph")) + flags |= STK; + if (PM_BOOL("FitX")) + flags |= FITX; + if (PM_BOOL("FitY")) + flags |= FITY; + Traverse(flags); + + /* Nasty hack here for bar graphs */ + if (PM_BOOL("BarGraph")) { + double base; + + llx -= PM_DBL("BarWidth"); + urx += PM_DBL("BarWidth"); + base = PM_DBL("BarBase"); + if (base < lly) + lly = base; + if (base > ury) + ury = base; + } + + /* Create initial window */ + if (PM_INT("Output Device") == D_XWINDOWS) { + double asp; + + asp = 1.0; + xtb_init(disp, screen, PM_PIXEL("Foreground"), PM_PIXEL("Background"), + PM_FONT("LabelFont")); + + primary = NewWindow(Prog_Name, + PM_DBL("XLowLimit"), PM_DBL("YLowLimit"), + PM_DBL("XHighLimit"), PM_DBL("YHighLimit"), + asp,0); + if (!primary) { + (void) fprintf(stderr, "Main window would not open\n"); + exit(1); + } + + zoomCursor = XCreateFontCursor(disp, XC_sizing); + fg_color = PM_COLOR("Foreground"); + bg_color = PM_COLOR("Background"); + XRecolorCursor(disp, zoomCursor, &fg_color, &bg_color); + + Num_Windows = 1; + while (Num_Windows > 0) { + XNextEvent(disp, &theEvent); + if (xtb_dispatch(&theEvent) != XTB_NOTDEF) + continue; + if (XFindContext(theEvent.xany.display, + theEvent.xany.window, + win_context, (caddr_t *) & win_info)) { + /* Nothing found */ + continue; + } + switch (theEvent.type) { + case Expose: + if (theEvent.xexpose.count <= 0) { + XWindowAttributes win_attr; + + XGetWindowAttributes(disp, theEvent.xany.window, &win_attr); + win_info->dev_info.area_w = win_attr.width; + win_info->dev_info.area_h = win_attr.height; + init_X(win_info->dev_info.user_state); + EraseData(win_info); + DrawWindow(win_info); + } + break; + case KeyPress: + nbytes = XLookupString(&theEvent.xkey, keys, MAXKEYS, + (KeySym *) 0, (XComposeStatus *) 0); + for (idx = 0; idx < nbytes; idx++) { + if (keys[idx] == CONTROL_D) { + /* Delete this window */ + DelWindow(theEvent.xkey.window, win_info); + } + else if (keys[idx] == CONTROL_C) { + /* Exit program */ + Num_Windows = 0; + } + else if (keys[idx] == 'h') { + PrintWindow(theEvent.xany.window, win_info); + } + } + break; + case ButtonPress: + /* Handle creating a new window */ + Num_Windows += HandleZoom(Prog_Name, + &theEvent.xbutton, + win_info, zoomCursor); + break; + default: + (void) fprintf(stderr, "Unknown event type: %x\n", + theEvent.type); + break; + } + } + } + else { + int Device = PM_INT("Output Device"); + int dflag = strcmp(PM_STR("Disposition"), "To Device") == 0; + + primary = NewWindow(Prog_Name, + PM_DBL("XLowLimit"), PM_DBL("YLowLimit"), + PM_DBL("XHighLimit"), PM_DBL("YHighLimit"), + 1.0,0); + do_hardcopy(Prog_Name, primary, + hard_devices[Device].dev_init, + dflag ? hard_devices[Device].dev_spec : 0, + PM_STR("FileOrDev"), (double) 19, + hard_devices[Device].dev_title_font, + hard_devices[Device].dev_title_size, + hard_devices[Device].dev_axis_font, + hard_devices[Device].dev_axis_size, + PM_BOOL("Document") * D_DOCU); + } + return 0; +} + + +#define BLACK_THRES 30000 + +static void +ReversePix(param_name) +char *param_name; /* Name of color parameter */ + +/* + * Looks up `param_name' in the parameters database. If found, the + * color is examined and judged to be either black or white based + * upon its red, green, and blue intensities. The sense of the + * color is then reversed and reset to its opposite. + */ +{ + params val; + + if (param_get(param_name, &val)) { + if ((val.pixv.value.red < BLACK_THRES) && + (val.pixv.value.green < BLACK_THRES) && + (val.pixv.value.blue < BLACK_THRES)) { + /* Color is black */ + param_reset(param_name, "white"); + } + else { + /* Color is white */ + param_reset(param_name, "black"); + } + } + else { + (void) fprintf(stderr, "Cannot reverse color `%s'\n", param_name); + } +} + +static void +ReverseIt() +/* + * This routine attempts to implement reverse video. It steps through + * all of the important colors in the parameters database and makes + * black white (and vice versa). + */ +{ + int i; + char buf[1024]; + + for (i = 0; i < MAXATTR; i++) { + (void) sprintf(buf, "%d.Color", i); + ReversePix(buf); + } + ReversePix("Foreground"); + ReversePix("Border"); + ReversePix("ZeroColor"); + ReversePix("Background"); +} + + +static void +Traverse(flags) +int flags; /* Options */ + +/* + * Traverses through all of the data applying certain options to the + * data and computing the overall bounding box. The flags are: + * LOG_X Take the log of the X axis + * LOG_Y Take the log of the Y axis + * STK Stack coordinates. + * FITX Fit x-coordinates from zero to one + * FITY Fit y-coordinates from zero to one + */ +{ + int i, + j; + PointList *spot; + PointList *pspot; + + static char *paramstr[] = + { + "Cannot plot negative %s values\n", + "when the logarithmic option is selected.\n", + "Number of points in %d and %d don't match for stacking.\n", + "Point %d in %d and %d doesn't match for stacking.\n", + "Set %d has 0 %s.\n" + }; + + if (flags & (FITX|FITY)) + for (i = 0; i < MAXSETS; i++) + for (spot = PlotData[i].list; spot; spot = spot->next) { + float minx, maxx, miny, maxy; + minx = maxx = spot->xvec[0]; + maxy = miny = spot->yvec[0]; + for (j = 1; j < spot->numPoints; j++) { + minx = MIN(minx, spot->xvec[j]); + miny = MIN(miny, spot->yvec[j]); + maxx = MAX(maxx, spot->xvec[j]); + maxy = MAX(maxy, spot->yvec[j]); + } + maxx = maxx - minx; + maxy = maxy - miny; + if (maxx == 0.0) { + (void) fprintf(stderr, paramstr[3], i, "width"); + maxx = 1.0; + } + if (maxy == 0.0) { + (void) fprintf(stderr, paramstr[3], i, "height"); + maxy = 1.0; + } + switch (flags & (FITX|FITY)) { + case FITX: + for (j = 0; j < spot->numPoints; j++) + spot->xvec[j] = (-minx + spot->xvec[j]) / maxx; + break; + case FITY: + for (j = 0; j < spot->numPoints; j++) + spot->yvec[j] = (-miny + spot->yvec[j]) / maxy; + break; + case FITX|FITY: + for (j = 0; j < spot->numPoints; j++) { + spot->xvec[j] = (-minx + spot->xvec[j]) / maxx; + spot->yvec[j] = (-miny + spot->yvec[j]) / maxy; + } + break; + default: + abort(); + } + } + + if (flags & STK) + for (i = 1; i < MAXSETS; i++) { + for (spot = PlotData[i].list, pspot = PlotData[i - 1].list; + spot && pspot; spot = spot->next, pspot = pspot->next) { + if (spot->numPoints != pspot->numPoints) { + (void) fprintf(stderr, paramstr[2], i - 1, i); + exit(1); + } + for (j = 0; j < spot->numPoints; j++) { + if (spot->xvec[j] != pspot->xvec[j]) { + (void) fprintf(stderr, paramstr[3], j, i - 1, i); + exit(1); + } + spot->yvec[j] += pspot->yvec[j]; + } + } + } + + + for (i = 0; i < MAXSETS; i++) { + for (spot = PlotData[i].list; spot; spot = spot->next) { + for (j = 0; j < spot->numPoints; j++) { + if (flags & LOG_Y) { + if (spot->yvec[j] > 0.0) { + spot->yvec[j] = log10(spot->yvec[j]); + } + else if (spot->yvec[j] == 0) + spot->yvec[j] = 0.0; + else { + (void) fprintf(stderr, paramstr[0], "Y"); + (void) fprintf(stderr, paramstr[1]); + exit(1); + } + } + if (flags & LOG_X) { + if (spot->xvec[j] > 0.0) { + spot->xvec[j] = log10(spot->xvec[j]); + } + else if (spot->xvec[j] == 0) + spot->xvec[j] = 0.0; + else { + (void) fprintf(stderr, paramstr[0], "X"); + (void) fprintf(stderr, paramstr[1]); + exit(1); + } + } + /* Update global bounding box */ + if (spot->xvec[j] < llx) + llx = spot->xvec[j]; + if (spot->xvec[j] > urx) + urx = spot->xvec[j]; + if (spot->yvec[j] < lly) + lly = spot->yvec[j]; + if (spot->yvec[j] > ury) + ury = spot->yvec[j]; + } + } + } +} + + + +/* + * Button handling functions + */ + +/*ARGSUSED*/ +xtb_hret +del_func(win, bval, info) +Window win; /* Button window */ +int bval; /* Button value */ +char *info; /* User information */ + +/* + * This routine is called when the `Close' button is pressed in + * an xgraph window. It causes the window to go away. + */ +{ + Window the_win = (Window) info; + LocalWin *win_info; + + xtb_bt_set(win, 1, (char *) 0, 0); + if (!XFindContext(disp, the_win, win_context, (caddr_t *) & win_info)) { + if (win_info->flags & HARDCOPY_IN_PROGRESS) { + do_error("Can't close window while\nhardcopy dialog is posted.\n"); + xtb_bt_set(win, 0, (char *) 0, 0); + } + else { + DelWindow(the_win, win_info); + } + } + return XTB_HANDLED; +} + +/*ARGSUSED*/ +xtb_hret +hcpy_func(win, bval, info) +Window win; /* Button Window */ +int bval; /* Button value */ +char *info; /* User Information */ + +/* + * This routine is called when the hardcopy button is pressed + * in an xgraph window. It causes the output dialog to be + * posted. + */ +{ + Window the_win = (Window) info; + LocalWin *win_info; + + xtb_bt_set(win, 1, (char *) 0, 0); + if (!XFindContext(disp, the_win, win_context, (caddr_t *) & win_info)) { + win_info->flags |= HARDCOPY_IN_PROGRESS; + PrintWindow(the_win, win_info); + win_info->flags &= (~HARDCOPY_IN_PROGRESS); + } + xtb_bt_set(win, 0, (char *) 0, 0); + return XTB_HANDLED; +} + +static +/*ARGSUSED*/ + xtb_hret +abt_func(win, bval, info) +Window win; /* Button window */ +int bval; /* Button value */ +char *info; /* User information */ +{ + static char *msg_fmt = + "Version %s\n\ +XGraph + Animation and Derivatives\n\ +Modification of code by David Harrison\n\ +University of California, Berkeley\n\ +(davidh@ic.Berkeley.EDU or \n\ +...!ucbvax!ucbic!davidh)\n\ +Animation, differentiation, and a few other\n\ +new features added by Paul Walker,\n\ +National Center for Supercomputer Applications\n\ +and Univ. Illinois at U-C Dept of Physics.\n\ +Send comments or suggestions to\n\ +pwalker@ncsa.uiuc.edu\n"; + static int active = 0; + char msg_buf[1024]; + + if (!active) { + active = 1; + xtb_bt_set(win, 1, (char *) 0, 0); + (void) sprintf(msg_buf, msg_fmt, VERSION_STRING); + msg_box("XGraph", msg_buf); + xtb_bt_set(win, 0, (char *) 0, 0); + active = 0; + } + return XTB_HANDLED; +} + + +#ifdef DO_DER +static +/*ARGSUSED PW*/ + xtb_hret +rew_func(win, bval, info) +Window win; /* Button window */ +int bval; /* Button value */ +char *info; /* User information */ +{ + /* This routine added, Paul Walker, to rewind the animation and start + it over. The only even moderatly tricky part is erasing the last + item, which still lives, and redrawing the axis. I do it by just + copying the "Expose" information from the main routine. */ + Window the_win = (Window) info; + LocalWin *win_info; + + /* Set animation to True */ + param_set("Animate",BOOL,"on"); + + if (!XFindContext(disp, the_win, win_context, (caddr_t *) & win_info)) { + XWindowAttributes win_attr; + + XGetWindowAttributes(disp, the_win, &win_attr); + win_info->dev_info.area_w = win_attr.width; + win_info->dev_info.area_h = win_attr.height; + init_X(win_info->dev_info.user_state); + EraseData (win_info); + DrawWindow(win_info); + } + + return XTB_HANDLED; +} + +static +/*ARGSUSED PW*/ + xtb_hret +der_func(win, bval, info) +Window win; /* Button window */ +int bval; /* Button value */ +char *info; /* User information */ +{ + /* This routine added, Paul Walker, to rewind the animation and start + it over. The only even moderatly tricky part is erasing the last + item, which still lives, and redrawing the axis. I do it by just + copying the "Expose" information from the main routine. */ + Window the_win = (Window) info; + Window new_win; + LocalWin *win_info; + double loX,loY,hiX,hiY,asp; + static char *msg_fmt = + "Version %s\n\ +Currently unable to display\n\ +or calculate derivatives\n\ +higher than 2nd order\n"; + static int active = 0; + char msg_buf[1024]; + + XFindContext(disp, the_win, win_context, (caddr_t *) & win_info); + if (win_info->DOrder == 2) { + + if (!active) { + active = 1; + xtb_bt_set(win, 1, (char *) 0, 0); + (void) sprintf(msg_buf, msg_fmt, VERSION_STRING); + msg_box("XGraph", msg_buf); + xtb_bt_set(win, 0, (char *) 0, 0); + active = 0; + } + return XTB_HANDLED; + } + Num_Windows += 1; + asp = 1.0; + Bounds(&loX,&loY,&hiX,&hiY,win_info->DOrder+1); + new_win = NewWindow("Derivatives", loX, loY, hiX, hiY, asp, + win_info->DOrder+1); + + if (!XFindContext(disp, new_win, win_context, (caddr_t *) & win_info)) { + XWindowAttributes win_attr; + + XGetWindowAttributes(disp, new_win, &win_attr); + win_info->dev_info.area_w = win_attr.width; + win_info->dev_info.area_h = win_attr.height; + init_X(win_info->dev_info.user_state); + EraseData (win_info); + DrawWindow(win_info); + } + + return XTB_HANDLED; +} + + +static +/*ARGSUSED PW*/ + xtb_hret +rpl_func(win, bval, info) +Window win; /* Button window */ +int bval; /* Button value */ +char *info; /* User information */ +{ + /* Puts us back into static mode ... */ + Window the_win = (Window) info; + LocalWin *win_info; + + /* Set animation to True */ + param_set("Animate",BOOL,"off"); + + if (!XFindContext(disp, the_win, win_context, (caddr_t *) & win_info)) { + XWindowAttributes win_attr; + + XGetWindowAttributes(disp, the_win, &win_attr); + win_info->dev_info.area_w = win_attr.width; + win_info->dev_info.area_h = win_attr.height; + init_X(win_info->dev_info.user_state); + EraseData (win_info); + DrawWindow(win_info); + } + + return XTB_HANDLED; +} +/* End change PW */ + +#endif /* DO_DER */ + +#define NORMSIZE 600 +#define MINDIM 100 + +Window +NewWindow(progname, lowX, lowY, upX, upY, asp, DO) +char *progname; /* Name of program */ +double lowX, + lowY; /* Lower left corner */ +double upX, + upY; /* Upper right corner */ +double asp; /* Aspect ratio */ +int DO; /* Derivative Order. */ + +/* + * Creates and maps a new window. This includes allocating its + * local structure and associating it with the XId for the window. + * The aspect ratio is specified as the ratio of width over height. + */ +{ + Window new_window; + LocalWin *new_info; + static Cursor theCursor = (Cursor) 0; + XSizeHints sizehints; + XSetWindowAttributes wattr; + XWMHints wmhints; + XColor fg_color, + bg_color; + int geo_mask; + int width, + height; + unsigned long wamask; + char defSpec[120]; + double pad; + + new_info = (LocalWin *) Malloc(sizeof(LocalWin)); + new_info->DOrder = DO; + + if (upX > lowX) { + new_info->loX = lowX; + new_info->hiX = upX; + } + else { + new_info->loX = llx; + new_info->hiX = urx; + } + if (upY > lowY) { + new_info->loY = lowY; + new_info->hiY = upY; + } + else { + new_info->loY = lly; + new_info->hiY = ury; + } + + /* Increase the padding for aesthetics */ + if (new_info->hiX - new_info->loX == 0.0) { + pad = MAX(0.5, fabs(new_info->hiX / 2.0)); + new_info->hiX += pad; + new_info->loX -= pad; + } + if (new_info->hiY - new_info->loY == 0) { + pad = MAX(0.5, fabs(ury / 2.0)); + new_info->hiY += pad; + new_info->loY -= pad; + } + + /* Add 10% padding to bounding box (div by 20 yeilds 5%) */ + pad = (new_info->hiX - new_info->loX) / 20.0; + new_info->loX -= pad; + new_info->hiX += pad; + pad = (new_info->hiY - new_info->loY) / 20.0; + new_info->loY -= pad; + new_info->hiY += pad; + + /* Aspect ratio computation */ + if (asp < 1.0) { + height = NORMSIZE; + width = ((int) (((double) NORMSIZE) * asp)); + } + else { + width = NORMSIZE; + height = ((int) (((double) NORMSIZE) / asp)); + } + height = MAX(MINDIM, height); + width = MAX(MINDIM, width); + if (PM_INT("Output Device") == D_XWINDOWS) { + (void) sprintf(defSpec, "%dx%d+100+100", width, height); + + wamask = CWBackPixel | CWBorderPixel | CWColormap; + wattr.background_pixel = PM_PIXEL("Background"); + wattr.border_pixel = PM_PIXEL("Border"); + wattr.colormap = cmap; + + sizehints.flags = PPosition | PSize; + sizehints.x = sizehints.y = 100; + sizehints.width = width; + sizehints.height = height; + + geo_mask = XParseGeometry(PM_STR("Geometry"), + &sizehints.x, &sizehints.y, + (unsigned int *) &sizehints.width, + (unsigned int *) &sizehints.height); + if (geo_mask & (XValue|YValue)) + sizehints.flags = (sizehints.flags & ~PPosition) | USPosition; + if (geo_mask & (WidthValue | HeightValue)) + sizehints.flags = (sizehints.flags & ~PSize) | USSize; + + new_window = XCreateWindow(disp, RootWindow(disp, screen), + sizehints.x, sizehints.y, + (unsigned int) sizehints.width, + (unsigned int) sizehints.height, + (unsigned int) PM_INT("BorderSize"), + depth, InputOutput, vis, + wamask, &wattr); + + + if (new_window) { + xtb_frame cl_frame, + hd_frame, + ab_frame, + rw_frame, + rp_frame, + dx_frame; + + XStoreName(disp, new_window, progname); + XSetIconName(disp, new_window, progname); + + wmhints.flags = InputHint | StateHint; + wmhints.input = True; + wmhints.initial_state = NormalState; + XSetWMHints(disp, new_window, &wmhints); + + XSetWMNormalHints(disp, new_window, &sizehints); + + /* Set device info */ + set_X(new_window, &(new_info->dev_info)); + + if (!PM_BOOL("NoButton")) { + /* Make buttons */ + xtb_bt_new(new_window, "Close", del_func, + (xtb_data) new_window, &cl_frame); + new_info->close = cl_frame.win; + XMoveWindow(disp, new_info->close, (int) BTNPAD, (int) BTNPAD); + xtb_bt_new(new_window, "Hdcpy", hcpy_func, + (xtb_data) new_window, &hd_frame); + new_info->hardcopy = hd_frame.win; + XMoveWindow(disp, new_info->hardcopy, + (int) (BTNPAD + cl_frame.width + BTNINTER), + BTNPAD); + xtb_bt_new(new_window, "About", abt_func, + (xtb_data) new_window, &ab_frame); + new_info->about = ab_frame.win; + XMoveWindow(disp, new_info->about, + (int) (BTNPAD + cl_frame.width + BTNINTER + + hd_frame.width + BTNINTER), BTNPAD); +#ifdef DO_DER + /* These buttons added PW */ + xtb_bt_new(new_window, "Anim", rew_func, + (xtb_data) new_window, &rw_frame); + new_info->rewind = rw_frame.win; + XMoveWindow(disp, new_info->rewind, + (int) (BTNPAD + cl_frame.width + BTNINTER + + hd_frame.width + BTNINTER + + ab_frame.width + BTNINTER), BTNPAD); + xtb_bt_new(new_window, "Replot", rpl_func, + (xtb_data) new_window, &rp_frame); + new_info->replot = rp_frame.win; + XMoveWindow(disp, new_info->replot, + (int) (BTNPAD + cl_frame.width + BTNINTER + + hd_frame.width + BTNINTER + + ab_frame.width + BTNINTER + + rw_frame.width + BTNINTER), BTNPAD); + xtb_bt_new(new_window, "Deriv", der_func, + (xtb_data) new_window, &dx_frame); + new_info->deriv = dx_frame.win; + XMoveWindow(disp, new_info->deriv, + (int) (BTNPAD + cl_frame.width + BTNINTER + + hd_frame.width + BTNINTER + + ab_frame.width + BTNINTER + + rw_frame.width + BTNINTER + + rp_frame.width + BTNINTER), BTNPAD); +#endif /* DO_DER */ + + new_info->flags = 0; + } + XSelectInput(disp, new_window, + ExposureMask | KeyPressMask | ButtonPressMask); + if (!theCursor) { + theCursor = XCreateFontCursor(disp, XC_top_left_arrow); + fg_color = PM_COLOR("Foreground"); + bg_color = PM_COLOR("Background"); + XRecolorCursor(disp, theCursor, &fg_color, &bg_color); + } + XDefineCursor(disp, new_window, theCursor); + if (!win_context) { + win_context = XUniqueContext(); + } + XSaveContext(disp, new_window, win_context, (caddr_t) new_info); + XMapWindow(disp, new_window); + return new_window; + } + else { + return (Window) 0; + } + } + else { + new_info->dev_info.area_h = 1.0; + new_info->dev_info.area_w = 1.0; + return ((Window) new_info); + } +} + + +DelWindow(win, win_info) +Window win; /* Window */ +LocalWin *win_info; /* Local Info */ + +/* + * This routine actually deletes the specified window and + * decrements the window count. + */ +{ + xtb_data info; + + XDeleteContext(disp, win, win_context); + xtb_bt_del(win_info->close, &info); + xtb_bt_del(win_info->hardcopy, &info); + xtb_bt_del(win_info->about, &info); + Free((char *) win_info); + XDestroyWindow(disp, win); + Num_Windows -= 1; +} + +PrintWindow(win, win_info) +Window win; /* Window */ +LocalWin *win_info; /* Local Info */ + +/* + * This routine posts a dialog asking about the hardcopy + * options desired. If the user hits `OK', the hard + * copy is performed. + */ +{ + ho_dialog(win, Prog_Name, (char *) win_info); +} + + +static XRectangle boxEcho; +static GC echoGC = (GC) 0; + +#define DRAWBOX \ +if (startX < curX) { \ + boxEcho.x = startX; \ + boxEcho.width = curX - startX; \ +} else { \ + boxEcho.x = curX; \ + boxEcho.width = startX - curX; \ +} \ +if (startY < curY) { \ + boxEcho.y = startY; \ + boxEcho.height = curY - startY; \ +} else { \ + boxEcho.y = curY; \ + boxEcho.height = startY - curY; \ +} \ +XDrawRectangles(disp, win, echoGC, &boxEcho, 1); + +#define TRANX(xval) \ +(((double) ((xval) - wi->XOrgX)) * wi->XUnitsPerPixel + wi->UsrOrgX) + +#define TRANY(yval) \ +(wi->UsrOppY - (((double) ((yval) - wi->XOrgY)) * wi->YUnitsPerPixel)) + + +int +HandleZoom(progname, evt, wi, cur) +char *progname; +XButtonPressedEvent *evt; +LocalWin *wi; +Cursor cur; +{ + Window win, + new_win; + Window root_rtn, + child_rtn; + XEvent theEvent; + int startX, + startY, + curX, + curY, + newX, + newY, + stopFlag, + numwin = 0; + int root_x, + root_y; + unsigned int mask_rtn; + double loX, + loY, + hiX, + hiY, + asp; + + win = evt->window; + if (XGrabPointer(disp, win, True, + (unsigned int) (ButtonPressMask | ButtonReleaseMask | + PointerMotionMask | PointerMotionHintMask), + GrabModeAsync, GrabModeAsync, + win, cur, CurrentTime) != GrabSuccess) { + XBell(disp, 0); + return 0; + } + if (echoGC == (GC) 0) { + unsigned long gcmask; + XGCValues gcvals; + + gcmask = GCForeground | GCFunction; + gcvals.foreground = PM_PIXEL("ZeroColor") ^ PM_PIXEL("Background"); + gcvals.function = GXxor; + echoGC = XCreateGC(disp, win, gcmask, &gcvals); + } + startX = evt->x; + startY = evt->y; + XQueryPointer(disp, win, &root_rtn, &child_rtn, &root_x, &root_y, + &curX, &curY, &mask_rtn); + /* Draw first box */ + DRAWBOX; + stopFlag = 0; + while (!stopFlag) { + XNextEvent(disp, &theEvent); + switch (theEvent.xany.type) { + case MotionNotify: + XQueryPointer(disp, win, &root_rtn, &child_rtn, &root_x, &root_y, + &newX, &newY, &mask_rtn); + /* Undraw the old one */ + DRAWBOX; + /* Draw the new one */ + curX = newX; + curY = newY; + DRAWBOX; + break; + case ButtonRelease: + DRAWBOX; + XUngrabPointer(disp, CurrentTime); + stopFlag = 1; + if ((startX - curX != 0) && (startY - curY != 0)) { + /* Figure out relative bounding box */ + loX = TRANX(startX); + loY = TRANY(startY); + hiX = TRANX(curX); + hiY = TRANY(curY); + if (loX > hiX) { + double temp; + + temp = hiX; + hiX = loX; + loX = temp; + } + if (loY > hiY) { + double temp; + + temp = hiY; + hiY = loY; + loY = temp; + } + /* physical aspect ratio */ + asp = ((double) ABS(startX - curX)) / + ((double) ABS(startY - curY)); + new_win = NewWindow(progname, loX, loY, hiX, hiY, asp, + wi->DOrder); + if (new_win) { + numwin = 1; + } + else { + numwin = 0; + } + } + else { + numwin = 0; + } + break; + default: + printf("unknown event: %d\n", theEvent.xany.type); + break; + } + } + return numwin; +} + + +#define RND(val) ((int) ((val) + 0.5)) + +/*ARGSUSED*/ +void +do_hardcopy(prog, info, init_fun, dev_spec, file_or_dev, maxdim, + ti_fam, ti_size, ax_fam, ax_size, doc_p) +char *prog; /* Program name for Xdefaults */ +char *info; /* Some state information */ +int (*init_fun) (); /* Hardcopy init function */ +char *dev_spec; /* Device specification (if any) */ +char *file_or_dev; /* Filename or device spec */ +double maxdim; /* Maximum dimension in cm */ +char *ti_fam, + *ax_fam; /* Font family names */ +double ti_size, + ax_size; /* Font sizes in points */ +int doc_p; /* Documentation predicate */ + +/* + * This routine resets the function pointers to those specified + * by `init_fun' and causes a screen redisplay. If `dev_spec' + * is non-zero, it will be considered a sprintf string with + * one %s which will be filled in with `file_or_dev' and fed + * to popen(3) to obtain a stream. Otherwise, `file_or_dev' + * is considered to be a file and is opened for writing. The + * resulting stream is fed to the initialization routine for + * the device. + */ +{ + LocalWin *curWin = (LocalWin *) info; + LocalWin thisWin; + FILE *out_stream; + char buf[MAXBUFSIZE], + err[MAXBUFSIZE], + ierr[ERRBUFSIZE]; + char tilde[MAXBUFSIZE * 10]; + int final_w, + final_h, + flags; + double ratio; + + if (dev_spec) { + (void) sprintf(buf, dev_spec, file_or_dev); + out_stream = popen(buf, "w"); + if (!out_stream) { + sprintf(err, "Unable to issue command:\n %s\n", buf); + do_error(err); + return; + } + } + else { + tildeExpand(tilde, file_or_dev); + out_stream = fopen(tilde, "w"); + if (!out_stream) { + sprintf(err, "Unable to open file `%s'\n", tilde); + do_error(err); + return; + } + } + if (curWin != (LocalWin *) 0) { + thisWin = *curWin; + ratio = ((double) thisWin.dev_info.area_w) / + ((double) thisWin.dev_info.area_h); + } + else + ratio = 1.0; + + if (thisWin.dev_info.area_w > thisWin.dev_info.area_h) { + final_w = RND(maxdim * 10000.0 * PM_DBL("Scale")); + final_h = RND(maxdim / ratio * 10000.0 * PM_DBL("Scale")); + } + else { + final_w = RND(maxdim * ratio * 10000.0 * PM_DBL("Scale")); + final_h = RND(maxdim * 10000.0 * PM_DBL("Scale")); + } + ierr[0] = '\0'; + flags = 0; + if (doc_p) + flags |= D_DOCU; + if ((*init_fun) (out_stream, final_w, final_h, ti_fam, ti_size, + ax_fam, ax_size, flags, &(thisWin.dev_info), ierr)) { + DrawWindow(&thisWin); + if (thisWin.dev_info.xg_end) { + thisWin.dev_info.xg_end(thisWin.dev_info.user_state); + } + } + else { + do_error(ierr); + } + if (dev_spec) { + (void) pclose(out_stream); + } + else { + (void) fclose(out_stream); + } +} + + +static char * +tildeExpand(out, in) +char *out; /* Output space for expanded file name */ +char *in; /* Filename with tilde */ + +/* + * This routine expands out a file name passed in `in' and places + * the expanded version in `out'. It returns `out'. + */ +{ + char username[50], + *userPntr; + struct passwd *userRecord; + + out[0] = '\0'; + + /* Skip over the white space in the initial path */ + while ((*in == ' ') ||(*in == '\t')) + in ++; + + /* Tilde? */ + if (in[0] == TILDE) { + /* Copy user name into 'username' */ + in ++; + + userPntr = &(username[0]); + while ((*in !='\0') &&(*in !='/')) { + *(userPntr++) = *(in ++); + } + *(userPntr) = '\0'; + /* See if we have to fill in the user name ourselves */ + if (strlen(username) == 0) { + userRecord = getpwuid(getuid()); + } + else { + userRecord = getpwnam(username); + } + if (userRecord) { + /* Found user in passwd file. Concatenate user directory */ + strcat(out, userRecord->pw_dir); + } + } + + /* Concantenate remaining portion of file name */ + strcat(out, in); + return out; +} + + + +#define ERR_MSG_SIZE 2048 + +/*ARGSUSED*/ +static int +XErrHandler(disp_ptr, evt) +Display *disp_ptr; +XErrorEvent *evt; + +/* + * Displays a nicely formatted message and core dumps. + */ +{ + char err_buf[ERR_MSG_SIZE], + mesg[ERR_MSG_SIZE], + number[ERR_MSG_SIZE]; + char *mtype = "XlibMessage"; + + XGetErrorText(disp_ptr, evt->error_code, err_buf, ERR_MSG_SIZE); + (void) fprintf(stderr, "X Error: %s\n", err_buf); + XGetErrorDatabaseText(disp_ptr, mtype, "MajorCode", + "Request Major code %d", mesg, ERR_MSG_SIZE); + (void) fprintf(stderr, mesg, evt->request_code); + (void) sprintf(number, "%d", evt->request_code); + XGetErrorDatabaseText(disp_ptr, "XRequest", number, "", err_buf, + ERR_MSG_SIZE); + (void) fprintf(stderr, " (%s)\n", err_buf); + + abort(); +} diff --git a/xgraph/xgraph.h b/xgraph/xgraph.h new file mode 100644 index 000000000..a2b42f6aa --- /dev/null +++ b/xgraph/xgraph.h @@ -0,0 +1,210 @@ +/* + * Globally accessible information from xgraph + */ + +#ifndef _XGRAPH_H_ +#define _XGRAPH_H_ + +#include "autoconf.h" + +#include +#include +#include +#include + +/* + * Get definitions from headers. + */ +#include /* sprintf */ + +#ifdef HAVE_STRING_H +#include /* str* */ +#else +#ifdef HAVE_STRINGS_H +#include /* str* */ +#else +extern char *strcpy(); +extern char *strcat(); +extern char *rindex(); +extern char *index(); +#endif /* HAVE_STRINGS_H */ +#endif /* HAVE_STRING_H */ + +#ifdef HAVE_UNISTD_H +#include /* exit, abort */ +#endif /* HAVE_UNISTD_H */ +#ifdef HAVE_STDLIB_H +#include /* atof */ +#endif /* HAVE_STDLIB_H */ + +#include "xgout.h" + +#define VERSION_STRING "12.1 December 1999 " + +#define MAXKEYS 50 +#define MAXATTR 8 +#define MAXSETS 112 +#define MAXBUFSIZE 120 +#define MAXLS 50 + +#define STRDUP(xx) (strcpy(Malloc((unsigned) (strlen(xx)+1)), (xx))) +#define SCREENX(ws, userX) \ + (((int) (((userX) - ws->UsrOrgX)/ws->XUnitsPerPixel + 0.5)) + ws->XOrgX) +#define SCREENY(ws, userY) \ + (ws->XOppY - ((int) (((userY) - ws->UsrOrgY)/ws->YUnitsPerPixel + 0.5))) +#define HARDCOPY_IN_PROGRESS 0x01 + +/* Portability */ +/* try to get those constants */ +#include +#ifdef HAVE_LIMITS_H +#include +#endif /* HAVE_LIMITS */ +#ifdef HAVE_FLOAT_H +#include +#endif /* HAVE_FLOAT_H */ + +#ifdef CRAY +#undef MAXFLOAT +#define MAXFLOAT 10.e300 +#endif /* CRAY */ + +#ifndef MAXFLOAT +#if defined(FLT_MAX) +#define MAXFLOAT FLT_MAX +#elif defined(HUGE) +#define MAXFLOAT HUGE +#endif +#endif + +#ifndef BIGINT +#if defined(INT_MAX) +#define BIGINT INT_MAX +#elif defined(MAXINT) +#define BIGINT MAXINT +#else +#define BIGINT 0xffffffff +#endif +#endif + +#define GRIDPOWER 10 +#define INITSIZE 128 + +#define CONTROL_D '\004' +#define CONTROL_C '\003' +#define TILDE '~' + +#define BTNPAD 1 +#define BTNINTER 3 + +#ifndef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif +#ifndef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif +#ifndef ABS +#define ABS(x) ((x) < 0 ? -(x) : (x)) +#endif +#define ZERO_THRES 1.0E-07 + +/* To get around an inaccurate log */ +#define nlog10(x) (x == 0.0 ? 0.0 : log10(x) + 1e-15) + +#define ISCOLOR (wi->dev_info.dev_flags & D_COLOR) + +#define PIXVALUE(set) ((set) % MAXATTR) + +#define LINESTYLE(set) \ +(ISCOLOR ? ((set)/MAXATTR) : ((set) % MAXATTR)) + +#define MARKSTYLE(set) \ +(colorMark ? COLMARK(set) : BWMARK(set)) + +#define COLMARK(set) \ +((set) / MAXATTR) + +#define BWMARK(set) \ +((set) % MAXATTR) + +#define LOG_X 0x01 +#define LOG_Y 0x02 +#define STK 0x04 +#define FITX 0x08 +#define FITY 0x10 +typedef unsigned long Pixel; + +/* Globally accessible values */ +extern Display *disp; /* Open display */ +extern Visual *vis; /* Standard visual */ +extern Colormap cmap; /* Standard colormap */ +extern int screen; /* Screen number */ +extern int depth; /* Depth of screen */ + +extern void do_hardcopy(); /* Carries out hardcopy */ +extern void ho_dialog(); /* Hardcopy dialog */ +extern void set_X(); /* Initializes X device */ + +typedef struct point_list { + int numPoints; /* Number of points in group */ + int allocSize; /* Allocated size */ + double *xvec; /* X values */ + double *yvec; /* Y values */ + struct point_list *next; /* Next set of points */ +} PointList; + +typedef struct new_data_set { + char *setName; /* Name of data set */ + PointList *list; /* List of point arrays */ +} NewDataSet; + +typedef struct local_win { + double loX, + loY, + hiX, + hiY; /* Local bounding box of window */ + int XOrgX, + XOrgY; /* Origin of bounding box on screen */ + int XOppX, + XOppY; /* Other point defining bounding box */ + double UsrOrgX, + UsrOrgY; /* Origin of bounding box in user space */ + double UsrOppX, + UsrOppY; /* Other point of bounding box */ + double XUnitsPerPixel; /* X Axis scale factor */ + double YUnitsPerPixel; /* Y Axis scale factor */ + struct xg_out dev_info; /* Device information */ + Window close, + hardcopy; /* Buttons for closing and hardcopy */ + Window about; /* Version information */ + Window rewind; /* PW Added this, for animation. */ + Window replot; /* PW Added this, for animation. */ + Window deriv; /* PW Added this, for animation. */ + int flags; /* Window flags */ + int DOrder; /* Which order of Derivative is being set? */ +} LocalWin; + +extern NewDataSet PlotData[MAXSETS], DataD1[MAXSETS], DataD2[MAXSETS]; +extern XSegment *Xsegs[2]; /* Point space for X */ +extern double llx, lly, urx, ury; /* Bounding box of all data */ +extern int numFiles; /* Number of input files */ +extern char *inFileNames[MAXSETS]; /* File names */ + +/* Total number of active windows */ +extern int Num_Windows; +extern char *Prog_Name; +extern char *disp_name; + +/* To make lint happy */ +extern char *Malloc(); +extern char *Realloc(); +extern void Free(); + +#ifndef _POSIX_SOURCE +/* extern int sprintf(); ---conflicts with sunos */ +extern void exit(); +extern double atof(); +extern void abort(); +#endif /* _POSIX_SOURCE */ + +#endif /* _XGRAPH_H_ */ diff --git a/xgraph/xgraph.man b/xgraph/xgraph.man new file mode 100644 index 000000000..ce8735801 --- /dev/null +++ b/xgraph/xgraph.man @@ -0,0 +1,389 @@ +.TH XGRAPH 1 "December, 1989" +.SH NAME +xgraph \- Draw a graph on an X11 Display +.SH SYNOPSIS +.B xgraph +[ options ] [[-geometry |=]WxH+X+Y ] [ -display host:display.screen ] [ file ... ] +.SH DESCRIPTION +The +.I xgraph +program draws a graph on an X display given data read from either +data files or from standard input if no files are specified. +It can display up to 64 independent data sets using different colors +and/or line styles for each set. +It annotates the graph with a title, axis labels, grid lines or tick +marks, grid labels, +and a legend. +There are options to control the appearance of most components of +the graph. +.PP +The input format is similar to +.I graph(1G) +but differs slightly. +The data consists of a number of +.I "data sets." +Data sets are separated by a blank line. +A new data set is also +assumed at the start of each input file. +A data set consists of an ordered list of points of the form "{directive} X Y". +The directive is either "draw" or "move" and can be omitted. +If the directive is "draw", a line will be drawn between the previous +point and the current point (if a line graph is chosen). +Specifying a "move" directive tells xgraph not to draw a line between +the points. +If the directive is omitted, "draw" is assumed for all points in +a data set except the +first point where "move" is assumed. +The "move" directive is used most often to allow discontinuous data +in a data set. +The name of a data set can be specified by +enclosing the name in double quotes on a line by itself in the +body of the data set. The trailing double quote is optional. +Overall graphing options for the graph can be specified in data +files by writing lines of the form "