diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-01-31 23:36:48 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-01-31 23:39:08 -0800 |
commit | df437f78e95a39bba36df6ffc1c00783bd80b4c6 (patch) | |
tree | 45aa6d287b7cca55a66f725b9326b543afe8a3f6 /mu.arc | |
parent | 74310db45ae50e792807bf6a1a2db0e9039ca569 (diff) | |
download | mu-df437f78e95a39bba36df6ffc1c00783bd80b4c6.tar.gz |
688 - <up> for history kinda sorta works
process-key is extracted to work on a given character, but its helpers for parsing strings and comments still read keys directly from keyboard. Still, this took long enough to get working that it's worth saving. Milestones: a) figuring out how to debug without dumping trace crap on the screen in cursor mode. b) realizing you can't assign directly to result in the up case. Have to let the recursive call do it. c) replacing continuations in 'process-key'.
Diffstat (limited to 'mu.arc')
-rw-r--r-- | mu.arc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mu.arc b/mu.arc index 045562c5..fadae49a 100644 --- a/mu.arc +++ b/mu.arc @@ -2408,6 +2408,23 @@ (reply result:boolean) ) +(init-fn buffer-index + (default-space:space-address <- new space:literal 30:literal) + (in:buffer-address <- next-input) + (idx:integer <- next-input) + { begin + (len:integer <- get in:buffer-address/deref length:offset) + (not-too-high?:boolean <- less-than idx:integer len:integer) + (not-too-low?:boolean <- greater-or-equal idx:integer 0:literal) + (in-bounds?:boolean <- and not-too-low?:boolean not-too-high?:boolean) + (break-if in-bounds?:boolean) + (assert nil:literal (("buffer-index out of bounds" literal))) + } + (s:string-address <- get in:buffer-address/deref data:offset) + (result:character <- index s:string-address/deref idx:integer) + (reply result:character) +) + (init-fn to-array ; from buffer (default-space:space-address <- new space:literal 30:literal) (in:buffer-address <- next-input) @@ -2588,14 +2605,13 @@ ;; load all provided files and start at 'main' (reset) -;? (new-trace "main") ;? 4 (awhen (pos "--" argv) (map add-code:readfile (cut argv (+ it 1))) ;? (= dump-trace* (obj whitelist '("run"))) ;? 1 ;? (= dump-trace* (obj whitelist '("schedule"))) ;? (= dump-trace* (obj whitelist '("run" "continuation"))) ;? 1 ;? (= dump-trace* (obj whitelist '("cn0" "cn1"))) -;? (set dump-trace*) ;? 2 +;? (set dump-trace*) ;? 4 ;? (freeze function*) ;? (prn function*!factorial) (run 'main) |