about summary refs log tree commit diff stats
path: root/504test-screen.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-28 21:49:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-28 21:53:37 -0700
commit2e00a9c288e9622656189f9c48d40c5e1f17ab98 (patch)
treee8022fbee810f68860a8657685c319ba10a13213 /504test-screen.mu
parent79e2569f1a842370edb29de070da63d0d217396d (diff)
downloadmu-2e00a9c288e9622656189f9c48d40c5e1f17ab98.tar.gz
.
Convert some old code to current idioms.
Diffstat (limited to '504test-screen.mu')
-rw-r--r--504test-screen.mu62
1 files changed, 31 insertions, 31 deletions
diff --git a/504test-screen.mu b/504test-screen.mu
index 7c5a653b..65c72a83 100644
--- a/504test-screen.mu
+++ b/504test-screen.mu
@@ -8,11 +8,11 @@ fn check-screen-row screen: (addr screen), y: int, expected: (addr array byte),
   check-screen-row-from screen, 0/x, y, expected, msg
 }
 
-fn check-screen-row-from screen-on-stack: (addr screen), x: int, y: int, expected: (addr array byte), msg: (addr array byte) {
-  var screen/esi: (addr screen) <- copy screen-on-stack
+fn check-screen-row-from _screen: (addr screen), x: int, y: int, expected: (addr array byte), msg: (addr array byte) {
+  var screen/esi: (addr screen) <- copy _screen
   var failure-count/edi: int <- copy 0
-  var idx/ecx: int <- screen-cell-index screen, x, y
-  # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme
+  var index/ecx: int <- screen-cell-index screen, x, y
+  # compare 'expected' with the screen contents starting at 'index', grapheme by grapheme
   var e: (stream byte 0x100)
   var e-addr/edx: (addr stream byte) <- address e
   write e-addr, expected
@@ -20,7 +20,7 @@ fn check-screen-row-from screen-on-stack: (addr screen), x: int, y: int, expecte
     var done?/eax: boolean <- stream-empty? e-addr
     compare done?, 0
     break-if-!=
-    var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx
+    var _g/eax: grapheme <- screen-grapheme-at-index screen, index
     var g/ebx: grapheme <- copy _g
     var expected-grapheme/eax: grapheme <- read-grapheme e-addr
     # compare graphemes
@@ -51,7 +51,7 @@ fn check-screen-row-from screen-on-stack: (addr screen), x: int, y: int, expecte
       draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
       move-cursor-to-left-margin-of-next-line 0/screen
     }
-    idx <- increment
+    index <- increment
     increment x
     loop
   }
@@ -72,10 +72,10 @@ fn check-screen-row-in-color screen: (addr screen), fg: int, y: int, expected: (
   check-screen-row-in-color-from screen, fg, y, 0/x, expected, msg
 }
 
-fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: int, x: int, expected: (addr array byte), msg: (addr array byte) {
-  var screen/esi: (addr screen) <- copy screen-on-stack
-  var idx/ecx: int <- screen-cell-index screen, x, y
-  # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme
+fn check-screen-row-in-color-from _screen: (addr screen), fg: int, y: int, x: int, expected: (addr array byte), msg: (addr array byte) {
+  var screen/esi: (addr screen) <- copy _screen
+  var index/ecx: int <- screen-cell-index screen, x, y
+  # compare 'expected' with the screen contents starting at 'index', grapheme by grapheme
   var e: (stream byte 0x100)
   var e-addr/edx: (addr stream byte) <- address e
   write e-addr, expected
@@ -83,7 +83,7 @@ fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: in
     var done?/eax: boolean <- stream-empty? e-addr
     compare done?, 0
     break-if-!=
-    var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx
+    var _g/eax: grapheme <- screen-grapheme-at-index screen, index
     var g/ebx: grapheme <- copy _g
     var _expected-grapheme/eax: grapheme <- read-grapheme e-addr
     var expected-grapheme/edi: grapheme <- copy _expected-grapheme
@@ -99,7 +99,7 @@ fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: in
       {
         compare expected-grapheme, 0x20
         break-if-!=
-        var color/eax: int <- screen-color-at-idx screen, idx
+        var color/eax: int <- screen-color-at-index screen, index
         compare color, fg
         break-if-!= $check-screen-row-in-color-from:compare-cells
       }
@@ -129,7 +129,7 @@ fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: in
         move-cursor-to-left-margin-of-next-line 0/screen
       }
       $check-screen-row-in-color-from:compare-colors: {
-        var color/eax: int <- screen-color-at-idx screen, idx
+        var color/eax: int <- screen-color-at-index screen, index
         compare fg, color
         {
           break-if-!=
@@ -153,7 +153,7 @@ fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: in
         move-cursor-to-left-margin-of-next-line 0/screen
       }
     }
-    idx <- increment
+    index <- increment
     increment x
     loop
   }
@@ -163,10 +163,10 @@ fn check-screen-row-in-background-color screen: (addr screen), bg: int, y: int,
   check-screen-row-in-background-color-from screen, bg, y, 0/x, expected, msg
 }
 
-fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg: int, y: int, x: int, expected: (addr array byte), msg: (addr array byte) {
-  var screen/esi: (addr screen) <- copy screen-on-stack
-  var idx/ecx: int <- screen-cell-index screen, x, y
-  # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme
+fn check-screen-row-in-background-color-from _screen: (addr screen), bg: int, y: int, x: int, expected: (addr array byte), msg: (addr array byte) {
+  var screen/esi: (addr screen) <- copy _screen
+  var index/ecx: int <- screen-cell-index screen, x, y
+  # compare 'expected' with the screen contents starting at 'index', grapheme by grapheme
   var e: (stream byte 0x100)
   var e-addr/edx: (addr stream byte) <- address e
   write e-addr, expected
@@ -174,7 +174,7 @@ fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg:
     var done?/eax: boolean <- stream-empty? e-addr
     compare done?, 0
     break-if-!=
-    var _g/eax: grapheme <- screen-grapheme-at-idx screen, idx
+    var _g/eax: grapheme <- screen-grapheme-at-index screen, index
     var g/ebx: grapheme <- copy _g
     var _expected-grapheme/eax: grapheme <- read-grapheme e-addr
     var expected-grapheme/edi: grapheme <- copy _expected-grapheme
@@ -190,7 +190,7 @@ fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg:
       {
         compare expected-grapheme, 0x20
         break-if-!=
-        var background-color/eax: int <- screen-background-color-at-idx screen, idx
+        var background-color/eax: int <- screen-background-color-at-index screen, index
         compare background-color, bg
         break-if-!= $check-screen-row-in-background-color-from:compare-cells
       }
@@ -221,7 +221,7 @@ fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg:
         break $check-screen-row-in-background-color-from:compare-graphemes
       }
       $check-screen-row-in-background-color-from:compare-background-colors: {
-        var background-color/eax: int <- screen-background-color-at-idx screen, idx
+        var background-color/eax: int <- screen-background-color-at-index screen, index
         compare bg, background-color
         {
           break-if-!=
@@ -245,7 +245,7 @@ fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg:
         move-cursor-to-left-margin-of-next-line 0/screen
       }
     }
-    idx <- increment
+    index <- increment
     increment x
     loop
   }
@@ -258,10 +258,10 @@ fn check-background-color-in-screen-row screen: (addr screen), bg: int, y: int,
   check-background-color-in-screen-row-from screen, bg, y, 0/x, expected-bitmap, msg
 }
 
-fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg: int, y: int, x: int, expected-bitmap: (addr array byte), msg: (addr array byte) {
-  var screen/esi: (addr screen) <- copy screen-on-stack
+fn check-background-color-in-screen-row-from _screen: (addr screen), bg: int, y: int, x: int, expected-bitmap: (addr array byte), msg: (addr array byte) {
+  var screen/esi: (addr screen) <- copy _screen
   var failure-count: int
-  var idx/ecx: int <- screen-cell-index screen, x, y
+  var index/ecx: int <- screen-cell-index screen, x, y
   # compare background color where 'expected-bitmap' is a non-space
   var e: (stream byte 0x100)
   var e-addr/edx: (addr stream byte) <- address e
@@ -273,7 +273,7 @@ fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg:
     var _expected-bit/eax: grapheme <- read-grapheme e-addr
     var expected-bit/edi: grapheme <- copy _expected-bit
     $check-background-color-in-screen-row-from:compare-cells: {
-      var background-color/eax: int <- screen-background-color-at-idx screen, idx
+      var background-color/eax: int <- screen-background-color-at-index screen, index
       # if expected-bit is space, assert that background is NOT bg
       compare expected-bit, 0x20
       {
@@ -306,7 +306,7 @@ fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg:
       draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, background-color, 3/fg/cyan, 0/bg
       move-cursor-to-left-margin-of-next-line 0/screen
     }
-    idx <- increment
+    index <- increment
     increment x
     loop
   }
@@ -322,8 +322,8 @@ fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg:
 }
 
 fn test-draw-single-grapheme {
-  var screen-on-stack: screen
-  var screen/esi: (addr screen) <- address screen-on-stack
+  var _screen: screen
+  var screen/esi: (addr screen) <- address _screen
   initialize-screen screen, 5, 4, 0/no-pixel-graphics
   draw-code-point screen, 0x61/a, 0/x, 0/y, 1/fg, 2/bg
   check-screen-row screen, 0/y, "a", "F - test-draw-single-grapheme"  # top-left corner of the screen
@@ -333,8 +333,8 @@ fn test-draw-single-grapheme {
 }
 
 fn test-draw-multiple-graphemes {
-  var screen-on-stack: screen
-  var screen/esi: (addr screen) <- address screen-on-stack
+  var _screen: screen
+  var screen/esi: (addr screen) <- address _screen
   initialize-screen screen, 0x10/rows, 4/cols, 0/no-pixel-graphics
   draw-text-wrapping-right-then-down-from-cursor-over-full-screen screen, "Hello, 世界", 1/fg, 2/bg
   check-screen-row screen, 0/y, "Hello, 世界", "F - test-draw-multiple-graphemes"