From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20406 invoked from network); 15 May 2000 18:44:51 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 May 2000 18:44:51 -0000 Received: (qmail 13095 invoked by alias); 15 May 2000 18:44:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11387 Received: (qmail 13088 invoked from network); 15 May 2000 18:44:41 -0000 Date: Mon, 15 May 2000 14:44:20 -0400 From: Clint Adams To: Peter Stephenson Cc: Zsh hackers list Subject: Re: PATCH: octal in arithmetic expressions Message-ID: <20000515144420.B31551@scowler.net> References: <20000515135109.A31551@scowler.net> <0FUM00JQE5MJSH@la-la.cambridgesiliconradio.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0.1i In-Reply-To: <0FUM00JQE5MJSH@la-la.cambridgesiliconradio.com>; from pws@cambridgesiliconradio.com on Mon, May 15, 2000 at 07:20:44PM +0100 > 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) )( +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,