72 return SPECCTRA_LEXER::TokenName( aTok );
88 for(
int kiNdx = layerCount - 1, pcbNdx=
FIRST_LAYER; kiNdx >= 0; --kiNdx, ++pcbNdx )
90 int kilayer = (kiNdx>0 && kiNdx==layerCount-1) ?
F_Cu : kiNdx;
93 pcbLayer2kicad[pcbNdx] = kilayer;
94 kicadLayer2pcb[kilayer] = pcbNdx;
105 if( i < layerCount-1 )
127 for(
int i = 0; i < int(
m_layerIds.size() ); ++i )
129 if( 0 == aLayerName.compare(
m_layerIds[i] ) )
141 static const char pin_def[] =
"<pin_reference>::=<component_id>-<pin_id>";
143 if( !IsSymbol( (T) CurTok() ) )
144 Expecting( pin_def );
148 if( CurTok() != T_STRING )
150 const char* toktext = CurText();
151 const char* dash = strchr( toktext,
'-' );
154 Expecting( pin_def );
156 while( toktext != dash )
157 *component_id += *toktext++;
162 *pin_id += *toktext++;
166 *component_id = CurText();
171 Expecting( pin_def );
185 static const char time_toks[] =
"<month> <day> <hour> : <minute> : <second> <year>";
187 static const char* months[] = {
188 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
189 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
nullptr
194 const char* ptok = CurText();
198 for(
int m = 0; months[m]; ++m )
200 if( !strcasecmp( months[m], ptok ) )
209 if( tok != T_NUMBER )
210 Expecting( time_toks );
212 mytime.tm_mday = atoi( CurText() );
216 if( tok != T_NUMBER )
217 Expecting( time_toks );
219 mytime.tm_hour = atoi( CurText() );
224 if( *CurText() !=
':' || strlen( CurText() )!=1 )
225 Expecting( time_toks );
229 if( tok != T_NUMBER )
230 Expecting( time_toks );
232 mytime.tm_min = atoi( CurText() );
237 if( *CurText() !=
':' || strlen( CurText() )!=1 )
238 Expecting( time_toks );
242 if( tok != T_NUMBER )
243 Expecting( time_toks );
245 mytime.tm_sec = atoi( CurText() );
249 if( tok != T_NUMBER )
250 Expecting( time_toks );
252 mytime.tm_year = atoi( CurText() ) - 1900;
255 *time_stamp = mktime( &mytime );
263 PushReader( &curr_reader );
265 if( NextTok() != T_LEFT )
268 if( NextTok() != T_pcb )
282 PushReader( &curr_reader );
284 if( NextTok() != T_LEFT )
287 if( NextTok() != T_session )
288 Expecting( T_session );
328 while( (tok = NextTok()) != T_RIGHT )
402 Unexpected( CurText() );
435 while( (tok = NextTok()) != T_RIGHT )
447 if( tok != T_QUOTE_DEF )
448 Expecting( T_QUOTE_DEF );
450 SetStringDelimiter( (
unsigned char) *CurText() );
456 case T_space_in_quoted_tokens:
459 if( tok!=T_on && tok!=T_off )
460 Expecting(
"on|off" );
462 SetSpaceInQuotedTokens( tok==T_on );
474 NeedSYMBOLorNUMBER();
480 NeedSYMBOLorNUMBER();
482 NeedSYMBOLorNUMBER();
489 case T_write_resolution:
490 while( (tok = NextTok()) != T_RIGHT )
493 Expecting( T_SYMBOL );
498 Expecting( T_NUMBER );
505 case T_routes_include:
506 while( (tok = NextTok()) != T_RIGHT )
516 case T_image_conductor:
520 Expecting(
"testpoint|guides|image_conductor" );
526 case T_wires_include:
529 if( tok != T_testpoint )
530 Expecting( T_testpoint );
536 case T_case_sensitive:
539 if( tok!=T_on && tok!=T_off )
540 Expecting(
"on|off" );
546 case T_via_rotate_first:
549 if( tok!=T_on && tok!=T_off )
550 Expecting(
"on|off" );
556 case T_generated_by_freeroute:
562 Unexpected( CurText() );
582 Expecting(
"inch|mil|cm|mm|um" );
587 if( tok != T_NUMBER )
588 Expecting( T_NUMBER );
590 growth->
value = atoi( CurText() );
610 Expecting(
"inch|mil|cm|mm|um" );
625 if( NextTok() != T_NUMBER )
626 Expecting( T_NUMBER );
639 while( ( tok = NextTok() ) != T_RIGHT )
644 if( NextTok() != T_layer_pair )
645 Expecting( T_layer_pair );
658 while( ( tok = NextTok() ) != T_RIGHT )
683 case T_layer_noise_weight:
691 case T_place_boundary:
716 growth->
m_planes.push_back( plane );
722 region =
new REGION( growth );
729 stringprop =
new STRINGPROP( growth, T_snap_angle );
730 growth->
Append( stringprop );
752 layer =
new LAYER( growth );
753 growth->
m_layers.push_back( layer );
774 case T_place_keepout:
778 case T_elongate_keepout:
780 keepout =
new KEEPOUT( growth, tok );
793 Unexpected( CurText() );
811 while( tok != T_RIGHT )
822 layer =
new LAYER( growth );
823 growth->
m_layers.push_back( layer );
836 Unexpected( CurText() );
850 growth->
m_name = CurText();
857 while( tok != T_RIGHT )
866 case T_sequence_number:
867 if( NextTok() != T_NUMBER )
868 Expecting( T_NUMBER );
906 case T_polyline_path:
929 window =
new WINDOW( growth );
935 Unexpected( CurText() );
954 while( tok != T_RIGHT )
965 while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
970 Unexpected( CurText() );
982 while( tok != T_RIGHT )
1007 case T_polyline_path:
1016 growth->
shape =
new PATH( growth, tok );
1029 Unexpected( CurText() );
1042 Expecting( T_LEFT );
1048 if( growth->
paths.size() )
1049 Unexpected(
"rect when path already encountered" );
1055 else if( tok == T_path )
1058 Unexpected(
"path when rect already encountered" );
1063 Expecting( T_path );
1071 if( tok == T_RIGHT )
1082 Expecting(
"rect|path" );
1091 if( !IsSymbol( tok ) && tok != T_NUMBER )
1092 Expecting(
"layer_id" );
1096 if( NextTok() != T_NUMBER )
1097 Expecting(
"aperture_width" );
1107 if( tok != T_NUMBER )
1108 Expecting( T_NUMBER );
1110 ptTemp.
x = strtod( CurText(),
nullptr );
1112 if( NextTok() != T_NUMBER )
1113 Expecting( T_NUMBER );
1115 ptTemp.
y = strtod( CurText(),
nullptr );
1117 growth->
points.push_back( ptTemp );
1119 }
while( ( tok = NextTok() ) != T_RIGHT && tok != T_LEFT );
1123 if( NextTok() != T_aperture_type )
1124 Expecting( T_aperture_type );
1128 if( tok!=T_round && tok!=T_square )
1129 Expecting(
"round|square" );
1143 if( NextTok() != T_NUMBER )
1144 Expecting( T_NUMBER );
1146 growth->
point0.
x = strtod( CurText(),
nullptr );
1148 if( NextTok() != T_NUMBER )
1149 Expecting( T_NUMBER );
1151 growth->
point0.
y = strtod( CurText(),
nullptr );
1153 if( NextTok() != T_NUMBER )
1154 Expecting( T_NUMBER );
1156 growth->
point1.
x = strtod( CurText(),
nullptr );
1158 if( NextTok() != T_NUMBER )
1159 Expecting( T_NUMBER );
1161 growth->
point1.
y = strtod( CurText(),
nullptr );
1171 NeedSYMBOLorNUMBER();
1174 if( NextTok() != T_NUMBER )
1175 Expecting( T_NUMBER );
1177 growth->
diameter = strtod( CurText(), 0 );
1181 if( tok == T_NUMBER )
1183 growth->
vertex.
x = strtod( CurText(), 0 );
1185 if( NextTok() != T_NUMBER )
1186 Expecting( T_NUMBER );
1188 growth->
vertex.
y = strtod( CurText(), 0 );
1193 if( tok != T_RIGHT )
1194 Expecting( T_RIGHT );
1203 if( NextTok() != T_NUMBER )
1204 Expecting( T_NUMBER );
1208 for(
int i = 0; i < 3; ++i )
1210 if( NextTok() != T_NUMBER )
1211 Expecting( T_NUMBER );
1213 growth->
vertex[i].
x = strtod( CurText(), 0 );
1215 if( NextTok() != T_NUMBER )
1216 Expecting( T_NUMBER );
1218 growth->
vertex[i].
y = strtod( CurText(), 0 );
1228 growth->
value = CurText();
1238 Unexpected( CurText() );
1240 growth->
value = tok;
1250 while( ( tok = NextTok() ) != T_RIGHT )
1254 if( NextTok() != T_spare )
1255 Expecting( T_spare );
1257 while( (tok = NextTok()) != T_RIGHT )
1259 if( !IsSymbol( tok ) )
1260 Expecting( T_SYMBOL );
1262 growth->
m_spares.push_back( CurText() );
1265 else if( IsSymbol( tok ) )
1271 Unexpected( CurText() );
1281 while( (tok = NextTok()) != T_RIGHT )
1284 Expecting( T_LEFT );
1293 if( tok!=T_on && tok!=T_off )
1294 Expecting(
"on|off" );
1301 case T_route_to_fanout_only:
1302 case T_force_to_terminal_point:
1303 case T_same_net_checking:
1304 case T_checking_trim_by_pin:
1305 case T_noise_calculation:
1306 case T_noise_accumulation:
1307 case T_include_pins_in_crosstalk:
1309 case T_average_pair_length:
1310 case T_crosstalk_model:
1311 case T_roundoff_rotation:
1313 case T_reroute_order_viols:
1315 tokprop =
new TOKPROP( growth, tok );
1316 growth->
Append( tokprop );
1321 Unexpected( CurText() );
1332 while( ( tok = NextTok() ) != T_RIGHT )
1335 Expecting( T_LEFT );
1337 NeedSYMBOLorNUMBER();
1338 property.name = CurText();
1340 NeedSYMBOLorNUMBER();
1341 property.value = CurText();
1343 growth->push_back( property );
1354 if( !IsSymbol( tok ) )
1355 Expecting( T_SYMBOL );
1357 growth->
name = CurText();
1359 while( ( tok = NextTok() ) != T_RIGHT )
1362 Expecting( T_LEFT );
1371 if( tok != T_signal && tok != T_power && tok != T_mixed && tok != T_jumper )
1372 Expecting(
"signal|power|mixed|jumper" );
1376 if( NextTok()!=T_RIGHT )
1382 growth->
rules =
new RULE( growth, T_rule );
1398 case T_positive_diagonal:
1399 case T_negative_diagonal:
1406 if( !strcmp(
"hori", CurText() ) )
1411 else if( !strcmp(
"vert", CurText() ) )
1417 Expecting(
"horizontal|vertical|orthogonal|positive_diagonal|negative_diagonal|"
1421 if( NextTok() != T_RIGHT )
1422 Expecting( T_RIGHT );
1441 growth->
cost = -atoi( CurText() );
1444 Expecting(
"forbidden|high|medium|low|free|<positive_integer>|-1" );
1451 if( NextTok() != T_type )
1452 Unexpected( CurText() );
1456 if( tok!=T_length && tok!=T_way )
1457 Expecting(
"length|way" );
1461 if( NextTok()!=T_RIGHT )
1462 Expecting( T_RIGHT );
1467 if( tok != T_RIGHT )
1468 Expecting( T_RIGHT );
1473 while( ( tok = NextTok() ) != T_RIGHT )
1475 if( !IsSymbol( tok ) )
1476 Expecting( T_SYMBOL );
1478 growth->
use_net.push_back( CurText() );
1484 Unexpected( CurText() );
1492 std::string builder;
1493 int bracketNesting = 1;
1496 while( bracketNesting != 0 && tok != T_EOF )
1502 else if( tok==T_RIGHT )
1505 if( bracketNesting >= 1 )
1507 if( PrevTok() != T_LEFT && tok != T_RIGHT && ( tok != T_LEFT || bracketNesting > 2 ) )
1510 if( tok == T_STRING )
1513 builder += CurText();
1515 if( tok == T_STRING )
1522 if( bracketNesting == 1 )
1524 growth->
m_rules.push_back( builder );
1530 Unexpected( T_EOF );
1535void SPECCTRA_DB::doPLACE_RULE( PLACE_RULE* growth,
bool expect_object_type )
1548 Expecting( T_LEFT );
1552 if( tok == T_object_type )
1554 if( !expect_object_type )
1569 growth->object_type = tok;
1582 growth->object_type = tok;
1585 Unexpected( CurText() );
1591 Unexpected( CurText() );
1600 if( tok != T_image_type )
1601 Expecting( T_image_type );
1605 if( tok!=T_smd && tok!=T_pin )
1606 Expecting(
"smd|pin" );
1613 if( tok != T_RIGHT )
1614 Expecting( T_RIGHT );
1632 if( IsSymbol( tok ) )
1641 Expecting( T_LEFT );
1664 case T_region_class:
1667 growth->
Append( stringprop );
1671 case T_region_class_class:
1674 growth->
Append( class_class );
1687 Unexpected( CurText() );
1692 if( tok == T_RIGHT )
1695 Expecting( T_rule );
1708 Expecting( T_LEFT );
1710 while( ( tok = NextTok() ) != T_RIGHT )
1724 if( growth->
Type() == T_region_class_class )
1728 rule =
new RULE( growth, T_rule );
1735 if( growth->
Type() == T_region_class_class )
1740 growth->
Append( layer_rule );
1757 if( !IsSymbol( tok ) )
1758 Expecting(
"class_id" );
1760 growth->
class_ids.push_back( CurText() );
1766 if( !IsSymbol( tok ) )
1767 Expecting(
"class_id" );
1769 growth->
class_ids.push_back( CurText() );
1771 }
while( ( tok = NextTok() ) != T_RIGHT );
1788 if( NextTok() != T_NUMBER )
1789 Expecting( T_NUMBER );
1796 while( ( tok = NextTok() ) != T_RIGHT )
1798 if( tok == T_direction )
1805 if( tok != T_x && tok != T_y )
1806 Unexpected( CurText() );
1810 if( NextTok() != T_RIGHT )
1813 else if( tok == T_offset )
1818 if( NextTok() != T_NUMBER )
1819 Expecting( T_NUMBER );
1821 growth->
m_offset = strtod( CurText(), 0 );
1823 if( NextTok() != T_RIGHT )
1824 Expecting( T_RIGHT );
1826 else if( tok == T_image_type )
1833 if( tok != T_smd && tok != T_pin )
1834 Unexpected( CurText() );
1838 if( NextTok() != T_RIGHT )
1839 Expecting( T_RIGHT );
1862 }
while( IsSymbol( tok = NextTok() ) );
1865 Expecting( T_LEFT );
1867 if( NextTok() != T_rule )
1868 Expecting( T_rule );
1881 if( !IsSymbol( tok ) )
1882 Expecting(
"component_id" );
1888 if( tok == T_NUMBER )
1892 point.
x = strtod( CurText(), 0 );
1894 if( NextTok() != T_NUMBER )
1895 Expecting( T_NUMBER );
1897 point.
y = strtod( CurText(), 0 );
1903 if( tok != T_front && tok != T_back )
1904 Expecting(
"front|back" );
1908 if( NextTok() != T_NUMBER )
1909 Expecting(
"rotation" );
1914 while( ( tok = NextTok() ) != T_RIGHT )
1917 Expecting( T_LEFT );
1926 if( tok == T_x || tok == T_y || tok == T_xy || tok == T_off )
1929 Expecting(
"x|y|xy|off" );
1936 if( tok==T_added || tok==T_deleted || tok==T_substituted )
1939 Expecting(
"added|deleted|substituted");
1943 case T_logical_part:
1949 if( !IsSymbol( tok ) )
1950 Expecting(
"logical_part_id");
1973 if( tok == T_position || tok == T_gate || tok == T_subgate || tok == T_pin )
1976 Expecting(
"position|gate|subgate|pin" );
2000 NeedSYMBOLorNUMBER();
2016 if( !IsSymbol( tok ) && tok != T_NUMBER )
2017 Expecting(
"image_id" );
2021 while( ( tok = NextTok() ) != T_RIGHT )
2024 Expecting( T_LEFT );
2032 place =
new PLACE( growth );
2033 growth->
m_places.push_back( place );
2048 while( ( tok = NextTok() ) != T_RIGHT )
2051 Unexpected( T_EOF );
2054 Expecting( T_LEFT );
2064 if( tok == T_resolution )
2070 case T_place_control:
2074 if( tok != T_flip_style )
2075 Expecting( T_flip_style );
2079 if( tok == T_mirror_first || tok == T_rotate_first )
2082 Expecting(
"mirror_first|rotate_first" );
2121 if( !IsSymbol( tok ) && tok != T_NUMBER )
2122 Expecting(
"m_padstack_id" );
2126 while( ( tok = NextTok() ) != T_RIGHT )
2129 Expecting( T_LEFT );
2146 if( tok != T_on && tok != T_off )
2147 Expecting(
"on|off" );
2156 if( tok != T_on && tok != T_off )
2157 Expecting(
"on|off" );
2165 shape =
new SHAPE( growth );
2173 if( tok != T_off && tok != T_on )
2174 Expecting(
"off|on" );
2181 if( NextTok() != T_use_via )
2182 Expecting( T_use_via );
2208 Unexpected( CurText() );
2224 while( ( tok = NextTok() ) != T_RIGHT )
2227 Expecting( T_LEFT );
2233 case T_polyline_path:
2250 if( !strcmp(
"circ", CurText() ) )
2271 growth->
shape =
new PATH( growth, tok );
2282 if( tok!=T_on && tok!=T_off )
2283 Expecting(
"on|off" );
2290 window =
new WINDOW( growth );
2296 Unexpected( CurText() );
2323 if( !IsSymbol( tok ) && tok != T_NUMBER )
2324 Expecting(
"image_id" );
2328 while( ( tok = NextTok() ) != T_RIGHT )
2331 Expecting( T_LEFT );
2348 if( tok != T_front && tok != T_back && tok != T_both )
2349 Expecting(
"front|back|both" );
2357 outline =
new SHAPE( growth, T_outline );
2358 growth->
Append( outline );
2386 case T_place_keepout:
2388 case T_wire_keepout:
2389 case T_bend_keepout:
2390 case T_elongate_keepout:
2392 keepout =
new KEEPOUT( growth, tok );
2398 Unexpected( CurText() );
2414 if( !IsSymbol( tok ) && tok!=T_NUMBER )
2415 Expecting(
"m_padstack_id" );
2419 while( ( tok = NextTok() ) != T_RIGHT )
2425 if( tok != T_rotate )
2426 Expecting( T_rotate );
2428 if( NextTok() != T_NUMBER )
2429 Expecting( T_NUMBER );
2436 if( !IsSymbol( tok ) && tok != T_NUMBER )
2437 Expecting(
"pin_id" );
2441 if( NextTok() != T_NUMBER )
2442 Expecting( T_NUMBER );
2444 growth->
m_vertex.
x = strtod( CurText(), 0 );
2446 if( NextTok() != T_NUMBER )
2447 Expecting( T_NUMBER );
2449 growth->
m_vertex.
y = strtod( CurText(), 0 );
2473 while( ( tok = NextTok() ) != T_RIGHT )
2476 Expecting( T_LEFT );
2505 Unexpected( CurText() );
2537 if( !IsSymbol( tok ) )
2538 Expecting(
"net_id" );
2542 while( ( tok = NextTok() ) != T_RIGHT )
2545 Expecting( T_LEFT );
2557 if( NextTok() != T_NUMBER )
2558 Expecting( T_NUMBER );
2567 pin_refs = &growth->
m_pins;
2583 pin_refs = &growth->
m_load;
2594 while( ( tok = NextTok() ) != T_RIGHT )
2597 pin_refs->push_back(
empty );
2599 PIN_REF* pin_ref = &pin_refs->back();
2618 if( tok!=T_fix && tok!=T_normal )
2619 Expecting(
"fix|normal" );
2647 fromto =
new FROMTO( growth );
2653 Unexpected( CurText() );
2668 while( ( tok = NextTok() ) != T_RIGHT )
2671 Expecting( T_LEFT );
2679 fromto =
new FROMTO( growth );
2692 Unexpected( CurText() );
2717 while( IsSymbol( tok = NextTok() ) )
2719 growth->
m_net_ids.push_back( CurText() );
2723 while( tok != T_RIGHT )
2726 Expecting( T_LEFT );
2757 std::string builder;
2758 int bracketNesting = 1;
2761 while( bracketNesting != 0 && tok != T_EOF )
2767 else if( tok == T_RIGHT )
2770 if( bracketNesting >= 1 )
2772 T previousTok = (T) PrevTok();
2774 if( previousTok != T_LEFT && previousTok != T_circuit && tok != T_RIGHT )
2777 if( tok == T_STRING )
2780 builder += CurText();
2782 if( tok == T_STRING )
2788 if( bracketNesting == 0 )
2796 Unexpected( T_EOF );
2802 Unexpected( CurText() );
2827 while( ( tok = NextTok() ) != T_RIGHT )
2830 Expecting( T_LEFT );
2838 net =
new NET( growth );
2839 growth->
m_nets.push_back( net );
2845 myclass =
new CLASS( growth );
2851 Unexpected( CurText() );
2865 while( IsSymbol( tok = NextTok() ) )
2868 if( tok != T_RIGHT )
2869 Expecting( T_RIGHT );
2894 char old = SetStringDelimiter( 0 );
2896 if( !IsSymbol(NextTok() ) )
2898 SetStringDelimiter( old );
2899 Expecting( T_SYMBOL );
2904 if( !IsSymbol(NextTok() ) )
2906 SetStringDelimiter( old );
2907 Expecting( T_SYMBOL );
2912 SetStringDelimiter( old );
2914 while( ( tok = NextTok() ) != T_RIGHT )
2917 Expecting( T_LEFT );
2926 if( tok != T_fix && tok != T_normal && tok != T_soft )
2927 Expecting(
"fix|normal|soft" );
2960 Unexpected( CurText() );
2987 while( ( tok = NextTok() ) != T_RIGHT )
2990 Expecting( T_LEFT );
3012 case T_polyline_path:
3034 NeedSYMBOLorNUMBER();
3040 if( NextTok() != T_NUMBER )
3041 Expecting( T_NUMBER );
3043 growth->
m_turret = atoi( CurText() );
3050 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3051 Expecting(
"fix|route|normal|protect" );
3060 if( tok != T_test && tok != T_fanout && tok != T_bus && tok != T_jumper )
3061 Expecting(
"test|fanout|bus|jumper" );
3075 window =
new WINDOW( growth );
3094 Unexpected( CurText() );
3124 while( ( tok = NextTok() ) == T_NUMBER )
3126 point.
x = strtod( CurText(), 0 );
3128 if( NextTok() != T_NUMBER )
3129 Expecting(
"vertex.y" );
3131 point.
y = strtod( CurText(), 0 );
3136 while( tok != T_RIGHT )
3139 Expecting( T_LEFT );
3152 if( NextTok() != T_NUMBER )
3153 Expecting(
"<via#>" );
3162 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3163 Expecting(
"fix|route|normal|protect" );
3172 if( tok != T_test && tok != T_fanout && tok != T_jumper && tok != T_virtual_pin )
3173 Expecting(
"test|fanout|jumper|virtual_pin" );
3177 if( tok == T_virtual_pin )
3190 while( IsSymbol( tok ) )
3196 if( tok != T_RIGHT )
3197 Expecting( T_RIGHT );
3207 Unexpected( CurText() );
3228 while( ( tok = NextTok() ) != T_RIGHT )
3231 Expecting( T_LEFT );
3255 wire =
new WIRE( growth );
3256 growth->
wires.push_back( wire );
3263 growth->
wire_vias.push_back( wire_via );
3268 Unexpected( CurText() );
3286 while( ( tok = NextTok() ) != T_RIGHT )
3289 Expecting( T_LEFT );
3295 case T_created_time:
3307 Unexpected( CurText() );
3321 while( ( tok = NextTok() ) != T_RIGHT )
3324 Expecting( T_LEFT );
3333 growth->
ancestors.push_back( ancestor );
3338 while( ( tok = NextTok() ) != T_RIGHT )
3341 Expecting( T_LEFT );
3347 case T_created_time:
3354 growth->
comments.push_back( CurText() );
3359 Unexpected( CurText() );
3366 Unexpected( CurText() );
3393 while( ( tok = NextTok() ) != T_RIGHT )
3396 Expecting( T_LEFT );
3449 Unexpected( CurText() );
3466 while( ( tok = NextTok() ) != T_RIGHT )
3469 Expecting( T_LEFT );
3490 Unexpected( CurText() );
3511 while( ( tok = NextTok() ) != T_RIGHT )
3514 Expecting( T_LEFT );
3543 case T_structure_out:
3560 while( ( tok = NextTok() ) != T_RIGHT )
3563 Expecting( T_LEFT );
3568 Unexpected( CurText() );
3571 net_out =
new NET_OUT( growth );
3573 growth->
net_outs.push_back( net_out );
3580 Unexpected( CurText() );
3600 NeedSYMBOLorNUMBER();
3601 growth->
net_id = CurText();
3603 while( ( tok = NextTok() ) != T_RIGHT )
3606 Expecting( T_LEFT );
3615 if( tok!= T_NUMBER )
3616 Expecting( T_NUMBER );
3626 growth->
rules =
new RULE( growth, tok );
3632 wire =
new WIRE( growth );
3633 growth->
wires.push_back( wire );
3640 growth->
wire_vias.push_back( wire_via );
3652 Unexpected( CurText() );
3668 growth->
net_id = CurText();
3670 while( ( tok = NextTok() ) != T_RIGHT )
3680 else if( tok == T_LEFT )
3687 growth->
net_id = CurText();
3691 Unexpected( CurText() );
3761 return SPECCTRA_DB::TokenName(
type );
3775 out->
Print( nestLevel,
"(%s\n",
Name() );
3779 out->
Print( nestLevel,
")\n" );
3785 for(
int i = 0; i <
Length(); ++i )
3794 for(
unsigned i = 0; i <
kids.size(); ++i )
3798 if( repeats == instanceNum )
3818 if( !lhs->
m_hash.size() )
3821 if( !rhs->
m_hash.size() )
3839 if( !lhs->
m_hash.size() )
3842 if( !rhs->
m_hash.size() )
3866 ELEM( T_parser, aParent )
3889 out->
Print( nestLevel,
"(host_cad \"%s\")\n",
host_cad.c_str() );
3894 const std::string& s1 = *i++;
3895 const std::string& s2 = *i++;
3899 out->
Print( nestLevel,
"(constant %s%s%s %s%s%s)\n",
3900 q1, s1.c_str(), q1, q2, s2.c_str(), q2 );
3905 out->
Print( nestLevel,
"(routes_include%s%s%s)\n",
3912 out->
Print( nestLevel,
"(wires_include testpoint)\n" );
3915 out->
Print( nestLevel,
"(via_rotate_first off)\n" );
3930 useMultiLine =
true;
3933 out->
Print( nestLevel+1,
"%s",
"" );
3937 useMultiLine =
false;
3949 const char* space =
" ";
3972 out->
Print( 0,
"\n" );
3979 out->
Print( nestLevel + 1,
"(property \n" );
3982 i->Format( out, nestLevel + 2 );
3984 out->
Print( nestLevel + 1,
")\n" );
4017 out->
Print( 0,
")\n" );
wxString GetBuildVersion()
Get the full KiCad version string.
Information pertinent to a Pcbnew printed circuit board.
int GetCopperLayerCount() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
The <class_descriptor> in the specctra spec.
STRINGS m_circuit
circuit descriptor list
LAYER_RULES m_layer_rules
Implement a <component_descriptor> in the specctra dsn spec.
The <component_order_descriptor>.
A <plane_descriptor> in the specctra dsn spec.
int FindElem(DSN_T aType, int instanceNum=0)
Find a particular instance number of a given type of ELEM.
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Write the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
ELEM_ARRAY kids
ELEM pointers.
ELEM * At(int aIndex) const
int Length() const
Return the number of ELEMs in this holder.
A base class for any DSN element class.
std::string makeHash()
Return a string which uniquely represents this ELEM among other ELEMs of the same derived class as "t...
const char * Name() const
virtual void Format(OUTPUTFORMATTER *out, int nestLevel)
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
ELEM(DSN_T aType, ELEM *aParent=nullptr)
virtual UNIT_RES * GetUnits() const
Return the units for this section.
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel)
Write the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
static STRING_FORMATTER sf
LAYER_RULES m_layer_rules
DSN_T m_grid_type
T_via | T_wire | T_via_keepout | T_place | T_snap.
DSN_T m_direction
T_x | T_y | -1 for both.
std::string m_hash
a hash string used by Compare(), not Format()ed/exported.
static int Compare(IMAGE *lhs, IMAGE *rhs)
Compare two objects of this type and returns <0, 0, or >0.
Used for <keepout_descriptor> and <plane_descriptor>.
SPECCTRA_LAYER_PAIRS layer_pairs
DSN_T layer_type
one of: T_signal, T_power, T_mixed, T_jumper
int cost_type
T_length | T_way.
int direction
[forbidden | high | medium | low | free | <positive_integer> | -1]
A <library_descriptor> in the specctra dsn specification.
void AddPadstack(PADSTACK *aPadstack)
A <net_out_descriptor> of the specctra dsn spec.
A <net_descriptor> in the DSN spec.
LAYER_RULES m_layer_rules
COMP_ORDER * m_comp_order
DSN_T m_pins_type
T_pins | T_order, type of field 'pins' below.
Hold either a via or a pad definition.
std::string m_hash
a hash string used by Compare(), not Format()ed/exported.
std::string m_padstack_id
static int Compare(PADSTACK *lhs, PADSTACK *rhs)
Compare two objects of this type and returns <0, 0, or >0.
A configuration record per the SPECCTRA DSN file spec.
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Write the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
bool routes_include_image_conductor
bool routes_include_guides
bool wires_include_testpoint
STRINGS constants
This holds pairs of strings, one pair for each constant definition.
bool routes_include_testpoint
bool generated_by_freeroute
bool space_in_quoted_tokens
Support both the <path_descriptor> and the <polygon_descriptor> per the specctra dsn spec.
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
void SetRotation(double aRotation)
std::string m_padstack_id
Implement a <placement_reference> in the specctra dsn spec.
void SetVertex(const POINT &aVertex)
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
void SetRotation(double aRotation)
std::string m_logical_part
std::string m_part_number
std::string m_component_id
reference designator
POINT point0
one of two opposite corners
STRUCTURE_OUT * structure_out
A <rule_descriptor> in the specctra dsn spec.
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
STRINGS m_rules
rules are saved in std::string form.
A <session_file_descriptor> in the specctra dsn spec.
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
A "(shape ..)" element in the specctra dsn spec.
void doUNIT(UNIT_RES *growth)
void doCOMPONENT(COMPONENT *growth)
void doWAS_IS(WAS_IS *growth)
void doPLACEMENT(PLACEMENT *growth)
void doNET_OUT(NET_OUT *growth)
void buildLayerMaps(BOARD *aBoard)
Create a few data translation structures for layer name and number mapping between the DSN::PCB struc...
void doCLASS(CLASS *growth)
void SetSESSION(SESSION *aSession)
Delete any existing SESSION and replaces it with the given one.
void doSTRUCTURE_OUT(STRUCTURE_OUT *growth)
void doCIRCLE(CIRCLE *growth)
void doANCESTOR(ANCESTOR *growth)
void doLAYER_NOISE_WEIGHT(LAYER_NOISE_WEIGHT *growth)
void ExportPCB(const wxString &aFilename, bool aNameChange=false)
Write the internal PCB instance out as a SPECTRA DSN format file.
void doCLASS_CLASS(CLASS_CLASS *growth)
void doSESSION(SESSION *growth)
void doWINDOW(WINDOW *growth)
void doSHAPE(SHAPE *growth)
void doQARC(QARC *growth)
void doRESOLUTION(UNIT_RES *growth)
void LoadPCB(const wxString &aFilename)
A recursive descent parser for a SPECCTRA DSN "design" file.
void doSTRINGPROP(STRINGPROP *growth)
STRINGS m_layerIds
indexed by PCB layer number
void doBOUNDARY(BOUNDARY *growth)
void doSPECCTRA_LAYER_PAIR(SPECCTRA_LAYER_PAIR *growth)
void doRECTANGLE(RECTANGLE *growth)
void doREGION(REGION *growth)
void ExportSESSION(const wxString &aFilename)
Write the internal #SESSION instance out as a #SPECTRA DSN format file.
void doWIRE(WIRE *growth)
void SetPCB(PCB *aPcb)
Delete any existing PCB and replaces it with the given one.
void doTOKPROP(TOKPROP *growth)
void doIMAGE(IMAGE *growth)
void doCONNECT(CONNECT *growth)
void doCOMP_ORDER(COMP_ORDER *growth)
static PCB * MakePCB()
Make a PCB with all the default ELEMs and parts on the heap.
void doTOPOLOGY(TOPOLOGY *growth)
void doKEEPOUT(KEEPOUT *growth)
void doRULE(RULE *growth)
void doPATH(PATH *growth)
std::vector< PCB_LAYER_ID > m_pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
void doSUPPLY_PIN(SUPPLY_PIN *growth)
void doLAYER(LAYER *growth)
void LoadSESSION(const wxString &aFilename)
A recursive descent parser for a SPECCTRA DSN "session" file.
void doLIBRARY(LIBRARY *growth)
std::vector< int > m_kicadLayer2pcb
maps BOARD layer number to PCB layer numbers
void doFROMTO(FROMTO *growth)
void doPLACE(PLACE *growth)
void doGRID(GRID *growth)
void doLAYER_RULE(LAYER_RULE *growth)
void doWIRE_VIA(WIRE_VIA *growth)
void doCLASSES(CLASSES *growth)
void readCOMPnPIN(std::string *component_id, std::string *pid_id)
Read a <pin_reference> and splits it into the two parts which are on either side of the hyphen.
void doPARSER(PARSER *growth)
void doNETWORK(NETWORK *growth)
void doSTRUCTURE(STRUCTURE *growth)
int findLayerName(const std::string &aLayerName) const
Return the PCB layer index for a given layer name, within the specctra sessionfile.
void doROUTE(ROUTE *growth)
void readTIME(time_t *time_stamp)
Read a <time_stamp> which consists of 8 lexer tokens: "month date hour : minute : second year".
void doPADSTACK(PADSTACK *growth)
void doWIRING(WIRING *growth)
void doHISTORY(HISTORY *growth)
void doCONTROL(CONTROL *growth)
void doPROPERTIES(PROPERTIES *growth)
A container for a single property whose value is a string.
LAYER_NOISE_WEIGHT * m_layer_noise_weight
BOUNDARY * m_place_boundary
A <supply_pin_descriptor> in the specctra dsn spec.
A container for a single property whose value is another DSN_T token.
COMP_ORDERS m_comp_orders
A holder for either a T_unit or T_resolution object which are usually mutually exclusive in the dsn g...
static UNIT_RES Default
A static instance which holds the default units of T_inch and 2540000.
A <via_descriptor> in the specctra dsn spec.
A <was_is_descriptor> in the specctra dsn spec.
A <wire_via_descriptor> in the specctra dsn spec.
std::string m_padstack_id
std::string m_virtual_pin_name
A <wire_shape_descriptor> in the specctra dsn spec.
A <wiring_descriptor> in the specctra dsn spec.
A LINE_READER that reads from an open file.
static bool empty(const wxTextEntryBase *aCtrl)
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
This source file implements export and import capabilities to the specctra dsn file format.
std::vector< PIN_REF > PIN_REFS
const char * GetTokenText(T aTok)
The DSN namespace and returns the C string representing a SPECCTRA_DB::keyword.
std::vector< PROPERTY > PROPERTIES
@ NET
This item represents a net.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Used within the WAS_IS class below to hold a pair of PIN_REFs and corresponds to the (pins was is) co...
A <pin_reference> definition in the specctra dsn spec.
A point in the SPECCTRA DSN coordinate system.