about summary refs log tree commit diff stats
path: root/shell/sandbox.mu
Commit message (Collapse)AuthorAgeFilesLines
...
* start progressively increasing trace depthKartik K. Agaram2021-05-301-24/+30
| | | | | | | | | | | The goal: the sandbox initially maintains a shallow trace. As you expand into the trace, the environment reruns the sandbox at greater depth as needed. The challenge: expanding happens within edit-trace, which doesn't have the whole sandbox needed to re-run the sandbox. We'll either need to expand the trace's capabilities to include the whole sandbox, or duplicate some logic to decide when to run the sandbox.
* disable ctrl-s when browsing traceKartik K. Agaram2021-05-231-2/+6
| | | | | We're soon going to be dynamically rerunning the sandbox in other ways when browsing the trace.
* .Kartik K. Agaram2021-05-231-4/+4
|
* shell: reduce trace depth in sandboxKartik K. Agaram2021-05-221-1/+1
| | | | We'll gradually make this more dynamic.
* disallow null tracesKartik K. Agaram2021-05-191-6/+11
| | | | | | We now use traces everywhere for error-checking. Null traces introduce the possibility of changing a functions error response, and therefore its semantics.
* shell: traces track a maximum depth to recordKartik K. Agaram2021-05-191-2/+2
|
* shell: add a lot of error-checkingKartik K. Agaram2021-05-181-0/+6
|
* .Kartik K. Agaram2021-05-071-4/+4
|
* an often-overflowing stream when running brcircleKartik K. Agaram2021-05-071-0/+2
| | | | We really need to systematically check our trace streams.
* .Kartik K. Agaram2021-05-071-3/+3
|
* starting to implement first macrosKartik K. Agaram2021-05-071-0/+1
| | | | | | | | | | | | | | | Another commit, another bugfix. Some snippets from my currently exploding todo list: - always investigate lookup errors immediately. Beyond the root cause, they should never happen at the moment, while we aren't reclaiming memory. we should always return a more precise error message. Usually involving null pointer checks. - on abort, print out stack trace - emit mapping of labels to addresses during survey - store a mapping of symbols somewhere in the code image - stop allocating 1KB per token; expand space for tokens as needed
* back to macros; switch macroexpand to operate in placeKartik K. Agaram2021-05-061-4/+2
|
* shell: start implementing macrosKartik K. Agaram2021-05-041-1/+4
|
* .Kartik K. Agaram2021-05-041-6/+6
|
* .Kartik K. Agaram2021-05-011-3/+3
| | | | Clean up menus.
* cleaner rendering of fake screens and keyboardsKartik K. Agaram2021-05-011-116/+9
| | | | | | I don't understand why a second line in the keyboard is visible now where it wasn't before. That whole aspect has unclear desires. What exactly do I want to happen on newlines?
* .Kartik K. Agaram2021-05-011-49/+63
| | | | Use sandbox background in the top line on the right.
* move color scheme closer to Solarized darkKartik K. Agaram2021-05-011-50/+50
| | | | | | | | | | | | | sed -i 's,0x12/bg=almost-black,0xdc/bg=green-bg,g' shell/*.mu sed -i 's, 0/bg, 0xc5/bg=blue-bg,g' shell/*.mu sed -i 's, 7/fg=trace, 0x38/fg=trace,g' shell/*.mu sed -i 's, 7/bg=grey, 0x5c/bg=black,g' shell/*.mu Still a few issues. Thanks Adrian Cochrane and Zach DeCook. https://floss.social/@alcinnz/106152068473019933 https://social.librem.one/@zachdecook/106159988837603417
* shell: squeeze menuKartik K. Agaram2021-04-301-11/+13
|
* adjust fake screen aspect ratio for verisimilitudeKartik K. Agaram2021-04-291-1/+1
|
* make pixel borders of screen clearKartik K. Agaram2021-04-291-16/+20
|
* make matching parens pop againKartik K. Agaram2021-04-291-1/+1
|
* white text everywhere by defaultKartik K. Agaram2021-04-291-1/+1
|
* adjust some colors and paddingKartik K. Agaram2021-04-291-52/+54
|
* bugfix: initialize gap buffers before using themKartik K. Agaram2021-04-281-1/+1
| | | | | | | I keep running into one hole in Mu's memory-safety since dropping the Linux dependency: null pointers no longer error when dereferenced. Here the problem manifests as aliasing: lots of gap buffers share the same exact data near address 0, because it was never initialized.
* shell: load/store from/to disk with indentKartik K. Agaram2021-04-281-0/+17
| | | | | Once I came up with the right approach, this worked on the first try once I got the types and registers to line up!
* .Kartik K. Agaram2021-04-281-3/+1
|
* start stashing and clearing sandbox after definitionsKartik K. Agaram2021-04-281-9/+13
|
* shell: stream literalsKartik K. Agaram2021-04-271-0/+17
|
* .Kartik K. Agaram2021-04-271-17/+17
|
* .Kartik K. Agaram2021-04-271-73/+18
|
* shell: use ctrl-m rather than tab to bounce to traceKartik K. Agaram2021-04-251-9/+9
| | | | We'll save tab for inserting graphemes.
* devote 2/3rds of screen to definitionsKartik K. Agaram2021-04-251-1/+1
|
* add some padding to the sandboxKartik K. Agaram2021-04-251-1/+1
|
* clear old output when new run is in progressKartik K. Agaram2021-04-211-67/+92
| | | | I'm currently doing this extremely naively/slowly/uglily. Not a bottleneck.
* .Kartik K. Agaram2021-04-211-13/+13
|
* .Kartik K. Agaram2021-04-211-1/+1
|
* .Kartik K. Agaram2021-04-211-66/+66
|
* shell: show screen state during evaluationKartik K. Agaram2021-04-211-1/+1
| | | | | | | | | | | | | | All highly experimental. Current constraints: * No tail recursion elimination * No heap reuse * Keep implementation simple So it's slow, and I don't want to complicate it to speed it up. So I'm investing in affordances to help deal with the slowness. However, in the process I've taken the clean abstraction of a trace ("all you need to do is add to the trace") and bolted on call counts and debug-prints as independent mechanisms.
* an interface approximating stack tracesKartik K. Agaram2021-04-201-3/+3
|
* get bresenham line drawing working with a traceKartik K. Agaram2021-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (brline . (fn () (screen x0 y0 x1 y1 color) ((fn (dx dy sx sy) ((fn (err) (brline1 screen x0 y0 x1 y1 dx dy sx sy err color)) (+ dx dy))) (abs (- x1 x0)) (- 0 (abs (- y1 y0))) (sgn (- x1 x0)) (sgn (- y1 y0))))) (brline1 . (fn () (screen x y xmax ymax dx dy sx sy err color) (pixel screen x y color) (if (andf (= x xmax) (= y ymax)) () ((fn (e2) (brline1 screen (if (>= e2 dy) (+ x sx) x) (if (<= e2 dx) (+ y sy) y) xmax ymax dx dy sx sy (+ err (+ (if (>= e2 dy) dy 0) (if (<= e2 dx) dx 0))) color)) (* err 2))))) sandbox: (brline screen 1 1 5 5 12) There are two ideas stemming from this commit: - I need an extremely compact on-screen trace to underlie the trace UX - perhaps we should start truncating trace lines
* reimplement pixel graphicsKartik K. Agaram2021-04-191-24/+46
| | | | | | | | | | | Before: we always drew pixels atop characters, and we only drew pixels that were explicitly requested. After: we always draw pixels atop characters, and we only draw pixels that don't have color 0. Both semantics should be identical as long as pixels are never drawn atop characters.
* start cleaning up pixel graphicsKartik K. Agaram2021-04-191-11/+11
| | | | | | Filling pixels isn't a rare corner case. I'm going to switch to a dense rather than sparse representation for pixels, but callers will have to explicitly request the additional memory.
* shell: ctrl-r runs on real screen without a traceKartik K. Agaram2021-04-171-12/+7
| | | | | We run out of memory fairly early in the course of drawing a chessboard on the whole screen.
* .Kartik K. Agaram2021-04-171-4/+4
|
* shell: reenable the traceKartik K. Agaram2021-04-171-1/+1
| | | | | | | | | | | | | | We now have a couple of protections: - if we get close to running out of space in the trace we drop in an error - if we run out of space in the trace we stop trying to append - if there are errors we cancel future evaluations This is already much nicer. You can't do much on the Mu computer, but at least it gracefully gives up and shows its limitations. On my computer the Mu shell tries to run computations for about 20s before giving up. That seems at the outer limit of what interactivity supports. If things take too long, test smaller chunks.
* tmp: debugging why brline prints no pixelsKartik K. Agaram2021-04-171-1/+1
| | | | | | | | | | | | | | | | | Among other things, we turned off the trace to significantly speed up the debug cycle. State as of https://merveilles.town/@akkartik/106079258606146213 Ohhh, as I save the commit I notice a big problem: I've been editing the disk image directly because writes to the Mu disk lose indentation. But I've been forgetting that the state in the Mu disk needs to be pre-evaluated. So function bindings need extra parens for the environment. The `pixel` calls in the previous commit message are the first statement in the body, and they aren't actually considered part of the body right now. No wonder they don't run. There are lots of other problems, but this will clarify a lot.
* handle drawing 16*4 = 64 pixelsKartik K. Agaram2021-04-161-1/+1
| | | | | | | | | | | | | | | Previously we'd only drawn 8*5 = 40 pixels. Current contents of data.img: ( (globals . ( (hline . (fn () (screen y) (hline1 screen y 0 (width screen)))) (hline1 . (fn () (screen y lo hi) (if (>= lo hi) () ((fn () (pixel screen lo y 12) (hline1 screen y (+ lo 1) hi)))))) (vline1 . (fn () (screen x lo hi) (if (>= lo hi) () ((fn () (pixel screen x lo 12) (vline1 screen x (+ lo 1) hi)))))) )) (sandbox . (vline1 screen 5 0 (height screen))) )
* first session programming _within_ the Mu computerKartik K. Agaram2021-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I tried building a function to draw a horizontal line across the screen. Here's what I have in data.txt: ( (globals . ( (horline . (fn () (screen y) (horline_1 screen y 0 (width screen)))) (horline_1 . (fn () (screen y lo hi) (if (>= lo hi) () ((fn () (pixel screen lo y 12) (horline_1 screen y (+ lo 1) hi)))))) )) (sandbox . (horline_1 screen 0 0 20)) ) $ dd if=/dev/zero of=data.img count=20160 $ cat data.txt |dd of=data.img conv=notrunc $ ./translate shell/*.mu && qemu-system-i386 -hda disk.img -hdb data.img Result: I can't call (horline screen 0) over a fake screen of width 40. Some stream overflows somewhere after all the tweaks to various fixed-size buffers scattered throughout the app. Calling horline_1 gets to a 'hi' column of 20, but not to 30.
* shell: start persisting global bindingsKartik K. Agaram2021-04-151-1/+4
|