Index: trunk/src/obj_pstk.c =================================================================== --- trunk/src/obj_pstk.c (revision 22087) +++ trunk/src/obj_pstk.c (revision 22088) @@ -1435,3 +1435,15 @@ pcb_r_insert_entry(data->padstack_tree, (pcb_box_t *)pstk); pcb_poly_clear_from_poly(data, PCB_OBJ_PSTK, NULL, pstk); } + +pcb_layer_id_t pcb_proto_board_layer_for(const pcb_data_t *data, pcb_layer_type_t mask, pcb_layer_combining_t comb) +{ + pcb_layer_id_t lid; + pcb_layer_t *ly; + for(lid = 0, ly = data->Layer; lid < data->LayerN; lid++,ly++) { + pcb_layer_type_t typ = pcb_layer_flags_(ly); + if ((typ == mask) && (ly->comb == comb)) + return lid; + } + return -1; +} Index: trunk/src/obj_pstk.h =================================================================== --- trunk/src/obj_pstk.h (revision 22087) +++ trunk/src/obj_pstk.h (revision 22088) @@ -281,6 +281,11 @@ #define pcb_proto_num_layers 8 const pcb_proto_layer_t pcb_proto_layers[pcb_proto_num_layers]; + +/* Return the id of a board layer that matches a mask:comb pair or invalid if + nothing matched */ +pcb_layer_id_t pcb_proto_board_layer_for(const pcb_data_t *data, pcb_layer_type_t mask, pcb_layer_combining_t comb); + /*** hash ***/ unsigned int pcb_pstk_proto_hash(const pcb_pstk_proto_t *p); int pcb_pstk_proto_eq(const pcb_pstk_proto_t *p1, const pcb_pstk_proto_t *p2);