[comp.sources.unix] v24i037: Manipulate data on the chemical elements, Part02/03

rsalz@uunet.uu.net (Rich Salz) (03/14/91)

Submitted-by: "J.E. King" <jek5036@ultb.isc.rit.edu>
Posting-number: Volume 24, Issue 37
Archive-name: chemtab/part02

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents:  Makefile VERSION chemtab.1 cleanup.c element.c element.h
#   element2.c graph.h graphlib.c online_help pertab pertab_graphic
#   ptabl.c schar.c scrmisc.c tune.h variables.h vdata.c
# Wrapped by rsalz@litchi.bbn.com on Wed Mar 13 13:55:19 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo '          "shar: End of archive 2 (of 3)."'
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
  echo shar: Extracting \"'Makefile'\" \(1780 characters\)
  sed "s/^X//" >'Makefile' <<'END_OF_FILE'
XCC            = cc
XCFLAGS        = -g -DReGIS
X# Define ReGIS if you want to program to prompt the user to answer y/n
X# to the question of if they have a ReGIS compatible terminal
XDEST	      = chemtab
XEXTHDRS	      = /usr/include/curses.h \
X		/usr/include/math.h \
X		/usr/include/sgtty.h \
X		/usr/include/signal.h \
X		/usr/include/stdio.h \
X		/usr/include/sys/ioctl.h \
X		/usr/include/sys/ttychars.h \
X		/usr/include/sys/ttydev.h \
X		/usr/include/sys/ttyio.h \
X		/usr/include/time.h
XHDRS	      = element.h \
X		graph.h \
X		tune.h \
X		undefs.h \
X		variables.h \
X		windows.h
XLDFLAGS	      = $(CFLAGS)
XLIBS	      = -lcurses -ltermcap graphlib.a
XLINKER	      = cc
XMAKEFILE      = Makefile
XOBJS	      = cleanup.o \
X		dogph.o \
X		doregisgph.o \
X		element.o \
X		element2.o \
X		esort.o \
X		looke.o \
X		main.o \
X		ptabl.o \
X		schar.o \
X		scrmisc.o \
X		vdata.o
XPRINT	      = lpr
XPROGRAM	      = chemtab
XSRCS	      = cleanup.c \
X		dogph.c \
X		doregisgph.c \
X		element.c \
X		element2.c \
X		esort.c \
X		graphlib.c \
X		looke.c \
X		main.c \
X		ptabl.c \
X		schar.c \
X		scrmisc.c \
X		vdata.c
X
Xall:		grlib $(PROGRAM)
X
Xgrlib:		graphlib.o
X		ar cr graphlib.a graphlib.o
X		ranlib graphlib.a
X
X$(PROGRAM):     $(OBJS) graphlib.a
X		@echo -n "Loading $(PROGRAM) ... "
X		@$(LINKER) $(LDFLAGS) $(OBJS) -o $(PROGRAM) $(LIBS)
X		@echo "done"
X
Xclean:;		@rm -f $(OBJS)
X
Xdepend:;	@mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
X
Xindex:;		@ctags -wx $(HDRS) $(SRCS)
X
Xinstall:	$(PROGRAM)
X		@echo Installing $(PROGRAM) in $(DEST)
X		@install -m 4755 $(PROGRAM) $(DEST)
X
Xprint:;		@$(PRINT) $(HDRS) $(SRCS)
X
Xprogram:        $(PROGRAM)
X
Xtags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
X
Xupdate:		$(DEST)/$(PROGRAM)
X
X$(DEST)/$(PROGRAM): $(SRCS) $(LIBS) $(HDRS) $(EXTHDRS)
X		@make -f $(MAKEFILE) DEST=$(DEST) 
X###
END_OF_FILE
  if test 1780 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
  fi
  # end of 'Makefile'
fi
if test -f 'VERSION' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'VERSION'\"
else
  echo shar: Extracting \"'VERSION'\" \(1005 characters\)
  sed "s/^X//" >'VERSION' <<'END_OF_FILE'
XCurrently, you have Chemtab Version 2.01, Patchlevel 1.
X
XVersion History:
X
X	Chemtab V1.0	Selection and sorting algorithms, menu-bar
X			driven display, slow and tedious.
X
X	Chemtab V1.1	Menu bar converted to keyboard selection by
X			letter or number, faster, rewrote sorting
X			algorithm, 5X faster.
X
X	Chemtab V1.2	Implementation of looking at a specific
X			element and the graphing module was installed.
X
X	Chemtab V2.0	ReGIS interface made available to users for
X			the graphing module, vt100 graphics set
X			implemented for the periodic table.  Plotter
X			capabilities installed for graphing module
X			to plot on DEC LVP16 and possibly any HP..
X			Minor screen glitches fixed. 
X
X	Chemtab V2.01	Added escape to main menu from all menus, changed
X			looke.c to turn all lines into lowercase for 'look
X			for element by name i.e. TECHnetIUM = technetium'.
X			Online help implemented.
X			Job stopping fixed. (BSD only)
X			Pipe of ReGIS graphing commands into a file.
X			Graphing module updated to work faster.
END_OF_FILE
  if test 1005 -ne `wc -c <'VERSION'`; then
    echo shar: \"'VERSION'\" unpacked with wrong size!
  fi
  # end of 'VERSION'
fi
if test -f 'chemtab.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'chemtab.1'\"
else
  echo shar: Extracting \"'chemtab.1'\" \(1904 characters\)
  sed "s/^X//" >'chemtab.1' <<'END_OF_FILE'
X.TH chemtab 1
X.SH NAME
Xchemtab \- a database utility for the elements
X.SH SYNTAX
X.B chemtab
X[
X.I \-r
X]
X.SH DESCRIPTION
XThe
X.PN chemtab
Xprogram is a utility which will allow you to manipulate data concerning
Xthe elements.  The program was written to teach students entering a chemistry
Xcourse for the first time to make connections between the elements
Xcharacteristics and establish pattern recognition in the Periodic Table.
XChemtab was written by a student for students, however the program does not
Xnecessarily have to be for students only.  Chemtab contains a wide variety of
Xinformation regarding all the elements and I hope it proves useful to you.
X.SH FLAGS
XIf you are using a Digital ReGIS compatible terminal, and you specify the
X\-r flag, this will activate the ReGIS graphing routines.  If you wish to
Xswitch between ReGIS and non-ReGIS while inside the program, there is a
XReGIS indicator on the MAIN MENU screen.  Commands are available to switch
Xbetween modes from the MAIN MENU.
X.SH ONLINE HELP
XThe database has a full online help utility.  At (most) any time you may type a
Xquestion mark (?) and the program will give you information about the
Xmenu choices.  Basically, since there is online help, there are no more
Xmanual pages for chemtab.
X.SH AUTHOR
XJim King, Lincoln-Sudbury Regional High School AND
XRochecter Institute of Technology
XContact me at jek5036@ultb.isc.rit.edu.
X.SH BUG REPORTS
XPlease send all bug reports to the above internet address.  If it is a 
Xsimple bug, like a screen glitch, explain where.  If it is more complex,
Xindicate what you did to make this bug appear.
X.SH KNOWN GLITCHES
XThis program may have a hard time on a System V system.  Some include files
Xare different, etc.  If anyone converts chemtab to a SYSV format, please
Xsend me the diffs or the program back with the modifications.  I will then
Xmake a SYSV compile-time definition so everyone can use it.
END_OF_FILE
  if test 1904 -ne `wc -c <'chemtab.1'`; then
    echo shar: \"'chemtab.1'\" unpacked with wrong size!
  fi
  # end of 'chemtab.1'
fi
if test -f 'cleanup.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cleanup.c'\"
else
  echo shar: Extracting \"'cleanup.c'\" \(2542 characters\)
  sed "s/^X//" >'cleanup.c' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * cleanup.c	Cleanup (exit) routine
X */
X
X#include <curses.h>
X#include <stdio.h>
X#include <signal.h>
X#include "windows.h"
X#include "variables.h"
X#include "tune.h"
X
X/*
X * cleanup() - no input
X *
X * purpose:  Handle any quit or ^C signal nicely.
X */
X
Xcleanup()
X{
X	char	c, str[80];			/* input */
X#ifdef	PRINTQ
X	char	que[80];			/* print queue */
X#endif	PRINTQ
X
X#ifdef	ReGIS
X	if (regis) endregis();
X#endif	ReGIS
X	if (trans) {				/* transcript flag */
Xl1:		mvwaddstr(btm, 0, 0, "Would you like your transcript printed out? ");
X		wrefresh(btm);
X		cur = btm;
X		xp = 44; yp = 0;
X		noecho();
X		crmode();
X		c = getchar();
X		if (c == 'n') {
X			wclear(btm);
X			wrefresh(btm);
X		} else if (c == '?') {
X			help(1);
X			goto l1;
X		} else {			/* else print it out */
X			wprintw(btm, "yes");
X			wrefresh(btm);
X			echo(); nocrmode();
X#ifdef	PRINTQ
X			wclear(btm);
X			mvwaddstr(btm, 0, 0, "Queue to print to: ");
X			wrefresh(btm);
X			cur = btm; xp = 21; yp = 0;
X			gets(que);
X			sprintf(str, "%s%s %d.chemtab", PRINTER, que, getpid());
X#else	PRINTQ
X			sprintf(str, "%s %d.chemtab", PRINTER, getpid());
X#endif	PRINTQ
X			fclose(fp);
X			wclear(btm);
X			wrefresh(btm);
X			clear(); refresh();
X			system(str);
X		}
X	}
X	fclose(fp);				/* close things up */
X	echo();
X	nocrmode();
X	clear(); refresh();
X	endwin();				/* turn off curses */
X	if (trans) {
X		printf("A copy of your transcript can be found in the file %d.chemtab\n", getpid());
X	/*	printf("\nYou can pick up your printout at the printer to the left of\n");
X		printf("The White-Board, labelled Happy.  Look for your last name in >><<'s on\n");
X		printf("the top line of each printout.  Good luck with Chemistry.\n");
X	 */ }
X	fflush(stdout);				/* just make sure.. */
X	exit(1);				/* quit nicely */
X}
X
X#ifdef	USERSHELL
Xstop()	/* Handle a ^Z */
X{
X	char	sh[80];
X
X	strcpy(sh, getenv("SHELL"));
X	if (!strlen(sh))
X		strcpy(sh, USERSHELL);
X#ifdef	ReGIS
X	if (regis) endregis();
X#endif  ReGIS
X	clear(); refresh();
X	signal(SIGTSTP, SIG_DFL);
X	printf("Type 'exit' to return to chemtab...\n");
X	system(sh);
X	clear(); refresh();
X	signal(SIGTSTP, stop);
X	if (needsit(stdscr)) { touchwin(stdscr); wrefresh(stdscr); }
X	if (needsit(graph)) { touchwin(graph); wrefresh(graph); }
X	if (needsit(mn)) { touchwin(mn); wrefresh(mn); }
X	if (needsit(srt)) { touchwin(srt); wrefresh(srt); }
X	if (needsit(btm)) { touchwin(btm); wrefresh(btm); }
X	if (hlp != NULL) { touchwin(hlp); wrefresh(hlp); }
X	wmove(cur, yp, xp);
X	wrefresh(mn);
X	crmode();
X}
X#endif	USERSHELL
END_OF_FILE
  if test 2542 -ne `wc -c <'cleanup.c'`; then
    echo shar: \"'cleanup.c'\" unpacked with wrong size!
  fi
  # end of 'cleanup.c'
fi
if test -f 'element.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'element.c'\"
else
  echo shar: Extracting \"'element.c'\" \(2273 characters\)
  sed "s/^X//" >'element.c' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * element.c	Reads in the file from the #define PERTABLE (which is the
X *		data file) and sorts into the structure elem (e).
X *              Also reads in the close values (at the end)
X */
X
X#include "variables.h"
X#include "element.h"
X#include "tune.h"
X#include <stdio.h>
X
Xfloat closev[15];
X
X/*
X * readelem() - no input
X *
X * purpose:	Take a line from PERTABLE (tune.h) and put it in structure
X *		e which is defined as the element table used throughout
X *		the program.  This was designed so the operator could easily
X *		change an element or add one without changing anything but
X *		tune.h
X */
Xreadelem()
X{
X	int	first = 1;
X	char	inp[160];
X	FILE	*fptr;				/* File pointer for PERTABLE */
X	struct	elem	*tmp, *old, *new;
X
X	fptr = fopen(PERTABLE, "r");
X
X	fgets(inp, 160, fptr);			/* Read in comment line */
X	fgets(inp, 160, fptr);			/* Eat the spacer */
X
X	tmp = NEW(elem);
X	e = tmp;
X	while (fscanf(fptr, "%s %s %d %f %d %d %d %d %d %d %d %f %f %f %f\n",
X		       tmp->name, tmp->sym, &tmp->anum, &tmp->amass, &tmp->fam,
X		       &tmp->row, &tmp->val, &tmp->melt, &tmp->boil,
X		       &tmp->fio, &tmp->year, &tmp->eneg, &tmp->spht,
X		       &tmp->dens, &tmp->arad) != EOF) {
X			if (first) { first = 0; tmp = NEW(elem); continue; }
X			if (tmp->anum < e->anum) {
X				tmp->next = e;
X				e = tmp;
X				tmp = NEW(elem);
X				continue;
X			}
X			old = NULL; new = e;
X			for (;;) {
X				if (new->next == NULL) { /* new tail */
X					new->next = tmp;
X					tmp->next = NULL;
X					break;
X				}
X				old = new;
X				new = new->next;
X				if ((old->anum < tmp->anum) &&
X				   (tmp->anum < new->anum)) {
X					tmp->next = new;
X					old->next = tmp;
X					break;
X				}
X			}
X		tmp = NEW(elem);
X	}
X	tmp = NULL;
X	fclose(fptr);				/* Be nice and neat */
X}
X
X/*
X * getclose()
X * inputs: none
X * returns: 888 if bad closefile
X * purpose: read close values from CLOSEFILE
X */
Xint getclose()
X{
X	FILE	*fp;
X	char	str[90];
X	int	i;
X
X	if ((fp = fopen(CLOSEFILE, "r")) == NULL) {
X		printf("chemtab: Make sure that tune.h reflects all file names. (CLOSEFILE)\n");
X		exit(1);
X	}
X
X	fgets(str, 90, fp); fgets(str, 90, fp);
X
X	for (i = 0; i < 15; i++)
X		if (fscanf(fp, "%s%c%f\n", str, str, &closev[i]) == EOF) return(888);
X	
X	fclose(fp);
X}
X
END_OF_FILE
  if test 2273 -ne `wc -c <'element.c'`; then
    echo shar: \"'element.c'\" unpacked with wrong size!
  fi
  # end of 'element.c'
fi
if test -f 'element.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'element.h'\"
else
  echo shar: Extracting \"'element.h'\" \(797 characters\)
  sed "s/^X//" >'element.h' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * element.h	Contains the structure for all the elements, *e.
X */
X
X#include "tune.h"
X
X#define	NEW(X)	(struct X *)malloc(sizeof(struct X))
X
Xstruct elem {
X	char	name[18],		/* Atomic Name */
X		sym[4];			/* Atomic Symbol */
X	float	amass,			/* Atomic Mass */
X		eneg,			/* Electronegativity */
X		spht,			/* Specific Heat */
X		arad,			/* Atomic Radius */
X		dens;			/* Density of the Solid */
X	int	anum,			/* Atomic Number */
X		melt,			/* Melting point, deg C */
X		boil,			/* Boiling point, deg C */
X		fio,			/* First Ionization Energy, cal */
X		year,			/* Year Discovered */
X		val,			/* Valence Electrons */
X		fam,			/* Family (1-18, new system) */
X		row;			/* Horizontal rows */
X	struct	elem	*next;		/* linked list */
X} *e;
END_OF_FILE
  if test 797 -ne `wc -c <'element.h'`; then
    echo shar: \"'element.h'\" unpacked with wrong size!
  fi
  # end of 'element.h'
fi
if test -f 'element2.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'element2.c'\"
else
  echo shar: Extracting \"'element2.c'\" \(1235 characters\)
  sed "s/^X//" >'element2.c' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * element2.c	Reads in the file from the #define BINTABLE (which is the
X *		data file) and sorts into the structure stat (e).
X */
X
X#include "tune.h"
X#include "variables.h"
X#include <stdio.h>
X#include "element.h"
X
X/*
X * binreadelem() - no input
X *
X * purpose:	Take a line from BINTABLE (tune.h) and put it in structure
X *		e which is defined as the element table used throughout
X *		the program.  This was designed so the operator could easily
X *		change an element or add one without changing anything but
X *		tune.h
X */
Xbinreadelem()
X{
X	FILE	*fptr;				/* File pointer for PERTABLE */
X	struct	elem	*tmp, *old, *new;
X
X	if ((fptr = fopen(BINTABLE, "r")) == NULL) /* Open it please */
X		return(888);
X
X	e = NEW(elem);
X	tmp = e;
X	while (fread(tmp, sizeof(struct elem), 1, fptr) == 1) {
X		tmp->next = NEW(elem);
X		tmp = tmp->next;
X	}
X	tmp = NULL;
X	fclose(fptr);				/* Be nice and neat */
X}
X
Xbinwritelem()
X{
X	FILE	*fptr;
X	struct	elem	*tmp;
X
X	tmp = e;
X	if ((fptr = fopen(BINTABLE, "w")) == NULL) return(888);
X
X	for (tmp = e; tmp != NULL; tmp = tmp->next) {
X		if (fwrite(tmp, sizeof(struct elem), 1, fptr) != 1)
X			return(888);
X		fflush(fptr);
X	}
X
X	fclose(fptr);
X}
END_OF_FILE
  if test 1235 -ne `wc -c <'element2.c'`; then
    echo shar: \"'element2.c'\" unpacked with wrong size!
  fi
  # end of 'element2.c'
fi
if test -f 'graph.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'graph.h'\"
else
  echo shar: Extracting \"'graph.h'\" \(1463 characters\)
  sed "s/^X//" >'graph.h' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 by Jim King (pulsar@lsrhs)
X *
X * graph.h	Contains stuff for graphing
X */
X
X/* NOTE: All regis drawing code runs off these numbers
X *       XMAXDEF = 798 - XBOUND
X *       YMAXDEF = 478 - YBOUND
X *       XAXISDEF = XMAXDEF - XBOUND
X *       YAXISDEF = YMAXDEF - YBOUND
X *
X * for some reason these wouldn't work just as defines.. probably a
X * memory or program counter error.
X */
X#ifdef	ReGIS
X#define	XBOUND	100
X#define	YBOUND	50
X
X#define	XMINDEF	XBOUND
X#define XMAXDEF	693
X#define YMINDEF	YBOUND
X#define YMAXDEF	428
X
X#define XAXISDEF 593
X#define YAXISDEF 378
X
X/* VT2XX ReGIS colors */
X#define RED_2	7
X#define GRN_2	6
X#define BLU_2	5
X#define BLK_2	4
X
X/* VT3XX ReGIS colors */
X#define WHT_3	7
X#define YEL_3	6
X#define CYA_3	5
X#define MAG_3	4
X#define GRN_3	3
X#define RED_3	2
X#define BLU_3	1
X#define BLK_3	0
X#endif	ReGIS
X
Xdouble	xmax,		/* X axis maximum value */
X	xmin,		/* X axis minimum value */
X	ymax,		/* Y axis maximum value */
X	ymin,		/* Y axis minimum value */
X	scale,		/* used to determine spots */
X	xaxis[800],
X	yaxis[400];
Xchar	c1,		/* letter of choice, x axis */
X	c2;		/* letter of choice, y axis */
Xint	xspot,		/* x axis line to plot on */
X	yspot;		/* y axis line to plot on */
X
Xstatic char	*gname[] = {	/* Top line, 'x' vs. 'y' */
X	0,"Atomic Number","Atomic Mass","Melting Temp.","Boiling Temp.",
X	"Ionization energy","Electronegativity","Specific Heat",
X	"Density","Atomic Radius","Discovery Year",0
X};
END_OF_FILE
  if test 1463 -ne `wc -c <'graph.h'`; then
    echo shar: \"'graph.h'\" unpacked with wrong size!
  fi
  # end of 'graph.h'
fi
if test -f 'graphlib.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'graphlib.c'\"
else
  echo shar: Extracting \"'graphlib.c'\" \(2302 characters\)
  sed "s/^X//" >'graphlib.c' <<'END_OF_FILE'
X#ifdef	ReGIS
X
X#include <stdio.h>
X#include <curses.h>
X#include <strings.h>
X#include "variables.h"
X#include "element.h"
X#include "graph.h"
X#include "undefs.h"
X#include "tune.h"
X
X/*
X * ReGIS graphics interface package (NOTE: Not curses oriented)
X */
X
Xchcolor(col)
Xint	col;
X{
X	if (!strncmp(getenv("TERM"), "vt2", 3)) {
X		switch(col) {
X			case '7':
X			case '2':
X			case '4':
X				col = RED_2;
X				break;
X			case '1':
X			case '5':
X				col = BLU_2;
X				break;
X			case '0': col = BLK_2; break;
X			default:
X				col = GRN_2;
X				break;
X		}
X	}
X	printf("W(I%d)", col);
X}
X
Xinitregis()
X{
X	printf("\033Pp");
X#ifdef	LASERPRT
X	if (laser)
X		fprintf(lsr, "\033Pp");
X#endif	LASERPRT
X	chcolor(6);
X}
X
Xendregis()
X{
X#ifdef	LASERPRT
X	if (laser)
X		fprintf(lsr, "\033\\");
X#endif	LASERPRT
X	printf("\033\\"); 
X}
X
Xregisgoto(x, y)
Xint	x, y;
X{
X#ifdef	LASERPRT
X	if (laser)
X		fprintf(lsr, "P[%d,%d]", x, y);
X#endif	LASERPRT
X	printf("P[%d,%d]", x, y);
X}
X
Xline(x1, y1, x2, y2)
Xint	x1, y1, x2, y2;	/* From x1,y1 to x2,y2 */
X{
X	regisgoto(x1, y1);
X	printf("V[%d,%d]", x2, y2);
X#ifdef	LASERPRT
X	if (laser)
X		fprintf(lsr, "V[%d,%d]", x2, y2);
X#endif	LASERPRT
X	}
X
Xmybox(width, x1, y1, x2, y2)
Xint	width, x1, y1, x2, y2;
X{
X	int	i;
X	for (i = 0; i <= width; i++) {
X		line(x1+i, y1+i, x2-i, y1+i);
X		line(x2-i, y1+i, x2-i, y2-i);
X		line(x2-i, y2-i, x1+i, y2-i);
X		line(x1+i, y2-i, x1+i, y1+i);
X	}
X}
X
Xhash(x1, y1, which)
Xint	x1, y1, which;		/* Make small hashmark with cross at x1,y1 */
X{
X	if (which) {
X		regisgoto(x1, y1);  /* decided to make it a circle... */
X		printf("W(S1)C[+2]W(S0)");
X		fflush(stdout);
X#ifdef	LASERPRT
X		if (laser)
X			fprintf(lsr, "W(S1)C[+2]W(S0)");
X#endif	LASERPRT
X	} else {
X		line(x1, y1-2, x1, y1+2);
X		line(x1-2, y1, x1+2, y1);
X	}
X}
X
Xtext(size, dir, angle, string)
Xint	size,		/* 0 through 16 * multiplier of # pixels in char */
X	dir,		/* Angle of text in 45 degree increments */
X	angle;		/* italics angle -45 to 45 degrees */
Xchar	*string;	/* text to output */
X{
X	printf("T(D%d)(S%d)(D%d)(I%d)'%s'", dir, size, dir, angle, string);
X#ifdef	LASERPRT
X	if (laser)
X		fprintf(lsr, "T(D%d)(S%d)(D%d)(I%d)'%s'", dir, size, dir, angle, string);
X#endif	LASERPRT
X}
X
Xregispc()
X{
X	noecho(); crmode();
X	regisgoto(10, 455);
X	text(1, 0, -5, "Press SPACE to continue...");
X	fflush(stdout);
X	getchar();
X	echo(); nocrmode();
X}
X#endif	ReGIS
END_OF_FILE
  if test 2302 -ne `wc -c <'graphlib.c'`; then
    echo shar: \"'graphlib.c'\" unpacked with wrong size!
  fi
  # end of 'graphlib.c'
fi
if test -f 'online_help' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'online_help'\"
else
  echo shar: Extracting \"'online_help'\" \(4315 characters\)
  sed "s/^X//" >'online_help' <<'END_OF_FILE'
X_
X	Before ending your session, you may choose to print
Xout all of your recorded transcripts.  If you type 'y', the
Xprogram will send your transcript to an appropriate printer
XIn either case, the transcript will be saved in a file
Xwith the format XXX.chemtab where XXX is the process ID
Xof your current session.
X_
X	Since you have selected some elements within
Xcertain boundaries, now you may choose whether or not you
Xwish to use all the elements or these special elements
Xwhen plotting on the graph.  Type 'a' for the special
Xelements, or 'b' for all the elements.
X_
X	In order to graph, each axis must have a
Xdefinition.  If you want to compare electronegativity to
Xatomic number, it is easier to see the pattern if atomic
Xnumber is on the x-axis, (which is also the wider axis
Xwith 69 [or 600 with ReGIS].)
X_
X	The x-axis is special because it is the scale for
Xwhat you view.  You can change this scale to be whatever
Xyou wish.  If you only want to look at elements with an
Xatomic number between 50 and 60, you can select atomic
Xnumber for your x-axis and enter 50 for the x-axis
Xminimum value, and 60 for the maximum.
X_
X	In order to graph, both axes must have a
Xdefinition.  The y-axis is important because this will be
Xwhat you are comparing to.  You must choose one.  Example:
XIf you choose atomic number for both x- and y-axes, you
Xshould get a straight line slanting /
X_
X	The ReGIS graphics can provide you with grid lines
Xat the intervals marked on the screen.  This helps in
Xdetermining a point's values on the graph far away from
Xthe axes.
X_
X	Sometimes it is easier to see a pattern if the
Xpoints are connected.  An example is atomic number vs.
Xelectronegativity.  Try it and decide which you like
Xmore.
X_
X	This is only for asthetics and speed.  The points
Xlook nicer on the graph but they take longer because they
Xare a 'graphic fill' which only means it takes more time
Xfor the terminal to do the work than it would to make two
Xlines.
X_
X	This is the first sub-menu.  Here you can choose
Xwhich method you want to look for an element by.  Your
Xchoices are name, number, or symbol.  Of course you can
Xget back to the main menu by hitting '4'.
X_
X	Type in the full name, or part of a name of an
Xelement.  If your choice is not ambiguous, ('i' would be
Xambiguous, whereas 'hyd' would not) the computer will
Xdisplay the information you request.
X_
X	Type in the atomic number of the element you
Xare looking for.
X_
X	Type in the symbol of the element you are
Xlooking for.  Remember that uppercase and lowercase
Xcount here.
X_
X	The computer can keep a copy of all lists,
Xgraphs (not ReGIS graphs), and tables (not VT100
Xalternate set tables) which you make.  These will
Xbe saved in a file in this account and you may
Xhave the option to have this program print these
Xout for you.
X_
X	Since there may be more than one person
Xprinting out at a time, this program will put your
Xname on the top of your transcript so you can tell
Xwhich one is yours.
X_
X	This is the main menu.  From here you can
Xdo several things.  '1' will let you choose to
Xlook at one elements information.  '2' will allow
Xyou to choose boundaries for the elements you wish
Xto look at.  '3' will list these special elements.
X'4' will show their position on the periodic table.
X'5' will let you use the graphing module.
X'6' will exit the program.  '^R' or Control-R
X(hold down the control key and press R) will turn
XReGIS mode on and off.  This affects the graphing
Xportion of the pogram only.  Of course, '^C' will
Xexit the program at any time.  '^V' shows all version
Xdefinitions.
X_
X	For asthetics, the program can make the
Xperiodic table look nice by using graphics.
XOne drawback is that these graphics cannot be saved
Xand printed.
X_
X	Here you should choose one characteristic
Xto set.  Say, for example you want to see all
Xelements with a melting temperature greater than
X1000 celcius.  You would type in the number for
Xmelting temperature here.
X_
X_
X	The ReGIS commands can be printed on any DEC
XLN03 compatible laserprinter, possibly others.  If
Xyou want the program to save a copy of your graph
Xin text form (usually about 5000 chars) type 'y'.
XThe filename will be in the current directory under
X'laser'.
X_
X	This determines how your search will be
Xprocessed.
X_
X_
X	You may choose whether or not you want this
Xgraph, list, or table in your transcript.
END_OF_FILE
  if test 4315 -ne `wc -c <'online_help'`; then
    echo shar: \"'online_help'\" unpacked with wrong size!
  fi
  # end of 'online_help'
fi
if test -f 'pertab' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pertab'\"
else
  echo shar: Extracting \"'pertab'\" \(1256 characters\)
  sed "s/^X//" >'pertab' <<'END_OF_FILE'
X  1 <- 1a                                     8a -> 18
X|--|2a    PERIODIC TABLE OF          3a 4a 5a 6a 7a|--|
X|  | 2             THE ELEMENTS      13 14 15 16 17|  |1
X|--|--|                             |--|--|--|--|--|--|
X|  |  |                             |  |  |  |  |  |  |2
X|--+--|1b 2b 3b 4b 5b 6b 7b 8b 9b Xb|--+--+--+--+--+--|
X|  |  | 3  4  5  6  7  8  9 10 11 12|  |  |  |  |  |  |3
X|--+--|--|--|--|--|--|--|--|--|--|--|--|--+--+--+--+--|
X|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |4
X|--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
X|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |5
X|--+--|--|--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
X|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |6a (6)
X|--+--|  |-----------+-----------+-----|--|--|--|--|--|
X|  |  |  |   |   |   |   |   |   |   |7a (7)
X|--|--|  |---|---|---|---|---|---|---|
X            4   5   6   7   8   9  10  <- Unx family numbers
X            |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|    v----^
XLanthanides |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |6b (8)
X            |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
X  Actinides |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |7b (9)
X            |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|
END_OF_FILE
  if test 1256 -ne `wc -c <'pertab'`; then
    echo shar: \"'pertab'\" unpacked with wrong size!
  fi
  # end of 'pertab'
fi
if test -f 'pertab_graphic' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pertab_graphic'\"
else
  echo shar: Extracting \"'pertab_graphic'\" \(1246 characters\)
  sed "s/^X//" >'pertab_graphic' <<'END_OF_FILE'
X  1                                                 18
Xlqqk      PERIODIC TABLE OF                        lqqk
Xx  x 2             THE ELEMENTS      13 14 15 16 17x  x1
Xtqqnqqk                             lqqwqqwqqwqqwqqnqqu
Xx  x  x                             x  x  x  x  x  x  x2
Xtqqnqqu                             tqqnqqnqqnqqnqqnqqu
Xx  x  x 3  4  5  6  7  8  9 10 11 12x  x  x  x  x  x  x3
Xtqqnqqnqqwqqwqqwqqwqqwqqwqqwqqwqqwqqnqqnqqnqqnqqnqqnqqu
Xx  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x4
Xtqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqu
Xx  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x5
Xtqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqu
Xx  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x6A (6)
Xtqqnqqu  tqqvwqvqwvqqnqqvwqvqwvqqnqqvwqvqqvqqvqqvqqvqqj
Xx  x  x  x   x   x   x   x   x   x   x7A (7)
Xmqqvqqj  mqqqvqqqvqqqvqqqvqqqvqqqvqqqj
X            4   5   6   7   8   9  10  <- UNX FAMILY NUMBERS
X            lqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqwqqk
XLANTHANIDES x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x6B (8)
X            tqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqnqqu
X  ACTINIDES x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x7B (9)
X            mqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqvqqj
END_OF_FILE
  if test 1246 -ne `wc -c <'pertab_graphic'`; then
    echo shar: \"'pertab_graphic'\" unpacked with wrong size!
  fi
  # end of 'pertab_graphic'
fi
if test -f 'ptabl.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ptabl.c'\"
else
  echo shar: Extracting \"'ptabl.c'\" \(2877 characters\)
  sed "s/^X//" >'ptabl.c' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * ptabl.c	Print the Periodic Table with sorted elements in place
X */
X
X#include <curses.h>
X#include "windows.h"
X#include <stdio.h>
X#include "variables.h"
X#include "tune.h"
X#include "element.h"
X#include <signal.h>
X
Xextern int	stop();
X
X/* helps to print out where the elements go */
Xint	horz[10] = { 0, 2, 4, 6, 8, 10, 12, 14, 18, 20 };
X
X/*
X * ptabl() - no input
X *
X * purpose:	To print the periodic table then fill in spaces with
X *		appropriate ''selected'' elements.
X */
Xptabl()
X{
X	struct	elem	*tmp;
X	FILE	*fd;		/* Periodic table is in a file */
X	char	foo[80];	/* And we need to read it into something */
X	int	z, i, n, ics;	/* element number reference */
X
X	if (gtot == -1) {
X		mvwaddstr(mn, 15, 0, "Please choose some selection characteristics before you do this.");
X		wrefresh(mn);
X		sleep(2);
X		wmove(mn, 15, 0); wclrtoeol(mn);
X		return(0);
X	}
X
X	strcpy(foo, TABLE);
X
X	wclear(mn); wrefresh(mn);
X	clear(); refresh();
Xl16:	mvwaddstr(btm, 0, 0, "VT100 alternate graphic set (if yes, no transcript of this table) ");
X	wrefresh(btm);
X	cur = btm; xp = 65; yp = 0;
X	noecho(); crmode();
X	switch(getchar()) {
X		case '?': help(16); goto l16;
X		case 'y':
X		case 'Y':
X#ifdef	USERSHELL
X			signal(SIGTSTP, SIG_IGN);
X#endif	USERSHELL
X			strcat(foo, "_graphic"); ics = 1; break;
X		default: ics = 0; break;
X	}
X	if ((fd = fopen(foo, "r")) == NULL) {
X		bot("Cannot open periodic table.. sorry..");
X		sleep(3);
X		return(0);
X	}
X	if (ics) printf("\033(0");	/* on graphics */
X	for (i = 0; i < 22; i++) {	/* read in the table */
X		fgets(foo, 80, fd);
X		mvwaddstr(graph, i, 0, foo);
X		wrefresh(graph);
X	}				/* and output to WINDOW *graph */
X	fclose(fd);
X	if (ics) printf("\033(B");
X	tablsort();			/* Put characteristics on screen */
X	if (ics) printf("\033(0"); fflush(stdout);
X	for (i = 1; i < gtot+1; i++) {	/* format and print element sym. */
X		n = sub1[i];
X		for (tmp = e; n != tmp->anum; tmp = tmp->next) ;
X		if (tmp->anum > 56 && tmp->anum < 72)
X			wmove(graph, horz[8], (13 + ((tmp->fam - 1) * 3)));
X		else if (tmp->anum > 88 && tmp->anum < 104)
X			wmove(graph, horz[9], (13 + ((tmp->fam - 1) * 3)));
X		else if (tmp->anum > 103 && tmp->anum < 111)
X			wmove(graph, horz[tmp->row], (1 + ((tmp->fam - 1) * 3) - (104 - tmp->anum)));
X		else
X			wmove(graph, horz[tmp->row], (1 + ((tmp->fam - 1) * 3)));
X
X		wrefresh(graph);
X		wstandout(graph);
X		if (ics) {		/* I realize the slowness... */
X			printf("\033(B"); fflush(stdout);
X			wprintw(graph, "%2s", tmp->sym);
X			wrefresh(graph);
X			printf("\033(0"); fflush(stdout);
X		} else
X			wprintw(graph, "%2s", tmp->sym);
X		wrefresh(graph);
X		wstandend(graph);
X	}
X	if (ics) printf("\033(B");
X	wrefresh(graph);
X	if (!ics) capture(graph, 0, 0);
X	spc();
X	wclear(graph); wrefresh(graph);
X	clear();
X	refresh();
X#ifdef	USERSHELL
X	signal(SIGTSTP, stop);
X#endif	USERSHELL
X	return(0);
X}
END_OF_FILE
  if test 2877 -ne `wc -c <'ptabl.c'`; then
    echo shar: \"'ptabl.c'\" unpacked with wrong size!
  fi
  # end of 'ptabl.c'
fi
if test -f 'schar.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'schar.c'\"
else
  echo shar: Extracting \"'schar.c'\" \(6207 characters\)
  sed "s/^X//" >'schar.c' <<'END_OF_FILE'
X/*
X * Chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * schar.c	Interface with user for sorting
X */
X
X#include <stdio.h>
X#include <curses.h>
X#include "element.h"
X#include "variables.h"
X#include "windows.h"
X#include "tune.h"
X
Xextern float closev[];
X
X/*
X * whichone() - no input
X *
X * purpose:	to find out how many characteristics we are sorting already
X */
Xwhichone()
X{
X	if (dosort[2].wch != 0)
X		return(3);
X	if (dosort[1].wch != 0)
X		return(2);
X	if (dosort[0].wch != 0)
X		return(1);
X	return(0);
X}
X
X/*
X * tablsort() - no input
X *
X * purpose:	Put characteristics on table window
X */
Xtablsort()
X{
X	int	i;
X	
X	for (i = 0; i < 3; i++) {
X		if (dosort[i].wch != 0) {
X			wmove(graph, i*4, 57);
X			wstandout(graph);
X			wprintw(graph, "%s", sopts[dosort[i].wch].chst);
X			wstandend(graph);
X			switch(dosort[i].sgn) {
X				case EQUAL: mvwaddstr(graph, i*4+1, 58, "is Equal to"); break;
X				case GREATER: wmove(graph, i*4+1, 58); wprintw(graph, "is %s", sopts[dosort[i].wch].upline); break;
X				case CLOSE: mvwaddstr(graph, i*4+1, 58, "is Close to"); break;
X				default: wmove(graph, i*4+1, 58); wprintw(graph, "is %s", sopts[dosort[i].wch].dnline); break;
X			}
X			wmove(graph, i*4+2, 59);
X			wprintw(graph, "%4.*f", sopts[dosort[i].wch].dnum, dosort[i].amt);
X		}
X	}
X	wrefresh(graph);
X}
X
X/*
X * upsort() - no input
X *
X * purpose:	Update the sort window
X */
Xupsort()
X{
X	int	i;
X
X	wclear(srt);
X	mvwaddstr(srt, 0, 0, "Current selecting characteristics: (max of 3)");
X	for (i = 0; i < 3; i++) {
X		if (dosort[i].wch != 0) {
X			wmove(srt, i+2, 0);
X			wstandout(srt);
X			wprintw(srt, "%s", sopts[dosort[i].wch].chst);
X			wstandend(srt);
X			switch(dosort[i].sgn) {
X				case EQUAL: wprintw(srt, " is Equal to "); break;
X				case GREATER: wprintw(srt, " is %s ", sopts[dosort[i].wch].upline); break;
X				case LESS: wprintw(srt, " is %s ", sopts[dosort[i].wch].dnline); break;
X				case CLOSE: wprintw(srt, " is Close to "); break;
X			}
X			wprintw(srt, "%4.*f", sopts[dosort[i].wch].dnum, dosort[i].amt);
X		}
X	}
X	wrefresh(srt);
X}
X
X/*
X * schar() - no input
X *
X * purpose:	Interface with user to select sorting characteristics
X *		to sort elements from
X */
Xschar()
X{
X	char	str[50];
X	int	n, curn, i;
X
X	noecho();
X	crmode();
Xlop1:	clear(); refresh();
X	for (;;) {
Xlop2:		upsort();				/* Update sorts */
X		wclear(mn); wrefresh(mn);
X		menu("Select Elemental Characteristics");
X		for (i = 1; i < 8; i++) {
X			wmove(mn, i+1, 0);
X			wprintw(mn, "%d] %s", i, sopts[i].chst);
X			wmove(mn, i+1, 40);
X			wprintw(mn, "%d] %s", i+7, sopts[i+7].chst);
X		}
X		wmove(mn, 9, 40);
X		wprintw(mn, "15] %s", sopts[15].chst);
Xl17:		mvwaddstr(mn, 11, 0, "Your Choice [14]? ");
X		wclrtoeol(mn);
X		cur = mn; xp = 18; yp = 11;
X		mvwaddstr(mn, 11, 16, " ");
X		wrefresh(mn);
X		echo();
X		nocrmode();
X		gets(str);
X		if (str[0] == '?') { help(17); goto l17; }
X		if (!strlen(str)) n = 14; else n = atoi(str);
X		fixup(mn);
X		switch(n) {
X			case 14:		/* Main Menu */
X				esort();
X				wclear(mn);
X				return(0);
X			case 15:		/* Clear all chars */
X				mvwaddstr(mn, 12, 0, "Are you sure? ");
X				wrefresh(mn);
X				cur = mn; xp = 15; yp = 12;
X				noecho();
X				crmode();
X				if (wgetch(mn) == 'y') {
X					for (i = 0; i < 3; i++)
X						dosort[i].wch = 0;
X				}
X				gtot = -1;
X				wmove(mn, 12, 0); wclrtoeol(mn);
X				wrefresh(mn);
X				goto lop1;
X			default:
X				if (n < 1 || n > 15)
X					goto lop2;
X				else
X					break;
X		}
X		curn = whichone();
X		if (dosort[0].wch == n || dosort[1].wch == n || dosort[2].wch == n) {
X			bot("This characteristic is already being sorted.");
X			sleep(3);
X			bot(" ");
X			mvwaddstr(btm, 0, 0, "Do you wish to change this characteristic? ");
X			wrefresh(btm);
X			cur = btm; xp = 44; yp = 0;
X			noecho(); crmode();
X			if (getchar() == 'y') {
X				bot(" ");
X				for (i = 0; i < 2; i++) {
X					if (dosort[i].wch == n)
X						curn = i;
X				}
X				goto lop3;
X			} else if (curn != 3) {
X				mvwaddstr(btm, 0, 0, "Do you wish to make another characteristic of the same type? ");
X				wrefresh(btm);
X				cur = btm; xp = 62; yp = 0;
X				noecho(); crmode();
X				if (getchar() != 'y') {
X					wclear(btm); wrefresh(btm);
X					goto lop2;
X				}
X				wclear(btm); wrefresh(btm);
X			}
X		}
X		if (curn > 2) {
X			bot("Maximum of three sorting characteristics");
X			sleep(3);
X			bot(" ");
X			goto lop2;
X		}
Xlop3:		dosort[curn].wch = n;
X		wclear(mn); wrefresh(mn);
X		wmove(mn, 1, 0);
X		wprintw(mn, "You would like to select some elements with their '%s' being", sopts[n].chst);
X		mvwaddstr(mn, 3, 0, "1] Equal To");
X		wmove(mn, 4, 0); wprintw(mn, "2] %s", sopts[n].upline);
X		wmove(mn, 5, 0); wprintw(mn, "3] %s", sopts[n].dnline);
X		wmove(mn, 6, 0);
X		wprintw(mn, "4] Close To (+/- %1.*f)", sopts[n].dnum, closev[n]);
X		wmove(mn, 7, 0); wprintw(mn, "5] Exit (will erase characteristic)");
Xlop4:		mvwaddstr(mn, 11, 0, "Your Choice? ");
X		wrefresh(mn);
X		cur = mn; xp = 14; yp = 11;
X		noecho();
X		crmode();
X		switch(wgetch(mn)) {
X			case '?': help(20); goto lop4;
X			case '1': wprintw(mn, "Equal To"); dosort[curn].sgn = EQUAL;	break;
X			case '2': wprintw(mn, "Greater Than"); dosort[curn].sgn = GREATER;	break;
X			case '3': wprintw(mn, "Less Than"); dosort[curn].sgn = LESS;	break;
X			case '4': wprintw(mn, "Close To"); dosort[curn].sgn = CLOSE;	break;
X			case '5': dosort[curn].wch = 0;
X				  if (curn == 1) {
X					if (dosort[2].wch != 0) {
X						dosort[1].wch = dosort[2].wch;
X						dosort[1].sgn = dosort[2].sgn;
X						dosort[1].amt = dosort[2].amt;
X						dosort[2].wch = 0;
X					}
X				  } else if (curn == 0) {
X					if (dosort[1].wch != 0) {
X						dosort[0].wch = dosort[1].wch;
X						dosort[0].sgn = dosort[1].sgn;
X						dosort[0].amt = dosort[1].amt;
X						dosort[1].wch = 0;
X					}
X					if (dosort[2].wch != 0) {
X						dosort[1].wch = dosort[2].wch;
X						dosort[1].sgn = dosort[2].sgn;
X						dosort[1].amt = dosort[2].amt;
X						dosort[2].wch = 0;
X					}
X				  }
X				goto lop1;
X			default:
X				goto lop4;
X		}
Xlop5:		mvwaddstr(mn, 12, 0, "What Value? ");
X		wclrtoeol(mn);
X		wrefresh(mn);
X		cur = mn; xp = 13; yp = 12;
X		echo();
X		nocrmode();
X		scanf("%f", &dosort[curn].amt);
X		if (dosort[curn].amt > 9999) {
X			bot("Maximum amount is 9999.");
X			sleep(2);
X			bot(" ");
X			goto lop5;
X		}
X		getchar();		/* Eat the \n that scanf doesn't */
X	}
X}
END_OF_FILE
  if test 6207 -ne `wc -c <'schar.c'`; then
    echo shar: \"'schar.c'\" unpacked with wrong size!
  fi
  # end of 'schar.c'
fi
if test -f 'scrmisc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'scrmisc.c'\"
else
  echo shar: Extracting \"'scrmisc.c'\" \(5067 characters\)
  sed "s/^X//" >'scrmisc.c' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * scrmisc.c	Collection of curses screen misc stuff
X */
X
X#include <curses.h>
X#include "variables.h"
X#include "windows.h"
X
X/* The SPACING define is for spacing the transcripts.  This spacing technique
X * will USUALLY work for most print queues WITHOUT end-of-page form-feeding,
X * meaning the print command doesn't care about upper and lower margins.  If
X * so, a lower value may be needed. */
X#define	SPACING		4
X
Xmenu(str)
Xchar	*str;
X{
X	wstandout(mn);
X	mvwaddstr(mn, 0, (40 - (strlen(str) / 2)), str);
X	wstandend(mn);
X	wrefresh(mn);
X}
X
X/*
X * bot(str)
X *	input:	str - char - string to print on bottom
X *	output: curses only
X *
X * purpose:	Take ''str'' and put it on ''btm'' (window)
X */
Xbot(strn)
Xchar	*strn;
X{
X	wclear(btm); mvwaddstr(btm, 0, 0, strn); wrefresh(btm);
X}
X
X/*
X * spc() - no input
X *
X * purpose:	To prompt the user that there is more..
X */
Xspc()
X{
X	wclear(btm); mvwaddstr(btm, 0, 0, "<< Press SPACE BAR to continue >>");
X	wrefresh(btm);
X	cur = btm; xp = 33; yp = 1;
X	noecho(); crmode();
X	getchar();
X	wclear(btm);
X	wrefresh(btm);
X}
X
Xint	needsit(win)
XWINDOW	*win;
X{
X	int	y, x;
X
X	for (y = 0; y < win->_maxy; y++) {
X		for (x = 0; x < win->_maxx; x++)
X			if (mvwinch(win, y, x) != ' ')
X				return(1);
X	}
X	return(0);
X}
X
Xvoid	help(num)
Xint	num;
X{
X	FILE	*fp;
X	char	str[60];
X	int	line, i;
X
X	hlp = newwin(16, 62, 4, 8);
X	wrefresh(hlp);
X
X	if ((fp = fopen(HELPFILE, "r")) == NULL) {
X		mvwaddstr(hlp, 7, 1, "The HELPFILE is not available.");
X		mvwaddstr(hlp, 8, 1, "Contact a chemtab administrator.");
X		sleep(5);
X		delwin(hlp);
X		goto clean;
X	}
X
X	line = 0;
X	for (;;) {
X		fgets(str, 60, fp);
X		if (str[0] == '_')
X			if (++line == num)
X				break;
X	}
X
X	for (i = 1; i < 15; i++) {
X		if (fgets(str, 60, fp) == NULL) break;
X		if (str[0] == '_') break;
X		mvwaddstr(hlp, i, 2, str);
X	}
X
X	box(hlp, '|', '-');
Xclean:	wstandout(hlp); mvwaddstr(hlp, 15, 15, "Press <<RETURN>> to continue...");
X	wrefresh(hlp);
X	wstandend(hlp);
X	cur = hlp; xp = 46; yp = 15;
X	noecho();
X	gets(str);
X	wclear(hlp); wrefresh(hlp);
X	delwin(hlp);
X	hlp = NULL;
X	if (needsit(stdscr)) { touchwin(stdscr); wrefresh(stdscr); }
X	if (needsit(graph)) { touchwin(graph); wrefresh(graph); }
X	if (needsit(mn)) { touchwin(mn); wrefresh(mn); }
X	if (needsit(srt)) { touchwin(srt); wrefresh(srt); }
X	if (needsit(btm)) { touchwin(btm); wrefresh(btm); }
X}
X
Xcapture(win, f, z)
XWINDOW	*win;
Xint	f, z;
X{
X	char	c;
X	int	i, j, icn = 0;			/* Internal count */
X	if (!trans)
X		return(1);
X
X	for (;;) {
Xl22:		wclear(btm); mvwaddstr(btm, 0, 0, "Would you like this on your transcript? ");
X		wrefresh(btm);
X		cur = btm; xp = 41; yp = 0;
X		noecho(); crmode();
X		c = wgetch(btm);
X		if (c == 'y') break;
X		if (c == '?') { help(22); goto l22; }
X		else if (c == 'n') return(1);
X	}
X			
X	if (!z) {
X		for (i = 0; i < SPACING; i++) {
X			fputc('\n', fp);
X			icn++;
X		}
X	} else {
X		for (i = 0; i < SPACING-2; i++) {
X			fputc('\n', fp);
X			icn++;
X		}
X		fprintf(fp, "Your selection characteristics are listed on the next line.\n");
X		icn++;
X		for (i = 0; i < 3; i++) {
X			if (dosort[i].wch != 0) {
X				icn++;
X				fprintf(fp, "%s ", sopts[dosort[i].wch].chst);
X				switch(dosort[i].sgn) {
X					case EQUAL: fprintf(fp, "= "); break;
X					case GREATER: fprintf(fp, "> "); break;
X					case CLOSE: fprintf(fp, "~ "); break;
X					default: fprintf(fp, "< ");
X				}
X				fprintf(fp, "%4.*f  ", sopts[dosort[i].wch].dnum, dosort[i].amt);
X			}
X		}
X	}
X	fputc('\n', fp);
X	for (i = 0; i < 23; i++) {
X		if (!f)
X			fprintf(fp, "      ");
X		for (j = 0; j < 80; j++) {
X			wmove(graph, i, j);
X			fputc(winch(graph), fp);
X		}
X		fputc('\n', fp);
X	}
X	for (i = 0; i < SPACING-2; i++)
X		fputc('\n', fp);
X
X	fflush(fp);
X	return(1);
X}
X
Xversion()
X{
X	clear(); refresh();
X
X	standout();
X	mvaddstr(0, 34, "Chemtab V2.01");
X	standend();
X	mvaddstr(2, 0, "Element data (text): ");
X	printw("%s", PERTABLE);
X	mvaddstr(3, 0, "Element table (binary): ");
X	printw("%s", BINTABLE);
X	mvaddstr(4, 0, "Periodic table (text): ");
X	printw("%s", TABLE);
X	mvaddstr(5, 0, "Periodic table (graphic): ");
X	printw("%s_graphic", TABLE);
X	mvaddstr(6, 0, "Online help file (text): ");
X	printw("%s", HELPFILE);
X	mvaddstr(7, 0, "Close value file (text): ");
X	printw("%s", CLOSEFILE);
X	standout();
X	mvaddstr(9, 0, "The above files must be properly defined for the program to run");
X	mvaddstr(10, 0, "The files below are optional definitions");
X	standend();
X#ifdef	USERSHELL
X	mvaddstr(12, 0, "Job stopping is enabled.");
X#else
X	mvaddstr(12, 0, "Job stopping is disabled.");
X#endif	USERSHELL
X
X#ifdef	PRINTER
X	mvaddstr(13, 0, "Printing is enabled through the ");
X	printw("%s ", PRINTER);
X	printw("command.");
X#else
X	mvaddstr(13, 0, "Printing is disabled.");
X#endif	PRINTER
X
X#ifdef	TRANSCRIPT
X	mvaddstr(14, 0, "User logs are kept in ");
X	printw("%s.", TRANSCRIPT);
X#else
X	mvaddstr(14, 0, "User logs are disabled.");
X#endif	TRANSCRIPT
X
X#ifdef	ReGIS
X	mvaddstr(15, 0, "ReGIS graphics module is installed.");
X#else
X	mvaddstr(15, 0, "ReGIS graphics module is not installed.");
X#endif	ReGIS
X
X	refresh();
X	spc();
X	clear(); refresh();
X}
END_OF_FILE
  if test 5067 -ne `wc -c <'scrmisc.c'`; then
    echo shar: \"'scrmisc.c'\" unpacked with wrong size!
  fi
  # end of 'scrmisc.c'
fi
if test -f 'tune.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'tune.h'\"
else
  echo shar: Extracting \"'tune.h'\" \(2692 characters\)
  sed "s/^X//" >'tune.h' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base 1990 Jim King (pulsar@lsrhs)
X *
X * tune.h	Site Specifics
X */
X
X/***********
X *********** DEFINES which MUST be defined.
X ***********/
X
X/* PERTABLE is the path up to and including the list of elements, elist */
X#define PERTABLE	"/usr/local/lib/chemtab/elist"
X
X/* BINTABLE is the binary form (faster to read in) of PERTABLE */
X#define BINTABLE	"/usr/local/lib/chemtab/binlist"
X
X/* TABLE is the path up to and including the periodic table outline, pertab */
X/* NOTE: the names of the file pertab and pertab_graphic should not be changed.
X         if you want to change the name change then to name and name_graphic */
X
X#define TABLE		"/usr/local/lib/chemtab/pertab"
X
X/* HELPFILE is the path up to and including the online helpfile */
X#define HELPFILE	"/usr/local/lib/chemtab/online_help"
X
X/* CLOSEFILE is the filename which contains the close values, meaning if
X	     someone searches for a value 'close to' something, this is the
X	     defined good range to look for. */
X#define CLOSEFILE	"/usr/local/lib/chemtab/closevalues"
X
X/* Now go to scrmisc.c and change the 'SPACING' define.  It is required. */
X
X/**********
X ********** DEFINES which are conditional on IF they are defined.
X **********/
X
X/* If you have a digital LN03 compatible laser printer, define this and
X   you will be able to print copies of your ReGIS graphs! */
X#define LASERPRT
X
X/* USERSHELL is the command to run if a person tries to stop the program
X   with a ^Z if you do NOT want the program to stop, comment this out */
X/* Obviously, this was not written on a SYSV system..  If you have SYSV
X   it is advised you comment this out */
X#define USERSHELL	"/bin/csh"
X
X/* PRINTER is the printer program or shell script you use to print on
X   the desired printer for Chemtab output.  Preferably, when using lpr,
X   you want to add the '-h' function to skip the header page. */
X/* If you do NOT want to program to print anything out at the end of the
X   transcript section, do NOT define this.  If it is defined, the printouts
X   will automagically be printed with this command */
X/* With PRINTER, an optional define is PRINTQ.  If you have multiple
X   printers or print queues, the program will prompt you for one to print
X   to.  Make sure if a space is necessary to use it.. i.e.:
X
X   #define PRINTER	"lpr h -P"
X   #define PRINTQ
X
X   #define PRINTER	"prvms -q "
X   #define PRINTQ			note you need a space */
X/* ------------------------------------------------------------- */
X#define PRINTER		"prvms -q "
X#define	PRINTQ
X
X/* TRANSCRIPT is the path to the logfile which lists who uses the program.
X              if it is not defined, then no log is made. */
X#define TRANSCRIPT	"logfile"
END_OF_FILE
  if test 2692 -ne `wc -c <'tune.h'`; then
    echo shar: \"'tune.h'\" unpacked with wrong size!
  fi
  # end of 'tune.h'
fi
if test -f 'variables.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'variables.h'\"
else
  echo shar: Extracting \"'variables.h'\" \(2397 characters\)
  sed "s/^X//" >'variables.h' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * variables.h	Include file - basically a global file
X */
X
X#include <stdio.h>
X#include "tune.h"
X
Xfloat	x;				/* global find() element */
Xint	sub1[120],			/* Sorted elements stored here */
X	xp, yp,				/* Stop job handling */
X#ifdef	LASERPRT
X	laser,				/* Laser print? */
X#endif	LASERPRT
X#ifdef  ReGIS
X	regis,				/* regis on/off flag */
X#endif 	ReGIS
X#ifdef	TRANSCRIPT
X	trans,				/* transcript flag */
X#endif  TRANSCRIPT
X	gtot;				/* total of sorted elements */
X#ifdef	LASERPRT
XFILE	*lsr;
X#endif	LASERPRT
XFILE	*fp;				/* File pointer for the above flag */
X
Xchar	lnm[80];			/* User's last name for transcript */
X
Xstruct dung {				/* Sorting structure */
X	int	wch,
X		sgn;
X	float	amt;
X} dosort[3];
X
Xstatic char	*mopts[] = {		/* Main menu options */
X	0,
X	"List information regarding one element",
X	"Choose element's characteristics",
X	"List information on all selected elements",
X	"View periodic table showing positions of selected elements",
X	"Use the graphing module",
X	"Save your transcripts, Print them, and Quit",
X	0
X};
X
X/* If you are looking here because you want to change the 'close values'
X * and you do not understand the abbreviations in 'closevalues' then
X * the following list is in order (note the first element is
X        "0",			"0",		"0",		0,
X * which means that the first value in the closevalues is 0
X */
X
Xstatic struct op {
X	char	chst[30],
X		upline[20],
X		dnline[20];
X	int	dnum;
X} sopts[] = {			/* Selecting options */
X	"0",			"0",		"0",		0,
X	"Atomic Number",	"Greater Than",	"Less Than",	0,
X	"Atomic Mass",		"Greater Than",	"Less Than",	3,
X	"Family (going up-dn)",	"Greater Than",	"Less Than",	0,
X	"Row (going left-rt)",	"Greater Than",	"Less Than",	0,
X	"Valence Electrons",	"More Than",	"Less Than",	0,
X	"Melting Temperature",	"Greater Than",	"Less Than",	0,
X	"Boiling Temperature",	"Greater Than",	"Less Than",	0,
X	"Ionization Energy",	"Greater Than",	"Less Than",	0,
X	"Discovery Year",	"After",	"Before",	0,
X	"Electronegativity",	"Greater Than",	"Less Than",	1,
X	"Specific Heat",	"Greater Than",	"Less Than",	3,
X	"Density",		"Greater Than",	"Less Than",	2,
X	"Atomic Radius",	"Greater Than",	"Smaller Than",	2,
X	"Return to Main Menu",	"0",		"0",		0,
X	"Clear ALL Characteristics",	"0",	"0",		0,
X	"0",			"0",		"0",		0
X};
X
X#define	EQUAL	0		/* Constants */
X#define GREATER	1
X#define LESS	2
X#define	CLOSE	3
END_OF_FILE
  if test 2397 -ne `wc -c <'variables.h'`; then
    echo shar: \"'variables.h'\" unpacked with wrong size!
  fi
  # end of 'variables.h'
fi
if test -f 'vdata.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'vdata.c'\"
else
  echo shar: Extracting \"'vdata.c'\" \(4062 characters\)
  sed "s/^X//" >'vdata.c' <<'END_OF_FILE'
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar@lsrhs)
X *
X * vdata.c	View current data
X */
X
X#include <stdio.h>
X#include <curses.h>
X#include "variables.h"
X#include "tune.h"
X#include "element.h"
X#include "windows.h"
X#include "undefs.h"
X
X/*
X * topline() - no input
X *
X * purpose:	sets up the topline of user info.
X */
Xtopline()
X{
X	mvwaddstr(graph, 0, 0, "Name");
X	mvwaddstr(graph, 0, 13, "Sy");
X	mvwaddstr(graph, 0, 18, "Z");
X	mvwaddstr(graph, 0, 23, "MASS");
X	mvwaddstr(graph, 0, 30, "FM");
X	mvwaddstr(graph, 0, 33, "R");
X	mvwaddstr(graph, 0, 35, "V");
X	mvwaddstr(graph, 0, 37, "Melt");
X	mvwaddstr(graph, 0, 42, "Boil");
X	mvwaddstr(graph, 0, 47, "FIO");
X	mvwaddstr(graph, 0, 51, "Year");
X	mvwaddstr(graph, 0, 56, "ENG");
X	mvwaddstr(graph, 0, 60, "SPHT");
X	mvwaddstr(graph, 0, 66, "DENS");
X	mvwaddstr(graph, 0, 71, "ARAD");
X	wrefresh(graph);
X}
X
X/*
X * vdata() - no input
X *
X * purpose:	show all information on all selected elements to user
X */
Xvdata()
X{
X	struct elem *tmp;
X	int	n = 0, flg = 0, factor = 1, l, m, i, j, sorted;
X
X	if (gtot == -1) {
X		mvwaddstr(mn, 15, 0, "Please choose some selection characteristics before you do this.");
X		wrefresh(mn);
X		sleep(2);
X		wmove(mn, 15, 0); wclrtoeol(mn);
X		return(0);
X	}
X
X	wclear(mn);
X	wrefresh(mn);
X
X	wclear(graph);
X	wrefresh(graph);
X	if (gtot == 0) {
X		mvwaddstr(graph, 5, 0, "No elements met the requirements you set.");
X		wrefresh(graph);
X		spc();
X		clear();
X		refresh();
X		return(0);
X	}
X	if (gtot > 22)
X		factor++;
X	if (gtot > 44)
X		factor++;
X	if (gtot > 66)
X		factor++;
X	if (gtot > 88)
X		factor++;
X	clear();
X	refresh();
X	for (i = 0; i < factor; i++) {
X		topline();
X		for (j = 22*i+1; j < 22*i+23; j++) {
X			if (j > gtot)
X				break;
X			n = sub1[j];
X			for (tmp = e; n != tmp->anum; tmp = tmp->next) ;
X			mvwaddstr(graph, j-22*i, 0, tmp->name);
X			wmove(graph, j-22*i, 13); wprintw(graph, "%s", tmp->sym);
X			wmove(graph, j-22*i, 18); wprintw(graph, "%-d", tmp->anum);
X			wmove(graph, j-22*i, 22); wprintw(graph, "%-3.3f", tmp->amass);
X			wmove(graph, j-22*i, 30); wprintw(graph, "%-d", tmp->fam);
X			wmove(graph, j-22*i, 33); wprintw(graph, "%-d", tmp->row);
X			if (tmp->val == VAL) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*1, 35, "X");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 35); wprintw(graph, "%d", tmp->val);
X			}
X			if (tmp->melt == MEL) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*i, 37, "N/F");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 37); wprintw(graph, "%-d", tmp->melt);
X			}
X			if (tmp->boil == BOI) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*i, 42, "N/F");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 42); wprintw(graph, "%-d", tmp->boil);
X			}
X			if (tmp->fio == FIO) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*i, 47, "N/F");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 47); wprintw(graph, "%3d", tmp->fio);
X			}
X			if (tmp->year == YEA) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*i, 51, "B.C.");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 51); wprintw(graph, "%-d", tmp->year);
X			}
X			if (tmp->eneg == ENG) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*i, 56, "N/F");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 56); wprintw(graph, "%1.1f", tmp->eneg);
X			}
X			if (tmp->spht == SPHT) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*i, 60, "N/F");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 60); wprintw(graph, "%1.3f", tmp->spht);
X			}
X			if (tmp->dens == DENS) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*i, 66, "N/F");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 66);
X				if (tmp->dens > 9.99)
X					wprintw(graph, "%2.1f", tmp->dens);
X				else
X					wprintw(graph, "%1.2f", tmp->dens);
X			}
X			if (tmp->arad == ARD) {
X				wstandout(graph);
X				mvwaddstr(graph, j-22*i, 71, "N/F");
X				wstandend(graph);
X			} else {
X				wmove(graph, j-22*i, 71); wprintw(graph, "%1.2f", tmp->arad);
X			}
X			wrefresh(graph);
X		}
X		spc();
X		capture(graph, 0, 1);
X		wclear(graph);
X	}
X	clear();
X	refresh();
X	return(0);
X}
END_OF_FILE
  if test 4062 -ne `wc -c <'vdata.c'`; then
    echo shar: \"'vdata.c'\" unpacked with wrong size!
  fi
  # end of 'vdata.c'
fi
echo shar: End of archive 2 \(of 3\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 archives.
    rm -f ark[1-9]isdone
else
    echo You still must unpack the following archives:
    echo "        " ${MISSING}
fi
exit 0
exit 0 # Just in case...
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.