v14i062: Chemtab 1.2 (part 2 of 3)
root at ames.arc.nasa.gov
root at ames.arc.nasa.gov
Thu Aug 30 08:41:12 AEST 1990
Posting-number: Volume 14, Issue 62
Submitted-by: root at ames.arc.nasa.gov@lsrhs.UUCP (Mr System)
Archive-name: chemtab-1.2/part02
---- Cut Here and unpack ----
#!/bin/sh
# this is part 2 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file looke.c continued
#
CurArch=2
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
exit 1; fi
( read Scheck
if test "$Scheck" != $CurArch
then echo "Please unpack part $Scheck next!"
exit 1;
else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file looke.c"
sed 's/^X//' << 'SHAR_EOF' >> looke.c
X wrefresh(mn);
X echo();
X nocrmode();
X gets(srch);
X }
X
X wclear(mn); wrefresh(mn);
X for (i = 1; i < MAXLM; i++) { /* Look for appropriate element */
X switch(c) { /* then display it */
X case '1': strn = e[i].name;
X if (strncmp(srch, strn, sizeof(srch)) == 0) {
X disp(e[i].anum); goto nd;
X } else
X break;
X case '2':
X if (atoi(srch) == e[i].anum) {
X disp(e[i].anum); goto nd;
X } else
X break;
X case '3': strn = e[i].sym;
X if (strncmp(srch, strn, sizeof(srch)) == 0) {
X disp(e[i].anum); goto nd;
X } else
X break;
X }
X }
X mvwaddstr(mn, 11, 0, "No such element!");
X wrefresh(mn);
X sleep(2);
Xnd: wclear(graph); wrefresh(graph);
X wclear(mn); wrefresh(mn);
X return(0);
X}
SHAR_EOF
echo "File looke.c is complete"
chmod 0755 looke.c || echo "restore of looke.c fails"
set `wc -c looke.c`;Sum=$1
if test "$Sum" != "4281"
then echo original size 4281, current size $Sum;fi
echo "x - extracting main.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > main.c &&
X
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar at lsrhs)
X *
X * main.c Main program structure and branch
X */
X
X#include <stdio.h>
X#include <curses.h>
X#include <time.h>
X#include <signal.h>
X
X#include "variables.h"
X#include "windows.h"
X
Xextern int cleanup();
X
X/*
X * main() - no input
X *
X * purpose: Main program branch & menu & inits
X */
Xmain()
X{
X#ifdef TRANSCRIPT
X long secs; /* For logfile */
X#endif TRANSCRIPT
X char c; /* input choice */
X initscr(); /* start curses */
X
X btm = newwin(1, 79, 23, 0); /* Bottom line window */
X srt = newwin(5, 79, 0, 0); /* Top sort window */
X graph = newwin(23, 79, 0, 0); /* Whole screen overwrite */
X mn = newwin(17, 79, 5, 0); /* Middle (main) window */
X
X#ifdef TRANSCRIPT /* Log time and user in file */
X time(&secs);
X bot("Logging you in..");
X if ((fp = fopen(TRANSCRIPT, "a+")) != NULL) {
X fprintf(fp, "%s logged in at %s", getenv("USER"), ctime(&secs));
X fclose(fp);
X } else {
X bot("Please set the TRANSCRIPT define in tune.h to work on your machine.");
X sleep(10);
X bot("The program will exit so you can do this now.");
X sleep(5);
X cleanup();
X }
X#endif TRANSCRIPT
X
X clear();
X mvaddstr(5, 37, "ChemTab");
X mvaddstr(9, 8, "\033#6Periodic Table Data Base");
X mvaddstr(20, 21, "Version 1.2, August 2nd 1990 by Jim King");
X refresh(); /* Title page */
X spc();
Xfrs: mvwaddstr(btm, 0, 0, "Would you like extra explanations? ");
X wrefresh(btm); /* .. help flag (hlp) */
X noecho();
X crmode();
X c = getchar();
X if (c == 'y') {
X wprintw(btm, "yes"); wrefresh(btm);
X hlp++;
X } else if (c != 'n') {
X mvwaddstr(btm, 0, 38, "(y or n)");
X goto frs;
X }
X wprintw(btm, "no"); wrefresh(btm);
X wclear(btm);
X wrefresh(btm);
Xnxt: mvwaddstr(btm, 0, 0, "Would you like a transcript of graphs and information? ");
X wrefresh(btm); /* transcript flag (trans) */
X c = getchar();
X if (c == 'y') {
X trans = 1;
X wclear(btm);
X mvwaddstr(btm, 0, 0, "Please enter your last name for the transcript: ");
X wrefresh(btm);
X echo(); nocrmode();
X gets(lnm);
X sprintf(str, "%d.chemtab", getpid());
X fp = fopen(str, "w");
X fprintf(fp, "*** ChemTab - Periodic Table Database - Transcript for >> %s <<", lnm);
X }
X else if (c != 'n') {
X mvwaddstr(btm, 0, 58, "(y or n) ");
X goto nxt;
X }
X wprintw(btm, "no"); wrefresh(btm);
X wclear(btm);
X wrefresh(btm);
X clear();
X refresh();
X
X bot("Reading in elements...");
X
X readelem(); /* Sort PERTABLE -> e[] */
X
X signal(SIGINT, cleanup);
X signal(SIGTSTP, SIG_IGN);
X signal(SIGQUIT, SIG_IGN);
X
X for (i = 0; i < 3; i++) /* initialize sort choices */
X dosort[i].wch = 0;
X
X bot(" "); /* clear the bottom line */
X
X for (;;) { /* main loop */
X wclear(mn);
X wrefresh(srt);
X upsort(); /* Update the sort window */
X for (i = 1; i < 7; i++) {
X wmove(mn, i+1, 0);
X wprintw(mn, "%d] %s", i, mopts[i]);
X } /* give me choices and help, then branch off */
X if (hlp) {
X mvwaddstr(mn, 12, 16, "If you do not know what to do, consult your ChemTab handbook");
X mvwaddstr(mn, 9, 16, "(type in number of choice, do not hit return)");
X }
X wmove(mn, 9, 0); wrefresh(mn);
X wrefresh(mn);
X wstandout(mn);
X mvwaddstr(mn, 0, 36, "MAIN MENU");
X wstandend(mn);
X mvwaddstr(mn, 9, 0, "Your choice? ");
X wclrtoeol(mn);
X wrefresh(mn);
X noecho();
X crmode();
Xloop: switch(wgetch(mn)) {
X case '1': looke(); break; /* View specific Element. */
X case '2': schar(); esort(); break; /* Select Characteristics */
X case '3': vdata(); break; /* View Selected Elements */
X case '4': ptabl(); break; /* Print periodic table.. */
X case '5': dogph(); break; /* Do a graph for us..... */
X case '6': cleanup(); break; /* Exit */
X default: goto loop;
X }
X }
X}
SHAR_EOF
chmod 0644 main.c || echo "restore of main.c fails"
set `wc -c main.c`;Sum=$1
if test "$Sum" != "3646"
then echo original size 3646, current size $Sum;fi
echo "x - extracting ptabl.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > ptabl.c &&
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar at 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
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 FILE *fd; /* Periodic table is in a file */
X char foo[80]; /* And we need to read it into something */
X int n; /* element number reference */
X
X if ((fd = fopen(TABLE, "r")) == NULL) {
X bot("Cannot open Periodic Table for reading..");
X sleep(2);
X bot(" ");
X return(0);
X }
X
X clear(); refresh();
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 tablsort(); /* Put characteristics on screen */
X for (i = 1; i < gtot+1; i++) { /* format and print element sym. */
X n = sub1[i];
X if (e[n].anum > 56 && e[n].anum < 72)
X wmove(graph, horz[8], (13 + ((e[n].fam - 1) * 3)));
X else if (e[n].anum > 88 && e[n].anum < 104)
X wmove(graph, horz[9], (13 + ((e[n].fam - 1) * 3)));
X else
X wmove(graph, horz[e[n].row], (1 + ((e[n].fam - 1) * 3)));
X
X wstandout(graph);
X wprintw(graph, "%2s", e[n].sym);
X wrefresh(graph);
X wstandend(graph);
X }
X wrefresh(graph);
X capture(graph, 0, 0);
X spc();
X wclear(graph); wrefresh(graph);
X clear();
X refresh();
X return(0);
X}
SHAR_EOF
chmod 0755 ptabl.c || echo "restore of ptabl.c fails"
set `wc -c ptabl.c`;Sum=$1
if test "$Sum" != "1612"
then echo original size 1612, current size $Sum;fi
echo "x - extracting schar.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > schar.c &&
X/*
X * Chemtab - a periodic table data base (C) 1990 Jim King (pulsar at 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
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 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 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 int n, cur;
X
X noecho();
X crmode();
Xlop1: clear(); refresh();
X for (;;) {
Xlop2: upsort(); /* Update sorts */
X wclear(mn); wrefresh(mn);
X for (i = 1; i < 8; i++) {
X wmove(mn, i, 0);
X wprintw(mn, "%d] %s", i, sopts[i].chst);
X wmove(mn, i, 40);
X wprintw(mn, "%d] %s", i+7, sopts[i+7].chst);
X }
X wmove(mn, 8, 40);
X wprintw(mn, "15] %s", sopts[15].chst);
X mvwaddstr(mn, 10, 0, "Your Choice? ");
X wclrtoeol(mn);
X if (hlp)
X mvwaddstr(mn, 10, 16, "(type number of choice and press return)");
X mvwaddstr(mn, 10, 12, " ");
X wrefresh(mn);
X echo();
X nocrmode();
X gets(str);
X n = atoi(str);
X switch(n) {
X case 14: /* Main Menu */
X esort();
X return(0);
X case 15: /* Clear all chars */
X mvwaddstr(mn, 10, 0, "Are you sure? ");
X wrefresh(mn);
X noecho();
X crmode();
X if (wgetch(mn) == 'y') {
X for (i = 0; i < 3; i++)
X dosort[i].wch = 0;
X }
X wmove(mn, 10, 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 cur = whichone();
X if (dosort[0].wch == n || dosort[1].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 noecho(); crmode();
X if (getchar() == 'y') {
X bot(" ");
X for (i = 0; i < 2; i++) {
X if (dosort[i].wch == n)
X cur = i;
X }
X goto lop3;
X } else {
X mvwaddstr(btm, 0, 0, "Do you wish to make another characteristic of the same type?");
X wrefresh(btm);
X noecho(); crmode();
X if (getchar() != 'y') {
X wclear(btm); wrefresh(btm);
X goto lop2;
X }
X }
X }
X if (cur > 2) {
X bot("Maximum of three sorting characteristics");
X sleep(3);
X bot(" ");
X goto lop2;
X }
Xlop3: dosort[cur].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 mvwaddstr(mn, 6, 0, "4] Close To");
X wmove(mn, 7, 0); wprintw(mn, "5] Exit (will erase characteristic)");
X mvwaddstr(mn, 9, 9, "the amount you select next.");
X if (hlp)
X mvwaddstr(mn, 11, 16, "(type in number of choice, do not hit return)");
Xlop4: mvwaddstr(mn, 11, 0, "Your Choice? ");
X wrefresh(mn);
X noecho();
X crmode();
X switch(getchar()) {
X case '1': dosort[cur].sgn = EQUAL; break;
X case '2': dosort[cur].sgn = GREATER; break;
X case '3': dosort[cur].sgn = LESS; break;
X case '4': dosort[cur].sgn = CLOSE; break;
X case '5': dosort[cur].wch = 0; goto lop1;
X default:
X goto lop4;
X }
X wclear(mn);
X wrefresh(mn);
X wmove(mn, 1, 0);
X wprintw(mn, "You want to select some elements with the '%s' being ", sopts[n].chst);
X switch(dosort[cur].sgn) {
X case EQUAL:
X wprintw(mn, "Equal to");
X break;
X case GREATER:
X wprintw(mn, "%s", sopts[n].upline);
X break;
X case CLOSE:
X wprintw(mn, "Close to");
X break;
X default:
X wprintw(mn, "%s", sopts[n].dnline);
X break;
X }
X if (hlp)
X mvwaddstr(mn, 3, 21, "(type in a number then hit return. Decimals are allowed)");
Xlop5: mvwaddstr(mn, 3, 0, "What Amount? ");
X wclrtoeol(mn);
X wrefresh(mn);
X echo();
X nocrmode();
X scanf("%f", &dosort[cur].amt);
X if (dosort[cur].amt > 9999) {
X bot("Maximum amount is 9999.");
X sleep(3);
X bot(" ");
X goto lop5;
X }
X getchar(); /* Eat the \n that scanf doesn't */
X }
X}
SHAR_EOF
chmod 0644 schar.c || echo "restore of schar.c fails"
set `wc -c schar.c`;Sum=$1
if test "$Sum" != "5654"
then echo original size 5654, current size $Sum;fi
echo "x - extracting scrmisc.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > scrmisc.c &&
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar at 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/*
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 noecho(); crmode();
X getchar();
X wclear(btm);
X wrefresh(btm);
X}
X
Xcapture(win, f, z)
XWINDOW *win;
Xint f, z;
X{
X char c;
X int icn = 0; /* Internal count */
X if (!trans)
X return(1);
X
X for (;;) {
X wclear(btm); mvwaddstr(btm, 0, 0, "Would you like this on your transcript? ");
X wrefresh(btm);
X noecho(); crmode();
X c = wgetch(btm);
X if (c == 'y') break;
X else if (c == 'n') return(1);
X }
X
X if (!z) {
X for (i = 0; i < 5; i++) {
X fputc('\n', fp);
X icn++;
X }
X } else {
X for (i = 0; i < 3; 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 < 4; i++)
X fputc('\n', fp);
X
X fflush(fp);
X return(1);
X}
SHAR_EOF
chmod 0755 scrmisc.c || echo "restore of scrmisc.c fails"
set `wc -c scrmisc.c`;Sum=$1
if test "$Sum" != "1903"
then echo original size 1903, current size $Sum;fi
echo "x - extracting vdata.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > vdata.c &&
X
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar at 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, 22, "M");
X mvwaddstr(graph, 0, 26, "FM");
X mvwaddstr(graph, 0, 29, "R");
X mvwaddstr(graph, 0, 31, "V");
X mvwaddstr(graph, 0, 33, "Melt");
X mvwaddstr(graph, 0, 38, "Boil");
X mvwaddstr(graph, 0, 43, "FIO");
X mvwaddstr(graph, 0, 47, "Year");
X mvwaddstr(graph, 0, 52, "ENG");
X mvwaddstr(graph, 0, 56, "SPHT");
X mvwaddstr(graph, 0, 61, "DENS");
X mvwaddstr(graph, 0, 66, "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 int n = 0, flg = 0, factor = 1, l, m;
X
X wclear(mn);
X wrefresh(mn);
X
X clear();
X wclear(graph);
X wrefresh(graph);
X refresh();
X topline();
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 sprintf(str, "GTOT = %d", gtot);
X bot(str);
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 for (i = 0; i < factor; i++) {
X for (j = 22*i+1; j < 22*i+23; j++) {
X if (j > gtot)
X break;
X n = sub1[j];
X mvwaddstr(graph, j-22*i, 0, e[n].name);
X wmove(graph, j-22*i, 13); wprintw(graph, "%s", e[n].sym);
X wmove(graph, j-22*i, 18); wprintw(graph, "%-d", e[n].anum);
X wmove(graph, j-22*i, 22); wprintw(graph, "%-d", e[n].amass);
X wmove(graph, j-22*i, 26); wprintw(graph, "%-d", e[n].fam);
X wmove(graph, j-22*i, 29); wprintw(graph, "%-d", e[n].row);
X if (e[n].val == VAL) {
X wstandout(graph);
X mvwaddstr(graph, j-22*1, 31, "X");
X wstandend(graph);
X } else {
X wmove(graph, j-22*i, 31); wprintw(graph, "%d", e[n].val);
X }
X if (e[n].melt == MEL) {
X wstandout(graph);
X mvwaddstr(graph, j-22*i, 33, "N/F");
X wstandend(graph);
X } else {
X wmove(graph, j-22*i, 33); wprintw(graph, "%-d", e[n].melt);
X }
X if (e[n].boil == BOI) {
X wstandout(graph);
X mvwaddstr(graph, j-22*i, 38, "N/F");
X wstandend(graph);
X } else {
X wmove(graph, j-22*i, 38); wprintw(graph, "%-d", e[n].boil);
X }
X if (e[n].fio == FIO) {
X wstandout(graph);
X mvwaddstr(graph, j-22*i, 43, "N/F");
X wstandend(graph);
X } else {
X wmove(graph, j-22*i, 43); wprintw(graph, "%3d", e[n].fio);
X }
X if (e[n].year == YEA) {
X wstandout(graph);
X mvwaddstr(graph, j-22*i, 47, "B.C.");
X wstandend(graph);
X } else {
X wmove(graph, j-22*i, 47); wprintw(graph, "%-d", e[n].year);
X }
X if (e[n].eneg == ENG) {
X wstandout(graph);
X mvwaddstr(graph, j-22*i, 52, "N/F");
X wstandend(graph);
X } else {
X wmove(graph, j-22*i, 52); wprintw(graph, "%1.1f", e[n].eneg);
X }
X if (e[n].spht == SPHT) {
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.2f", e[n].spht);
X }
X if (e[n].dens == DENS) {
X wstandout(graph);
X mvwaddstr(graph, j-22*i, 61, "N/F");
X wstandend(graph);
X } else {
X wmove(graph, j-22*i, 61);
X if (e[n].dens > 9.99)
X wprintw(graph, "%2.1f", e[n].dens);
X else
X wprintw(graph, "%1.2f", e[n].dens);
X }
X if (e[n].arad == ARD) {
X wstandout(graph);
X mvwaddstr(graph, j-22*i, 66, "N/F");
X wstandend(graph);
X } else {
X wmove(graph, j-22*i, 66); wprintw(graph, "%1.2f", e[n].arad);
X }
X wrefresh(graph);
X }
X spc();
X capture(graph, 0, 1);
X wclear(graph);
X topline();
X }
X clear();
X refresh();
X return(0);
X}
SHAR_EOF
chmod 0755 vdata.c || echo "restore of vdata.c fails"
set `wc -c vdata.c`;Sum=$1
if test "$Sum" != "3838"
then echo original size 3838, current size $Sum;fi
echo "x - extracting element.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > element.h &&
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar at lsrhs)
X *
X * element.h Contains the structure for all the elements, e[].
X */
X
X#include "tune.h"
X
Xstruct elem {
X char name[15], /* Atomic Name */
X sym[4]; /* Atomic Symbol */
X float eneg, /* Electronegativity */
X spht, /* Specific Heat */
X arad, /* Atomic Radius */
X dens; /* Density of the Solid */
X int anum, /* Atomic Number */
X amass, /* Atomic Mass */
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} e[MAXLM];
SHAR_EOF
chmod 0755 element.h || echo "restore of element.h fails"
set `wc -c element.h`;Sum=$1
if test "$Sum" != "712"
then echo original size 712, current size $Sum;fi
echo "x - extracting graph.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > graph.h &&
X/*
X * chemtab - a periodic table data base (C) 1990 by Jim King (pulsar at lsrhs)
X *
X * graph.h Contains stuff for graphing
X */
X
X#include "undefs.h"
X
Xfloat 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[70], /* each spot on x axis is given a defined number */
X yaxis[21]; /* each spot on y axis is given a defined number */
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
Xchar *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};
SHAR_EOF
chmod 0755 graph.h || echo "restore of graph.h fails"
set `wc -c graph.h`;Sum=$1
if test "$Sum" != "836"
then echo original size 836, current size $Sum;fi
echo "x - extracting tune.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > tune.h &&
X/*
X * chemtab - a periodic table data base 1990 Jim King (pulsar at lsrhs)
X *
X * tune.h Site Specifics
X */
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#define PRINTER "/usr/local/bin/letter -h"
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/* MAXLM is the number of elements in PERTABLE + 1 */
X#define MAXLM 108
X
X/* TABLE is the path up to and including the periodic table outline, pertab */
X#define TABLE "/usr/local/lib/chemtab/pertab"
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 "/usr/local/lib/chemtab/logfile"
SHAR_EOF
chmod 0755 tune.h || echo "restore of tune.h fails"
set `wc -c tune.h`;Sum=$1
if test "$Sum" != "869"
then echo original size 869, current size $Sum;fi
echo "x - extracting undefs.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > undefs.h &&
X/*
X * chemtab - a periodic table data base 1990 Jim King (puslar at lsrhs)
X *
X * undefs.h - carries all the numbers for undefined vars throughout
X */
X
Xstatic int VAL = 9,
X MEL = -273,
X BOI = -273,
X FIO = -1,
X YEA = -1;
Xstatic float ENG = -1.5,
X SPHT = -1.5,
X DENS = -1.5,
X ARD = -1.5;
X
X/* Close values */
Xstatic float close[15] = {
X 0.00, 5.00, 10.00, 1.00, 1.00, 1.00, 100.00, 100.00, 25.00, 50.00,
X 0.20, 0.05, 0.20, 0.05, 0.00
X};
SHAR_EOF
chmod 0644 undefs.h || echo "restore of undefs.h fails"
set `wc -c undefs.h`;Sum=$1
if test "$Sum" != "438"
then echo original size 438, current size $Sum;fi
echo "x - extracting variables.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > variables.h &&
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar at lsrhs)
X *
X * variables.h Include file - basically a global file
X */
X
X#include <stdio.h>
X#include "tune.h"
X
Xint hlp; /* Help flag */
X
Xint trans; /* Puts lists, graphs, and table in file for print */
X
XFILE *fp; /* File pointer for the above flag */
X
Xint sub1[MAXLM], gtot; /* sorted elements stored here */
X
Xchar foo[160], str[80]; /* Random input */
X
Xchar lnm[80]; /* User's last name for transcript */
X
Xint i, j, k; /* Random ints */
X
Xfloat x; /* Random floater */
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
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", 0,
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", 2,
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
X
Xint sort_list[MAXLM]; /* Sort final list */
SHAR_EOF
chmod 0644 variables.h || echo "restore of variables.h fails"
set `wc -c variables.h`;Sum=$1
if test "$Sum" != "2007"
then echo original size 2007, current size $Sum;fi
echo "x - extracting windows.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > windows.h &&
X/*
X * chemtab - a periodic table data base (C) 1990 Jim King (pulsar at lsrhs)
X *
X * windows.h Curses WINDOW init
X */
X
X#include <curses.h>
X
XWINDOW *srt, /* Sort chrst window */
X *graph, /* Graph/table Window */
X *mn, /* Main Window */
X *btm; /* Bottom line */
SHAR_EOF
chmod 0755 windows.h || echo "restore of windows.h fails"
set `wc -c windows.h`;Sum=$1
if test "$Sum" != "269"
then echo original size 269, current size $Sum;fi
echo "x - extracting elist (Text)"
sed 's/^X//' << 'SHAR_EOF' > elist &&
XName Sy Z M FM R V MELT BOIL FIO YEAR ENG SPHT DENS ARD
X
Xhydrogen H 1 1 1 1 1 -259 -252 313 1766 2.2 0.57 0.07 0.30
Xhelium He 2 4 18 1 2 -272 -269 563 1895 -1.5 -1.5 0.15 0.93
Xlithium Li 3 6 1 2 1 181 1342 124 1817 1.0 0.08 0.53 1.52
Xberyllium Be 4 9 2 2 2 127 2970 214 1798 1.5 0.42 1.85 1.12
Xboron B 5 11 13 2 3 2079 2550 191 1808 2.0 0.30 2.34 0.88
Xcarbon C 6 12 14 2 4 3550 4827 259 -1 2.5 0.17 2.25 0.77
Xnitrogen N 7 14 15 2 5 -210 -196 334 1772 3.0 0.39 0.81 0.70
Xoxygen O 8 16 16 2 6 -218 -183 313 1774 3.5 0.33 1.14 0.66
Xfluorine F 9 19 17 2 7 -220 -188 401 1886 4.0 -1.5 1.11 0.64
Xneon Ne 10 20 18 2 8 -249 -246 496 1898 -1.5 -1.5 1.21 1.31
Xsodium Na 11 23 1 3 1 98 883 118 1807 0.9 0.30 0.97 1.86
Xmagnesium Mg 12 24 2 3 2 649 1090 176 1755 1.2 0.25 1.74 1.60
Xaluminum Al 13 27 13 3 3 660 2467 138 1827 1.5 0.21 2.70 1.43
Xsilicon Si 14 28 14 3 4 1410 2355 187 1824 1.8 0.17 2.33 1.17
Xphosphorous P 15 31 15 3 5 44 280 350 1669 2.1 0.19 0.82 1.10
Xsulfur S 16 32 16 3 6 113 445 238 -1 2.5 0.18 2.06 1.04
Xchlorine Cl 17 36 17 3 7 -101 -35 298 1774 3.0 0.19 1.37 0.99
Xargon Ar 18 40 18 3 0 -189 -186 362 1894 -1.5 0.16 1.40 1.74
Xpotassium K 19 39 1 4 1 64 774 100 1807 0.8 0.19 0.86 2.31
Xcalcium Ca 20 40 2 4 2 839 1484 141 1808 1.0 0.15 1.54 1.97
Xscandium Sc 21 45 3 4 9 1539 2832 150 1879 1.3 -1.5 2.99 1.60
Xtitanium Ti 22 48 4 4 9 1660 3287 157 1791 1.4 0.11 4.54 1.46
Xvanadium V 23 51 5 4 9 1890 3380 155 1831 1.6 0.12 6.09 1.31
Xchromium Cr 24 52 6 4 9 1857 2672 156 1798 1.6 0.11 7.18 1.25
Xmanganese Mn 25 55 7 4 9 1244 1962 171 1774 1.5 0.12 7.21 1.29
Xiron Fe 26 56 8 4 9 1535 2750 181 -1 1.8 0.11 7.87 1.26
Xcobalt Co 27 59 9 4 9 1495 2870 181 1735 1.8 0.10 8.90 1.25
Xnickel Ni 28 59 10 4 9 1453 2732 176 1751 1.8 0.11 8.90 1.24
Xcopper Cu 29 64 11 4 9 1083 2567 178 -1 1.9 0.09 8.96 1.20
Xzinc Zn 30 65 12 4 9 420 907 216 1746 1.6 0.09 7.13 1.33
Xgallium Ga 31 70 13 4 3 30 2403 138 1875 1.6 0.08 5.91 1.22
Xgermanium Ge 32 73 14 4 4 937 2830 182 1886 1.8 0.07 5.32 1.22
Xarsenic As 33 75 15 4 5 817 613 226 1649 2.0 0.08 5.73 1.21
Xselenium Se 34 79 16 4 6 217 685 224 1818 2.4 0.08 4.79 1.17
Xbromine Br 35 80 17 4 7 -7 59 272 1826 2.8 0.09 3.12 1.14
Xkrypton Kr 36 84 18 4 0 -157 -152 322 1898 -1.5 -1.5 2.16 1.89
Xrubidium Rb 37 85 1 5 1 39 688 96 1861 0.8 0.08 1.53 2.44
Xstrontium Sr 38 88 2 5 2 769 1384 131 1790 1.0 0.00 2.63 2.15
Xyttrium Y 39 89 3 5 3 1523 3337 147 1794 1.2 0.07 4.47 1.62
Xzirconium Zr 40 91 4 5 4 1852 4377 157 1824 1.4 0.07 5.80 1.48
Xniobium Nb 41 93 5 5 5 2468 4742 158 1801 1.6 0.06 7.83 1.48
Xmolybdenum Mo 42 96 6 5 6 2617 4612 163 1778 1.8 0.06 9.35 1.47
Xtechnetium Tc 43 97 7 5 7 2172 4877 167 1925 1.9 0.06 11.5 1.47
Xruthenium Ru 44 101 8 5 8 2310 3900 170 1827 2.2 0.06 10.9 1.46
Xrhodium Rh 45 103 9 5 6 1966 3727 172 1803 2.2 0.07 11.1 1.45
Xpalladium Pd 46 106 10 5 4 1554 3140 192 1803 2.2 0.06 10.7 1.44
Xsilver Ag 47 108 11 5 2 962 2212 174 -1 1.9 0.06 9.32 1.53
Xcadminium Cd 48 112 12 5 2 321 765 207 1817 1.7 0.06 8.02 1.48
Xindium In 49 115 13 5 3 157 2080 133 1924 1.7 0.06 7.30 1.44
Xtin Sn 50 119 14 5 4 232 2270 169 -1 1.8 0.05 6.98 1.40
Xantimony Sb 51 122 15 5 5 631 1750 199 1700 1.9 0.05 6.69 1.41
Xtellurium Te 52 128 16 5 6 450 990 207 1782 2.1 0.05 5.75 1.37
Xiodine I 53 127 17 5 7 114 184 240 1811 2.5 0.01 4.94 1.33
Xxenon Xe 54 131 18 5 0 -112 -107 279 1898 -1.5 0.04 0.00 2.09
Xcesium Cs 55 133 1 6 1 28 669 90 1860 0.7 0.06 1.84 2.62
Xbarium Ba 56 137 2 6 2 725 1640 120 1774 0.9 0.05 3.50 2.17
Xlanthanium La 57 139 1 6 9 920 3454 128 1839 1.1 0.05 6.20 1.69
Xcerium Ce 58 140 2 8 9 798 3257 126 1803 1.1 0.05 6.70 -1.5
Xpraeseodym. Pr 59 141 3 8 3 931 3212 125 1841 1.2 0.05 6.80 -1.5
Xneodymium Nd 60 144 4 8 3 1010 3127 126 1841 1.1 0.05 7.00 -1.5
Xpromethium Pm 61 145 5 8 3 1080 2460 128 1902 1.1 0.04 0.00 -1.5
Xsamarium Sm 62 150 6 8 2 1072 1778 129 1879 1.2 0.04 7.50 -1.5
Xeuropium Eu 63 152 7 8 2 822 1597 130 1890 1.2 0.04 5.30 -1.5
Xgadolinium Gd 64 157 8 8 3 1311 3233 141 1880 1.1 0.06 7.90 -1.5
Xterbium Tb 65 159 9 8 3 1360 3041 135 1843 1.2 0.04 8.30 -1.5
Xdysprosium Dy 66 163 10 8 3 1409 2335 136 1886 1.2 0.04 8.50 -1.5
Xholmium Ho 67 165 11 8 3 1470 2720 138 1878 1.1 0.04 8.80 -1.5
Xerbium Er 68 167 12 8 3 1522 2510 140 1842 1.2 0.04 9.10 -1.5
Xthulium Tm 69 169 13 8 2 1545 1727 142 1879 1.2 0.04 9.10 -1.5
Xytterbium Yb 70 173 14 8 2 824 1193 144 1878 1.2 0.03 7.00 -1.5
Xlutetium Lu 71 175 15 8 3 1656 3315 125 1907 1.2 0.04 9.80 -1.5
Xhafnium Hf 72 178 4 6 4 2227 4602 161 1923 1.3 0.04 13.1 1.65
Xtantalum Ta 73 181 5 6 5 2996 5425 181 1844 1.5 0.03 16.6 1.62
Xtungsten W 74 184 6 6 6 3410 5660 184 1779 1.7 0.03 19.3 1.60
Xrhenium Re 75 186 7 6 7 3180 5627 181 1925 1.9 0.03 21.0 1.56
Xosmium Os 76 190 8 6 8 3045 5027 200 1803 2.2 0.03 22.6 1.52
Xiridium Ir 77 192 9 6 3 2410 4130 209 1803 2.2 0.03 22.5 1.48
Xplatinum Pt 78 195 10 6 4 1772 3827 207 1735 2.2 0.03 21.4 1.45
Xgold Au 79 197 11 6 1 1064 3080 212 -1 2.4 0.03 19.3 1.50
Xmercury Hg 80 201 12 6 1 -39 357 240 -1 1.9 0.03 13.6 1.49
Xthallium Tl 81 204 13 6 3 304 1457 140 1861 1.8 0.03 11.9 1.48
Xlead Pb 82 207 14 6 4 328 1720 171 -1 1.8 0.04 11.4 1.75
Xbismuth Bi 83 209 15 6 5 271 1560 168 1753 1.9 0.03 9.80 1.46
Xpolonium Po 84 209 16 6 6 254 962 194 1898 2.0 0.03 9.20 1.40
Xastatine At 85 210 17 6 7 302 337 -1 1940 2.2 -1.5 -1.5 1.40
Xradon Rn 86 222 18 6 0 -71 -62 247 1908 -1.5 0.02 -1.5 2.14
Xfrancium Fr 87 223 1 7 1 27 677 -1 1939 0.7 -1.5 -1.5 2.70
Xradium Ra 88 226 2 7 2 700 1140 121 1898 0.9 0.03 -1.5 2.20
Xactinium Ac 89 227 1 7 9 1050 3200 159 1899 -1.5 -1.5 10.1 -1.5
Xthorium Th 90 232 2 9 4 1750 4790 -1 1828 -1.5 0.03 11.7 -1.5
Xprotactinium Pa 91 231 3 9 4 1600 -273 -1 1913 -1.5 0.03 15.4 -1.5
Xuranium U 92 238 4 9 6 1132 3818 -1 1789 -1.5 0.03 19.1 -1.5
Xneptunium Np 93 237 5 9 4 640 3902 -1 1940 -1.5 -1.5 19.5 -1.5
Xplutonium Pu 94 244 6 9 5 641 3232 133 1940 -1.5 -1.5 19.5 -1.5
Xamericium Am 95 243 7 9 9 994 2607 138 1944 -1.5 -1.5 11.7 -1.5
Xcurium Cm 96 247 8 9 3 1340 -273 -1 1944 -1.5 -1.5 -1.5 -1.5
Xberkelium Bk 97 247 9 9 3 -273 -273 -1 1949 -1.5 -1.5 -1.5 -1.5
Xcalifornium Cf 98 251 10 9 9 -273 -273 -1 1950 -1.5 -1.5 -1.5 -1.5
Xeinsteinum Es 99 254 11 9 9 -273 -273 -1 1952 -1.5 -1.5 -1.5 -1.5
Xfermium Fm 100 257 12 9 9 -273 -273 -1 1952 -1.5 -1.5 -1.5 -1.5
Xmendelevium Md 101 257 13 9 3 -273 -273 -1 1955 -1.5 -1.5 -1.5 -1.5
Xnobelium No 102 259 14 9 4 -273 -273 -1 1958 -1.5 -1.5 -1.5 -1.5
Xlawrencium Lr 103 260 15 9 3 -273 -273 -1 1961 -1.5 -1.5 -1.5 -1.5
Xrutherford. Rf 104 260 4 7 9 -273 -273 -1 1969 -1.5 -1.5 -1.5 -1.5
Xhahnium Ha 105 260 5 7 9 -273 -273 -1 1970 -1.5 -1.5 -1.5 -1.5
XUnnamed Un 106 263 6 7 9 -273 -273 -1 1974 -1.5 -1.5 -1.5 -1.5
XUnnamed Un 107 266 7 7 9 -273 -273 -1 1975 -1.5 -1.5 -1.5 -1.5
SHAR_EOF
chmod 0755 elist || echo "restore of elist fails"
set `wc -c elist`;Sum=$1
if test "$Sum" != "7456"
then echo original size 7456, current size $Sum;fi
echo "x - extracting pertab (Text)"
sed 's/^X//' << 'SHAR_EOF' > pertab &&
X 1 18
X|--| PERIODIC TABLE OF |--|
X| | 2 THE ELEMENTS 13 14 15 16 17| |1
X|--|--| |--|--|--|--|--|--|
X| | | | | | | | | |2
X|--|--| |--|--|--|--|--|--|
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 In this program, the below elements are classified in the groups in ()
X |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|
XLanthanides | | | | | | | | | | | | | | | |6b (8)
X |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|
X Actinides | | | | | | | | | | | | | | | |7b (9)
X |--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|
SHAR_EOF
chmod 0755 pertab || echo "restore of pertab fails"
set `wc -c pertab`;Sum=$1
if test "$Sum" != "1243"
then echo original size 1243, current size $Sum;fi
rm -f s2_seq_.tmp
echo "You have unpacked the last part"
exit 0
More information about the Comp.sources.misc
mailing list