zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: another base output problem.
@ 2000-09-04 15:05 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2000-09-04 15:05 UTC (permalink / raw)
  To: Zsh hackers list

This fixes this problem:

% f=472
% print $(( [#16] f ))
472

which arose because the nested evaluation set outputradix back to zero.
The simplest fix seems to be only to reset it for a top-level math eval.
Anything more sophisticated is hard because of the fact that some inner
math evals (such as this one) are fairly well hidden.

Index: Src/math.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/math.c,v
retrieving revision 1.6
diff -u -r1.6 math.c
--- Src/math.c	2000/09/02 17:09:29	1.6
+++ Src/math.c	2000/09/04 15:01:57
@@ -959,7 +959,9 @@
     char *junk;
     mnumber x;
     int xmtok = mtok;
-    outputradix = 0;
+    /* maintain outputradix across levels of evaluation */
+    if (!mlevel)
+	outputradix = 0;
 
     if (!*s) {
 	x.type = MN_INTEGER;

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-09-04 15:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-04 15:05 PATCH: another base output problem Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).