fix(v4.0.0): step 6e review round 1 -- a take that does not take does nothing; output and answers wait at a middle node; no queue on the kernel's port; a printing wait is not interrupted

- The result of every take is looked at: a wire cut between the look and
  the take leaves nothing acted on (the text before run again, a refusal
  counted, a wait ended by an old answer, a way forgotten).
- A node with no room to pass on what another printed, or its word of how
  text ended, leaves it on the wire it came by and moves it when there is
  room; what is behind it for the same port waits too.  Sleep for room (9)
  is woken by room on any of the node's wires (engine; MESH.md 7d.3).
- The lone node's host keeps no queue for the kernel's port: a message to
  it is error 18.  The step limit is counted while the node waits for room.
- A text waiting for room to print is not interrupted by console text;
  AWAIT is, as before.  (BREAK?) is gone.
- A GONE is believed only by the centre's port; unawaited answers let go
  are counted; nothing past a message's last character goes on a wire;
  AWAIT sets (AWAIT-FROM) only once the stack has been tried.
- test_host_depth.c: ten paths, each run works or ends in one named stack
  error; it fails with (ROOM) or (ROOM-SERVE) taken out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-08 20:01:11 -04:00
co-authored by Claude Opus 5.5
parent b1d09af043
commit 6a7d0aa27f
16 changed files with 624 additions and 182 deletions
+12 -4
View File
@@ -147,10 +147,18 @@ void v4_fabric_wake(v4_fabric *f, unsigned id);
* the node is let go: put, take, move and drop and the rest (MESH.md 7d.3).
* Sleep (8) and sleep for room (9) are the two that wait: the node stays
* blocked, executing nothing, until a message has come to one of its wires
* since it last fetched which wires have one -- or, for 9, until its wire
* has the room (a wire that can never have the room answers 1 at once). A message has "come" when a put or a move or a device put
* put it on the back of a queue; fetching Have clears that for all of the
* node's wires.
* since it last fetched which wires have one. A message has "come" when a
* put or a move or a device put put it on the back of a queue; fetching Have
* clears that for all of the node's wires.
* SLEEP FOR ROOM (9) answers 0 at once if the wire it names has the room,
* and 1 at once if it can never have it. Otherwise the node sleeps until a
* message has come, as for 8, or a message has come off ANY of the wires
* that lead from it -- taken, moved on or dropped by whoever reads that wire
* -- since it was last woken that way; then it is answered 0 if the wire it
* named now has the room and 1 if not, and it asks which wire has what
* (10). A node may be waiting to put on several wires at once and can name
* only one. A wake-up that finds nothing to do is answered by asking
* again.
*
* Time passes: every node that is awake and not blocked executes one
* instruction word; then every write with a reader waiting on the other end
+1
View File
@@ -39,6 +39,7 @@ typedef struct {
unsigned used; /* how many cells they take */
unsigned mark; /* how many cells from the front the reader's mark is; == used: at no message */
unsigned arrived; /* not 0: a message has come since the reader last asked which wires have one */
unsigned freed; /* not 0: a message has come off since the writer was last woken from a sleep for room */
} v4_wire_queue;
enum { V4_WIRE_DONE = 0, V4_WIRE_NO_ROOM = 1, V4_WIRE_NO_ONE = 2, V4_WIRE_NO_MESSAGE = 3, V4_WIRE_NOT_A_MESSAGE = 4 };