mcgrew@aramis.rutgers.edu (Charles Mcgrew) (05/15/91)
Submitted-by: news@trantor.harris-atd.com (News stuff) Posting-number: Volume 3, Issue 7 Archive-name: catcher/patch01 My apologies to those of you who built catcher only to discover that it wouldn't even work with the samples I packed with it. I have since fixed several minor but fatal bugs, and this patch should give you a much happier tool. Again, my apologies for such a buggy first release. Chuck Musciano ARPA : chuck@trantor.harris-atd.com Harris Corporation Usenet: ...!uunet!x102a!trantor!chuck PO Box 37, MS 3A/1912 AT&T : (407) 727-6131 Melbourne, FL 32902 FAX : (407) 729-3363 A good newspaper is never good enough, but a lousy newspaper is a joy forever. -- Garrison Keillor #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: patch # Wrapped by chuck@melmac on Tue Jan 29 12:41:23 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'patch' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patch'\" else echo shar: Extracting \"'patch'\" \(8362 characters\) sed "s/^X//" >'patch' <<'END_OF_FILE' X*** Makefile.orig Tue Jan 29 12:39:44 1991 X--- Makefile Tue Jan 22 07:32:58 1991 X*************** X*** 43,49 **** X install: catcher $(MAN)/catcher.$(MANEXT) X cp catcher $(BIN) X chmod 755 $(BIN)/catcher X- cp catcher.info $(HELPDIR) X X $(MAN)/catcher.$(MANEXT): catcher.man X cp -p catcher.man $(MAN)/catcher.$(MANEXT) X--- 43,48 ---- X*** Imakefile.orig Tue Jan 29 12:39:47 1991 X--- Imakefile Tue Jan 22 07:32:57 1991 X*************** X*** 20,26 **** X ComplexProgramTarget(catcher) X X install:: install.man X- $(INSTALL) -c $(INSTMANFLAGS) catcher.info $(HELPDIR)/catcher.info X X manual: X cd doc; make PRINT="$(PRINT)" PRINTER="$(PRINTER)" manual X--- 20,25 ---- X*** README.orig Tue Jan 29 12:39:47 1991 X--- README Tue Jan 29 12:37:00 1991 X*************** X*** 107,109 **** X--- 107,115 ---- X ********************************************************************************* X X 1.0 16 Jan 91 Original release X+ X+ 1.0a 29 Jan 91 Patch 1 X+ Fixed Imakefile X+ Corrected bug in parser X+ Corrected handling of suffix string X+ Renamed ungetc to last_char in lex.c X*** lex.c.orig Tue Jan 29 12:39:53 1991 X--- lex.c Tue Jan 29 12:33:55 1991 X*************** X*** 52,59 **** X {"value", VALUE}, X {"window", WINDOW_}}; X X- X- X PRIVATE struct {char first; X char next; X int name; X--- 52,57 ---- X*************** X*** 73,85 **** X curr_file = "stdin"; X f = stdin; X line_count = 1; X! ungetc = -1; X return(TRUE); X } X else if (f = fopen(path, "r")) { X curr_file = strsave(path); X line_count = 1; X! ungetc = -1; X return(TRUE); X } X else X--- 71,83 ---- X curr_file = "stdin"; X f = stdin; X line_count = 1; X! last_char = -1; X return(TRUE); X } X else if (f = fopen(path, "r")) { X curr_file = strsave(path); X line_count = 1; X! last_char = -1; X return(TRUE); X } X else X*************** X*** 92,99 **** X { register char c; X static int first = TRUE; X X! if (ungetc != -1) X! c = ungetc, ungetc = -1; X else if (f == NULL) X return(EOF); X else { X--- 90,97 ---- X { register char c; X static int first = TRUE; X X! if (last_char != -1) X! c = last_char, last_char = -1; X else if (f == NULL) X return(EOF); X else { X*************** X*** 182,188 **** X *p++ = c; X while (isalnum(c = getch()) || c == '_') X *p++ = c; X! ungetc = c; X *p = '\0'; X temp = strsave(buf); X for (p = buf; *p; p++) X--- 180,186 ---- X *p++ = c; X while (isalnum(c = getch()) || c == '_') X *p++ = c; X! last_char = c; X *p = '\0'; X temp = strsave(buf); X for (p = buf; *p; p++) X*************** X*** 220,226 **** X while (isdigit(c = getch())) X *p++ = c; X *p = '\0'; X! ungetc = c; X yylval.ival = atoi(buf); X RETURN(INTEGER); X } X--- 218,224 ---- X while (isdigit(c = getch())) X *p++ = c; X *p = '\0'; X! last_char = c; X yylval.ival = atoi(buf); X RETURN(INTEGER); X } X*************** X*** 240,246 **** X for (c1 = getch(), j = 1; punc[i + j].first == c; j++) X if (c1 == punc[i + j].next) X RETURN(punc[i + j].name); X! ungetc = c1; X RETURN(punc[i].name); X } X yyerror("Invalid character in source file: %c (0x%02x)", c, c); X--- 238,244 ---- X for (c1 = getch(), j = 1; punc[i + j].first == c; j++) X if (c1 == punc[i + j].next) X RETURN(punc[i + j].name); X! last_char = c1; X RETURN(punc[i].name); X } X yyerror("Invalid character in source file: %c (0x%02x)", c, c); X*** parse.y.orig Tue Jan 29 12:39:58 1991 X--- parse.y Tue Jan 29 12:33:56 1991 X*************** X*** 30,42 **** X X EXPORT int parse_errors_occured; X X! EXPORT Catch config = {NULL, NULL, "Catcher", NULL, '$', '{', '}', NULL, NULL}; X X PRIVATE char *get_last_token(); X X PRIVATE char *curr_file; X PRIVATE int line_count = 1; X! PRIVATE char ungetc = -1; X X PRIVATE Command *curr_cmd; X PRIVATE Option *curr_opt; X--- 30,42 ---- X X EXPORT int parse_errors_occured; X X! EXPORT Catch config = {NULL, NULL, "Catcher 1.0a", NULL, '$', '{', '}', NULL, NULL}; X X PRIVATE char *get_last_token(); X X PRIVATE char *curr_file; X PRIVATE int line_count = 1; X! PRIVATE char last_char = -1; X X PRIVATE Command *curr_cmd; X PRIVATE Option *curr_opt; X*************** X*** 59,66 **** X X %token LBRACE RBRACE X X! %token BY CHOICE COMMAND DEFAULT DELIMITER EXCLUSIVE FINISH HORIZONTAL ICON_ ICON_MASK INIT LABEL X! %token MESSAGE NONEXCLUSIVE NUMERIC OPTIONAL OUTPUT PARAMETER START SUFFIX TEXT TO VALUE WINDOW_ X X %type <chval> anon_choice choice X %type <cpval> command_name delimiter icon icon_mask label message suffix text_init value X--- 59,66 ---- X X %token LBRACE RBRACE X X! %token BY CHOICE COMMAND DEFAULT DELIMITER EXCLUSIVE HORIZONTAL ICON_ ICON_MASK INIT LABEL X! %token MESSAGE NONEXCLUSIVE NUMERIC OPTIONAL OUTPUT PARAMETER SUFFIX TEXT TO VALUE WINDOW_ X X %type <chval> anon_choice choice X %type <cpval> command_name delimiter icon icon_mask label message suffix text_init value X*************** X*** 383,389 **** X X { char buf1[1024], buf2[1024]; X X! sprintf(buf1, "%s: line %d: ", curr_file, line_count - ((ungetc == '\n')? 1 : 0)); X sprintf(buf2, s1, s2, s3, s4, s5, s6, s7); X strcat(buf1, buf2); X if (strcmp(s1, "syntax error") == 0) { X--- 383,389 ---- X X { char buf1[1024], buf2[1024]; X X! sprintf(buf1, "%s: line %d: ", curr_file, line_count - ((last_char == '\n')? 1 : 0)); X sprintf(buf2, s1, s2, s3, s4, s5, s6, s7); X strcat(buf1, buf2); X if (strcmp(s1, "syntax error") == 0) { X*** patchlevel.h.orig Tue Jan 29 12:40:00 1991 X--- patchlevel.h Tue Jan 29 12:11:30 1991 X*************** X*** 0 **** X--- 1,29 ---- X+ /************************************************************************/ X+ /* Copyright 1987-1991 by Chuck Musciano and Harris Corporation */ X+ /* */ X+ /* Full ownership of this software, and all rights pertaining to */ X+ /* the for-profit distribution of this software, are retained by */ X+ /* Chuck Musciano and Harris Corporation. You are permitted to */ X+ /* use this software without fee. This software is provided "as */ X+ /* is" without express or implied warranty. You may redistribute */ X+ /* this software, provided that this copyright notice is retained, */ X+ /* and that the software is not distributed for profit. If you */ X+ /* wish to use this software in a profit-making venture, you must */ X+ /* first license this code and its underlying technology from */ X+ /* Harris Corporation. */ X+ /* */ X+ /* Bottom line: you can have this software, you can use it, you */ X+ /* can give it away. You just can't sell any or all parts of it */ X+ /* without prior permission from Harris Corporation. */ X+ /************************************************************************/ X+ X+ /************************************************************************/ X+ /* */ X+ /* Patch Comments */ X+ /* 0 Initial release */ X+ /* comp.sources.x: Volume 11, Issues 6-10 */ X+ /* */ X+ /* 1 Bug fixes; see README for details */ X+ /* comp.sources.x: Volume 11, Issue ? */ X+ /* */ X+ /************************************************************************/ X*** process.c.orig Tue Jan 29 12:40:01 1991 X--- process.c Tue Jan 29 12:33:57 1991 X*************** X*** 340,350 **** X { char *path; X FILE *f; X X! path = (char *) malloc(strlen(config.suffix) + 22); X strcpy(path, "/tmp/catcher.XXXXXX"); X mktemp(path); X! strcat(path, "."); X! strcat(path, config.suffix); X if ((f = fopen(path, "w")) == NULL) X error("cannot open %s for writing: %s", path, sys_errlist[errno]); X else if (fwrite(data, 1, strlen(data), f) != strlen(data)) { X--- 340,352 ---- X { char *path; X FILE *f; X X! path = (char *) malloc((config.suffix? strlen(config.suffix) : 0) + 22); X strcpy(path, "/tmp/catcher.XXXXXX"); X mktemp(path); X! if (config.suffix) { X! strcat(path, "."); X! strcat(path, config.suffix); X! } X if ((f = fopen(path, "w")) == NULL) X error("cannot open %s for writing: %s", path, sys_errlist[errno]); X else if (fwrite(data, 1, strlen(data), f) != strlen(data)) { END_OF_FILE if test 8362 -ne `wc -c <'patch'`; then echo shar: \"'patch'\" unpacked with wrong size! fi # end of 'patch' fi echo shar: End of shell archive. exit 0 Chuck Musciano ARPA : chuck@trantor.harris-atd.com Harris Corporation Usenet: ...!uunet!x102a!trantor!chuck PO Box 37, MS 3A/1912 AT&T : (407) 727-6131 Melbourne, FL 32902 FAX : (407) 729-3363 A good newspaper is never good enough, but a lousy newspaper is a joy forever. -- Garrison Keillor