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:
917 window =
new WINDOW( growth );
923 Unexpected( CurText() );
942 while( tok != T_RIGHT )
953 while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
958 Unexpected( CurText() );
970 while( tok != T_RIGHT )
995 case T_polyline_path:
1004 growth->
shape =
new PATH( growth, tok );
1017 Unexpected( CurText() );
1030 Expecting( T_LEFT );
1036 if( growth->
paths.size() )
1037 Unexpected(
"rect when path already encountered" );
1043 else if( tok == T_path )
1046 Unexpected(
"path when rect already encountered" );
1051 Expecting( T_path );
1059 if( tok == T_RIGHT )
1070 Expecting(
"rect|path" );
1079 if( !IsSymbol( tok ) && tok != T_NUMBER )
1080 Expecting(
"layer_id" );
1084 if( NextTok() != T_NUMBER )
1085 Expecting(
"aperture_width" );
1095 if( tok != T_NUMBER )
1096 Expecting( T_NUMBER );
1100 if( NextTok() != T_NUMBER )
1101 Expecting( T_NUMBER );
1105 growth->
points.push_back( ptTemp );
1107 }
while( ( tok = NextTok() ) != T_RIGHT && tok != T_LEFT );
1111 if( NextTok() != T_aperture_type )
1112 Expecting( T_aperture_type );
1116 if( tok!=T_round && tok!=T_square )
1117 Expecting(
"round|square" );
1131 if( NextTok() != T_NUMBER )
1132 Expecting( T_NUMBER );
1136 if( NextTok() != T_NUMBER )
1137 Expecting( T_NUMBER );
1141 if( NextTok() != T_NUMBER )
1142 Expecting( T_NUMBER );
1146 if( NextTok() != T_NUMBER )
1147 Expecting( T_NUMBER );
1159 NeedSYMBOLorNUMBER();
1162 if( NextTok() != T_NUMBER )
1163 Expecting( T_NUMBER );
1169 if( tok == T_NUMBER )
1173 if( NextTok() != T_NUMBER )
1174 Expecting( T_NUMBER );
1181 if( tok != T_RIGHT )
1182 Expecting( T_RIGHT );
1191 if( NextTok() != T_NUMBER )
1192 Expecting( T_NUMBER );
1196 for(
int i = 0; i < 3; ++i )
1198 if( NextTok() != T_NUMBER )
1199 Expecting( T_NUMBER );
1203 if( NextTok() != T_NUMBER )
1204 Expecting( T_NUMBER );
1216 growth->
value = CurText();
1226 Unexpected( CurText() );
1228 growth->
value = tok;
1238 while( ( tok = NextTok() ) != T_RIGHT )
1242 if( NextTok() != T_spare )
1243 Expecting( T_spare );
1245 while( (tok = NextTok()) != T_RIGHT )
1247 if( !IsSymbol( tok ) )
1248 Expecting( T_SYMBOL );
1250 growth->
m_spares.push_back( CurText() );
1253 else if( IsSymbol( tok ) )
1259 Unexpected( CurText() );
1269 while( (tok = NextTok()) != T_RIGHT )
1272 Expecting( T_LEFT );
1281 if( tok!=T_on && tok!=T_off )
1282 Expecting(
"on|off" );
1289 case T_route_to_fanout_only:
1290 case T_force_to_terminal_point:
1291 case T_same_net_checking:
1292 case T_checking_trim_by_pin:
1293 case T_noise_calculation:
1294 case T_noise_accumulation:
1295 case T_include_pins_in_crosstalk:
1297 case T_average_pair_length:
1298 case T_crosstalk_model:
1299 case T_roundoff_rotation:
1301 case T_reroute_order_viols:
1303 tokprop =
new TOKPROP( growth, tok );
1304 growth->
Append( tokprop );
1309 Unexpected( CurText() );
1320 while( ( tok = NextTok() ) != T_RIGHT )
1323 Expecting( T_LEFT );
1325 NeedSYMBOLorNUMBER();
1326 property.name = CurText();
1328 NeedSYMBOLorNUMBER();
1329 property.value = CurText();
1331 growth->push_back( property );
1342 if( !IsSymbol( tok ) )
1343 Expecting( T_SYMBOL );
1345 growth->
name = CurText();
1347 while( ( tok = NextTok() ) != T_RIGHT )
1350 Expecting( T_LEFT );
1359 if( tok != T_signal && tok != T_power && tok != T_mixed && tok != T_jumper )
1360 Expecting(
"signal|power|mixed|jumper" );
1364 if( NextTok()!=T_RIGHT )
1370 growth->
rules =
new RULE( growth, T_rule );
1386 case T_positive_diagonal:
1387 case T_negative_diagonal:
1394 if( !strcmp(
"hori", CurText() ) )
1399 else if( !strcmp(
"vert", CurText() ) )
1405 Expecting(
"horizontal|vertical|orthogonal|positive_diagonal|negative_diagonal|"
1409 if( NextTok() != T_RIGHT )
1410 Expecting( T_RIGHT );
1429 growth->
cost = -atoi( CurText() );
1432 Expecting(
"forbidden|high|medium|low|free|<positive_integer>|-1" );
1439 if( NextTok() != T_type )
1440 Unexpected( CurText() );
1444 if( tok!=T_length && tok!=T_way )
1445 Expecting(
"length|way" );
1449 if( NextTok()!=T_RIGHT )
1450 Expecting( T_RIGHT );
1455 if( tok != T_RIGHT )
1456 Expecting( T_RIGHT );
1461 while( ( tok = NextTok() ) != T_RIGHT )
1463 if( !IsSymbol( tok ) )
1464 Expecting( T_SYMBOL );
1466 growth->
use_net.push_back( CurText() );
1472 Unexpected( CurText() );
1480 std::string builder;
1481 int bracketNesting = 1;
1484 while( bracketNesting != 0 && tok != T_EOF )
1490 else if( tok==T_RIGHT )
1493 if( bracketNesting >= 1 )
1495 if( PrevTok() != T_LEFT && tok != T_RIGHT && ( tok != T_LEFT || bracketNesting > 2 ) )
1498 if( tok == T_STRING )
1501 builder += CurText();
1503 if( tok == T_STRING )
1510 if( bracketNesting == 1 )
1512 growth->
m_rules.push_back( builder );
1518 Unexpected( T_EOF );
1523void SPECCTRA_DB::doPLACE_RULE( PLACE_RULE* growth,
bool expect_object_type )
1536 Expecting( T_LEFT );
1540 if( tok == T_object_type )
1542 if( !expect_object_type )
1557 growth->object_type = tok;
1570 growth->object_type = tok;
1573 Unexpected( CurText() );
1579 Unexpected( CurText() );
1588 if( tok != T_image_type )
1589 Expecting( T_image_type );
1593 if( tok!=T_smd && tok!=T_pin )
1594 Expecting(
"smd|pin" );
1601 if( tok != T_RIGHT )
1602 Expecting( T_RIGHT );
1620 if( IsSymbol( tok ) )
1629 Expecting( T_LEFT );
1652 case T_region_class:
1655 growth->
Append( stringprop );
1659 case T_region_class_class:
1662 growth->
Append( class_class );
1675 Unexpected( CurText() );
1680 if( tok == T_RIGHT )
1683 Expecting( T_rule );
1696 Expecting( T_LEFT );
1698 while( ( tok = NextTok() ) != T_RIGHT )
1712 if( growth->
Type() == T_region_class_class )
1716 rule =
new RULE( growth, T_rule );
1723 if( growth->
Type() == T_region_class_class )
1728 growth->
Append( layer_rule );
1745 if( !IsSymbol( tok ) )
1746 Expecting(
"class_id" );
1748 growth->
class_ids.push_back( CurText() );
1754 if( !IsSymbol( tok ) )
1755 Expecting(
"class_id" );
1757 growth->
class_ids.push_back( CurText() );
1759 }
while( ( tok = NextTok() ) != T_RIGHT );
1776 if( NextTok() != T_NUMBER )
1777 Expecting( T_NUMBER );
1784 while( ( tok = NextTok() ) != T_RIGHT )
1786 if( tok == T_direction )
1793 if( tok != T_x && tok != T_y )
1794 Unexpected( CurText() );
1798 if( NextTok() != T_RIGHT )
1801 else if( tok == T_offset )
1806 if( NextTok() != T_NUMBER )
1807 Expecting( T_NUMBER );
1811 if( NextTok() != T_RIGHT )
1812 Expecting( T_RIGHT );
1814 else if( tok == T_image_type )
1821 if( tok != T_smd && tok != T_pin )
1822 Unexpected( CurText() );
1826 if( NextTok() != T_RIGHT )
1827 Expecting( T_RIGHT );
1850 }
while( IsSymbol( tok = NextTok() ) );
1853 Expecting( T_LEFT );
1855 if( NextTok() != T_rule )
1856 Expecting( T_rule );
1869 if( !IsSymbol( tok ) )
1870 Expecting(
"component_id" );
1876 if( tok == T_NUMBER )
1882 if( NextTok() != T_NUMBER )
1883 Expecting( T_NUMBER );
1891 if( tok != T_front && tok != T_back )
1892 Expecting(
"front|back" );
1896 if( NextTok() != T_NUMBER )
1897 Expecting(
"rotation" );
1902 while( ( tok = NextTok() ) != T_RIGHT )
1905 Expecting( T_LEFT );
1914 if( tok == T_x || tok == T_y || tok == T_xy || tok == T_off )
1917 Expecting(
"x|y|xy|off" );
1924 if( tok==T_added || tok==T_deleted || tok==T_substituted )
1927 Expecting(
"added|deleted|substituted");
1931 case T_logical_part:
1937 if( !IsSymbol( tok ) )
1938 Expecting(
"logical_part_id");
1961 if( tok == T_position || tok == T_gate || tok == T_subgate || tok == T_pin )
1964 Expecting(
"position|gate|subgate|pin" );
1988 NeedSYMBOLorNUMBER();
2004 if( !IsSymbol( tok ) && tok != T_NUMBER )
2005 Expecting(
"image_id" );
2009 while( ( tok = NextTok() ) != T_RIGHT )
2012 Expecting( T_LEFT );
2020 place =
new PLACE( growth );
2021 growth->
m_places.push_back( place );
2036 while( ( tok = NextTok() ) != T_RIGHT )
2039 Unexpected( T_EOF );
2042 Expecting( T_LEFT );
2052 if( tok == T_resolution )
2058 case T_place_control:
2062 if( tok != T_flip_style )
2063 Expecting( T_flip_style );
2067 if( tok == T_mirror_first || tok == T_rotate_first )
2070 Expecting(
"mirror_first|rotate_first" );
2109 if( !IsSymbol( tok ) && tok != T_NUMBER )
2110 Expecting(
"m_padstack_id" );
2114 while( ( tok = NextTok() ) != T_RIGHT )
2117 Expecting( T_LEFT );
2134 if( tok != T_on && tok != T_off )
2135 Expecting(
"on|off" );
2144 if( tok != T_on && tok != T_off )
2145 Expecting(
"on|off" );
2153 shape =
new SHAPE( growth );
2161 if( tok != T_off && tok != T_on )
2162 Expecting(
"off|on" );
2169 if( NextTok() != T_use_via )
2170 Expecting( T_use_via );
2196 Unexpected( CurText() );
2212 while( ( tok = NextTok() ) != T_RIGHT )
2215 Expecting( T_LEFT );
2221 case T_polyline_path:
2238 if( !strcmp(
"circ", CurText() ) )
2259 growth->
shape =
new PATH( growth, tok );
2270 if( tok!=T_on && tok!=T_off )
2271 Expecting(
"on|off" );
2278 window =
new WINDOW( growth );
2284 Unexpected( CurText() );
2311 if( !IsSymbol( tok ) && tok != T_NUMBER )
2312 Expecting(
"image_id" );
2316 while( ( tok = NextTok() ) != T_RIGHT )
2319 Expecting( T_LEFT );
2336 if( tok != T_front && tok != T_back && tok != T_both )
2337 Expecting(
"front|back|both" );
2345 outline =
new SHAPE( growth, T_outline );
2346 growth->
Append( outline );
2374 case T_place_keepout:
2376 case T_wire_keepout:
2377 case T_bend_keepout:
2378 case T_elongate_keepout:
2380 keepout =
new KEEPOUT( growth, tok );
2386 Unexpected( CurText() );
2402 if( !IsSymbol( tok ) && tok!=T_NUMBER )
2403 Expecting(
"m_padstack_id" );
2407 while( ( tok = NextTok() ) != T_RIGHT )
2413 if( tok != T_rotate )
2414 Expecting( T_rotate );
2416 if( NextTok() != T_NUMBER )
2417 Expecting( T_NUMBER );
2424 if( !IsSymbol( tok ) && tok != T_NUMBER )
2425 Expecting(
"pin_id" );
2429 if( NextTok() != T_NUMBER )
2430 Expecting( T_NUMBER );
2434 if( NextTok() != T_NUMBER )
2435 Expecting( T_NUMBER );
2461 while( ( tok = NextTok() ) != T_RIGHT )
2464 Expecting( T_LEFT );
2493 Unexpected( CurText() );
2502 std::vector<PIN_REF>* pin_refs;
2525 if( !IsSymbol( tok ) )
2526 Expecting(
"net_id" );
2530 while( ( tok = NextTok() ) != T_RIGHT )
2533 Expecting( T_LEFT );
2545 if( NextTok() != T_NUMBER )
2546 Expecting( T_NUMBER );
2555 pin_refs = &growth->
m_pins;
2571 pin_refs = &growth->
m_load;
2582 while( ( tok = NextTok() ) != T_RIGHT )
2585 pin_refs->push_back(
empty );
2587 PIN_REF* pin_ref = &pin_refs->back();
2606 if( tok!=T_fix && tok!=T_normal )
2607 Expecting(
"fix|normal" );
2635 fromto =
new FROMTO( growth );
2641 Unexpected( CurText() );
2656 while( ( tok = NextTok() ) != T_RIGHT )
2659 Expecting( T_LEFT );
2667 fromto =
new FROMTO( growth );
2680 Unexpected( CurText() );
2705 while( IsSymbol( tok = NextTok() ) )
2707 growth->
m_net_ids.push_back( CurText() );
2711 while( tok != T_RIGHT )
2714 Expecting( T_LEFT );
2745 std::string builder;
2746 int bracketNesting = 1;
2749 while( bracketNesting != 0 && tok != T_EOF )
2755 else if( tok == T_RIGHT )
2758 if( bracketNesting >= 1 )
2760 T previousTok = (
T) PrevTok();
2762 if( previousTok != T_LEFT && previousTok != T_circuit && tok != T_RIGHT )
2765 if( tok == T_STRING )
2768 builder += CurText();
2770 if( tok == T_STRING )
2776 if( bracketNesting == 0 )
2784 Unexpected( T_EOF );
2790 Unexpected( CurText() );
2815 while( ( tok = NextTok() ) != T_RIGHT )
2818 Expecting( T_LEFT );
2826 net =
new NET( growth );
2827 growth->
m_nets.push_back( net );
2833 myclass =
new CLASS( growth );
2839 Unexpected( CurText() );
2853 while( IsSymbol( tok = NextTok() ) )
2856 if( tok != T_RIGHT )
2857 Expecting( T_RIGHT );
2882 char old = SetStringDelimiter( 0 );
2884 if( !IsSymbol(NextTok() ) )
2886 SetStringDelimiter( old );
2887 Expecting( T_SYMBOL );
2892 if( !IsSymbol(NextTok() ) )
2894 SetStringDelimiter( old );
2895 Expecting( T_SYMBOL );
2900 SetStringDelimiter( old );
2902 while( ( tok = NextTok() ) != T_RIGHT )
2905 Expecting( T_LEFT );
2914 if( tok != T_fix && tok != T_normal && tok != T_soft )
2915 Expecting(
"fix|normal|soft" );
2948 Unexpected( CurText() );
2975 while( ( tok = NextTok() ) != T_RIGHT )
2978 Expecting( T_LEFT );
3000 case T_polyline_path:
3022 NeedSYMBOLorNUMBER();
3028 if( NextTok() != T_NUMBER )
3029 Expecting( T_NUMBER );
3031 growth->
m_turret = atoi( CurText() );
3038 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3039 Expecting(
"fix|route|normal|protect" );
3048 if( tok != T_test && tok != T_fanout && tok != T_bus && tok != T_jumper )
3049 Expecting(
"test|fanout|bus|jumper" );
3063 window =
new WINDOW( growth );
3082 Unexpected( CurText() );
3112 while( ( tok = NextTok() ) == T_NUMBER )
3116 if( NextTok() != T_NUMBER )
3117 Expecting(
"vertex.y" );
3124 while( tok != T_RIGHT )
3127 Expecting( T_LEFT );
3140 if( NextTok() != T_NUMBER )
3141 Expecting(
"<via#>" );
3150 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3151 Expecting(
"fix|route|normal|protect" );
3160 if( tok != T_test && tok != T_fanout && tok != T_jumper && tok != T_virtual_pin )
3161 Expecting(
"test|fanout|jumper|virtual_pin" );
3165 if( tok == T_virtual_pin )
3178 while( IsSymbol( tok ) )
3184 if( tok != T_RIGHT )
3185 Expecting( T_RIGHT );
3195 Unexpected( CurText() );
3216 while( ( tok = NextTok() ) != T_RIGHT )
3219 Expecting( T_LEFT );
3243 wire =
new WIRE( growth );
3244 growth->
wires.push_back( wire );
3251 growth->
wire_vias.push_back( wire_via );
3256 Unexpected( CurText() );
3274 while( ( tok = NextTok() ) != T_RIGHT )
3277 Expecting( T_LEFT );
3283 case T_created_time:
3295 Unexpected( CurText() );
3309 while( ( tok = NextTok() ) != T_RIGHT )
3312 Expecting( T_LEFT );
3321 growth->
ancestors.push_back( ancestor );
3326 while( ( tok = NextTok() ) != T_RIGHT )
3329 Expecting( T_LEFT );
3335 case T_created_time:
3342 growth->
comments.push_back( CurText() );
3347 Unexpected( CurText() );
3354 Unexpected( CurText() );
3380 std::stringstream fullPath;
3381 fullPath << CurText();
3383 while( ( tok = NextTok() ) != T_LEFT )
3384 fullPath <<
" " << CurText();
3391 Expecting( T_LEFT );
3444 Unexpected( CurText() );
3446 }
while( ( tok = NextTok() ) != T_RIGHT );
3461 while( ( tok = NextTok() ) != T_RIGHT )
3464 Expecting( T_LEFT );
3485 Unexpected( CurText() );
3506 while( ( tok = NextTok() ) != T_RIGHT )
3509 Expecting( T_LEFT );
3538 case T_structure_out:
3555 while( ( tok = NextTok() ) != T_RIGHT )
3558 Expecting( T_LEFT );
3564 if( tok != T_net && !( tok == T_SYMBOL && !strcmp( CurText(),
"Net" ) ) )
3565 Unexpected( CurText() );
3568 net_out =
new NET_OUT( growth );
3570 growth->
net_outs.push_back( net_out );
3577 while( ( tok = NextTok() ) != T_RIGHT )
3580 Unexpected( CurText() );
3585 Unexpected( CurText() );
3605 NeedSYMBOLorNUMBER();
3606 growth->
net_id = CurText();
3608 while( ( tok = NextTok() ) != T_RIGHT )
3611 Expecting( T_LEFT );
3620 if( tok!= T_NUMBER )
3621 Expecting( T_NUMBER );
3631 growth->
rules =
new RULE( growth, tok );
3637 wire =
new WIRE( growth );
3638 growth->
wires.push_back( wire );
3645 growth->
wire_vias.push_back( wire_via );
3657 Unexpected( CurText() );
3673 growth->
net_id = CurText();
3675 while( ( tok = NextTok() ) != T_RIGHT )
3685 else if( tok == T_LEFT )
3692 growth->
net_id = CurText();
3696 Unexpected( CurText() );
3710 m_pcb->Format( &formatter, 0 );
3768 return SPECCTRA_DB::TokenName(
type );
3774 return parent->GetUnits();
3782 out->
Print( nestLevel,
"(%s\n",
Name() );
3786 out->
Print( nestLevel,
")\n" );
3792 for(
int i = 0; i <
Length(); ++i )
3801 for(
unsigned i = 0; i <
kids.size(); ++i )
3805 if( repeats == instanceNum )
3825 if( !lhs->
m_hash.size() )
3828 if( !rhs->
m_hash.size() )
3846 if( !lhs->
m_hash.size() )
3849 if( !rhs->
m_hash.size() )
3873 ELEM( T_parser, aParent )
3896 out->
Print( nestLevel,
"(host_cad \"%s\")\n",
host_cad.c_str() );
3901 const std::string& s1 = *i++;
3902 const std::string& s2 = *i++;
3906 out->
Print( nestLevel,
"(constant %s%s%s %s%s%s)\n",
3907 q1, s1.c_str(), q1, q2, s2.c_str(), q2 );
3912 out->
Print( nestLevel,
"(routes_include%s%s%s)\n",
3919 out->
Print( nestLevel,
"(wires_include testpoint)\n" );
3922 out->
Print( nestLevel,
"(via_rotate_first off)\n" );
3937 useMultiLine =
true;
3940 out->
Print( nestLevel+1,
"%s",
"" );
3944 useMultiLine =
false;
3956 const char* space =
" ";
3979 out->
Print( 0,
"\n" );
3986 out->
Print( nestLevel + 1,
"(property \n" );
3989 i->Format( out, nestLevel + 2 );
3991 out->
Print( nestLevel + 1,
")\n" );
3998 m_rules->Format( out, nestLevel+1 );
4001 m_region->Format( out, nestLevel+1 );
4024 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.