What a birthing node needs is centre.4th; KILL, PAUSE, RESUME, UNIT-KILL and CENTRE are Hera's. An outer node births, as a v3 VM may, and may not kill. A capsule is read by the node that opened it. test_host_unit: 93 checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.4 KiB
Forth
31 lines
1.4 KiB
Forth
Block 8000
|
|
( hera.4th -- what is Hera's alone, beside centre.4th, which )
|
|
( she loads first. docs/v4.0.0/MESH.md 9a. She decides )
|
|
( which nodes there are and which are awake: KILL, PAUSE and )
|
|
( RESUME, by number, through the kernel's registry, are hers )
|
|
( and no other node's, as v3's KILL is Hera's alone. )
|
|
-10 KERNEL-WORD NODE-SLEEP -11 KERNEL-WORD NODE-WAKE
|
|
-12 KERNEL-WORD NODE-KILL
|
|
( 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. )
|
|
: KILL ( n -- )
|
|
(THERE?) 0= IF ." KILL: " (NO-NODE) THEN
|
|
DUP NODE-KILL DUP NO-ROUTE GONE-DOWN ;
|
|
Block 8001
|
|
: PAUSE ( n -- )
|
|
(THERE?) 0= IF ." PAUSE: " (NO-NODE) THEN NODE-SLEEP ;
|
|
: RESUME ( n -- )
|
|
(THERE?) 0= IF ." RESUME: " (NO-NODE) THEN NODE-WAKE ;
|
|
( n -- a unit is removed: each of n's children, then n )
|
|
: UNIT-KILL ( n -- )
|
|
BEGIN DUP 0 NODE-CHILD ?DUP WHILE KILL REPEAT KILL ;
|
|
( n -- A SECOND CENTRE, node n, from its port 6 to Hera's )
|
|
( port 6, given centre.4th; it births its unit, n+1 to n+4. )
|
|
: CENTRE ( n -- )
|
|
DUP 6 6 S" v4:centre.4th" BIRTH-AS DROP
|
|
5 1 DO DUP I + 6 ROUTE LOOP DROP
|
|
(T0) (KID#) @ (TN) S" UNIT" (TS) (T) (TELL) ;
|