>> So, would it be fair to say that the layers are 0..max_layers-1, >> with some places where layer numbers can appear giving special-case >> semantics to the otherwise invalid values max_layers and >> max_layers+1? > Yes, pretty much like that.
Okay, then. Question time. :) In the lesstif HID, in lesstif_set_layer(), there is code that first maps an incoming group number (ie, an argument in [0..max_layer)) to its [0] member. Then, if the result, idx, is in [0..max_layer+2), it uses PCB->Data->Layer[idx].On as the return value. This seems to imply that (a) max_layer or max_layer+1 can be the [0] element of a group (rather than being a later member, just there to tag the group as being the solder or component side copper), and (b) PCB->Data->Layer[] has something useful in the [max_layer] and [max_layer+1] entries. However, it is not at all clear whether that's actually so. Of the other places in the lesstif HID that use ->Layer[]... - lgbutton_expose special-cases max_layer and max_layer+1. - lesstif_update_layer_groups likewise. - SwapSides accesses those ->Layer[] values iff they are in the solder or component group's [0] elements. Comparing with the GTK HID, I find that set_layer and SwapSides are in this respect the same as their lesstif counterparts (and indeed in set_layer there's a comment implying that its history involves the lesstif version). config_layers_apply uses only Layers[] for [0..max_layers). layer_name_entry_cb depends on code elsewhere; looking for that code, I _think_ it uses only [0..max_layers). ghid_config_groups_changed special-cases max_layer and max_layer+1. layer_process, given how it's used, seems to access Layer[] for [0..MAX_LAYER), oddly enough. layer_button_enable_cb seems to use [0..max_layer] (!). ghid_layer_enable_buttons_update and ghid_layer_buttons_update use [0..max_layer). ToggleView uses the .Name fields from [0..max_layer+2). I find this all rather confusing. It looks as though some fields are valid and some aren't, and then there's the GTK layer_button_enable_cb, which uses one of the extra "layers" but not the other, just to keep things interesting. All this makes it seem likely to me that PCB->Data->Layer[] has data for [0..max_layer), with the code that uses other entries being buggy (and getting away with it only by chance), with SwapSides living dangerously by assuming that the layer groups are "well-formed". Am I right? And, if not, what _is_ in PCB->Data->Layer[max_layer] and [max_layer+1]? /~\ The ASCII der Mouse \ / Ribbon Campaign X Against HTML [EMAIL PROTECTED] / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B _______________________________________________ geda-dev mailing list [email protected] http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev
