69 return SPECCTRA_LEXER::TokenName( aTok );
98 for(
int i = 0; i < int(
m_layerIds.size() ); ++i )
100 if( 0 == aLayerName.compare(
m_layerIds[i] ) )
112 static const char pin_def[] =
"<pin_reference>::=<component_id>-<pin_id>";
114 if( !IsSymbol( (
T) CurTok() ) )
115 Expecting( pin_def );
119 if( CurTok() != T_STRING )
121 const char* toktext = CurText();
122 const char* dash = strchr( toktext,
'-' );
125 Expecting( pin_def );
127 while( toktext != dash )
128 *component_id += *toktext++;
133 *pin_id += *toktext++;
137 *component_id = CurText();
142 Expecting( pin_def );
161 static const char time_toks[] =
"<month> <day> <hour> : <minute> : <second> <year> or <month> <day> <hour>:<minute>:<second> <year>";
163 static const char* months[] = {
164 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
165 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
nullptr
170 const char* ptok = CurText();
174 for(
int m = 0; months[m]; ++m )
176 if( !strcasecmp( months[m], ptok ) )
185 if( tok != T_NUMBER )
186 Expecting( time_toks );
188 mytime.tm_mday = atoi( CurText() );
192 if( tok == T_NUMBER )
194 mytime.tm_hour = atoi( CurText() );
199 if( *CurText() !=
':' || strlen( CurText() ) != 1 )
200 Expecting( time_toks );
204 if( tok != T_NUMBER )
205 Expecting( time_toks );
207 mytime.tm_min = atoi( CurText() );
212 if( *CurText() !=
':' || strlen( CurText() ) != 1 )
213 Expecting( time_toks );
217 if( tok != T_NUMBER )
218 Expecting( time_toks );
220 mytime.tm_sec = atoi( CurText() );
222 else if( tok == T_SYMBOL )
224 wxString str = wxString( CurText() );
225 wxArrayString arr = wxSplit( str,
':',
'\0' );
227 if( arr.size() != 3 )
228 Expecting( time_toks );
230 mytime.tm_hour = wxAtoi( arr[0] );
231 mytime.tm_min = wxAtoi( arr[1] );
232 mytime.tm_sec = wxAtoi( arr[2] );
237 if( tok != T_NUMBER )
238 Expecting( time_toks );
240 mytime.tm_year = atoi( CurText() ) - 1900;
242 *time_stamp = mktime( &mytime );
250 PushReader( &curr_reader );
252 if( NextTok() != T_LEFT )
255 if( NextTok() != T_pcb )
269 PushReader( &curr_reader );
271 if( NextTok() != T_LEFT )
274 if( NextTok() != T_session )
275 Expecting( T_session );
315 while( (tok = NextTok()) != T_RIGHT )
389 Unexpected( CurText() );
422 while( (tok = NextTok()) != T_RIGHT )
434 if( tok != T_QUOTE_DEF )
435 Expecting( T_QUOTE_DEF );
437 SetStringDelimiter( (
unsigned char) *CurText() );
443 case T_space_in_quoted_tokens:
446 if( tok!=T_on && tok!=T_off )
447 Expecting(
"on|off" );
449 SetSpaceInQuotedTokens( tok==T_on );
461 NeedSYMBOLorNUMBER();
467 NeedSYMBOLorNUMBER();
469 NeedSYMBOLorNUMBER();
476 case T_write_resolution:
477 while( (tok = NextTok()) != T_RIGHT )
480 Expecting( T_SYMBOL );
485 Expecting( T_NUMBER );
492 case T_routes_include:
493 while( (tok = NextTok()) != T_RIGHT )
503 case T_image_conductor:
507 Expecting(
"testpoint|guides|image_conductor" );
513 case T_wires_include:
516 if( tok != T_testpoint )
517 Expecting( T_testpoint );
523 case T_case_sensitive:
526 if( tok!=T_on && tok!=T_off )
527 Expecting(
"on|off" );
533 case T_via_rotate_first:
536 if( tok!=T_on && tok!=T_off )
537 Expecting(
"on|off" );
543 case T_generated_by_freeroute:
549 Unexpected( CurText() );
558 wxString str = wxString( CurText() ).MakeLower();
560 if( str == wxS(
"inch" ) )
561 growth->
units = T_inch;
562 else if( str == wxS(
"mil" ) )
563 growth->
units = T_mil;
564 else if( str == wxS(
"cm" ) )
565 growth->
units = T_cm;
566 else if( str == wxS(
"mm" ) )
567 growth->
units = T_mm;
568 else if( str == wxS(
"um" ) )
569 growth->
units = T_um;
571 Expecting(
"inch|mil|cm|mm|um" );
575 if( tok != T_NUMBER )
576 Expecting( T_NUMBER );
578 growth->
value = atoi( CurText() );
598 Expecting(
"inch|mil|cm|mm|um" );
613 if( NextTok() != T_NUMBER )
614 Expecting( T_NUMBER );
627 while( ( tok = NextTok() ) != T_RIGHT )
632 if( NextTok() != T_layer_pair )
633 Expecting( T_layer_pair );
646 while( ( tok = NextTok() ) != T_RIGHT )
671 case T_layer_noise_weight:
679 case T_place_boundary:
704 growth->
m_planes.push_back( plane );
710 region =
new REGION( growth );
717 stringprop =
new STRINGPROP( growth, T_snap_angle );
718 growth->
Append( stringprop );
740 layer =
new LAYER( growth );
741 growth->
m_layers.push_back( layer );
762 case T_place_keepout:
766 case T_elongate_keepout:
768 keepout =
new KEEPOUT( growth, tok );
781 Unexpected( CurText() );
799 while( tok != T_RIGHT )
810 layer =
new LAYER( growth );
811 growth->
m_layers.push_back( layer );
824 Unexpected( CurText() );
838 growth->
m_name = CurText();
845 while( tok != T_RIGHT )
854 case T_sequence_number:
855 if( NextTok() != T_NUMBER )
856 Expecting( T_NUMBER );
894 case T_polyline_path:
921 window =
new WINDOW( growth );
927 Unexpected( CurText() );
946 while( tok != T_RIGHT )
957 while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
962 Unexpected( CurText() );
974 while( tok != T_RIGHT )
999 case T_polyline_path:
1012 growth->
shape =
new PATH( growth, tok );
1025 Unexpected( CurText() );
1038 Expecting( T_LEFT );
1044 if( growth->
paths.size() )
1045 Unexpected(
"rect when path already encountered" );
1051 else if( tok == T_path )
1054 Unexpected(
"path when rect already encountered" );
1059 Expecting( T_path );
1067 if( tok == T_RIGHT )
1078 Expecting(
"rect|path" );
1087 if( !IsSymbol( tok ) && tok != T_NUMBER )
1088 Expecting(
"layer_id" );
1092 if( NextTok() != T_NUMBER )
1093 Expecting(
"aperture_width" );
1103 if( tok != T_NUMBER )
1104 Expecting( T_NUMBER );
1108 if( NextTok() != T_NUMBER )
1109 Expecting( T_NUMBER );
1113 growth->
points.push_back( ptTemp );
1115 }
while( ( tok = NextTok() ) != T_RIGHT && tok != T_LEFT );
1119 if( NextTok() != T_aperture_type )
1120 Expecting( T_aperture_type );
1124 if( tok!=T_round && tok!=T_square )
1125 Expecting(
"round|square" );
1139 if( NextTok() != T_NUMBER )
1140 Expecting( T_NUMBER );
1144 if( NextTok() != T_NUMBER )
1145 Expecting( T_NUMBER );
1149 if( NextTok() != T_NUMBER )
1150 Expecting( T_NUMBER );
1154 if( NextTok() != T_NUMBER )
1155 Expecting( T_NUMBER );
1167 NeedSYMBOLorNUMBER();
1170 if( NextTok() != T_NUMBER )
1171 Expecting( T_NUMBER );
1177 if( tok == T_NUMBER )
1181 if( NextTok() != T_NUMBER )
1182 Expecting( T_NUMBER );
1189 if( tok != T_RIGHT )
1190 Expecting( T_RIGHT );
1199 if( NextTok() != T_NUMBER )
1200 Expecting( T_NUMBER );
1204 for(
int i = 0; i < 3; ++i )
1206 if( NextTok() != T_NUMBER )
1207 Expecting( T_NUMBER );
1211 if( NextTok() != T_NUMBER )
1212 Expecting( T_NUMBER );
1224 growth->
value = CurText();
1234 Unexpected( CurText() );
1236 growth->
value = tok;
1246 while( ( tok = NextTok() ) != T_RIGHT )
1250 if( NextTok() != T_spare )
1251 Expecting( T_spare );
1253 while( (tok = NextTok()) != T_RIGHT )
1255 if( !IsSymbol( tok ) )
1256 Expecting( T_SYMBOL );
1258 growth->
m_spares.push_back( CurText() );
1261 else if( IsSymbol( tok ) )
1267 Unexpected( CurText() );
1277 while( (tok = NextTok()) != T_RIGHT )
1280 Expecting( T_LEFT );
1289 if( tok!=T_on && tok!=T_off )
1290 Expecting(
"on|off" );
1297 case T_route_to_fanout_only:
1298 case T_force_to_terminal_point:
1299 case T_same_net_checking:
1300 case T_checking_trim_by_pin:
1301 case T_noise_calculation:
1302 case T_noise_accumulation:
1303 case T_include_pins_in_crosstalk:
1305 case T_average_pair_length:
1306 case T_crosstalk_model:
1307 case T_roundoff_rotation:
1309 case T_reroute_order_viols:
1311 tokprop =
new TOKPROP( growth, tok );
1312 growth->
Append( tokprop );
1317 Unexpected( CurText() );
1328 while( ( tok = NextTok() ) != T_RIGHT )
1331 Expecting( T_LEFT );
1333 NeedSYMBOLorNUMBER();
1334 property.name = CurText();
1336 NeedSYMBOLorNUMBER();
1337 property.value = CurText();
1339 growth->push_back( property );
1350 if( !IsSymbol( tok ) )
1351 Expecting( T_SYMBOL );
1353 growth->
name = CurText();
1355 while( ( tok = NextTok() ) != T_RIGHT )
1358 Expecting( T_LEFT );
1367 if( tok != T_signal && tok != T_power && tok != T_mixed && tok != T_jumper )
1368 Expecting(
"signal|power|mixed|jumper" );
1372 if( NextTok()!=T_RIGHT )
1378 growth->
rules =
new RULE( growth, T_rule );
1394 case T_positive_diagonal:
1395 case T_negative_diagonal:
1402 if( !strcmp(
"hori", CurText() ) )
1407 else if( !strcmp(
"vert", CurText() ) )
1413 Expecting(
"horizontal|vertical|orthogonal|positive_diagonal|negative_diagonal|"
1417 if( NextTok() != T_RIGHT )
1418 Expecting( T_RIGHT );
1437 growth->
cost = -atoi( CurText() );
1440 Expecting(
"forbidden|high|medium|low|free|<positive_integer>|-1" );
1447 if( NextTok() != T_type )
1448 Unexpected( CurText() );
1452 if( tok!=T_length && tok!=T_way )
1453 Expecting(
"length|way" );
1457 if( NextTok()!=T_RIGHT )
1458 Expecting( T_RIGHT );
1463 if( tok != T_RIGHT )
1464 Expecting( T_RIGHT );
1469 while( ( tok = NextTok() ) != T_RIGHT )
1471 if( !IsSymbol( tok ) )
1472 Expecting( T_SYMBOL );
1474 growth->
use_net.push_back( CurText() );
1480 Unexpected( CurText() );
1488 std::string builder;
1489 int bracketNesting = 1;
1492 while( bracketNesting != 0 && tok != T_EOF )
1498 else if( tok==T_RIGHT )
1501 if( bracketNesting >= 1 )
1503 if( PrevTok() != T_LEFT && tok != T_RIGHT && ( tok != T_LEFT || bracketNesting > 2 ) )
1506 if( tok == T_STRING )
1509 builder += CurText();
1511 if( tok == T_STRING )
1518 if( bracketNesting == 1 )
1520 growth->
m_rules.push_back( builder );
1526 Unexpected( T_EOF );
1531void SPECCTRA_DB::doPLACE_RULE( PLACE_RULE* growth,
bool expect_object_type )
1544 Expecting( T_LEFT );
1548 if( tok == T_object_type )
1550 if( !expect_object_type )
1565 growth->object_type = tok;
1578 growth->object_type = tok;
1581 Unexpected( CurText() );
1587 Unexpected( CurText() );
1596 if( tok != T_image_type )
1597 Expecting( T_image_type );
1601 if( tok!=T_smd && tok!=T_pin )
1602 Expecting(
"smd|pin" );
1609 if( tok != T_RIGHT )
1610 Expecting( T_RIGHT );
1628 if( IsSymbol( tok ) )
1637 Expecting( T_LEFT );
1661 case T_region_class:
1664 growth->
Append( stringprop );
1668 case T_region_class_class:
1671 growth->
Append( class_class );
1684 Unexpected( CurText() );
1689 if( tok == T_RIGHT )
1692 Expecting( T_rule );
1705 Expecting( T_LEFT );
1707 while( ( tok = NextTok() ) != T_RIGHT )
1721 if( growth->
Type() == T_region_class_class )
1725 rule =
new RULE( growth, T_rule );
1732 if( growth->
Type() == T_region_class_class )
1737 growth->
Append( layer_rule );
1754 if( !IsSymbol( tok ) )
1755 Expecting(
"class_id" );
1757 growth->
class_ids.push_back( CurText() );
1763 if( !IsSymbol( tok ) )
1764 Expecting(
"class_id" );
1766 growth->
class_ids.push_back( CurText() );
1768 }
while( ( tok = NextTok() ) != T_RIGHT );
1785 if( NextTok() != T_NUMBER )
1786 Expecting( T_NUMBER );
1793 while( ( tok = NextTok() ) != T_RIGHT )
1795 if( tok == T_direction )
1802 if( tok != T_x && tok != T_y )
1803 Unexpected( CurText() );
1807 if( NextTok() != T_RIGHT )
1810 else if( tok == T_offset )
1815 if( NextTok() != T_NUMBER )
1816 Expecting( T_NUMBER );
1820 if( NextTok() != T_RIGHT )
1821 Expecting( T_RIGHT );
1823 else if( tok == T_image_type )
1830 if( tok != T_smd && tok != T_pin )
1831 Unexpected( CurText() );
1835 if( NextTok() != T_RIGHT )
1836 Expecting( T_RIGHT );
1859 }
while( IsSymbol( tok = NextTok() ) );
1862 Expecting( T_LEFT );
1864 if( NextTok() != T_rule )
1865 Expecting( T_rule );
1878 if( !IsSymbol( tok ) )
1879 Expecting(
"component_id" );
1885 if( tok == T_NUMBER )
1891 if( NextTok() != T_NUMBER )
1892 Expecting( T_NUMBER );
1900 if( tok != T_front && tok != T_back )
1901 Expecting(
"front|back" );
1905 if( NextTok() != T_NUMBER )
1906 Expecting(
"rotation" );
1911 while( ( tok = NextTok() ) != T_RIGHT )
1914 Expecting( T_LEFT );
1923 if( tok == T_x || tok == T_y || tok == T_xy || tok == T_off )
1926 Expecting(
"x|y|xy|off" );
1933 if( tok==T_added || tok==T_deleted || tok==T_substituted )
1936 Expecting(
"added|deleted|substituted");
1940 case T_logical_part:
1946 if( !IsSymbol( tok ) )
1947 Expecting(
"logical_part_id");
1970 if( tok == T_position || tok == T_gate || tok == T_subgate || tok == T_pin )
1973 Expecting(
"position|gate|subgate|pin" );
1997 NeedSYMBOLorNUMBER();
2013 if( !IsSymbol( tok ) && tok != T_NUMBER )
2014 Expecting(
"image_id" );
2018 while( ( tok = NextTok() ) != T_RIGHT )
2021 Expecting( T_LEFT );
2029 place =
new PLACE( growth );
2030 growth->
m_places.push_back( place );
2045 while( ( tok = NextTok() ) != T_RIGHT )
2048 Unexpected( T_EOF );
2051 Expecting( T_LEFT );
2061 if( tok == T_resolution )
2067 case T_place_control:
2071 if( tok != T_flip_style )
2072 Expecting( T_flip_style );
2076 if( tok == T_mirror_first || tok == T_rotate_first )
2079 Expecting(
"mirror_first|rotate_first" );
2118 if( !IsSymbol( tok ) && tok != T_NUMBER )
2119 Expecting(
"m_padstack_id" );
2123 while( ( tok = NextTok() ) != T_RIGHT )
2126 Expecting( T_LEFT );
2143 if( tok != T_on && tok != T_off )
2144 Expecting(
"on|off" );
2153 if( tok != T_on && tok != T_off )
2154 Expecting(
"on|off" );
2162 shape =
new SHAPE( growth );
2170 if( tok != T_off && tok != T_on )
2171 Expecting(
"off|on" );
2178 if( NextTok() != T_use_via )
2179 Expecting( T_use_via );
2205 Unexpected( CurText() );
2221 while( ( tok = NextTok() ) != T_RIGHT )
2224 Expecting( T_LEFT );
2230 case T_polyline_path:
2248 if( !strcmp(
"circ", CurText() ) )
2273 growth->
shape =
new PATH( growth, tok );
2284 if( tok!=T_on && tok!=T_off )
2285 Expecting(
"on|off" );
2292 window =
new WINDOW( growth );
2298 Unexpected( CurText() );
2325 if( !IsSymbol( tok ) && tok != T_NUMBER )
2326 Expecting(
"image_id" );
2330 while( ( tok = NextTok() ) != T_RIGHT )
2333 Expecting( T_LEFT );
2350 if( tok != T_front && tok != T_back && tok != T_both )
2351 Expecting(
"front|back|both" );
2359 outline =
new SHAPE( growth, T_outline );
2360 growth->
Append( outline );
2388 case T_place_keepout:
2390 case T_wire_keepout:
2391 case T_bend_keepout:
2392 case T_elongate_keepout:
2394 keepout =
new KEEPOUT( growth, tok );
2400 Unexpected( CurText() );
2416 if( !IsSymbol( tok ) && tok!=T_NUMBER )
2417 Expecting(
"m_padstack_id" );
2421 while( ( tok = NextTok() ) != T_RIGHT )
2427 if( tok != T_rotate )
2428 Expecting( T_rotate );
2430 if( NextTok() != T_NUMBER )
2431 Expecting( T_NUMBER );
2438 if( !IsSymbol( tok ) && tok != T_NUMBER )
2439 Expecting(
"pin_id" );
2443 if( NextTok() != T_NUMBER )
2444 Expecting( T_NUMBER );
2448 if( NextTok() != T_NUMBER )
2449 Expecting( T_NUMBER );
2475 while( ( tok = NextTok() ) != T_RIGHT )
2478 Expecting( T_LEFT );
2507 Unexpected( CurText() );
2516 std::vector<PIN_REF>* pin_refs;
2539 if( !IsSymbol( tok ) )
2540 Expecting(
"net_id" );
2544 while( ( tok = NextTok() ) != T_RIGHT )
2547 Expecting( T_LEFT );
2559 if( NextTok() != T_NUMBER )
2560 Expecting( T_NUMBER );
2569 pin_refs = &growth->
m_pins;
2585 pin_refs = &growth->
m_load;
2596 while( ( tok = NextTok() ) != T_RIGHT )
2599 pin_refs->push_back(
empty );
2601 PIN_REF* pin_ref = &pin_refs->back();
2620 if( tok!=T_fix && tok!=T_normal )
2621 Expecting(
"fix|normal" );
2649 fromto =
new FROMTO( growth );
2655 Unexpected( CurText() );
2670 while( ( tok = NextTok() ) != T_RIGHT )
2673 Expecting( T_LEFT );
2681 fromto =
new FROMTO( growth );
2694 Unexpected( CurText() );
2719 while( IsSymbol( tok = NextTok() ) )
2721 growth->
m_net_ids.push_back( CurText() );
2725 while( tok != T_RIGHT )
2728 Expecting( T_LEFT );
2759 std::string builder;
2760 int bracketNesting = 1;
2763 while( bracketNesting != 0 && tok != T_EOF )
2769 else if( tok == T_RIGHT )
2772 if( bracketNesting >= 1 )
2774 T previousTok = (
T) PrevTok();
2776 if( previousTok != T_LEFT && previousTok != T_circuit && tok != T_RIGHT )
2779 if( tok == T_STRING )
2782 builder += CurText();
2784 if( tok == T_STRING )
2790 if( bracketNesting == 0 )
2798 Unexpected( T_EOF );
2804 Unexpected( CurText() );
2829 while( ( tok = NextTok() ) != T_RIGHT )
2832 Expecting( T_LEFT );
2840 net =
new NET( growth );
2841 growth->
m_nets.push_back( net );
2847 myclass =
new CLASS( growth );
2853 Unexpected( CurText() );
2867 while( IsSymbol( tok = NextTok() ) )
2870 if( tok != T_RIGHT )
2871 Expecting( T_RIGHT );
2896 char old = SetStringDelimiter( 0 );
2898 if( !IsSymbol(NextTok() ) )
2900 SetStringDelimiter( old );
2901 Expecting( T_SYMBOL );
2906 if( !IsSymbol(NextTok() ) )
2908 SetStringDelimiter( old );
2909 Expecting( T_SYMBOL );
2914 SetStringDelimiter( old );
2916 while( ( tok = NextTok() ) != T_RIGHT )
2919 Expecting( T_LEFT );
2928 if( tok != T_fix && tok != T_normal && tok != T_soft )
2929 Expecting(
"fix|normal|soft" );
2962 Unexpected( CurText() );
2989 while( ( tok = NextTok() ) != T_RIGHT )
2992 Expecting( T_LEFT );
3014 case T_polyline_path:
3040 NeedSYMBOLorNUMBER();
3046 if( NextTok() != T_NUMBER )
3047 Expecting( T_NUMBER );
3049 growth->
m_turret = atoi( CurText() );
3056 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3057 Expecting(
"fix|route|normal|protect" );
3066 if( tok != T_test && tok != T_fanout && tok != T_bus && tok != T_jumper )
3067 Expecting(
"test|fanout|bus|jumper" );
3081 window =
new WINDOW( growth );
3100 Unexpected( CurText() );
3130 while( ( tok = NextTok() ) == T_NUMBER )
3134 if( NextTok() != T_NUMBER )
3135 Expecting(
"vertex.y" );
3142 while( tok != T_RIGHT )
3145 Expecting( T_LEFT );
3158 if( NextTok() != T_NUMBER )
3159 Expecting(
"<via#>" );
3168 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3169 Expecting(
"fix|route|normal|protect" );
3178 if( tok != T_test && tok != T_fanout && tok != T_jumper && tok != T_virtual_pin )
3179 Expecting(
"test|fanout|jumper|virtual_pin" );
3183 if( tok == T_virtual_pin )
3196 while( IsSymbol( tok ) )
3202 if( tok != T_RIGHT )
3203 Expecting( T_RIGHT );
3213 Unexpected( CurText() );
3234 while( ( tok = NextTok() ) != T_RIGHT )
3237 Expecting( T_LEFT );
3261 wire =
new WIRE( growth );
3262 growth->
wires.push_back( wire );
3269 growth->
wire_vias.push_back( wire_via );
3274 Unexpected( CurText() );
3292 while( ( tok = NextTok() ) != T_RIGHT )
3295 Expecting( T_LEFT );
3301 case T_created_time:
3313 Unexpected( CurText() );
3327 while( ( tok = NextTok() ) != T_RIGHT )
3330 Expecting( T_LEFT );
3339 growth->
ancestors.push_back( ancestor );
3344 while( ( tok = NextTok() ) != T_RIGHT )
3347 Expecting( T_LEFT );
3353 case T_created_time:
3360 growth->
comments.push_back( CurText() );
3365 Unexpected( CurText() );
3372 Unexpected( CurText() );
3398 std::stringstream fullPath;
3399 fullPath << CurText();
3401 while( ( tok = NextTok() ) != T_LEFT )
3402 fullPath <<
" " << CurText();
3409 Expecting( T_LEFT );
3462 Unexpected( CurText() );
3464 }
while( ( tok = NextTok() ) != T_RIGHT );
3479 while( ( tok = NextTok() ) != T_RIGHT )
3482 Expecting( T_LEFT );
3503 Unexpected( CurText() );
3524 while( ( tok = NextTok() ) != T_RIGHT )
3527 Expecting( T_LEFT );
3556 case T_structure_out:
3573 while( ( tok = NextTok() ) != T_RIGHT )
3576 Expecting( T_LEFT );
3582 if( tok != T_net && !( tok == T_SYMBOL && !strcmp( CurText(),
"Net" ) ) )
3583 Unexpected( CurText() );
3586 net_out =
new NET_OUT( growth );
3588 growth->
net_outs.push_back( net_out );
3595 while( ( tok = NextTok() ) != T_RIGHT )
3598 Unexpected( CurText() );
3603 Unexpected( CurText() );
3624 NeedSYMBOLorNUMBER();
3625 growth->
net_id = CurText();
3627 while( ( tok = NextTok() ) != T_RIGHT )
3630 Expecting( T_LEFT );
3644 if( tok!= T_NUMBER )
3645 Expecting( T_NUMBER );
3655 growth->
rules =
new RULE( growth, tok );
3661 wire =
new WIRE( growth );
3662 growth->
wires.push_back( wire );
3669 growth->
wire_vias.push_back( wire_via );
3681 Unexpected( CurText() );
3697 growth->
net_id = CurText();
3699 while( ( tok = NextTok() ) != T_RIGHT )
3709 else if( tok == T_LEFT )
3716 growth->
net_id = CurText();
3720 Unexpected( CurText() );
3734 m_pcb->Format( &formatter, 0 );
3792 return SPECCTRA_DB::TokenName(
type );
3798 return parent->GetUnits();
3806 out->
Print( nestLevel,
"(%s\n",
Name() );
3810 out->
Print( nestLevel,
")\n" );
3816 for(
int i = 0; i <
Length(); ++i )
3825 for(
unsigned i = 0; i <
kids.size(); ++i )
3829 if( repeats == instanceNum )
3849 if( !lhs->
m_hash.size() )
3852 if( !rhs->
m_hash.size() )
3870 if( !lhs->
m_hash.size() )
3873 if( !rhs->
m_hash.size() )
3897 ELEM( T_parser, aParent )
3920 out->
Print( nestLevel,
"(host_cad \"%s\")\n",
host_cad.c_str() );
3925 const std::string& s1 = *i++;
3926 const std::string& s2 = *i++;
3930 out->
Print( nestLevel,
"(constant %s%s%s %s%s%s)\n",
3931 q1, s1.c_str(), q1, q2, s2.c_str(), q2 );
3936 out->
Print( nestLevel,
"(routes_include%s%s%s)\n",
3943 out->
Print( nestLevel,
"(wires_include testpoint)\n" );
3946 out->
Print( nestLevel,
"(via_rotate_first off)\n" );
3961 useMultiLine =
true;
3964 out->
Print( nestLevel+1,
"%s",
"" );
3968 useMultiLine =
false;
3980 const char* space =
" ";
4003 out->
Print( 0,
"\n" );
4010 out->
Print( nestLevel + 1,
"(property \n" );
4013 i->Format( out, nestLevel + 2 );
4015 out->
Print( nestLevel + 1,
")\n" );
4022 m_rules->Format( out, nestLevel+1 );
4025 m_region->Format( out, nestLevel+1 );
4048 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.
std::vector< std::string > class_ids
The <class_descriptor> in the specctra spec.
std::vector< std::string > m_circuit
circuit descriptor list
boost::ptr_vector< LAYER_RULE > m_layer_rules
std::vector< std::string > m_net_ids
Implement a <component_descriptor> in the specctra dsn spec.
boost::ptr_vector< PLACE > m_places
The <component_order_descriptor>.
std::vector< std::string > m_placement_ids
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.
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
boost::ptr_vector< LAYER_RULE > 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::vector< std::string > comments
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.
boost::ptr_vector< KEEPOUT > m_keepouts
boost::ptr_vector< PIN > m_pins
Used for <keepout_descriptor> and <plane_descriptor>.
boost::ptr_vector< WINDOW > m_windows
SPECCTRA_LAYER_PAIRS layer_pairs
std::vector< std::string > m_layer_ids
DSN_T layer_type
one of: T_signal, T_power, T_mixed, T_jumper
std::vector< std::string > use_net
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.
boost::ptr_vector< IMAGE > m_images
void AddPadstack(PADSTACK *aPadstack)
boost::ptr_vector< NET > m_nets
boost::ptr_vector< CLASS > m_classes
A <net_out_descriptor> of the specctra dsn spec.
boost::ptr_vector< WIRE > wires
boost::ptr_vector< WIRE_VIA > wire_vias
boost::ptr_vector< SUPPLY_PIN > supply_pins
A <net_descriptor> in the DSN spec.
std::vector< PIN_REF > m_load
boost::ptr_vector< FROMTO > m_fromtos
std::vector< PIN_REF > m_pins
std::vector< PIN_REF > m_noexpose
std::vector< PIN_REF > m_source
std::vector< PIN_REF > m_expose
std::vector< PIN_REF > m_terminator
boost::ptr_vector< LAYER_RULE > 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.
PADSTACK()
Cannot take ELEM* aParent because PADSTACKSET confuses this with a copy constructor and causes havoc.
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.
std::vector< std::string > constants
This holds pairs of strings, one pair for each constant definition.
bool routes_include_image_conductor
bool routes_include_guides
bool wires_include_testpoint
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.
std::vector< POINT > points
void SetRotation(double aRotation)
std::string m_padstack_id
boost::ptr_vector< COMPONENT > m_components
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
boost::ptr_vector< NET_OUT > net_outs
A <rule_descriptor> in the specctra dsn spec.
std::vector< std::string > m_rules
rules are saved in std::string form.
A <session_file_descriptor> in the specctra dsn spec.
A "(shape ..)" element in the specctra dsn spec.
boost::ptr_vector< WINDOW > m_windows
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)
std::map< int, PCB_LAYER_ID > m_pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
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)
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)
std::vector< std::string > m_layerIds
indexed by PCB layer number
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)
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::map< PCB_LAYER_ID, 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.
boost::ptr_vector< LAYER > m_layers
boost::ptr_vector< REGION > m_regions
boost::ptr_vector< GRID > m_grids
boost::ptr_vector< KEEPOUT > m_keepouts
LAYER_NOISE_WEIGHT * m_layer_noise_weight
BOUNDARY * m_place_boundary
boost::ptr_vector< COPPER_PLANE > m_planes
boost::ptr_vector< LAYER > m_layers
A <supply_pin_descriptor> in the specctra dsn spec.
std::vector< PIN_REF > pin_refs
A container for a single property whose value is another DSN_T token.
boost::ptr_vector< COMP_ORDER > m_comp_orders
boost::ptr_vector< FROMTO > m_fromtos
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.
std::vector< std::string > m_spares
std::vector< std::string > m_padstacks
A <was_is_descriptor> in the specctra dsn spec.
std::vector< PIN_PAIR > pin_pairs
A <wire_via_descriptor> in the specctra dsn spec.
std::string m_padstack_id
std::string m_virtual_pin_name
std::vector< std::string > m_contact_layers
std::vector< POINT > m_vertexes
A <wire_shape_descriptor> in the specctra dsn spec.
boost::ptr_vector< WINDOW > m_windows
A <wiring_descriptor> in the specctra dsn spec.
boost::ptr_vector< WIRE > wires
boost::ptr_vector< WIRE_VIA > wire_vias
A LINE_READER that reads from an open file.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
static bool empty(const wxTextEntryBase *aCtrl)
PCB_LAYER_ID
A quick note on layer IDs:
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.
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.
double parseDouble(LINE_READER &aReader, const char *aLine, const char **aOutput)
Parses an ASCII point string with possible leading whitespace into a double precision floating point ...
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
#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.
wxString result
Test unit parsing edge cases and error handling.