Commit Graph

83 Commits

Author SHA1 Message Date
Kartik K. Agaram cde14438e0 first test re-running sandbox with a deeper trace 2021-05-30 16:38:20 -07:00
Kartik K. Agaram 46009cd1bb . 2021-05-30 10:13:53 -07:00
Kartik K. Agaram 158b53eb8f first attempt doesn't work
I was aware of some complications. The various indexes and y coordinates
in the trace's cache would be unstable and need to be recomputed. But it's
surprising that the trace _completely disappears_.
2021-05-30 09:23:36 -07:00
Kartik K. Agaram 1496548287 start progressively increasing trace depth
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.
2021-05-30 08:51:58 -07:00
Kartik K. Agaram 7fa0163941 disable ctrl-s when browsing trace
We're soon going to be dynamically rerunning the sandbox in other ways
when browsing the trace.
2021-05-23 22:18:51 -07:00
Kartik K. Agaram d3103378c5 . 2021-05-23 22:17:05 -07:00
Kartik K. Agaram 7a04c8104d shell: reduce trace depth in sandbox
We'll gradually make this more dynamic.
2021-05-22 10:28:21 -07:00
Kartik K. Agaram e2ab1b30b1 disallow null traces
We now use traces everywhere for error-checking. Null traces introduce
the possibility of changing a functions error response, and therefore its
semantics.
2021-05-19 20:56:37 -07:00
Kartik K. Agaram ec2dab7801 shell: traces track a maximum depth to record 2021-05-19 01:26:25 -07:00
Kartik K. Agaram 837926751a shell: add a lot of error-checking 2021-05-18 20:01:11 -07:00
Kartik K. Agaram 19dd573a92 . 2021-05-07 20:02:01 -07:00
Kartik K. Agaram d3f17627d8 an often-overflowing stream when running brcircle
We really need to systematically check our trace streams.
2021-05-07 15:12:56 -07:00
Kartik K. Agaram c5f50f05b7 . 2021-05-07 12:46:41 -07:00
Kartik K. Agaram 74be534e2b starting to implement first macros
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
2021-05-07 09:49:16 -07:00
Kartik K. Agaram 6df53d463c back to macros; switch macroexpand to operate in place 2021-05-06 17:00:18 -07:00
Kartik K. Agaram 9156823c5d shell: start implementing macros 2021-05-04 19:49:21 -07:00
Kartik K. Agaram 7465fbb19f . 2021-05-04 19:46:49 -07:00
Kartik K. Agaram 83847e9f0a .
Clean up menus.
2021-05-01 16:20:44 -07:00
Kartik K. Agaram d0e2d093f7 cleaner rendering of fake screens and keyboards
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?
2021-05-01 16:12:49 -07:00
Kartik K. Agaram 719b6acf3d .
Use sandbox background in the top line on the right.
2021-05-01 15:54:02 -07:00
Kartik K. Agaram 2b616894fd move color scheme closer to Solarized dark
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
2021-05-01 15:37:55 -07:00
Kartik K. Agaram bf4c19f053 shell: squeeze menu 2021-04-30 00:00:55 -07:00
Kartik K. Agaram 772b7b6585 adjust fake screen aspect ratio for verisimilitude 2021-04-29 23:38:37 -07:00
Kartik K. Agaram 24222b1735 make pixel borders of screen clear 2021-04-29 20:35:50 -07:00
Kartik K. Agaram 26eae87d3f make matching parens pop again 2021-04-29 16:47:26 -07:00
Kartik K. Agaram 6503529627 white text everywhere by default 2021-04-29 16:27:43 -07:00
Kartik K. Agaram b860f108f7 adjust some colors and padding 2021-04-29 15:10:17 -07:00
Kartik K. Agaram dcb6a21a91 bugfix: initialize gap buffers before using them
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.
2021-04-28 22:03:58 -07:00
Kartik K. Agaram b9c59a5f5b shell: load/store from/to disk with indent
Once I came up with the right approach, this worked on the first try once
I got the types and registers to line up!
2021-04-28 17:49:55 -07:00
Kartik K. Agaram ef8dc999ca . 2021-04-28 17:08:15 -07:00
Kartik K. Agaram 5b7f938733 start stashing and clearing sandbox after definitions 2021-04-28 13:55:10 -07:00
Kartik K. Agaram 55cde01edf shell: stream literals 2021-04-27 23:10:30 -07:00
Kartik K. Agaram 9e9e40c05a . 2021-04-27 23:04:20 -07:00
Kartik K. Agaram 409d26ca87 . 2021-04-27 23:03:23 -07:00
Kartik K. Agaram cbebd548ca shell: use ctrl-m rather than tab to bounce to trace
We'll save tab for inserting graphemes.
2021-04-25 21:03:05 -07:00
Kartik K. Agaram 8e89dd5a78 devote 2/3rds of screen to definitions 2021-04-25 17:55:17 -07:00
Kartik K. Agaram 35a6f3cc99 add some padding to the sandbox 2021-04-25 17:49:39 -07:00
Kartik K. Agaram bcd37c381a clear old output when new run is in progress
I'm currently doing this extremely naively/slowly/uglily. Not a bottleneck.
2021-04-21 20:06:46 -07:00
Kartik K. Agaram bc4b6021de . 2021-04-21 19:56:32 -07:00
Kartik K. Agaram 5daa1f06d4 . 2021-04-21 19:45:02 -07:00
Kartik K. Agaram 9a5e94ce1f . 2021-04-21 19:44:06 -07:00
Kartik K. Agaram d27994a9d7 shell: show screen state during evaluation
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.
2021-04-21 00:25:06 -07:00
Kartik K. Agaram 7b2d39b8d4 an interface approximating stack traces 2021-04-20 23:27:13 -07:00
Kartik K. Agaram fb34909b4e get bresenham line drawing working with a trace
(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
2021-04-20 19:47:57 -07:00
Kartik K. Agaram 34596b6ee9 reimplement pixel graphics
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.
2021-04-19 21:05:57 -07:00
Kartik K. Agaram f5ece0451b start cleaning up pixel graphics
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.
2021-04-19 10:47:30 -07:00
Kartik K. Agaram 97df52bf2f shell: ctrl-r runs on real screen without a trace
We run out of memory fairly early in the course of drawing a chessboard
on the whole screen.
2021-04-17 23:52:52 -07:00
Kartik K. Agaram c11ea74442 . 2021-04-17 22:53:45 -07:00
Kartik K. Agaram c026dba006 shell: reenable the trace
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.
2021-04-17 22:33:28 -07:00
Kartik K. Agaram 1354161a36 tmp: debugging why brline prints no pixels
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.
2021-04-17 08:34:48 -07:00