// SafeC Standard Library — ISR Vector Table
// Interrupt service routine registration and dispatch. Freestanding-safe.
#pragma once
#define ISR_MAX 256
namespace std {
struct IsrTable {
?fn void() handlers[ISR_MAX]; // null = none
int count; // number of registered handlers
// Register a handler for IRQ number `irq`. Returns 1 on success, 0 if out of range.
int register_(int irq, fn void() handler);
// Unregister the handler for IRQ `irq`.
void unregister_(int irq);
// Dispatch: call the handler for IRQ `irq` if registered.
// Returns 1 if a handler was called, 0 if no handler registered.
int dispatch(int irq);
// Initialize an ISR vector table (all entries set to NULL).
static struct IsrTable new();
};
// Disable all interrupts (platform-specific inline asm).
void irq_disable();
// Enable all interrupts (platform-specific inline asm).
void irq_enable();
} // namespace std