Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: octal in arithmetic expressions



> It should be settable with some option such as
> MATH_MODE_MESSES_UP_CONVERSIONS_FROM_STRING_TO_INTEGER... well, all right,
> OCTAL_ZEROES.  As ksh doesn't do this it probably shouldn't be set for

Okay.

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.4
diff -u -r1.4 options.yo
--- Doc/Zsh/options.yo	2000/05/11 00:01:03	1.4
+++ Doc/Zsh/options.yo	2000/05/15 18:43:45
@@ -777,6 +777,12 @@
 If numeric filenames are matched by a filename generation pattern,
 sort the filenames numerically rather than lexicographically.
 )
+pindex(OCTAL_ZEROES)
+cindex(octal, arithmetic expressions)
+item(tt(OCTAL_ZEROES) <S>)(
+Interpret any integer constant beginning with a 0 and not
+as octal, per IEEE Std 1003.2-1992 (ISO 9945-2:1993).
+)
 pindex(OVERSTRIKE)
 cindex(editor, overstrike mode)
 cindex(overstrike mode, of editor)
Index: Src/math.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/math.c,v
retrieving revision 1.3
diff -u -r1.3 math.c
--- Src/math.c	2000/05/15 17:54:59	1.3
+++ Src/math.c	2000/05/15 18:43:45
@@ -357,7 +357,8 @@
 		yyval.u.l = zstrtol(++ptr, &ptr, lastbase = 16);
 		return NUM;
 	    }
-	    else if (idigit(*ptr) && (memchr(ptr, '.', strlen(ptr)) == NULL)) {
+	    else if (isset(OCTALZEROES) &&
+		    (memchr(ptr, '.', strlen(ptr)) == NULL)) {
 	        yyval.u.l = zstrtol(ptr, &ptr, lastbase = 8);
 	        return NUM;
 	    }
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.3
diff -u -r1.3 options.c
--- Src/options.c	2000/05/08 15:56:37	1.3
+++ Src/options.c	2000/05/15 18:43:45
@@ -162,6 +162,7 @@
 {NULL, "notify",	      OPT_ZSH,			 NOTIFY},
 {NULL, "nullglob",	      OPT_EMULATE,		 NULLGLOB},
 {NULL, "numericglobsort",     OPT_EMULATE,		 NUMERICGLOBSORT},
+{NULL, "octalzeroes",         OPT_EMULATE|OPT_SH,	 OCTALZEROES},
 {NULL, "overstrike",	      0,			 OVERSTRIKE},
 {NULL, "pathdirs",	      OPT_EMULATE,		 PATHDIRS},
 {NULL, "posixbuiltins",	      OPT_EMULATE|OPT_BOURNE,	 POSIXBUILTINS},
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.8
diff -u -r1.8 zsh.h
--- Src/zsh.h	2000/05/08 15:56:37	1.8
+++ Src/zsh.h	2000/05/15 18:43:45
@@ -1395,6 +1395,7 @@
     NOTIFY,
     NULLGLOB,
     NUMERICGLOBSORT,
+    OCTALZEROES,
     OVERSTRIKE,
     PATHDIRS,
     POSIXBUILTINS,



Messages sorted by: Reverse Date, Date, Thread, Author