From 9923285547c1cd4e1fdb56262ec85284b39b8779 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 23 Jan 2016 19:52:11 -0800 Subject: 2600 - teach 'print' about addresses Unfortunate that our type system requires this to be explicit.. --- 081print.mu | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to '081print.mu') diff --git a/081print.mu b/081print.mu index 1683b308..8f61504e 100644 --- a/081print.mu +++ b/081print.mu @@ -698,3 +698,23 @@ recipe print screen:address:shared:screen, n:number -> screen:address:shared:scr } screen <- print-integer screen, n, color, bg-color ] + +# addresses +recipe print screen:address:shared:screen, n:address:_elem -> screen:address:shared:screen [ + local-scope + load-ingredients + color:number, color-found?:boolean <- next-ingredient + { + # default color to white + break-if color-found? + color <- copy 7/white + } + bg-color:number, bg-color-found?:boolean <- next-ingredient + { + # default bg-color to black + break-if bg-color-found? + bg-color <- copy 0/black + } + n2:number <- copy n + screen <- print-integer screen, n2, color, bg-color +] -- cgit 1.4.1-2-gfad0