From 06e6b3ab540b836fe050b25b651f403ce4c4fdba Mon Sep 17 00:00:00 2001
From: dos-reis <gdr@axiomatics.org>
Date: Mon, 24 Sep 2007 16:55:26 +0000
Subject: 	* i-output.boot.pamphlet (half): New macro. 	(bigopAppAux):
 Use it. 	(charyTop): Likewise. 	(binomApp): Likewise.

---
 src/interp/ChangeLog              |  7 +++++++
 src/interp/i-output.boot.pamphlet | 15 +++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

(limited to 'src/interp')

diff --git a/src/interp/ChangeLog b/src/interp/ChangeLog
index 2079573a..1ef84715 100644
--- a/src/interp/ChangeLog
+++ b/src/interp/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-24  Gabriel Dos Reis  <gdr@cs.tamu.edu>
+
+	* i-output.boot.pamphlet (half): New macro.
+	(bigopAppAux): Use it.
+	(charyTop): Likewise.
+	(binomApp): Likewise.
+
 2007-09-24  Gabriel Dos Reis  <gdr@cs.tamu.edu>
 
 	* bookvol5.pamphlet (restart): Simplify.  Handle command line
diff --git a/src/interp/i-output.boot.pamphlet b/src/interp/i-output.boot.pamphlet
index f28b0af0..c671ac53 100644
--- a/src/interp/i-output.boot.pamphlet
+++ b/src/interp/i-output.boot.pamphlet
@@ -1177,6 +1177,9 @@ bigopWidth(bot,top,arg,kind) ==
   kindWidth := (kind = 'pi => 5; 3)
   MAX(kindWidth,WIDTH bot,(top => WIDTH top; 0)) + 2 + WIDTH arg
 
+half x ==>
+  QUOTIENT(x, 2)
+
 bigopAppAux(bot,top,arg,x,y,d,kind) ==
   botWidth := (bot => WIDTH bot; 0)
   topWidth := WIDTH top
@@ -1184,15 +1187,15 @@ bigopAppAux(bot,top,arg,x,y,d,kind) ==
     kind = 'pi => 5
     3
   maxWidth := MAX(opWidth,botWidth,topWidth)
-  xCenter := (maxWidth-1)/ 2 + x
+  xCenter := half(maxWidth-1) + x
   d:=APP(arg,x+2+maxWidth,y,d)
   d:=
       atom bot and SIZE atom2String bot = 1 => APP(bot,xCenter,y-2,d)
-      APP(bot,x + (maxWidth - botWidth)/2,y-2-superspan bot,d)
+      APP(bot,x + half(maxWidth - botWidth),y-2-superspan bot,d)
   if top then
     d:=
       atom top and SIZE atom2String top = 1 => APP(top,xCenter,y+2,d)
-      APP(top,x + (maxWidth - topWidth)/2,y+2+subspan top,d)
+      APP(top,x + half(maxWidth - topWidth),y+2+subspan top,d)
   delta := (kind = 'pi => 2; 1)
   opCode :=
     kind = 'sigma =>
@@ -1540,7 +1543,7 @@ charyTop(u,start,linelength) ==
   u is ['CENTER,a] =>
     b := charyTopWidth a
     (w := WIDTH(b)) > linelength-start => charyTop(a,start,linelength)
-    charyTop(b,(linelength-start-w)/2,linelength)
+    charyTop(b,half(linelength-start-w),linelength)
   v := charyTopWidth u
   EQ(keyp u,'ELSE) => charyElse(u,v,start,linelength)
   WIDTH(v) > linelength => charyTrouble(u,v,start,linelength)
@@ -2292,8 +2295,8 @@ binomApp(u,x,y,d) ==
   wden := WIDTH den
   wnum := WIDTH num
   w := MAX(wden,wnum)
-  d := APP(den,x+1+(w - wden)/2,ysub,d)
-  d := APP(num,x+1+(w - wnum)/2,ysup,d)
+  d := APP(den,x+1+ half(w - wden),ysub,d)
+  d := APP(num,x+1+ half(w - wnum),ysup,d)
   hnum := height num
   hden := height den
   w := 1 + w
-- 
cgit v1.2.3