Commit Graph

7285 Commits

Author SHA1 Message Date
Kartik Agaram 3b12aab3bc 7235 - belatedly add spiritual forks 2020-11-14 11:28:40 -08:00
Kartik Agaram c71073ebfe 7234 2020-11-14 00:40:04 -08:00
Kartik Agaram 236cf88a3e 7233 - fix some warnings from gcc 9
Make strncpy a little less error-prone.
Just use memcpy where that suffices:
  https://stackoverflow.com/questions/56782248/gcc-specified-bound-depends-on-the-length-of-the-source-argument/56782476#56782476
2020-11-13 20:53:32 -08:00
Kartik Agaram ea8a64cfb0 7232 - mu.subx: more checks for byte types 2020-11-12 23:56:41 -08:00
Kartik Agaram f3d33ac462 7231 2020-11-12 23:25:45 -08:00
Kartik Agaram 165ed256a3 7230 - mu.subx: some more checks for stmt outputs 2020-11-12 23:13:48 -08:00
Kartik Agaram 37ebd39253 7229 - tile: fix ctrl-e 2020-11-12 20:37:42 -08:00
Kartik Agaram 2ee741b0d3 7228 2020-11-12 20:33:37 -08:00
Kartik Agaram 2c56af2d8f 7227 2020-11-11 23:43:04 -08:00
Kartik Agaram d715599246 7226 2020-11-11 23:30:56 -08:00
Kartik Agaram 307745bcc2 7225
Both manual tests described in commit 7222 now work.

To make them work I had to figure out how to copy a file. It
requires a dependency on a new syscall: lseek.
2020-11-11 23:25:55 -08:00
Kartik Agaram 7d15b0884e 7224 2020-11-11 21:04:22 -08:00
Kartik Agaram 2be66922d6 7223 2020-11-11 20:51:17 -08:00
Kartik Agaram 3ae62cfd79 7222
Ok, I found a failing manual test for files as well.

Here are the two steelman tests, one for screens and one for files:

1.
  5 5 fake-screen =s

  s 1 down 1 right

  ctrl-d foo

  expand

final state:

  s       foo                                            foo
               s       1       down    1       right   ⇗
   ┌─────┐                                                ┌─────┐
                ┌─────┐      1  ┌─────┐      1  ┌─────┐    │
                        ┌─────┐  │      ┌─────┐  │         ─
                                         │       │
                                         │       │
                                                 ─
   └─────┘                                                └─────┘
                └─────┘         └─────┘         └─────┘
                        └─────┘         └─────┘

2.

  "x" open =f

  f read f read

  ctrl-d read2

  expand

final state:

  f      read2                                read2
                f      read   f      read   ⇗
    FILE                                       ❝def❞
                  FILE  ❝abc❞   FILE  ❝❞
                               ❝def❞  ❝ghi❞

In both cases there are 3 levels of issues:

- getting a single-line expression to work
- getting a single-line expression to work when operating on a binding
  defined in a previous line
- getting an expanded function call to work

The third is where the rub is right now. And what both examples above share
is that the function performs 2 mutations to the screen/file.

So we need a deep copy after all. And it's not very clear how to copy a
file descriptor including the seek location. Linux's dup() syscall creates
an alias to the file descriptor. And opening /proc seems awfully Linux-specific:

https://stackoverflow.com/questions/54727231/duplicating-file-descriptor-and-seeking-through-both-of-them-independently/54727424#54727424
2020-11-10 19:32:54 -08:00
Kartik Agaram 021c2975aa 7221
I can't get file values to exhibit the same problem. Why are fake screens
special?
2020-11-09 21:56:21 -08:00
Kartik Agaram f20984f44a 7220
Even this isn't enough. While shallow copies keep us from transferring
new bindings to callers, the screen object is still the same, so mutations
to bindings are contagious.

Basically I'm losing IQ points from programming in a language that encourages
mutation over copying.
2020-11-09 21:44:38 -08:00
Kartik Agaram 7e4f8983f8 7219
We're still busted, but on the right track.
2020-11-09 21:25:56 -08:00
Kartik Agaram c01289ddde 7218
This bug was incredibly painful to track down: the one-line fix is to replace
'line' with 'first-line' in the call to 'evaluate' in render-line before
recursing.

Things that made it challenging:
- A high degree of coiling with recursive calls and multiple places of
  evaluation.
- An accidental aliasing in bindings (when rendering the main column in
  render-line) that masked the underlying bug and made things seem to work
  most of the time.
- Too many fucking arguments to render-line, a maze of twisty line objects
  all alike.
2020-11-09 21:16:09 -08:00
Kartik Agaram 148f2c9b65 7217 2020-11-08 11:31:54 -08:00
Kartik Agaram 2be7af86db 7216
In addition to fixing a segfault, the realization here is that we don't
always have a type name. Error messages need to take that into account.
2020-11-08 09:43:35 -08:00
Kartik Agaram 4cf8be04e9 7215
Attempt #3: always create a copy of the bindings before each column/evaluate.
The details are fuzzy in my head, but it seemed worth trying. I figured
I'd either see the old duplication behavior or everything will work. Instead
I'm seeing new problems.

  commit 7208:
    5 5 fake-screen =s
    s 1 down 1 right

    expected:
      |
      -

    observed:
      |
      |
      -

  commit 7210-7212:
    5 5 fake-screen =s
    s 1 down 1 right
    [define foo]
    s foo
    [expand foo]

    observed: no bindings available when rendering foo expanded

  commit 7213:
    5 5 fake-screen =s
    s 1 down 1 right
    [define foo]
    s foo
    [expand foo]

    expected within foo:
      |
      -

    observed within foo:
      |
      |
      -

  commit 7215:
    5 5 fake-screen =s
    s 1 down 1 right
    [define foo]
    s foo
    [expand foo]

    observed: no bindings available when rendering foo expanded
2020-11-07 21:13:10 -08:00
Kartik Agaram 8fdf344ea9 7214 - undo 7213
Turns out even that doesn't work.

There are two distinct use cases here:
  1. Keeping columns from infecting each other.
  2. Expanding function calls.

Perhaps ping-ponging between them is a sign I need tests.
2020-11-07 20:22:19 -08:00
Kartik Agaram 97b665c9b4 7213 - redo the bugfix of 7210
It turns out deciding when to initialize the table of bindings is quite
a thorny problem in the presence of function calls (since they need their
args bound). In time I should probably support a linked list of tables.
For now I'll just continue to reuse tables, but perform lookups in reverse
order so that the correct binding is always returned.
2020-11-07 20:12:21 -08:00
Kartik Agaram 9185512dba 7212 2020-11-07 19:51:31 -08:00
Kartik Agaram 4f86220a6c 7211 2020-11-07 19:49:11 -08:00
Kartik Agaram f2a3c381a7 7210
Bug fixed; I had to reinitialize the table of bindings.
Interesting debugging experience.
2020-11-07 19:45:58 -08:00
Kartik Agaram 412304cf45 7209 2020-11-07 18:26:08 -08:00
Kartik Agaram 776f1eee0b 7208 - tile: start new line
Only the final line shows the stack for now. No way to move cursor back
up.

One bug I'm noticing: creating a screen on one line and then reusing it
in a second causes operations to be performed multiple times.
2020-11-07 18:23:05 -08:00
Kartik Agaram d7ad7f9753 7207 - tile: bugfix 2020-11-07 18:02:03 -08:00
Kartik Agaram 5e3927f7e1 7206 - tile: up/down/left/right now print lines 2020-11-07 16:36:47 -08:00
Kartik Agaram 8338c38698 7205 - tile: magnitudes for up/down/left/right 2020-11-07 15:26:04 -08:00
Kartik Agaram 2136ad26b8 7204 2020-11-07 15:12:53 -08:00
Kartik Agaram bf3783ada0 7203 2020-11-06 22:47:57 -08:00
Kartik Agaram 88e53f5628 7202 - rendering screens above other values 2020-11-06 18:26:25 -08:00
Kartik Agaram 1f77feff37 7201 2020-11-06 18:25:52 -08:00
Kartik Agaram cea9b05bb6 7200 - tile: cursor movement helpers 2020-11-06 18:18:42 -08:00
Kartik Agaram 7ee2129ef4 7199 - tile: primitive 'move' 2020-11-06 17:46:42 -08:00
Kartik Agaram aa96c23f0c 7198 - tile: primitive 'print' 2020-11-06 17:46:27 -08:00
Kartik Agaram abba997d1b 7197 - tile: render screen contents and cursor 2020-11-06 16:05:33 -08:00
Kartik Agaram 2855bc69bd 7196 - tile: render empty screen 2020-11-06 14:26:42 -08:00
Kartik Agaram 443140ae3e 7195 - tile: create 'screen' objects 2020-11-06 13:39:46 -08:00
Kartik Agaram 9a0412b858 7194 2020-11-06 13:39:46 -08:00
Kartik Agaram 0181e9eeb6 7193 - tile: extract taxonomy of values into a separate file 2020-11-06 13:39:46 -08:00
Kartik Agaram 494eb64aaf 7192 - more checks around literals
We can copy non-zero literals only to non-addr non-offset scalars.

This change is surprisingly short for the magnitude of the limb I felt
myself going out on for it. Surprising that there were no unpleasant discoveries.
2020-11-05 23:50:12 -08:00
Kartik Agaram bdb48b5211 7191 2020-11-05 21:03:57 -08:00
Kartik Agaram ed146be6bc 7190
Training sights now on some gaps with offset types.
2020-11-05 20:49:00 -08:00
Kartik Agaram 4b41663394 7189 - some validations on function name
Mu has no overloading or static dispatch for now.
2020-11-05 20:10:46 -08:00
Kartik Agaram 7a25625c43 7188 - raise error on deref of var on stack 2020-11-05 19:08:44 -08:00
Kartik Agaram f12ea75a76 7187 2020-11-05 17:07:26 -08:00
Kartik Agaram d496dd0bbc 7186 2020-11-05 17:02:33 -08:00