about summary refs log tree commit diff stats
path: root/mu.arc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-08 11:55:28 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-08 11:55:28 -0800
commit7847e20d265cc36d60d2b75a39fe496af17ef0e3 (patch)
treef840650a897f0175df524e186256bfcf37d7158a /mu.arc
parente898c419dbd81d24071e0e4592f87ee63d4f6b9f (diff)
downloadmu-7847e20d265cc36d60d2b75a39fe496af17ef0e3.tar.gz
716 - warn when writing to raw memory
Diffstat (limited to 'mu.arc')
-rw-r--r--mu.arc17
1 files changed, 17 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc
index 4da94d2b..272a3b8a 100644
--- a/mu.arc
+++ b/mu.arc
@@ -1375,6 +1375,16 @@
     (trace "cn1" instr))
   instrs)
 
+(def check-default-space (instrs name)
+  (let oarg-names (accum yield
+                    (each (oargs _ _) (map parse-instr (keep acons  ; non-label
+                                                             instrs))
+                      (each oarg oargs
+                        (when nondummy.oarg
+                          (yield v.oarg)))))
+    (when (~pos 'default-space oarg-names)
+      (prn "function @name has no default-space"))))
+
 ; assign an index to an arg
 (def maybe-add (arg location idx)
   (trace "maybe-add" arg)
@@ -1557,7 +1567,11 @@
 ;?     (prn "freeze " name)
     (= function-table.name (convert-labels:convert-braces:tokenize-args:insert-code body name)))
   (each (name body)  canon.function-table
+    (check-default-space body name))
+  (each (name body)  canon.function-table
     (add-next-space-generator body name))
+  ; keep converting names until none remain
+  ; (we need to skip unrecognized spaces)
   (let change t
     (while change
       (= change nil)
@@ -2092,6 +2106,7 @@
   (reply result:string-address))
 
 (init-fn find-next  ; string, character, index -> next index
+  (default-space:space-address <- new space:literal 30:literal)
   (s:string-address <- next-input)
   (needle:character <- next-input)
   (idx:integer <- next-input)
@@ -2300,6 +2315,7 @@
 )
 
 (init-fn wait-for-key
+  (default-space:space-address <- new space:literal 30:literal)
   (k:keyboard-address <- next-input)
   (screen:terminal-address <- next-input)
   { begin
@@ -2731,6 +2747,7 @@
 ; remember to call this before you clear the screen or at any other milestone
 ; in an interactive program
 (init-fn flush-stdout
+  (default-space:boolean <- copy nil:literal)  ; silence warning, but die if locals used
   (sleep for-some-cycles:literal 1:literal)
 )