The Arduino attachInterrupt mechanism already polls this register to
dispatch to the right function, so just use a function per pin. These functions
can call common code with a pin number if you like - a macro can be used
to define them even :
#define PIN_HANDLER(pin) \
void pin_handler_##pin (void) \
common_handler (pin) ;
- it would be nice if that could put the attachInterrupt calls in setup() but
alas C macros are lowly beasts with few powers.
Perhaps polling the register yourself is best, on reflection!
It wouldn't be hard to adapt WInterrupts.c to use handler functions
with the signature:
void handler (int pin)
But it would mean creating some port/mask -> Arduino pin reverse