Yes, this was basically what I came up with.

The problem turns out to be that for gl_LightSource[n], n must be a literal int or const int.  I'm not sure why this could be.  Ideas?  

I solved the problem by passing the light source itself to the function.  

There's a few more other problems, but it's mostly done.

Ian