Index: bxl.h =================================================================== --- bxl.h (revision 30607) +++ bxl.h (revision 30608) @@ -15,6 +15,10 @@ PCB_BXL_JUST_RIGHT = 4 } pcb_bxl_just_t; +typedef struct { + pcb_coord_t width, height, char_width; +} pcb_bxl_test_style_t; + typedef struct pcb_bxl_ctx_s { pcb_subc_t *subc; char in_target_fp; /* 1 if we are parsing the target footprint; else skip */ @@ -21,6 +25,7 @@ /* cache */ htsp_t layer_name2ly; + htsp_t text_name2style; struct { pcb_layer_t *layer; @@ -28,6 +33,7 @@ pcb_poly_t *poly; double arc_start, arc_delta; pcb_bxl_just_t hjust, vjust; + pcb_bxl_test_style_t *text_style; unsigned flipped:1; unsigned invis:1; unsigned plated:1; @@ -59,4 +65,7 @@ void pcb_bxl_poly_end(pcb_bxl_ctx_t *ctx); void pcb_bxl_poly_add_vertex(pcb_bxl_ctx_t *ctx, pcb_coord_t x, pcb_coord_t y); +void pcb_bxl_text_style_begin(pcb_bxl_ctx_t *ctx, char *name); +void pcb_bxl_text_style_end(pcb_bxl_ctx_t *ctx); + #endif Index: bxl_gram.c =================================================================== --- bxl_gram.c (revision 30607) +++ bxl_gram.c (revision 30608) @@ -16,151 +16,151 @@ static const pcb_bxl_int_t pcb_bxl_lhs[] = { -1, 0, 5, 5, 6, 6, 6, 6, 3, 3, 7, 7, 4, 4, 1, 1, 2, 12, 12, 12, 13, - 14, 15, 8, 16, 16, 17, 17, 17, 9, 18, - 18, 20, 20, 20, 20, 19, 19, 21, 22, 22, - 23, 23, 23, 23, 25, 10, 24, 24, 26, 26, - 26, 26, 27, 28, 28, 29, 29, 29, 29, 29, - 29, 29, 29, 30, 38, 38, 39, 39, 39, 39, - 39, 39, 39, 41, 31, 40, 40, 42, 42, 42, - 42, 42, 44, 32, 43, 43, 45, 45, 45, 45, - 33, 46, 46, 47, 47, 47, 47, 49, 35, 48, - 48, 50, 50, 50, 50, 50, 50, 36, 51, 51, - 52, 52, 52, 52, 52, 52, 37, 34, 53, 53, - 54, 54, 54, 11, + 14, 15, 17, 8, 16, 16, 18, 18, 18, 9, + 19, 19, 21, 21, 21, 21, 20, 20, 22, 23, + 23, 24, 24, 24, 24, 26, 10, 25, 25, 27, + 27, 27, 27, 28, 29, 29, 30, 30, 30, 30, + 30, 30, 30, 30, 31, 39, 39, 40, 40, 40, + 40, 40, 40, 40, 42, 32, 41, 41, 43, 43, + 43, 43, 43, 45, 33, 44, 44, 46, 46, 46, + 46, 34, 47, 47, 48, 48, 48, 48, 50, 36, + 49, 49, 51, 51, 51, 51, 51, 51, 37, 52, + 52, 53, 53, 53, 53, 53, 53, 38, 35, 54, + 54, 55, 55, 55, 11, }; static const pcb_bxl_int_t pcb_bxl_len[] = { 2, 2, 0, 3, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 4, - 2, 2, 3, 0, 4, 2, 2, 2, 10, 0, - 4, 2, 2, 2, 2, 0, 2, 4, 0, 4, - 2, 2, 1, 1, 0, 6, 0, 3, 1, 6, - 6, 6, 6, 0, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 0, 4, 2, 2, 2, 2, - 2, 2, 1, 0, 3, 0, 4, 2, 3, 1, - 1, 1, 0, 3, 0, 4, 4, 1, 1, 1, - 2, 0, 4, 3, 1, 1, 1, 0, 3, 0, - 4, 2, 2, 2, 1, 1, 1, 2, 0, 4, - 2, 2, 2, 1, 1, 1, 2, 2, 0, 4, - 2, 2, 1, 6, + 2, 2, 0, 4, 0, 4, 2, 2, 2, 10, + 0, 4, 2, 2, 2, 2, 0, 2, 4, 0, + 4, 2, 2, 1, 1, 0, 6, 0, 3, 1, + 6, 6, 6, 6, 0, 3, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 0, 4, 2, 2, 2, + 2, 2, 2, 1, 0, 3, 0, 4, 2, 3, + 1, 1, 1, 0, 3, 0, 4, 4, 1, 1, + 1, 2, 0, 4, 3, 1, 1, 1, 0, 3, + 0, 4, 2, 2, 2, 1, 1, 1, 2, 0, + 4, 2, 2, 2, 1, 1, 1, 2, 2, 0, + 4, 2, 2, 1, 6, }; static const pcb_bxl_int_t pcb_bxl_defred[] = { 0, 0, 0, 0, 13, 11, 0, 0, 0, 0, 1, - 0, 4, 5, 6, 7, 0, 0, 0, 0, 0, - 0, 23, 0, 0, 45, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, - 27, 28, 0, 32, 8, 9, 33, 34, 35, 0, - 0, 0, 0, 0, 0, 0, 0, 49, 0, 25, - 31, 0, 0, 0, 0, 0, 46, 0, 124, 0, - 0, 14, 15, 16, 0, 0, 0, 48, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 74, 83, 0, - 98, 0, 0, 0, 0, 0, 56, 57, 58, 59, - 60, 61, 62, 63, 0, 0, 0, 0, 29, 37, - 0, 64, 0, 0, 0, 91, 0, 0, 108, 0, - 117, 118, 53, 0, 50, 51, 52, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 73, 0, 0, 75, - 0, 84, 0, 0, 0, 0, 0, 95, 96, 97, - 0, 0, 99, 0, 0, 0, 114, 115, 116, 0, - 0, 0, 123, 0, 55, 0, 0, 0, 43, 44, - 0, 38, 67, 68, 69, 70, 0, 71, 72, 0, - 0, 0, 80, 81, 82, 0, 0, 88, 89, 90, - 0, 18, 21, 0, 17, 19, 0, 0, 0, 0, - 105, 106, 107, 0, 113, 111, 112, 0, 121, 122, - 0, 22, 41, 42, 0, 0, 66, 78, 0, 0, - 0, 0, 94, 93, 102, 103, 104, 0, 110, 120, - 40, 20, 79, 77, 0, 86, 101, 87, + 0, 4, 5, 6, 7, 23, 0, 0, 0, 0, + 0, 0, 0, 46, 0, 3, 0, 24, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 33, 8, 9, 34, 35, 36, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, 14, 15, 16, 27, + 28, 29, 0, 32, 0, 0, 0, 0, 0, 47, + 0, 125, 26, 0, 0, 0, 0, 0, 49, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 84, + 0, 99, 0, 0, 0, 0, 0, 57, 58, 59, + 60, 61, 62, 63, 64, 0, 0, 0, 0, 30, + 38, 0, 65, 0, 0, 0, 92, 0, 0, 109, + 0, 118, 119, 54, 0, 51, 52, 53, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, + 76, 0, 85, 0, 0, 0, 0, 0, 96, 97, + 98, 0, 0, 100, 0, 0, 0, 115, 116, 117, + 0, 0, 0, 124, 0, 56, 0, 0, 0, 44, + 45, 0, 39, 68, 69, 70, 71, 0, 72, 73, + 0, 0, 0, 81, 82, 83, 0, 0, 89, 90, + 91, 0, 18, 21, 0, 17, 19, 0, 0, 0, + 0, 106, 107, 108, 0, 114, 112, 113, 0, 122, + 123, 0, 22, 42, 43, 0, 0, 67, 79, 0, + 0, 0, 0, 95, 94, 103, 104, 105, 0, 111, + 121, 41, 20, 80, 78, 0, 87, 102, 88, }; static const pcb_bxl_int_t pcb_bxl_dgoto[] = { 2, - 74, 75, 47, 3, 10, 11, 4, 12, 13, 14, - 15, 148, 137, 150, 170, 22, 31, 24, 85, 36, - 86, 129, 171, 56, 38, 57, 58, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 112, 138, 140, - 113, 186, 142, 114, 191, 116, 151, 153, 117, 204, - 119, 160, 121, 164, + 59, 60, 44, 3, 10, 11, 4, 12, 13, 14, + 15, 149, 138, 151, 171, 28, 21, 40, 23, 86, + 33, 87, 130, 172, 53, 35, 54, 55, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 113, 139, + 141, 114, 187, 143, 115, 192, 117, 152, 154, 118, + 205, 120, 161, 122, 165, }; -static const pcb_bxl_int_t pcb_bxl_sindex[] = { -3, - -3, 0, -251, 0, 0, -230, -224, -210, -235, 0, - -3, 0, 0, 0, 0, 14, 24, -3, -234, -251, - -173, 0, -258, -3, 0, -228, 0, -156, -144, -143, - 44, -142, -229, -229, -229, 77, -150, -200, -136, 0, - 0, 0, 14, 0, 0, 0, 0, 0, 0, 24, - 63, 67, 87, 89, 92, -145, -3, 0, -177, 0, - 0, -121, -119, -219, -219, -219, 0, -200, 0, -3, - -3, 0, 0, 0, 97, 98, 100, 0, -123, -163, - -219, -219, -219, -115, -120, -123, 109, 0, 0, 110, - 0, 111, 112, 112, -127, -3, 0, 0, 0, 0, - 0, 0, 0, 0, 114, 116, 117, 119, 0, 0, - -179, 0, 120, 121, -239, 0, 122, -255, 0, -262, - 0, 0, 0, -163, 0, 0, 0, -178, -3, -95, - -96, -94, -93, -219, -90, -219, 0, 124, -233, 0, - -243, 0, -91, -87, -89, -84, -229, 0, 0, 0, - 133, -196, 0, -219, -85, -229, 0, 0, 0, 135, - -83, -82, 0, 138, 0, -219, -219, -78, 0, 0, - 140, 0, 0, 0, 0, 0, 139, 0, 0, 109, - -76, 141, 0, 0, 0, 145, -219, 0, 0, 0, - 146, 0, 0, -72, 0, 0, 110, -219, -219, -219, - 0, 0, 0, 148, 0, 0, 0, 111, 0, 0, - 112, 0, 0, 0, 119, -219, 0, 0, -219, 120, - 147, 121, 0, 0, 0, 0, 0, 122, 0, 0, - 0, 0, 0, 0, -219, 0, 0, 0, +static const pcb_bxl_int_t pcb_bxl_sindex[] = { 6, + 6, 0, -255, 0, 0, -225, -224, -216, -245, 0, + 6, 0, 0, 0, 0, 0, 11, 6, -274, -255, + 12, -213, 6, 0, -252, 0, -180, 0, -179, -241, + -241, -241, 34, -188, -141, -178, -229, -229, -229, 47, + 0, 0, 0, 0, 0, 0, 11, 39, 43, 69, + 70, 71, -166, 6, 0, -201, 0, 0, 0, 0, + 0, 0, 12, 0, -142, -139, -229, -229, -229, 0, + -141, 0, 0, 6, 6, 73, 76, 78, 0, -144, + -191, -229, -229, -229, -133, -140, -144, 100, 0, 0, + 104, 0, 109, 110, 110, -128, 6, 0, 0, 0, + 0, 0, 0, 0, 0, 113, 114, 115, 111, 0, + 0, -154, 0, 117, 118, -221, 0, 119, -249, 0, + -183, 0, 0, 0, -191, 0, 0, 0, -129, 6, + -98, -99, -96, -95, -229, -92, -229, 0, 121, -240, + 0, -250, 0, -93, -88, -90, -86, -241, 0, 0, + 0, 127, -210, 0, -229, -87, -241, 0, 0, 0, + 131, -85, -84, 0, 133, 0, -229, -229, -81, 0, + 0, 137, 0, 0, 0, 0, 0, 135, 0, 0, + 100, -80, 138, 0, 0, 0, 142, -229, 0, 0, + 0, 144, 0, 0, -74, 0, 0, 104, -229, -229, + -229, 0, 0, 0, 146, 0, 0, 0, 109, 0, + 0, 110, 0, 0, 0, 111, -229, 0, 0, -229, + 117, 145, 118, 0, 0, 0, 0, 0, 119, 0, + 0, 0, 0, 0, 0, -229, 0, 0, 0, }; static const pcb_bxl_int_t pcb_bxl_rindex[] = { 9, - 1, 0, 182, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 180, 183, 0, 0, 182, + 1, 0, 188, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 180, 0, 0, 188, + 181, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -83, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -81, 0, 0, - 0, 0, 180, 0, 0, 0, 0, 0, 0, 183, + 0, 0, 181, 0, 0, 0, 0, 0, 0, 0, + -83, 0, 0, 0, 0, 0, 0, 0, 0, -76, + -82, 0, 0, 0, 0, 0, -76, 183, 0, 0, + 184, 0, 185, 187, 187, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 191, 0, + 0, 0, 0, 192, 193, 0, 0, 194, 0, 0, + 0, 0, 0, 0, -82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -81, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -74, -86, - 0, 0, 0, 0, 0, -74, 186, 0, 0, 187, - 0, 189, 190, 190, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 191, 0, 0, - 0, 0, 192, 193, 0, 0, 194, 0, 0, 0, - 0, 0, 0, -86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 186, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 187, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 189, 0, 0, - 190, 0, 0, 0, 191, 0, 0, 0, 0, 192, - 0, 193, 0, 0, 0, 0, 0, 194, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 183, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 184, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 185, 0, + 0, 187, 0, 0, 0, 191, 0, 0, 0, 0, + 192, 0, 193, 0, 0, 0, 0, 0, 194, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static const pcb_bxl_int_t pcb_bxl_gindex[] = { 0, - -125, -63, -30, 0, 172, 0, -1, 0, 0, 0, - 0, 88, -52, -51, -79, 162, 0, 157, 123, 0, - 0, -7, 0, 142, 0, 0, 0, 90, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 31, 0, -8, - 0, 0, -9, 0, 0, 18, 0, -12, 0, 0, - 10, 0, -88, 0, + -130, -36, -27, 0, 178, 0, -1, 0, 0, 0, + 0, 86, -53, -47, -127, 143, 0, 0, 160, 122, + 0, 0, -8, 0, 139, 0, 0, 0, 87, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, + -7, 0, 0, -10, 0, 0, 17, 0, -13, 0, + 0, 8, 0, -89, 0, }; #define pcb_bxl_TABLESIZE 321 static const pcb_bxl_int_t pcb_bxl_table[] = { 5, - 10, 76, 77, 48, 49, 122, 1, 143, 12, 20, - 179, 6, 32, 33, 34, 7, 25, 105, 106, 107, - 19, 144, 37, 143, 72, 73, 8, 134, 205, 16, - 166, 45, 46, 144, 134, 17, 154, 144, 72, 73, - 166, 213, 146, 144, 161, 162, 134, 155, 147, 18, - 134, 187, 35, 21, 156, 68, 134, 145, 146, 185, - 9, 190, 149, 23, 147, 158, 159, 163, 79, 80, - 177, 181, 203, 226, 227, 182, 169, 166, 26, 52, - 144, 53, 54, 55, 43, 39, 183, 184, 188, 189, - 28, 29, 30, 134, 124, 166, 167, 168, 144, 201, - 202, 40, 212, 198, 199, 200, 130, 131, 132, 133, - 134, 135, 136, 41, 42, 44, 196, 50, 51, 59, - 62, 87, 230, 221, 63, 207, 64, 172, 65, 88, - 89, 66, 90, 67, 225, 91, 70, 69, 71, 92, - 81, 82, 93, 83, 108, 94, 84, 109, 111, 115, - 118, 120, 232, 123, 125, 233, 126, 127, 128, 139, - 141, 152, 173, 174, 180, 175, 176, 178, 192, 193, - 194, 238, 195, 197, 206, 208, 209, 210, 211, 214, - 215, 2, 216, 218, 219, 220, 222, 223, 228, 24, - 235, 27, 30, 36, 54, 65, 92, 47, 109, 119, - 39, 76, 85, 100, 60, 157, 61, 231, 110, 78, - 217, 234, 236, 165, 224, 237, 0, 229, 0, 0, + 10, 61, 62, 45, 46, 123, 180, 6, 12, 20, + 19, 7, 186, 144, 191, 1, 24, 57, 58, 42, + 43, 34, 8, 167, 206, 204, 145, 145, 57, 58, + 76, 77, 78, 167, 16, 17, 145, 214, 25, 135, + 135, 144, 155, 18, 188, 106, 107, 108, 147, 135, + 22, 27, 71, 156, 148, 145, 9, 29, 30, 31, + 157, 36, 150, 167, 182, 159, 145, 164, 135, 227, + 228, 160, 80, 81, 47, 146, 147, 56, 41, 135, + 48, 170, 148, 37, 38, 39, 184, 63, 189, 199, + 200, 201, 185, 88, 190, 125, 65, 32, 178, 202, + 66, 89, 90, 183, 91, 203, 135, 92, 67, 68, + 69, 93, 70, 72, 94, 74, 82, 95, 75, 83, + 197, 84, 231, 162, 163, 85, 109, 110, 173, 208, + 213, 131, 132, 133, 134, 135, 136, 137, 49, 112, + 50, 51, 52, 116, 167, 168, 169, 145, 119, 121, + 129, 222, 124, 126, 127, 128, 140, 142, 153, 174, + 175, 181, 226, 176, 177, 179, 193, 198, 194, 195, + 196, 209, 207, 212, 210, 211, 215, 216, 217, 219, + 233, 220, 221, 234, 223, 224, 229, 2, 236, 31, + 25, 37, 66, 93, 110, 48, 120, 26, 55, 239, + 40, 77, 86, 101, 158, 73, 64, 232, 111, 79, + 218, 166, 237, 235, 225, 238, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -174,28 +174,28 @@ 12, }; static const pcb_bxl_int_t pcb_bxl_check[] = { 1, - 0, 65, 66, 34, 35, 94, 10, 263, 0, 11, - 136, 263, 271, 272, 273, 267, 18, 81, 82, 83, - 256, 277, 24, 263, 258, 259, 278, 290, 154, 260, - 274, 261, 262, 277, 290, 260, 292, 277, 258, 259, - 274, 167, 298, 277, 307, 308, 290, 303, 304, 260, - 290, 295, 311, 40, 310, 57, 290, 297, 298, 139, - 312, 141, 115, 40, 304, 118, 118, 120, 70, 71, - 134, 305, 152, 199, 200, 139, 128, 274, 313, 280, - 277, 282, 283, 284, 41, 314, 139, 139, 141, 141, - 264, 265, 266, 290, 96, 274, 275, 276, 277, 152, - 152, 258, 166, 300, 301, 302, 286, 287, 288, 289, - 290, 291, 292, 258, 258, 258, 147, 41, 269, 256, - 58, 285, 211, 187, 58, 156, 40, 129, 40, 293, - 294, 40, 296, 279, 198, 299, 258, 315, 258, 303, - 44, 44, 306, 44, 260, 309, 270, 268, 40, 40, - 40, 40, 216, 281, 41, 219, 41, 41, 40, 40, - 40, 40, 258, 260, 41, 260, 260, 258, 260, 257, - 260, 235, 257, 41, 260, 41, 260, 260, 41, 258, - 41, 0, 44, 260, 44, 41, 41, 260, 41, 10, - 44, 20, 10, 268, 281, 10, 10, 279, 10, 10, - 10, 10, 10, 10, 43, 118, 50, 215, 86, 68, - 180, 220, 222, 124, 197, 228, -1, 208, -1, -1, + 0, 38, 39, 31, 32, 95, 137, 263, 0, 11, + 256, 267, 140, 263, 142, 10, 18, 258, 259, 261, + 262, 23, 278, 274, 155, 153, 277, 277, 258, 259, + 67, 68, 69, 274, 260, 260, 277, 168, 313, 290, + 290, 263, 292, 260, 295, 82, 83, 84, 298, 290, + 40, 40, 54, 303, 304, 277, 312, 271, 272, 273, + 310, 314, 116, 274, 305, 119, 277, 121, 290, 200, + 201, 119, 74, 75, 41, 297, 298, 256, 258, 290, + 269, 129, 304, 264, 265, 266, 140, 41, 142, 300, + 301, 302, 140, 285, 142, 97, 58, 311, 135, 153, + 58, 293, 294, 140, 296, 153, 290, 299, 40, 40, + 40, 303, 279, 315, 306, 258, 44, 309, 258, 44, + 148, 44, 212, 307, 308, 270, 260, 268, 130, 157, + 167, 286, 287, 288, 289, 290, 291, 292, 280, 40, + 282, 283, 284, 40, 274, 275, 276, 277, 40, 40, + 40, 188, 281, 41, 41, 41, 40, 40, 40, 258, + 260, 41, 199, 260, 260, 258, 260, 41, 257, 260, + 257, 41, 260, 41, 260, 260, 258, 41, 44, 260, + 217, 44, 41, 220, 41, 260, 41, 0, 44, 10, + 10, 268, 10, 10, 10, 279, 10, 20, 281, 236, + 10, 10, 10, 10, 119, 63, 47, 216, 87, 71, + 181, 125, 223, 221, 198, 229, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -210,7 +210,7 @@ }; #define pcb_bxl_FINAL 2 #define pcb_bxl_MAXTOKEN 315 -#define pcb_bxl_UNDFTOKEN 372 +#define pcb_bxl_UNDFTOKEN 373 #define pcb_bxl_TRANSLATE(a) ((a) > pcb_bxl_MAXTOKEN ? pcb_bxl_UNDFTOKEN : (a)) #if pcb_bxl_DEBUG static const char *const pcb_bxl_name[] = { @@ -233,7 +233,7 @@ "T_PROPERTY","T_WIZARD","T_VARNAME","T_VARDATA","T_TEMPLATEDATA","T_ISFLIPPED", "T_NOPASTE","T_SYMBOL","T_ENDSYMBOL","T_COMPONENT","T_ENDCOMPONENT",0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,"illegal-symbol", +0,0,0,0,0,0,0,0,0,0,0,"illegal-symbol", }; static const char *const pcb_bxl_rule[] = { "$accept : full_file", @@ -259,12 +259,13 @@ "common_origin : T_ORIGIN coord ',' coord", "common_layer : T_LAYER T_ID", "common_width : T_WIDTH coord", -"text_style : T_TEXTSTYLE T_QSTR text_style_attrs", +"$$1 :", +"text_style : T_TEXTSTYLE T_QSTR $$1 text_style_attrs", "text_style_attrs :", "text_style_attrs : '(' text_style_attr ')' text_style_attrs", -"text_style_attr : T_FONTWIDTH T_INTEGER", -"text_style_attr : T_FONTCHARWIDTH T_INTEGER", -"text_style_attr : T_FONTHEIGHT T_INTEGER", +"text_style_attr : T_FONTWIDTH coord", +"text_style_attr : T_FONTCHARWIDTH coord", +"text_style_attr : T_FONTHEIGHT coord", "pad_stack : T_PADSTACK T_QSTR pstk_attrs nl T_SHAPES ':' T_INTEGER nl pad_shapes T_ENDPADSTACK", "pstk_attrs :", "pstk_attrs : '(' pstk_attr ')' pstk_attrs", @@ -281,8 +282,8 @@ "padshape_attr : T_PADTYPE T_INTEGER", "padshape_attr : common_layer", "padshape_attr : common_width", -"$$1 :", -"pattern : T_PATTERN T_QSTR nl $$1 pattern_chldrn T_ENDPATTERN", +"$$2 :", +"pattern : T_PATTERN T_QSTR nl $$2 pattern_chldrn T_ENDPATTERN", "pattern_chldrn :", "pattern_chldrn : pattern_chld nl pattern_chldrn", "pattern_chld : data", @@ -310,8 +311,8 @@ "pad_attr : T_ORIGINALPINNUMBER T_INTEGER", "pad_attr : T_ROTATE real", "pad_attr : common_origin", -"$$2 :", -"poly : T_POLY $$2 poly_attrs", +"$$3 :", +"poly : T_POLY $$3 poly_attrs", "poly_attrs :", "poly_attrs : '(' poly_attr ')' poly_attrs", "poly_attr : T_PROPERTY T_QSTR", @@ -319,8 +320,8 @@ "poly_attr : common_origin", "poly_attr : common_layer", "poly_attr : common_width", -"$$3 :", -"line : T_LINE $$3 line_attrs", +"$$4 :", +"line : T_LINE $$4 line_attrs", "line_attrs :", "line_attrs : '(' line_attr ')' line_attrs", "line_attr : T_ENDPOINT coord ',' coord", @@ -334,8 +335,8 @@ "attribute_attr : common_attr_text", "attribute_attr : common_origin", "attribute_attr : common_layer", -"$$4 :", -"arc : T_ARC $$4 arc_attrs", +"$$5 :", +"arc : T_ARC $$5 arc_attrs", "arc_attrs :", "arc_attrs : '(' arc_attr ')' arc_attrs", "arc_attr : T_RADIUS coord", @@ -609,79 +610,99 @@ #line 139 "../../src_plugins/io_bxl/bxl_gram.y" { ctx->state.width = yyctx->stack.l_mark[0].un.c; } break; -case 33: -#line 176 "../../src_plugins/io_bxl/bxl_gram.y" - { ctx->state.surface = yyctx->stack.l_mark[0].un.i; } +case 23: +#line 145 "../../src_plugins/io_bxl/bxl_gram.y" + { pcb_bxl_text_style_begin(ctx, yyctx->stack.l_mark[0].un.s); /* $2 is taken over */ } break; +case 24: +#line 146 "../../src_plugins/io_bxl/bxl_gram.y" + { pcb_bxl_text_style_end(ctx); } +break; +case 27: +#line 155 "../../src_plugins/io_bxl/bxl_gram.y" + { ctx->state.text_style->width = yyctx->stack.l_mark[0].un.c; } +break; +case 28: +#line 156 "../../src_plugins/io_bxl/bxl_gram.y" + { ctx->state.text_style->char_width = yyctx->stack.l_mark[0].un.c; } +break; +case 29: +#line 157 "../../src_plugins/io_bxl/bxl_gram.y" + { ctx->state.text_style->height = yyctx->stack.l_mark[0].un.c; } +break; case 34: #line 177 "../../src_plugins/io_bxl/bxl_gram.y" - { ctx->state.plated = yyctx->stack.l_mark[0].un.i; } + { ctx->state.surface = yyctx->stack.l_mark[0].un.i; } break; case 35: #line 178 "../../src_plugins/io_bxl/bxl_gram.y" + { ctx->state.plated = yyctx->stack.l_mark[0].un.i; } +break; +case 36: +#line 179 "../../src_plugins/io_bxl/bxl_gram.y" { ctx->state.nopaste = yyctx->stack.l_mark[0].un.i; } break; -case 45: -#line 204 "../../src_plugins/io_bxl/bxl_gram.y" +case 46: +#line 205 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_pattern_begin(ctx, yyctx->stack.l_mark[-1].un.s); free(yyctx->stack.l_mark[-1].un.s); } break; -case 46: -#line 206 "../../src_plugins/io_bxl/bxl_gram.y" +case 47: +#line 207 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_pattern_end(ctx); } break; -case 74: -#line 266 "../../src_plugins/io_bxl/bxl_gram.y" +case 75: +#line 267 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_poly_begin(ctx); } break; -case 75: -#line 267 "../../src_plugins/io_bxl/bxl_gram.y" +case 76: +#line 268 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_poly_end(ctx); } break; -case 78: -#line 277 "../../src_plugins/io_bxl/bxl_gram.y" +case 79: +#line 278 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_add_property(ctx, (pcb_any_obj_t *)ctx->state.poly, yyctx->stack.l_mark[0].un.s); free(yyctx->stack.l_mark[0].un.s); } break; -case 79: -#line 278 "../../src_plugins/io_bxl/bxl_gram.y" +case 80: +#line 279 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_poly_add_vertex(ctx, yyctx->stack.l_mark[-2].un.c, yyctx->stack.l_mark[0].un.c); } break; -case 83: -#line 286 "../../src_plugins/io_bxl/bxl_gram.y" +case 84: +#line 287 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_reset(ctx); } break; -case 84: -#line 287 "../../src_plugins/io_bxl/bxl_gram.y" +case 85: +#line 288 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_add_line(ctx); pcb_bxl_reset(ctx); } break; -case 87: -#line 296 "../../src_plugins/io_bxl/bxl_gram.y" +case 88: +#line 297 "../../src_plugins/io_bxl/bxl_gram.y" { ctx->state.endp_x = yyctx->stack.l_mark[-2].un.c; ctx->state.endp_y = yyctx->stack.l_mark[0].un.c; } break; -case 98: -#line 322 "../../src_plugins/io_bxl/bxl_gram.y" +case 99: +#line 323 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_reset(ctx); } break; -case 99: -#line 323 "../../src_plugins/io_bxl/bxl_gram.y" +case 100: +#line 324 "../../src_plugins/io_bxl/bxl_gram.y" { pcb_bxl_add_arc(ctx); pcb_bxl_reset(ctx); } break; -case 102: -#line 332 "../../src_plugins/io_bxl/bxl_gram.y" - { ctx->state.radius = yyctx->stack.l_mark[0].un.c; } -break; case 103: #line 333 "../../src_plugins/io_bxl/bxl_gram.y" - { ctx->state.arc_start = yyctx->stack.l_mark[0].un.d; } + { ctx->state.radius = yyctx->stack.l_mark[0].un.c; } break; case 104: #line 334 "../../src_plugins/io_bxl/bxl_gram.y" + { ctx->state.arc_start = yyctx->stack.l_mark[0].un.d; } +break; +case 105: +#line 335 "../../src_plugins/io_bxl/bxl_gram.y" { ctx->state.arc_delta = yyctx->stack.l_mark[0].un.d; } break; -case 112: -#line 352 "../../src_plugins/io_bxl/bxl_gram.y" +case 113: +#line 353 "../../src_plugins/io_bxl/bxl_gram.y" { ctx->state.flipped = yyctx->stack.l_mark[0].un.i; } break; -#line 697 "../../src_plugins/io_bxl/bxl_gram.c" +#line 718 "../../src_plugins/io_bxl/bxl_gram.c" } yyctx->stack.s_mark -= yyctx->yym; yyctx->state = *yyctx->stack.s_mark; Index: bxl_gram.y =================================================================== --- bxl_gram.y (revision 30607) +++ bxl_gram.y (revision 30608) @@ -142,7 +142,8 @@ /*** TextStyle ***/ text_style: - T_TEXTSTYLE T_QSTR text_style_attrs + T_TEXTSTYLE T_QSTR { pcb_bxl_text_style_begin(ctx, $2); /* $2 is taken over */ } + text_style_attrs { pcb_bxl_text_style_end(ctx); } ; text_style_attrs: @@ -151,9 +152,9 @@ ; text_style_attr: - T_FONTWIDTH T_INTEGER - | T_FONTCHARWIDTH T_INTEGER - | T_FONTHEIGHT T_INTEGER + T_FONTWIDTH coord { ctx->state.text_style->width = $2; } + | T_FONTCHARWIDTH coord { ctx->state.text_style->char_width = $2; } + | T_FONTHEIGHT coord { ctx->state.text_style->height = $2; } ; Index: read.c =================================================================== --- read.c (revision 30607) +++ read.c (revision 30608) @@ -308,7 +308,24 @@ ctx->state.delayed_poly = 0; } +void pcb_bxl_text_style_begin(pcb_bxl_ctx_t *ctx, char *name) +{ + pcb_bxl_test_style_t *ts = htsp_get(&ctx->text_name2style, name); + if (ts == NULL) { + ts = calloc(sizeof(pcb_bxl_test_style_t), 1); + htsp_set(&ctx->text_name2style, name, ts); /* name is not free'd at the caller */ + } + else + pcb_message(PCB_MSG_WARNING, "bxl footprint error: text style '%s' is redefined; second definition will override first\n", name); + ctx->state.text_style = ts; +} +void pcb_bxl_text_style_end(pcb_bxl_ctx_t *ctx) +{ + ctx->state.text_style = NULL; +} + + #define WARN_CNT(_count_, args) \ do { \ long cnt = (bctx->warn._count_); \ @@ -323,6 +340,7 @@ TODO("This reads the first footprint only:"); bctx->in_target_fp = 1; htsp_init(&bctx->layer_name2ly, strhash, strkeyeq); + htsp_init(&bctx->text_name2style, strhash, strkeyeq); } static void pcb_bxl_uninit(pcb_bxl_ctx_t *bctx) @@ -338,6 +356,12 @@ for(e = htsp_first(&bctx->layer_name2ly); e != NULL; e = htsp_next(&bctx->layer_name2ly, e)) free(e->key); htsp_uninit(&bctx->layer_name2ly); + + for(e = htsp_first(&bctx->text_name2style); e != NULL; e = htsp_next(&bctx->text_name2style, e)) { + free(e->key); + free(e->value); + } + htsp_uninit(&bctx->text_name2style); } #undef WARN_CNT