gawk-2.13 patch1

David Trueman david at cs.dal.ca
Thu Jun 27 23:54:59 AEST 1991


This is patch1 for gawk-2.13.  Mostly it just fixes a few portability
problems, but it also fixes a serious bug in division and one in
the modulus implementation.  Change directory to the gawk source
and then apply with patch -p1

diff -cr gawk-2.13.0/CHANGES ./CHANGES
*** gawk-2.13.0/CHANGES	Thu Jun 20 22:03:28 1991
--- ./CHANGES	Wed Jun 26 22:42:08 1991
***************
*** 1,3 ****
--- 1,27 ----
+ Changes from 2.13.0 to 2.13.1
+ -----------------------------
+ 
+ More configs and PORTS.
+ 
+ Fixed bug wherein a simple division produced an erroneous FPE, caused by
+   the Cray division workaround -- that code is now #ifdef'd only for
+   Cray *and* fixed.
+ 
+ Fixed bug in modulus implementation -- it was very close to the above
+   code, so I noticed it.
+ 
+ Fixed portability problem with limits.h in missing.c
+ 
+ Fixed portability problem with tzname and daylight -- define TZNAME_MISSING
+   if strftime() is missing and tzname is also.
+ 
+ Better support for Latin-1 character set.
+ 
+ Fixed portability problem in test Makefile.
+ 
+ Updated PROBLEMS file.
+ 
+ =============================== gawk-2.13 released =========================
  Changes from 2.12.42 to 2.12.43
  -------------------------------
  
diff -cr gawk-2.13.0/PORTS ./PORTS
*** gawk-2.13.0/PORTS	Sat Jun 22 21:33:04 1991
--- ./PORTS	Wed Jun 26 22:25:21 1991
***************
*** 3,9 ****
  
  Sun 4/490 running 4.1
  NeXT running 2.0
! DECstation 3100 running Ultrix 4.0
  AtariST (16-bit ints, gcc compiler, byacc, running under TOS)
  ESIX V.3.2 Rev D (== System V Release 3.2), the 386.  compiler was gcc + bison
  IBM RS/6000 (see README.rs6000)
--- 3,9 ----
  
  Sun 4/490 running 4.1
  NeXT running 2.0
! DECstation 3100 running Ultrix 4.0 or Ultrix 3.1 (different config)
  AtariST (16-bit ints, gcc compiler, byacc, running under TOS)
  ESIX V.3.2 Rev D (== System V Release 3.2), the 386.  compiler was gcc + bison
  IBM RS/6000 (see README.rs6000)
***************
*** 12,17 ****
  Sequent Balance running Dynix V3.1
  Cray Y-MP8 running Unicos 6.0.11
  Cray 2 running Unicos 6.1 (modulo trailing zeroes in chem)
! VMS
  MSDOS - Microsoft C 5.1, compiles and runs very simple testing
  CLOSE: 4.3reno
--- 12,17 ----
  Sequent Balance running Dynix V3.1
  Cray Y-MP8 running Unicos 6.0.11
  Cray 2 running Unicos 6.1 (modulo trailing zeroes in chem)
! VMS 5.x (should also work on 4.6 and 4.7)
  MSDOS - Microsoft C 5.1, compiles and runs very simple testing
  CLOSE: 4.3reno
diff -cr gawk-2.13.0/PROBLEMS ./PROBLEMS
*** gawk-2.13.0/PROBLEMS	Sun Nov 18 11:35:16 1990
--- ./PROBLEMS	Tue Jun 25 22:48:33 1991
***************
*** 1,11 ****
! This is a list of known problems in gawk 2.12.
  Hopefully they will all be fixed in the next major release of gawk.
  
! Please keep in mind that the code
! is still undergoing significant evolution.
  
! 1. The debugging code does not print redirection info.
  
! 2. Gawk's printf doesn't yet match the latest nawk's.
! 
! Arnold Robbins
--- 1,8 ----
! This is a list of known problems in gawk 2.13.
  Hopefully they will all be fixed in the next major release of gawk.
  
! Please keep in mind that the code is still undergoing significant evolution.
  
! 1. Gawk's error messages are not in GNU standard format (not emacs parseable).
  
! 2. Gawk's printf is probably still not POSIX compliant.
diff -cr gawk-2.13.0/awk.h ./awk.h
*** gawk-2.13.0/awk.h	Sat Jun  1 14:33:13 1991
--- ./awk.h	Wed Jun 26 22:13:00 1991
***************
*** 85,91 ****
  #include "protos.h"
  #endif	/* STDC_HEADERS */
  
! #ifdef ultrix
  extern char * getenv P((char *name));
  extern double atof P((char *s));
  #endif
--- 85,91 ----
  #include "protos.h"
  #endif	/* STDC_HEADERS */
  
! #if defined(ultrix) && !defined(Ultrix41)
  extern char * getenv P((char *name));
  extern double atof P((char *s));
  #endif
***************
*** 135,143 ****
  extern void vms_arg_fixup P((int *,char ***));
  #endif  /*VMS*/
  
! #ifdef MSDOS
! extern int errno;
! #endif	/* MSDOS */
  
  #define	GNU_REGEX
  #ifdef GNU_REGEX
--- 135,141 ----
  extern void vms_arg_fixup P((int *,char ***));
  #endif  /*VMS*/
  
! extern int errno;	/* not necessary on many systems, but it can't hurt */
  
  #define	GNU_REGEX
  #ifdef GNU_REGEX
diff -cr gawk-2.13.0/config/sunos40 ./config/sunos40
*** gawk-2.13.0/config/sunos40	Fri Apr 26 21:49:40 1991
--- ./config/sunos40	Wed Jun 26 22:04:16 1991
***************
*** 3,6 ****
--- 3,7 ----
  STRCASE_MISSING	1 
  STRERROR_MISSING	1 
  STRFTIME_MISSING	1 
+ TZNAME_MISSING	1
  NON_STD_SPRINTF	1 
diff -cr gawk-2.13.0/config/ultrix31 ./config/ultrix31
*** gawk-2.13.0/config/ultrix31	Fri Apr 26 21:53:32 1991
--- ./config/ultrix31	Mon Jun 24 16:02:44 1991
***************
*** 1,5 ****
! VAX running Ultrix 3.x
  HAVE_UNDERSCORE_SETJMP	1 
  STRERROR_MISSING	1 
  STRFTIME_MISSING	1 
  NON_STD_SPRINTF	1 
--- 1,6 ----
! DECstation or VAX running Ultrix 3.x
  HAVE_UNDERSCORE_SETJMP	1 
  STRERROR_MISSING	1 
  STRFTIME_MISSING	1 
  NON_STD_SPRINTF	1 
+ TZSET_MISSING	1
diff -cr gawk-2.13.0/config/ultrix41 ./config/ultrix41
*** gawk-2.13.0/config/ultrix41	Tue Jun 25 15:54:42 1991
--- ./config/ultrix41	Tue Jun 25 15:55:13 1991
***************
*** 0 ****
--- 1,3 ----
+ DECstation running Ultrix 4.1 (and 4.2??)
+ STDC_HEADERS	1 
+ Ultrix41	1
diff -cr gawk-2.13.0/config.h-dist ./config.h-dist
*** gawk-2.13.0/config.h-dist	Tue May 21 23:31:18 1991
--- ./config.h-dist	Wed Jun 26 22:03:43 1991
***************
*** 150,163 ****
  /* #define STRERROR_MISSING	1 */
  
  /*
-  * STRFTIME_MISSING
-  *
-  * Your system lacks the ANSI C strftime() routine for formatting
-  * broken down time values.
-  */
- /* #define STRFTIME_MISSING	1 */
- 
- /*
   * STRTOD_MISSING
   *
   * Your system does not have the strtod() routine for converting
--- 150,155 ----
***************
*** 174,179 ****
--- 166,179 ----
  /* #define STRTOL_MISSING	1 */
  
  /*
+  * STRFTIME_MISSING
+  *
+  * Your system lacks the ANSI C strftime() routine for formatting
+  * broken down time values.
+  */
+ /* #define STRFTIME_MISSING	1 */
+ 
+ /*
   * TZSET_MISSING
   *
   * If you have a 4.2 BSD vintage system, then the strftime() routine
***************
*** 183,188 ****
--- 183,196 ----
   * have tzset(), define this.
   */
  /* #define TZSET_MISSING	1 */
+ 
+ /*
+  * TZNAME_MISSING
+  *
+  * Some systems do not support the external variables tzname and daylight.
+  * If this is the case *and* strftime() is missing, define this.
+  */
+ /* #define TZNAME_MISSING	1 */
  
  /*
   * STDC_HEADERS
diff -cr gawk-2.13.0/eval.c ./eval.c
*** gawk-2.13.0/eval.c	Mon Jun  3 09:20:44 1991
--- ./eval.c	Wed Jun 26 22:49:03 1991
***************
*** 26,31 ****
--- 26,32 ----
  #include "awk.h"
  
  extern double pow P((double x, double y));
+ extern double modf P((double x, double *yp));
  
  static int eval_condition P((NODE *tree));
  static NODE *op_assign P((NODE *tree));
***************
*** 560,580 ****
  	case Node_quotient:
  		if (x2 == 0)
  			fatal("division by zero attempted");
  		/*
  		 * special case for integer division, put in for Cray
- 		 * but maybe someone else will benefit -- let's see
  		 */
! 		lx = (long) x1 / (long) x2;
  		if (lx * x2 == x1)
! 			return tmp_number((double) lx);
  		else
  			return tmp_number(x1 / x2);
  
  	case Node_mod:
  		if (x2 == 0)
  			fatal("division by zero attempted in mod");
! 		lx = (long) x1 / (long) x2;	/* assignment to long truncates */
! 		return tmp_number(x1 - lx * x2);
  
  	case Node_plus:
  		return tmp_number(x1 + x2);
--- 561,585 ----
  	case Node_quotient:
  		if (x2 == 0)
  			fatal("division by zero attempted");
+ #ifdef _CRAY
  		/*
  		 * special case for integer division, put in for Cray
  		 */
! 		lx2 = x2;
! 		if (lx2 == 0)
! 			return tmp_number(x1 / x2);
! 		lx = (long) x1 / lx2;
  		if (lx * x2 == x1)
! 			return tmp_number((AWKNUM) lx);
  		else
+ #endif
  			return tmp_number(x1 / x2);
  
  	case Node_mod:
  		if (x2 == 0)
  			fatal("division by zero attempted in mod");
! 		(void) modf(x1 / x2, &x);
! 		return tmp_number(x1 - x * x2);
  
  	case Node_plus:
  		return tmp_number(x1 + x2);
***************
*** 749,762 ****
  	case Node_assign_quotient:
  		if (rval == (AWKNUM) 0)
  			fatal("division by zero attempted in /=");
  		/*
  		 * special case for integer division, put in for Cray
- 		 * but maybe someone else will benefit -- let's see
  		 */
! 		ltemp = (long) lval / (long) rval;
  		if (ltemp * lval == rval)
! 			*lhs = make_number((double) ltemp);
  		else
  			*lhs = make_number(lval / rval);
  		break;
  
--- 754,771 ----
  	case Node_assign_quotient:
  		if (rval == (AWKNUM) 0)
  			fatal("division by zero attempted in /=");
+ #ifdef _CRAY
  		/*
  		 * special case for integer division, put in for Cray
  		 */
! 		ltemp = rval;
! 		if (ltemp == 0)
! 			*lhs = make_number(lval / rval);
! 		ltemp = (long) lval / ltemp;
  		if (ltemp * lval == rval)
! 			*lhs = make_number((AWKNUM) ltemp);
  		else
+ #endif
  			*lhs = make_number(lval / rval);
  		break;
  
***************
*** 763,771 ****
  	case Node_assign_mod:
  		if (rval == (AWKNUM) 0)
  			fatal("division by zero attempted in %=");
! 		ltemp = (long) lval / (long) rval;	/* assignment to long truncates */
! 		t1 = ltemp * rval;
! 		t2 = lval - t1;
  		*lhs = make_number(t2);
  		break;
  
--- 772,779 ----
  	case Node_assign_mod:
  		if (rval == (AWKNUM) 0)
  			fatal("division by zero attempted in %=");
! 		(void) modf(lval / rval, &t1);
! 		t2 = lval - rval * t1;
  		*lhs = make_number(t2);
  		break;
  
diff -cr gawk-2.13.0/missing/strcase.c ./missing/strcase.c
*** gawk-2.13.0/missing/strcase.c	Wed Nov 28 21:09:39 1990
--- ./missing/strcase.c	Wed Jun 26 22:35:39 1991
***************
*** 51,60 ****
  	'\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
  	'\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
  	'\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
! 	'\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
  	'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
! 	'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
! 	'\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337',
  	'\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
  	'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
  	'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
--- 51,60 ----
  	'\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
  	'\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
  	'\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
! 	'\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
  	'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
! 	'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327',
! 	'\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
  	'\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
  	'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
  	'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
diff -cr gawk-2.13.0/missing/strftime.c ./missing/strftime.c
*** gawk-2.13.0/missing/strftime.c	Tue Jun 18 15:16:56 1991
--- ./missing/strftime.c	Wed Jun 26 22:00:19 1991
***************
*** 44,50 ****
  static int weeknumber(const struct tm *timeptr, int firstweekday);
  #endif
  
! #ifndef MSDOS
  extern char *tzname[2];
  extern int daylight;
  #endif
--- 44,50 ----
  static int weeknumber(const struct tm *timeptr, int firstweekday);
  #endif
  
! #if !defined(MSDOS) && !defined(TZNAME_MISSING)
  extern char *tzname[2];
  extern int daylight;
  #endif
***************
*** 244,252 ****
  
  		case 'Z':	/* time zone name or abbrevation */
  			i = 0;
! 			if (daylight && timeptr->tm_isdst)
  				i = 1;
  			strcpy(tbuf, tzname[i]);
  			break;
  
  #ifdef SYSV_EXT
--- 244,260 ----
  
  		case 'Z':	/* time zone name or abbrevation */
  			i = 0;
! 			if (
! #ifndef TZNAME_MISSING
! 			    daylight &&
! #endif
! 			    timeptr->tm_isdst)
  				i = 1;
+ #ifdef TZNAME_MISSING
+ 			strcpy(tbuf, timeptr->tm_zone);
+ #else
  			strcpy(tbuf, tzname[i]);
+ #endif
  			break;
  
  #ifdef SYSV_EXT
diff -cr gawk-2.13.0/missing/strtol.c ./missing/strtol.c
*** gawk-2.13.0/missing/strtol.c	Thu May 30 23:24:12 1991
--- ./missing/strtol.c	Tue Jun 25 22:56:24 1991
***************
*** 15,20 ****
--- 15,27 ----
  handle several cases correctly.)
  */
  
+ #ifdef __STDC__
+ #include <limits.h>
+ #else
+ #define	LONG_MIN	(-0x80000000)	/* for 32-bit 2s-complement at least */
+ #define	LONG_MAX	0x7fffffff
+ #endif
+ 
  #if 0
  #include <limits.h>
  #include <ctype.h>
diff -cr gawk-2.13.0/missing.c ./missing.c
*** gawk-2.13.0/missing.c	Sun Jun  2 09:49:05 1991
--- ./missing.c	Tue Jun 25 15:33:21 1991
***************
*** 5,16 ****
  #include <stdio.h>
  #include <ctype.h>
  #include <errno.h>
- #ifdef sequent
- #define	LONG_MIN	(-1*0x7fffffff)	/* ?? */
- #define	LONG_MAX	0x7fffffff	/* ?? */
- #else
- #include <limits.h>
- #endif
  #ifndef VAXC
  #include <fcntl.h>
  #include <sys/types.h>
--- 5,10 ----
diff -cr gawk-2.13.0/patchlevel.h ./patchlevel.h
*** gawk-2.13.0/patchlevel.h	Sat Jun 22 21:30:46 1991
--- ./patchlevel.h	Wed Jun 26 23:01:10 1991
***************
*** 1 ****
! #define PATCHLEVEL	0
--- 1 ----
! #define PATCHLEVEL	1
diff -cr gawk-2.13.0/regex.c ./regex.c
*** gawk-2.13.0/regex.c	Thu May 30 23:24:12 1991
--- ./regex.c	Wed Jun 26 22:35:40 1991
***************
*** 123,128 ****
--- 123,134 ----
  
     for (c = '0'; c <= '9'; c++)
       re_syntax_table[c] = Sword;
+  
+    /* Add specific syntax for ISO Latin-1.  */
+    for (c = 0300; c <= 0377; c++)
+      re_syntax_table[c] = Sword;
+    re_syntax_table[0327] = 0;
+    re_syntax_table[0367] = 0;
  
     done = 1;
  }
-- 
{uunet watmath}!dalcs!david  or  david at cs.dal.ca



More information about the Comp.sources.bugs mailing list