about summary refs log tree commit diff stats
path: root/071print.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-06 10:25:39 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-06 10:25:39 -0700
commit3434223916977d98cbd767dc8342b03d607dc2a2 (patch)
treeab85506e88a2b1609057b7f92f07cd74ae9d9318 /071print.mu
parent3ad1d42cc9b8d25b22e53cfb4b206b91b1fc3a17 (diff)
downloadmu-3434223916977d98cbd767dc8342b03d607dc2a2.tar.gz
1534 - print results in a different color
Diffstat (limited to '071print.mu')
-rw-r--r--071print.mu16
1 files changed, 14 insertions, 2 deletions
diff --git a/071print.mu b/071print.mu
index d7edf7ae..db7c97d1 100644
--- a/071print.mu
+++ b/071print.mu
@@ -420,13 +420,19 @@ recipe print-string [
   default-space:address:array:location <- new location:type, 30:literal
   x:address:screen <- next-ingredient
   s:address:array:character <- next-ingredient
+  color:number, color-found?:boolean <- next-ingredient
+  {
+    # default color to white
+    break-if color-found?:boolean
+    color:number <- copy 7:literal/white
+  }
   len:number <- length s:address:array:character/deref
   i:number <- copy 0:literal
   {
     done?:boolean <- greater-or-equal i:number, len:number
     break-if done?:boolean
     c:character <- index s:address:array:character/deref, i:number
-    print-character x:address:screen c:character
+    print-character x:address:screen, c:character, color:number
     i:number <- add i:number, 1:literal
     loop
   }
@@ -437,8 +443,14 @@ recipe print-integer [
   default-space:address:array:location <- new location:type, 30:literal
   x:address:screen <- next-ingredient
   n:number <- next-ingredient
+  color:number, color-found?:boolean <- next-ingredient
+  {
+    # default color to white
+    break-if color-found?:boolean
+    color:number <- copy 7:literal/white
+  }
   # todo: other bases besides decimal
   s:address:array:character <- integer-to-decimal-string n:number
-  print-string x:address:screen, s:address:array:character
+  print-string x:address:screen, s:address:array:character, color:number
   reply x:address:screen/same-as-ingredient:0
 ]