rsalz@uunet.uu.net (Rich Salz) (03/15/91)
Submitted-by: "J.E. King" <jek5036@ultb.isc.rit.edu> Posting-number: Volume 24, Issue 44 Archive-name: chemtab/patch1 Rich, After receiving bugs from people out on the network I have made 'an official patch' to Chemtab V2.01. This could be called patch #1, and it brings Chemtab up to V2.02. Unshar and read README.PATCH for a description of what has been fixed. There have also been a few small changes.. you may or may not notice but it does not affect the user really.. Thanks for the time. O / O / O / O / O / O / O / O / ----------X------X-------X-------X-------X-------X-------X-------X------ O \ O \ O \ O \ O \ O \ O \ O \ #!/bin/sh # to extract, remove the header and type "sh filename" if `test ! -s ./patch01` then echo "writing ./patch01" cat > ./patch01 << '\End\Of\Shar\' diff -c3 Old/Makefile New/Makefile *** Old/Makefile Wed Mar 13 19:42:26 1991 --- New/Makefile Wed Mar 13 21:27:14 1991 *************** *** 1,8 **** CC = cc ! CFLAGS = -g -DReGIS # Define ReGIS if you want to program to prompt the user to answer y/n # to the question of if they have a ReGIS compatible terminal ! DEST = chemtab EXTHDRS = /usr/include/curses.h \ /usr/include/math.h \ /usr/include/sgtty.h \ --- 1,22 ---- + # + # Makefile for Chemtab, current version 2.02, Makefile version 1.1 + # Makefile author: Jim King (jek5036@ultb.isc.rit.edu) + # Makefile additions: Jon Kamens (jik@pit-manager.mit.edu) + # CC = cc ! CFLAGS = -O -DReGIS # Define ReGIS if you want to program to prompt the user to answer y/n # to the question of if they have a ReGIS compatible terminal ! BINDIR = . ! MANDIR = . ! # MAKE SURE: Any defines in tune.h should reflect this file.. i.e. ! # if LIBDIR = LIB then the define in tune.h should be something ! # like #define PERTABLE "LIB/elist" *** important ! LIBDIR = LIB ! MANSUFFIX = 1 ! DEST = $(BINDIR)/ctab ! MANDEST = $(MANDIR)/man$(MANSUFFIX)/chemtab.$(MANSUFFIX) ! LIBFILS = closevalues elist pertab pertab_graphic online_help EXTHDRS = /usr/include/curses.h \ /usr/include/math.h \ /usr/include/sgtty.h \ *************** *** 20,26 **** variables.h \ windows.h LDFLAGS = $(CFLAGS) ! LIBS = -lcurses -ltermcap graphlib.a LINKER = cc MAKEFILE = Makefile OBJS = cleanup.o \ --- 34,40 ---- variables.h \ windows.h LDFLAGS = $(CFLAGS) ! LIBS = -lcurses -ltermcap LINKER = cc MAKEFILE = Makefile OBJS = cleanup.o \ *************** *** 29,34 **** --- 43,49 ---- element.o \ element2.o \ esort.o \ + graphlib.o \ looke.o \ main.o \ ptabl.o \ *************** *** 51,63 **** scrmisc.c \ vdata.c ! all: grlib $(PROGRAM) ! grlib: graphlib.o ! ar cr graphlib.a graphlib.o ! ranlib graphlib.a ! ! $(PROGRAM): $(OBJS) graphlib.a @echo -n "Loading $(PROGRAM) ... " @$(LINKER) $(LDFLAGS) $(OBJS) -o $(PROGRAM) $(LIBS) @echo "done" --- 66,74 ---- scrmisc.c \ vdata.c ! all: $(PROGRAM) ! $(PROGRAM): $(OBJS) @echo -n "Loading $(PROGRAM) ... " @$(LINKER) $(LDFLAGS) $(OBJS) -o $(PROGRAM) $(LIBS) @echo "done" *************** *** 68,77 **** index:; @ctags -wx $(HDRS) $(SRCS) ! install: $(PROGRAM) @echo Installing $(PROGRAM) in $(DEST) ! @install -m 4755 $(PROGRAM) $(DEST) ! print:; @$(PRINT) $(HDRS) $(SRCS) program: $(PROGRAM) --- 79,94 ---- index:; @ctags -wx $(HDRS) $(SRCS) ! install: $(PROGRAM) chemtab.1 @echo Installing $(PROGRAM) in $(DEST) ! @install -m 755 $(PROGRAM) $(DEST) ! @echo Installing chemtab.1 in $(MANDEST) ! @install -m 0644 chemtab.1 $(MANDEST) ! @echo Creating and modifying chemtab library files ! @-mkdir $(LIBDIR) ! @cp $(LIBFILS) $(LIBDIR) ! @chmod 755 $(LIBDIR) $(LIBDIR)/* ! print:; @$(PRINT) $(HDRS) $(SRCS) program: $(PROGRAM) diff -c3 Old/README New/README *** Old/README Wed Mar 13 19:42:27 1991 --- New/README Wed Mar 13 20:36:13 1991 *************** *** 30,32 **** --- 30,33 ---- Chemtab; written in C (1990) by Jim King (pulsar@lsrhs) Chemtab V2.01; (overlay from V1) written in C (1991) by Jim King (jek5036@ultb.isc.rit.edu) + Chemtab V2.02; (patch #1) with help from Jon Kamens (jik@pit-manager.mit.edu) Only in New: README.PATCH diff -c3 Old/VERSION New/VERSION *** Old/VERSION Wed Mar 13 19:42:28 1991 --- New/VERSION Wed Mar 13 20:29:49 1991 *************** *** 26,28 **** --- 26,34 ---- Job stopping fixed. (BSD only) Pipe of ReGIS graphing commands into a file. Graphing module updated to work faster. + + Chemtab V2.02 Patch to V2.01 + Makefile modified by Jon Kamens + (jik@pit-manager.MIT.EDU) + Problems when undefining ReGIS and TRANSCRIPT fixed. + A couple of minor screen display changes. diff -c3 Old/cleanup.c New/cleanup.c *** Old/cleanup.c Wed Mar 13 19:42:29 1991 --- New/cleanup.c Wed Mar 13 21:22:11 1991 *************** *** 67,78 **** nocrmode(); clear(); refresh(); endwin(); /* turn off curses */ ! if (trans) { printf("A copy of your transcript can be found in the file %d.chemtab\n", getpid()); ! /* printf("\nYou can pick up your printout at the printer to the left of\n"); ! printf("The White-Board, labelled Happy. Look for your last name in >><<'s on\n"); ! printf("the top line of each printout. Good luck with Chemistry.\n"); ! */ } fflush(stdout); /* just make sure.. */ exit(1); /* quit nicely */ } --- 67,76 ---- nocrmode(); clear(); refresh(); endwin(); /* turn off curses */ ! if (trans) ! /* You can put information on how to get to the printer HERE */ printf("A copy of your transcript can be found in the file %d.chemtab\n", getpid()); ! fflush(stdout); /* just make sure.. */ exit(1); /* quit nicely */ } diff -c3 Old/dogph.c New/dogph.c *** Old/dogph.c Wed Mar 13 19:42:31 1991 --- New/dogph.c Wed Mar 13 21:02:44 1991 *************** *** 109,114 **** --- 109,115 ---- if (x < xmin) xmin = x; } } else { + help(18); for (i = 1; i < gtot; i++) { find(c1, sub1[i]); if (x == -999.0) continue; *************** *** 162,177 **** /* Here we find the x axis max and min values */ /* if they are not already defined */ if (xmin == -999) { ! find(c1, e->anum); ! xmax = xmin = x; ! for (tmp = e; tmp->next != NULL; tmp = tmp->next) { ! find(c1, tmp->anum); ! if (x == -999.0) continue; ! if (x > xmax) xmax = x; ! if (x < xmin) xmin = x; } } - /* Here we find the y axis min and max values */ find(c2, e->anum); --- 163,189 ---- /* Here we find the x axis max and min values */ /* if they are not already defined */ if (xmin == -999) { ! if (gtot > 0) { ! for (i = 1; i < gtot; i++) { ! find(c1, sub1[i]); ! if (x == -999.0) continue; ! if (i == 1) xmax = xmin = x; ! else { ! if (x > xmax) xmax = x; ! if (x < xmin) xmin = x; ! } ! } ! } else { ! find(c1, e->anum); ! xmax = xmin = x; ! for (tmp = e; tmp->next != NULL; tmp = tmp->next) { ! find(c1, tmp->anum); ! if (x == -999.0) continue; ! if (x > xmax) xmax = x; ! if (x < xmin) xmin = x; ! } } } /* Here we find the y axis min and max values */ find(c2, e->anum); diff -c3 Old/doregisgph.c New/doregisgph.c *** Old/doregisgph.c Wed Mar 13 19:42:16 1991 --- New/doregisgph.c Wed Mar 13 21:02:44 1991 *************** *** 1,5 **** - #ifdef ReGIS - /* * chemtab - a periodic table data base (C) 1990 Jim King * jek5036@ritvax.isc.rit.edu (formerly pulsar@lsrhs) --- 1,3 ---- *************** *** 19,25 **** extern int numr(), stop(); - #endif ReGIS /* * find(ch, en) * --- 17,22 ---- *************** *** 125,130 **** --- 122,128 ---- if (x < xmin) xmin = x; } } else { + help(18); for (i = 1; i < gtot; i++) { find(c1, sub1[i]); if (x == -999.0) continue; *************** *** 178,190 **** bot("Calculating the X axis max and min values..."); if (xmin == -999) { ! find(c1, e->anum); ! xmax = xmin = x; ! for (tmp = e; tmp->next != NULL; tmp = tmp->next) { ! find(c1, tmp->anum); ! if (x == -999.0) continue; ! if (x > xmax) xmax = x; ! if (x < xmin) xmin = x; } } --- 176,200 ---- bot("Calculating the X axis max and min values..."); if (xmin == -999) { ! if (gtot > 0) { ! for (i = 1; i < gtot; i++) { ! find(c1, sub1[i]); ! if (x == -999.0) continue; ! if (i == 1) xmax = xmin = x; ! else { ! if (x > xmax) xmax = x; ! if (x < xmin) xmin = x; ! } ! } ! } else { ! find(c1, e->anum); ! xmax = xmin = x; ! for (tmp = e; tmp->next != NULL; tmp = tmp->next) { ! find(c1, tmp->anum); ! if (x == -999.0) continue; ! if (x > xmax) xmax = x; ! if (x < xmin) xmin = x; ! } } } diff -c3 Old/main.c New/main.c *** Old/main.c Wed Mar 13 19:42:02 1991 --- New/main.c Wed Mar 13 21:24:11 1991 *************** *** 93,99 **** sleep(1); unlink(LOCKFILE); } ! next: rebuild = 0; closetext = 0; gtot = 0; initscr(); /* start curses */ hlp = NULL; /* help screen init */ --- 93,99 ---- sleep(1); unlink(LOCKFILE); } ! next: rebuild = 0; closetext = 0; eopage = 0; initscr(); /* start curses */ hlp = NULL; /* help screen init */ *************** *** 123,132 **** mvaddstr(9, 28, "Periodic Table Data Base"); mvaddstr(10, 30, "Of the Known Elements"); standout(); ! mvaddstr(15, 21, "Chemtab 2.01 incorporates online help"); mvaddstr(16, 13, "Answer with a question mark at any question for help."); standend(); ! mvaddstr(18, 18, "Version 2.01, January 7th, 1991 by Jim King"); mvaddstr(19, 16, "Developed at Lincoln-Sudbury Regional High School"); mvaddstr(20, 12, "(and) ReGIS package at Rochester Institute of Technology"); refresh(); /* Title page */ --- 123,132 ---- mvaddstr(9, 28, "Periodic Table Data Base"); mvaddstr(10, 30, "Of the Known Elements"); standout(); ! mvaddstr(15, 21, "Chemtab 2.02 incorporates online help"); mvaddstr(16, 13, "Answer with a question mark at any question for help."); standend(); ! mvaddstr(18, 18, "Version 2.02, March 13th, 1991 by Jim King"); mvaddstr(19, 16, "Developed at Lincoln-Sudbury Regional High School"); mvaddstr(20, 12, "(and) ReGIS package at Rochester Institute of Technology"); refresh(); /* Title page */ *************** *** 195,201 **** wmove(mn, i+1, 0); wprintw(mn, "%d] %s", i, mopts[i]); } /* give me choices, then branch off */ ! menu("Chemtab 2.01 MAIN MENU"); #ifdef ReGIS mvwaddstr(mn, 11, 0, "^R toggles ReGIS mode which is currently "); wstandout(mn); --- 195,201 ---- wmove(mn, i+1, 0); wprintw(mn, "%d] %s", i, mopts[i]); } /* give me choices, then branch off */ ! menu("Chemtab 2.02 MAIN MENU"); #ifdef ReGIS mvwaddstr(mn, 11, 0, "^R toggles ReGIS mode which is currently "); wstandout(mn); diff -c3 Old/online_help New/online_help *** Old/online_help Wed Mar 13 19:42:02 1991 --- New/online_help Wed Mar 13 20:45:04 1991 *************** *** 101,106 **** --- 101,112 ---- 1000 celcius. You would type in the number for melting temperature here. _ + Since you selected some characteristics + using main menu command #2, the graphing module + will only use these elements when graphing. To + override this, select #15 (clear all characteristics) + in main menu command #2. If this message does not + appear, then all the elements are being used. _ The ReGIS commands can be printed on any DEC LN03 compatible laserprinter, possibly others. If diff -c3 Old/ptabl.c New/ptabl.c *** Old/ptabl.c Wed Mar 13 19:42:05 1991 --- New/ptabl.c Wed Mar 13 21:10:55 1991 *************** *** 42,48 **** wclear(mn); wrefresh(mn); clear(); refresh(); ! l16: mvwaddstr(btm, 0, 0, "VT100 alternate graphic set (if yes, no transcript of this table) "); wrefresh(btm); cur = btm; xp = 65; yp = 0; noecho(); crmode(); --- 42,51 ---- wclear(mn); wrefresh(mn); clear(); refresh(); ! l16: if (trans) ! mvwaddstr(btm, 0, 0, "VT100 alternate graphic set (if yes, no transcript of this table) "); ! else ! mvwaddstr(btm, 0, 0, "VT100 alternate graphic set? "); wrefresh(btm); cur = btm; xp = 65; yp = 0; noecho(); crmode(); diff -c3 Old/scrmisc.c New/scrmisc.c *** Old/scrmisc.c Wed Mar 13 19:42:07 1991 --- New/scrmisc.c Wed Mar 13 21:20:17 1991 *************** *** 12,19 **** * will USUALLY work for most print queues WITHOUT end-of-page form-feeding, * meaning the print command doesn't care about upper and lower margins. If * so, a lower value may be needed. */ ! #define SPACING 4 menu(str) char *str; { --- 12,22 ---- * will USUALLY work for most print queues WITHOUT end-of-page form-feeding, * meaning the print command doesn't care about upper and lower margins. If * so, a lower value may be needed. */ ! #define SPACING 2 + /* V2.02 uses a ^L to scroll to the end of page.. SPACING at 2 should work + * peachy.. :> */ + menu(str) char *str; { *************** *** 120,125 **** --- 123,129 ---- { char c; int i, j, icn = 0; /* Internal count */ + if (!trans) return(1); *************** *** 170,177 **** --- 174,186 ---- } fputc('\n', fp); } + ++eopage; for (i = 0; i < SPACING-2; i++) fputc('\n', fp); + if (eopage == 2) { + fputc('\014', fp); + eopage = 0; + } fflush(fp); return(1); *************** *** 182,188 **** clear(); refresh(); standout(); ! mvaddstr(0, 34, "Chemtab V2.01"); standend(); mvaddstr(2, 0, "Element data (text): "); printw("%s", PERTABLE); --- 191,197 ---- clear(); refresh(); standout(); ! mvaddstr(0, 30, "Chemtab V2.02 (patch 1)"); standend(); mvaddstr(2, 0, "Element data (text): "); printw("%s", PERTABLE); *************** *** 214,230 **** mvaddstr(13, 0, "Printing is disabled."); #endif PRINTER #ifdef TRANSCRIPT ! mvaddstr(14, 0, "User logs are kept in "); printw("%s.", TRANSCRIPT); #else ! mvaddstr(14, 0, "User logs are disabled."); #endif TRANSCRIPT #ifdef ReGIS ! mvaddstr(15, 0, "ReGIS graphics module is installed."); #else ! mvaddstr(15, 0, "ReGIS graphics module is not installed."); #endif ReGIS refresh(); --- 223,245 ---- mvaddstr(13, 0, "Printing is disabled."); #endif PRINTER + #ifdef PRINTQ + mvaddstr(14, 0, "User is prompted for a print queue."); + #else PRINTQ + mvaddstr(14, 0, "Print queue is coded into program."); + #endif PRINTQ + #ifdef TRANSCRIPT ! mvaddstr(15, 0, "User logs are kept in "); printw("%s.", TRANSCRIPT); #else ! mvaddstr(15, 0, "User logs are disabled."); #endif TRANSCRIPT #ifdef ReGIS ! mvaddstr(16, 0, "ReGIS graphics module is installed."); #else ! mvaddstr(16, 0, "ReGIS graphics module is not installed."); #endif ReGIS refresh(); diff -c3 Old/tune.h New/tune.h *** Old/tune.h Wed Mar 13 19:49:43 1991 --- New/tune.h Wed Mar 13 21:28:40 1991 *************** *** 42,49 **** with a ^Z if you do NOT want the program to stop, comment this out */ /* Obviously, this was not written on a SYSV system.. If you have SYSV it is advised you comment this out */ ! #define USERSHELL "/bin/csh" /* PRINTER is the printer program or shell script you use to print on the desired printer for Chemtab output. Preferably, when using lpr, you want to add the '-h' function to skip the header page. */ --- 42,53 ---- with a ^Z if you do NOT want the program to stop, comment this out */ /* Obviously, this was not written on a SYSV system.. If you have SYSV it is advised you comment this out */ ! /*#define USERSHELL "/bin/csh" */ + /* TRANSCRIPT is the path to the logfile which lists who uses the program. + if it is not defined, then no log is made. */ + #define TRANSCRIPT "logfile" + /* PRINTER is the printer program or shell script you use to print on the desired printer for Chemtab output. Preferably, when using lpr, you want to add the '-h' function to skip the header page. */ *************** *** 57,68 **** #define PRINTER "lpr h -P" #define PRINTQ ! #define PRINTER "prvms -q " #define PRINTQ note you need a space */ /* ------------------------------------------------------------- */ #define PRINTER "prvms -q " #define PRINTQ - /* TRANSCRIPT is the path to the logfile which lists who uses the program. - if it is not defined, then no log is made. */ - #define TRANSCRIPT "logfile" --- 61,76 ---- #define PRINTER "lpr h -P" #define PRINTQ ! #define PRINTER "prvms -q " /* prvms looks for a space between args #define PRINTQ note you need a space */ + + /* Without printq, if you want to hardcode the queue into the program, + do it like this: + + #define PRINTER "lpr -h -Pprinter1" /* printer1 is the name of the + printer */ + /* ------------------------------------------------------------- */ #define PRINTER "prvms -q " #define PRINTQ diff -c3 Old/variables.h New/variables.h *** Old/variables.h Wed Mar 13 19:42:09 1991 --- New/variables.h Wed Mar 13 21:22:11 1991 *************** *** 16,29 **** #ifdef ReGIS regis, /* regis on/off flag */ #endif ReGIS - #ifdef TRANSCRIPT trans, /* transcript flag */ ! #endif TRANSCRIPT gtot; /* total of sorted elements */ #ifdef LASERPRT FILE *lsr; #endif LASERPRT ! FILE *fp; /* File pointer for the above flag */ char lnm[80]; /* User's last name for transcript */ --- 16,28 ---- #ifdef ReGIS regis, /* regis on/off flag */ #endif ReGIS trans, /* transcript flag */ ! eopage, /* end of page flag */ gtot; /* total of sorted elements */ #ifdef LASERPRT FILE *lsr; #endif LASERPRT ! FILE *fp; /* File pointer for the transcript */ char lnm[80]; /* User's last name for transcript */ diff -c3 Old/vdata.c New/vdata.c *** Old/vdata.c Wed Mar 13 19:42:10 1991 --- New/vdata.c Wed Mar 13 21:24:49 1991 *************** *** 160,167 **** } wrefresh(graph); } - spc(); capture(graph, 0, 1); wclear(graph); } clear(); --- 160,167 ---- } wrefresh(graph); } capture(graph, 0, 1); + spc(); wclear(graph); } clear(); \End\Of\Shar\ else echo "will not over write ./patch01" fi if [ `wc -c ./patch01 | awk '{printf $1}'` -ne 17713 ] then echo `wc -c ./patch01 | awk '{print "Got " $1 ", Expected " 17713}'` fi if `test ! -s ./README.PATCH` then echo "writing ./README.PATCH" cat > ./README.PATCH << '\End\Of\Shar\' This patch will bring the original, untouched version of Chemtab 2.01 up to Chemtab 2.02. This is officially patch #1. It fixes a few things which previously went untested (oops..). Please apply it as soon as you get it. Changes: TRANSCRIPT define can be removed without error messages ReGIS define can be removed without error messages Program will now prompt you on some questions according to #defines Makefile modified - no longer a library (graphlib.a) - Jim (yes there are probably bound to be more patches.. but this is all I could find. You MAY have to tweak your Makefile to work for your system.) \End\Of\Shar\ else echo "will not over write ./README.PATCH" fi if [ `wc -c ./README.PATCH | awk '{printf $1}'` -ne 630 ] then echo `wc -c ./README.PATCH | awk '{print "Got " $1 ", Expected " 630}'` fi echo "Finished archive 1 of 1" exit 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.