diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-07 11:37:48 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-07 11:37:48 -0700 |
commit | d8298d1a2af876915cd4ba8d6a7b5ae7dc2dd0e3 (patch) | |
tree | 9bf969535249c799625b277c7ac3bbbcd77120f4 /shell/data.limg | |
parent | 91f76e6b228dbe6ff74b7b657fd9dc79d10f8909 (diff) | |
download | mu-d8298d1a2af876915cd4ba8d6a7b5ae7dc2dd0e3.tar.gz |
clean up read_line
Diffstat (limited to 'shell/data.limg')
-rw-r--r-- | shell/data.limg | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/shell/data.limg b/shell/data.limg index f276e9b5..26b7a27d 100644 --- a/shell/data.limg +++ b/shell/data.limg @@ -45,16 +45,13 @@ (if (<= e2 dx) dx 0))))))))))))))]) - (read_line_2 . [(def read_line_2 (fn (keyboard stream) - ((fn (c) - (if (= c 10) - stream - (if (= c 0) - stream - (read_line_2 keyboard (write stream c))))) - (key keyboard))))]) (read_line . [(def read_line (fn (keyboard) - (read_line_2 keyboard (stream))))]) + (let str (stream) + (let c (key keyboard) + (while (not (or (= c 0) (= c 10))) + (write str c) + (set c (key keyboard)))) + str)))]) (chessboard . [(def chessboard (fn (screen px) (chessboard1 screen px 0 15)))]) (chessboard1 . [(def chessboard1 (fn (screen px y color) |