safety commit

This commit is contained in:
rajames
2026-10-19 06:35:46 -04:00
parent 63434f3762
commit 5707b07abf
12 changed files with 122 additions and 75 deletions
-27
View File
@@ -36,22 +36,6 @@ Block 8102
: (LINES) ( baddr u -- ) CAPSULE-OPEN 0= IF (FAIL) THEN
BEGIN PAD CAPSULE-LINE DUP 0< 0= WHILE PAD SWAP (TELL) REPEAT
DROP ;
Block 8103
( The nodes this one has had born: for each its number and )
( the port of this node it is on. Sixteen at most. )
CREATE (KIDS) 32 ALLOT VARIABLE (KIDS#) 0 (KIDS#) !
: (KID@) ( i -- addr ) 2 * (KIDS) + ;
: (NOTE) ( number port -- )
(KIDS#) @ 16 < IF
(KIDS#) @ (KID@) SWAP OVER 1+ ! ! 1 (KIDS#) +!
ELSE DROP DROP THEN ;
: (WHICH) ( number -- i | -1 )
-1 SWAP (KIDS#) @ DUP IF 0 DO
DUP I (KID@) @ = IF SWAP DROP I SWAP THEN
LOOP ELSE DROP THEN DROP ;
: (UNLIST) ( i -- )
(KIDS#) @ 1- DUP (KIDS#) ! (KID@) DUP @ SWAP 1+ @
ROT (KID@) SWAP OVER 1+ ! ! ;
Block 8104
( Who it is, where its printing goes, which of its ports )
( leads to everything it is not told of, and who is there. )
@@ -75,7 +59,6 @@ Block 8105
(PERS#) @ IF (PERS) @ (PERS#) @ (LINES) THEN
S" (SEAL)" (TELL)
(KID) @ (KID#) @ NODE-PARITY
(KID#) @ (KIDP) @ (NOTE)
(KID) @ ;
Block 8106
( number port childport -- place a node with no capsule )
@@ -105,13 +88,3 @@ VARIABLE (P1) VARIABLE (P2) VARIABLE (P3) VARIABLE (P4)
(P2) @ 2 (N) (X) (P4) @ 4 (N) (Y) (JOIN)
(P4) @ 4 (N) (X) (P3) @ 3 (N) (Y) (JOIN)
(P3) @ 3 (N) (X) (P1) @ 1 (N) (Y) (JOIN) ;
Block 8108
( n -- NODE n IS GONE: every node this one birthed is told, )
( as from this one, and n leaves the list if it was there. )
( The system calls this when it believes a GONE, through )
( GONE-HOOK in quit.f18; Hera calls it from KILL. )
: GONE-DOWN ( n -- )
DUP (WHICH) DUP 0< IF DROP ELSE (UNLIST) THEN
(KIDS#) @ DUP IF 0 DO DUP I (KID@) @ GONE LOOP
ELSE DROP THEN DROP ;
' GONE-DOWN (GONE-HOOK) !
+3 -3
View File
@@ -9,11 +9,11 @@ Block 8000
( n -- n flag a node there is, and not Hera herself )
: (THERE?) DUP (ME) @ = 0= OVER NODE-PLACE 0< 0= AND ;
: (NO-NODE) ( n -- ) DROP ." no such node" CR -1 NODE-ERROR ! ;
( n -- KILL: node n is removed, whatever it was doing; this )
( node forgets the way to it, and GONE goes down the graph. )
( n -- KILL: node n is removed, whatever it was doing; the )
( kernel tells every node it is gone, and Hera forgets it. )
: KILL ( n -- )
(THERE?) 0= IF ." KILL: " (NO-NODE) THEN
DUP NODE-KILL DUP NO-ROUTE GONE-DOWN ;
DUP NODE-KILL NO-ROUTE ;
Block 8001
: PAUSE ( n -- )
(THERE?) 0= IF ." PAUSE: " (NO-NODE) THEN NODE-SLEEP ;