about summary refs log tree commit diff stats
path: root/shell
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-05-07 10:05:20 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-05-07 10:05:20 -0700
commitc651bbeffcd3b840a63ca3ae831e8ba2ec64189b (patch)
treedc16f492b68cb525346b0b6f6d947bcc1ed570f8 /shell
parent74be534e2be007f0729092c49a90ca8e410150a8 (diff)
downloadmu-c651bbeffcd3b840a63ca3ae831e8ba2ec64189b.tar.gz
clean up hline and vline
Diffstat (limited to 'shell')
-rw-r--r--shell/data.limg20
1 files changed, 10 insertions, 10 deletions
diff --git a/shell/data.limg b/shell/data.limg
index b3750892..c2a7805c 100644
--- a/shell/data.limg
+++ b/shell/data.limg
@@ -4,18 +4,18 @@
   `(def ,name (litmac litfn () ,params ,@body))))])
     (when . [(mac when (cond body)
   `(if ,cond ,body ()))])
+    (let . [(mac let (var val . body)
+  `((fn (,var) ,@body) ,val))])
     (hline . [(def hline (fn (screen y color)
-  (hline1 screen y 0 (width screen) color)))])
-    (hline1 . [(def hline1 (fn (screen y lo hi color)
-  (while (< lo hi)
-    (pixel screen lo y color)
-    (set lo (+ lo 1)))))])
+  (let (x xmax) `(0 ,(width screen))
+    (while (< x xmax)
+      (pixel screen x y color)
+      (set x (+ x 1))))))])
     (vline . [(def vline (fn (screen x color)
-  (vline1 screen x 0 (height screen) color)))])
-    (vline1 . [(def vline1 (fn (screen x lo hi color)
-  (while (< lo hi)
-    (pixel screen x lo color)
-    (set lo (+ lo 1)))))])
+  (let (y ymax) `(0 ,(height screen))
+    (while (< y ymax)
+      (pixel screen x y color)
+      (set y (+ y 1))))))])
     (fill_rect . [(def fill_rect (fn (screen x1 y1 x2 y2 color)
   (while (< y1 y2)
     (hline1 screen y1 x1 x2 color)