about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-01-22 12:05:24 -0800
committerKartik K. Agaram <vc@akkartik.com>2017-01-22 12:05:24 -0800
commitab6e672d4e0a0bf92254df59f0cd8c66492a8ad0 (patch)
treecb73b9bec6e3583ba09a3183e0b786cc14141d21
parent42f08f13b2fbbaab65783124553ac3022af8fa02 (diff)
downloadmu-ab6e672d4e0a0bf92254df59f0cd8c66492a8ad0.tar.gz
3735 - get rid of 'print-integer'
We do support printing non-integer numbers for some time, albeit using
the underlying host platform.
-rw-r--r--081print.mu23
-rw-r--r--chessboard.mu2
-rw-r--r--edit/005-sandbox.mu4
-rw-r--r--edit/008-sandbox-edit.mu6
4 files changed, 8 insertions, 27 deletions
diff --git a/081print.mu b/081print.mu
index 474e4c31..77f295a5 100644
--- a/081print.mu
+++ b/081print.mu
@@ -684,7 +684,7 @@ scenario print-text-stops-at-right-margin [
   ]
 ]
 
-def print-integer screen:&:screen, n:num -> screen:&:screen [
+def print screen:&:screen, n:num -> screen:&:screen [
   local-scope
   load-ingredients
   color:num, color-found?:bool <- next-ingredient
@@ -704,25 +704,6 @@ def print-integer screen:&:screen, n:num -> screen:&:screen [
   screen <- print screen, s, color, bg-color
 ]
 
-# for now, we can only print integers
-def print screen:&:screen, n:num -> screen:&:screen [
-  local-scope
-  load-ingredients
-  color:num, color-found?:bool <- next-ingredient
-  {
-    # default color to white
-    break-if color-found?
-    color <- copy 7/white
-  }
-  bg-color:num, bg-color-found?:bool <- next-ingredient
-  {
-    # default bg-color to black
-    break-if bg-color-found?
-    bg-color <- copy 0/black
-  }
-  screen <- print-integer screen, n, color, bg-color
-]
-
 # addresses
 def print screen:&:screen, n:&:_elem -> screen:&:screen [
   local-scope
@@ -740,5 +721,5 @@ def print screen:&:screen, n:&:_elem -> screen:&:screen [
     bg-color <- copy 0/black
   }
   n2:num <- copy n
-  screen <- print-integer screen, n2, color, bg-color
+  screen <- print screen, n2, color, bg-color
 ]
diff --git a/chessboard.mu b/chessboard.mu
index feb49058..17f3f771 100644
--- a/chessboard.mu
+++ b/chessboard.mu
@@ -151,7 +151,7 @@ def print-board screen:&:screen, board:board -> screen:&:screen [
     break-if done?
     # print rank number as a legend
     rank:num <- add row, 1
-    print-integer screen, rank
+    print screen, rank
     print screen, [ | ]
     # print each square in the row
     col:num <- copy 0
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index 7476875d..dac50c83 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -580,7 +580,7 @@ scenario run-instruction-manages-screen-per-sandbox [
   assume-resources [
   ]
   # sandbox editor contains an instruction
-  env:&:environment <- new-programming-environment resources, screen, [print-integer screen, 4]  # contents of sandbox editor
+  env:&:environment <- new-programming-environment resources, screen, [print screen, 4]  # contents of sandbox editor
   # run the code in the editor
   assume-console [
     press F4
@@ -594,7 +594,7 @@ scenario run-instruction-manages-screen-per-sandbox [
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
     .                                                  ┊0   edit          copy            delete         .
-    .                                                  ┊print-integer screen, 4                          .
+    .                                                  ┊print screen, 4                                  .
     .                                                  ┊screen:                                          .
     .                                                  ┊  .4                             .               .
     .                                                  ┊  .                              .               .
diff --git a/edit/008-sandbox-edit.mu b/edit/008-sandbox-edit.mu
index a857e88c..dd5c1bb9 100644
--- a/edit/008-sandbox-edit.mu
+++ b/edit/008-sandbox-edit.mu
@@ -165,7 +165,7 @@ scenario sandbox-with-print-can-be-edited [
   assume-resources [
   ]
   # right editor contains a print instruction
-  env:&:environment <- new-programming-environment resources, screen, [print-integer screen, 4]
+  env:&:environment <- new-programming-environment resources, screen, [print screen, 4]
   # run the sandbox
   assume-console [
     press F4
@@ -176,7 +176,7 @@ scenario sandbox-with-print-can-be-edited [
     .                                                  ┊                                                 .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
     .                                                  ┊0   edit          copy            delete         .
-    .                                                  ┊print-integer screen, 4                          .
+    .                                                  ┊print screen, 4                                  .
     .                                                  ┊screen:                                          .
     .                                                  ┊  .4                             .               .
     .                                                  ┊  .                              .               .
@@ -195,7 +195,7 @@ scenario sandbox-with-print-can-be-edited [
   ]
   screen-should-contain [
     .                                                                                 run (F4)           .
-    .                                                  ┊print-integer screen, 4                          .
+    .                                                  ┊print screen, 4                                  .
     .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊─────────────────────────────────────────────────.
     .                                                  ┊                                                 .
     .                                                  ┊                                                 .