starkernel: item 3.3 -- behaviour enumeration and dispatch
Punch list §25 item 3.3 complete. StadiumBehaviour (stadium.h) enumerates exactly the four tags §18.3 already names -- MIGRATE, DELIVER, EXPIRE, COOL -- mapped from §17.1's patron table: blocks->MIGRATE, messages->DELIVER, ACLs->EXPIRE, words and VMs both->COOL. Nothing invented; the tag set and mapping were already in the document. stadium_dispatch(cell_index, behaviour) dispatches on the tag only, never asks what kind of patron departed. Handlers are stubs -- the real actions belong to subsystems not yet migrated onto the Stadium (Phase 4). Nothing calls stadium_dispatch() yet; item 3.5 is its first consumer. The switch is exhaustive with no default case, making §13's "closed enumeration, fixed at build time" a compiler-enforced property under this project's -Wall -Werror rather than just prose. Verified live: temporarily deleted the COOL case, rebuild failed with error: enumeration value 'STADIUM_BEHAVIOUR_COOL' not handled in switch [-Werror=switch], restored it, confirmed clean again. The header's behaviour field stays uint8_t, not the enum type itself, since C does not guarantee an enum's underlying type and that field's offset is load-bearing for item 3.1's validated 64-byte layout. Verified: three-architecture boot (amd64, aarch64, riscv64), all reaching ok> with identical dict_hash=0x3d4e1daf289da94f matching the item-3.2 baseline. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
eb0fd4fffa
commit
378d688898
@@ -120,4 +120,34 @@ uint8_t *stadium_header_bitmap(void) {
|
||||
return stadium_bitmap;
|
||||
}
|
||||
|
||||
/*
|
||||
* Exhaustive switch, no default: §13/§18.3 require the behaviour set to be
|
||||
* closed and fixed at build time. With -Wall -Werror, omitting a case here
|
||||
* for a tag that exists is a build failure, not a silent gap -- the compiler
|
||||
* enforces closedness, not just this comment.
|
||||
*
|
||||
* Handlers are stubs: the real actions belong to subsystems not yet migrated
|
||||
* onto the Stadium (Phase 4, §25.5). Nothing calls this yet either -- item
|
||||
* 3.5 is the first consumer.
|
||||
*/
|
||||
void stadium_dispatch(size_t cell_index, StadiumBehaviour behaviour) {
|
||||
console_puts("Stadium: dispatch cell=");
|
||||
console_put_u64((uint64_t)cell_index);
|
||||
console_puts(" behaviour=");
|
||||
switch (behaviour) {
|
||||
case STADIUM_BEHAVIOUR_MIGRATE:
|
||||
console_println("MIGRATE (stub)");
|
||||
break;
|
||||
case STADIUM_BEHAVIOUR_DELIVER:
|
||||
console_println("DELIVER (stub)");
|
||||
break;
|
||||
case STADIUM_BEHAVIOUR_EXPIRE:
|
||||
console_println("EXPIRE (stub)");
|
||||
break;
|
||||
case STADIUM_BEHAVIOUR_COOL:
|
||||
console_println("COOL (stub)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __STARKERNEL__ */
|
||||
Reference in New Issue
Block a user