First of all, I would strongly advise against using the bitfield macros PTAD_PTAD0 etc since there is plenty of undefined behavior asociated with bitfields, making your program behave randomly in case you ever port it to another compiler/CPU. Also, the Codewarrior headers with those macros don't follow ISO C, so it is best to avoid them entirely.
I think what you are looking for is something like this:
typedef enum
{
LED0 = 0x01, /* bit masks for the port */
LED1 = 0x02,
LED2 = 0x04,
...
} LedType;
static const unsigned char LED_MASK[N] =
{
LED0,
LED1,
LED2,
...
};
static volatile unsigned char* leds[N] =
{
&PTAD,
&PTCD,
...
};
void set_led (unsigned int n, BOOL active)
{
if(active)
{
*leds[n] |= LED_MASK[n];
}
else
{
*leds[n] &= (unsigned char) ~LED_MASK[n];
}
}