72 return SPECCTRA_LEXER::TokenName( aTok );
101 for(
int i = 0; i < int(
m_layerIds.size() ); ++i )
103 if( 0 == aLayerName.compare(
m_layerIds[i] ) )
115 static const char pin_def[] =
"<pin_reference>::=<component_id>-<pin_id>";
117 if( !IsSymbol( (T) CurTok() ) )
118 Expecting( pin_def );
122 if( CurTok() != T_STRING )
124 const char* toktext = CurText();
125 const char* dash = strchr( toktext,
'-' );
128 Expecting( pin_def );
130 while( toktext != dash )
131 *component_id += *toktext++;
136 *pin_id += *toktext++;
140 *component_id = CurText();
145 Expecting( pin_def );
164 static const char time_toks[] =
"<month> <day> <hour> : <minute> : <second> <year> or <month> <day> <hour>:<minute>:<second> <year>";
166 static const char* months[] = {
167 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
168 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
nullptr
173 const char* ptok = CurText();
177 for(
int m = 0; months[m]; ++m )
179 if( !strcasecmp( months[m], ptok ) )
188 if( tok != T_NUMBER )
189 Expecting( time_toks );
191 mytime.tm_mday = atoi( CurText() );
195 if( tok == T_NUMBER )
197 mytime.tm_hour = atoi( CurText() );
202 if( *CurText() !=
':' || strlen( CurText() ) != 1 )
203 Expecting( time_toks );
207 if( tok != T_NUMBER )
208 Expecting( time_toks );
210 mytime.tm_min = atoi( CurText() );
215 if( *CurText() !=
':' || strlen( CurText() ) != 1 )
216 Expecting( time_toks );
220 if( tok != T_NUMBER )
221 Expecting( time_toks );
223 mytime.tm_sec = atoi( CurText() );
225 else if( tok == T_SYMBOL )
227 wxString str = wxString( CurText() );
228 wxArrayString arr = wxSplit( str,
':',
'\0' );
230 if( arr.size() != 3 )
231 Expecting( time_toks );
233 mytime.tm_hour = wxAtoi( arr[0] );
234 mytime.tm_min = wxAtoi( arr[1] );
235 mytime.tm_sec = wxAtoi( arr[2] );
240 if( tok != T_NUMBER )
241 Expecting( time_toks );
243 mytime.tm_year = atoi( CurText() ) - 1900;
245 *time_stamp = mktime( &mytime );
253 PushReader( &curr_reader );
255 if( NextTok() != T_LEFT )
258 if( NextTok() != T_pcb )
272 PushReader( &curr_reader );
274 if( NextTok() != T_LEFT )
277 if( NextTok() != T_session )
278 Expecting( T_session );
318 while( (tok = NextTok()) != T_RIGHT )
392 Unexpected( CurText() );
425 while( (tok = NextTok()) != T_RIGHT )
437 if( tok != T_QUOTE_DEF )
438 Expecting( T_QUOTE_DEF );
440 SetStringDelimiter( (
unsigned char) *CurText() );
446 case T_space_in_quoted_tokens:
449 if( tok!=T_on && tok!=T_off )
450 Expecting(
"on|off" );
452 SetSpaceInQuotedTokens( tok==T_on );
464 NeedSYMBOLorNUMBER();
470 NeedSYMBOLorNUMBER();
472 NeedSYMBOLorNUMBER();
479 case T_write_resolution:
480 while( (tok = NextTok()) != T_RIGHT )
483 Expecting( T_SYMBOL );
488 Expecting( T_NUMBER );
495 case T_routes_include:
496 while( (tok = NextTok()) != T_RIGHT )
506 case T_image_conductor:
510 Expecting(
"testpoint|guides|image_conductor" );
516 case T_wires_include:
519 if( tok != T_testpoint )
520 Expecting( T_testpoint );
526 case T_case_sensitive:
529 if( tok!=T_on && tok!=T_off )
530 Expecting(
"on|off" );
536 case T_via_rotate_first:
539 if( tok!=T_on && tok!=T_off )
540 Expecting(
"on|off" );
546 case T_generated_by_freeroute:
552 Unexpected( CurText() );
561 wxString str = wxString( CurText() ).MakeLower();
563 if( str == wxS(
"inch" ) )
564 growth->
units = T_inch;
565 else if( str == wxS(
"mil" ) )
566 growth->
units = T_mil;
567 else if( str == wxS(
"cm" ) )
568 growth->
units = T_cm;
569 else if( str == wxS(
"mm" ) )
570 growth->
units = T_mm;
571 else if( str == wxS(
"um" ) )
572 growth->
units = T_um;
574 Expecting(
"inch|mil|cm|mm|um" );
578 if( tok != T_NUMBER )
579 Expecting( T_NUMBER );
581 growth->
value = atoi( CurText() );
601 Expecting(
"inch|mil|cm|mm|um" );
616 if( NextTok() != T_NUMBER )
617 Expecting( T_NUMBER );
630 while( ( tok = NextTok() ) != T_RIGHT )
635 if( NextTok() != T_layer_pair )
636 Expecting( T_layer_pair );
649 while( ( tok = NextTok() ) != T_RIGHT )
674 case T_layer_noise_weight:
682 case T_place_boundary:
707 growth->
m_planes.push_back( plane );
713 region =
new REGION( growth );
720 stringprop =
new STRINGPROP( growth, T_snap_angle );
721 growth->
Append( stringprop );
743 layer =
new LAYER( growth );
744 growth->
m_layers.push_back( layer );
765 case T_place_keepout:
769 case T_elongate_keepout:
771 keepout =
new KEEPOUT( growth, tok );
784 Unexpected( CurText() );
802 while( tok != T_RIGHT )
813 layer =
new LAYER( growth );
814 growth->
m_layers.push_back( layer );
827 Unexpected( CurText() );
841 growth->
m_name = CurText();
848 while( tok != T_RIGHT )
857 case T_sequence_number:
858 if( NextTok() != T_NUMBER )
859 Expecting( T_NUMBER );
897 case T_polyline_path:
920 window =
new WINDOW( growth );
926 Unexpected( CurText() );
945 while( tok != T_RIGHT )
956 while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
961 Unexpected( CurText() );
973 while( tok != T_RIGHT )
998 case T_polyline_path:
1007 growth->
shape =
new PATH( growth, tok );
1020 Unexpected( CurText() );
1033 Expecting( T_LEFT );
1039 if( growth->
paths.size() )
1040 Unexpected(
"rect when path already encountered" );
1046 else if( tok == T_path )
1049 Unexpected(
"path when rect already encountered" );
1054 Expecting( T_path );
1062 if( tok == T_RIGHT )
1073 Expecting(
"rect|path" );
1082 if( !IsSymbol( tok ) && tok != T_NUMBER )
1083 Expecting(
"layer_id" );
1087 if( NextTok() != T_NUMBER )
1088 Expecting(
"aperture_width" );
1098 if( tok != T_NUMBER )
1099 Expecting( T_NUMBER );
1101 ptTemp.
x = strtod( CurText(),
nullptr );
1103 if( NextTok() != T_NUMBER )
1104 Expecting( T_NUMBER );
1106 ptTemp.
y = strtod( CurText(),
nullptr );
1108 growth->
points.push_back( ptTemp );
1110 }
while( ( tok = NextTok() ) != T_RIGHT && tok != T_LEFT );
1114 if( NextTok() != T_aperture_type )
1115 Expecting( T_aperture_type );
1119 if( tok!=T_round && tok!=T_square )
1120 Expecting(
"round|square" );
1134 if( NextTok() != T_NUMBER )
1135 Expecting( T_NUMBER );
1137 growth->
point0.
x = strtod( CurText(),
nullptr );
1139 if( NextTok() != T_NUMBER )
1140 Expecting( T_NUMBER );
1142 growth->
point0.
y = strtod( CurText(),
nullptr );
1144 if( NextTok() != T_NUMBER )
1145 Expecting( T_NUMBER );
1147 growth->
point1.
x = strtod( CurText(),
nullptr );
1149 if( NextTok() != T_NUMBER )
1150 Expecting( T_NUMBER );
1152 growth->
point1.
y = strtod( CurText(),
nullptr );
1162 NeedSYMBOLorNUMBER();
1165 if( NextTok() != T_NUMBER )
1166 Expecting( T_NUMBER );
1168 growth->
diameter = strtod( CurText(), 0 );
1172 if( tok == T_NUMBER )
1174 growth->
vertex.
x = strtod( CurText(), 0 );
1176 if( NextTok() != T_NUMBER )
1177 Expecting( T_NUMBER );
1179 growth->
vertex.
y = strtod( CurText(), 0 );
1184 if( tok != T_RIGHT )
1185 Expecting( T_RIGHT );
1194 if( NextTok() != T_NUMBER )
1195 Expecting( T_NUMBER );
1199 for(
int i = 0; i < 3; ++i )
1201 if( NextTok() != T_NUMBER )
1202 Expecting( T_NUMBER );
1204 growth->
vertex[i].
x = strtod( CurText(), 0 );
1206 if( NextTok() != T_NUMBER )
1207 Expecting( T_NUMBER );
1209 growth->
vertex[i].
y = strtod( CurText(), 0 );
1219 growth->
value = CurText();
1229 Unexpected( CurText() );
1231 growth->
value = tok;
1241 while( ( tok = NextTok() ) != T_RIGHT )
1245 if( NextTok() != T_spare )
1246 Expecting( T_spare );
1248 while( (tok = NextTok()) != T_RIGHT )
1250 if( !IsSymbol( tok ) )
1251 Expecting( T_SYMBOL );
1253 growth->
m_spares.push_back( CurText() );
1256 else if( IsSymbol( tok ) )
1262 Unexpected( CurText() );
1272 while( (tok = NextTok()) != T_RIGHT )
1275 Expecting( T_LEFT );
1284 if( tok!=T_on && tok!=T_off )
1285 Expecting(
"on|off" );
1292 case T_route_to_fanout_only:
1293 case T_force_to_terminal_point:
1294 case T_same_net_checking:
1295 case T_checking_trim_by_pin:
1296 case T_noise_calculation:
1297 case T_noise_accumulation:
1298 case T_include_pins_in_crosstalk:
1300 case T_average_pair_length:
1301 case T_crosstalk_model:
1302 case T_roundoff_rotation:
1304 case T_reroute_order_viols:
1306 tokprop =
new TOKPROP( growth, tok );
1307 growth->
Append( tokprop );
1312 Unexpected( CurText() );
1323 while( ( tok = NextTok() ) != T_RIGHT )
1326 Expecting( T_LEFT );
1328 NeedSYMBOLorNUMBER();
1329 property.name = CurText();
1331 NeedSYMBOLorNUMBER();
1332 property.value = CurText();
1334 growth->push_back( property );
1345 if( !IsSymbol( tok ) )
1346 Expecting( T_SYMBOL );
1348 growth->
name = CurText();
1350 while( ( tok = NextTok() ) != T_RIGHT )
1353 Expecting( T_LEFT );
1362 if( tok != T_signal && tok != T_power && tok != T_mixed && tok != T_jumper )
1363 Expecting(
"signal|power|mixed|jumper" );
1367 if( NextTok()!=T_RIGHT )
1373 growth->
rules =
new RULE( growth, T_rule );
1389 case T_positive_diagonal:
1390 case T_negative_diagonal:
1397 if( !strcmp(
"hori", CurText() ) )
1402 else if( !strcmp(
"vert", CurText() ) )
1408 Expecting(
"horizontal|vertical|orthogonal|positive_diagonal|negative_diagonal|"
1412 if( NextTok() != T_RIGHT )
1413 Expecting( T_RIGHT );
1432 growth->
cost = -atoi( CurText() );
1435 Expecting(
"forbidden|high|medium|low|free|<positive_integer>|-1" );
1442 if( NextTok() != T_type )
1443 Unexpected( CurText() );
1447 if( tok!=T_length && tok!=T_way )
1448 Expecting(
"length|way" );
1452 if( NextTok()!=T_RIGHT )
1453 Expecting( T_RIGHT );
1458 if( tok != T_RIGHT )
1459 Expecting( T_RIGHT );
1464 while( ( tok = NextTok() ) != T_RIGHT )
1466 if( !IsSymbol( tok ) )
1467 Expecting( T_SYMBOL );
1469 growth->
use_net.push_back( CurText() );
1475 Unexpected( CurText() );
1483 std::string builder;
1484 int bracketNesting = 1;
1487 while( bracketNesting != 0 && tok != T_EOF )
1493 else if( tok==T_RIGHT )
1496 if( bracketNesting >= 1 )
1498 if( PrevTok() != T_LEFT && tok != T_RIGHT && ( tok != T_LEFT || bracketNesting > 2 ) )
1501 if( tok == T_STRING )
1504 builder += CurText();
1506 if( tok == T_STRING )
1513 if( bracketNesting == 1 )
1515 growth->
m_rules.push_back( builder );
1521 Unexpected( T_EOF );
1526void SPECCTRA_DB::doPLACE_RULE( PLACE_RULE* growth,
bool expect_object_type )
1539 Expecting( T_LEFT );
1543 if( tok == T_object_type )
1545 if( !expect_object_type )
1560 growth->object_type = tok;
1573 growth->object_type = tok;
1576 Unexpected( CurText() );
1582 Unexpected( CurText() );
1591 if( tok != T_image_type )
1592 Expecting( T_image_type );
1596 if( tok!=T_smd && tok!=T_pin )
1597 Expecting(
"smd|pin" );
1604 if( tok != T_RIGHT )
1605 Expecting( T_RIGHT );
1623 if( IsSymbol( tok ) )
1632 Expecting( T_LEFT );
1655 case T_region_class:
1658 growth->
Append( stringprop );
1662 case T_region_class_class:
1665 growth->
Append( class_class );
1678 Unexpected( CurText() );
1683 if( tok == T_RIGHT )
1686 Expecting( T_rule );
1699 Expecting( T_LEFT );
1701 while( ( tok = NextTok() ) != T_RIGHT )
1715 if( growth->
Type() == T_region_class_class )
1719 rule =
new RULE( growth, T_rule );
1726 if( growth->
Type() == T_region_class_class )
1731 growth->
Append( layer_rule );
1748 if( !IsSymbol( tok ) )
1749 Expecting(
"class_id" );
1751 growth->
class_ids.push_back( CurText() );
1757 if( !IsSymbol( tok ) )
1758 Expecting(
"class_id" );
1760 growth->
class_ids.push_back( CurText() );
1762 }
while( ( tok = NextTok() ) != T_RIGHT );
1779 if( NextTok() != T_NUMBER )
1780 Expecting( T_NUMBER );
1787 while( ( tok = NextTok() ) != T_RIGHT )
1789 if( tok == T_direction )
1796 if( tok != T_x && tok != T_y )
1797 Unexpected( CurText() );
1801 if( NextTok() != T_RIGHT )
1804 else if( tok == T_offset )
1809 if( NextTok() != T_NUMBER )
1810 Expecting( T_NUMBER );
1812 growth->
m_offset = strtod( CurText(), 0 );
1814 if( NextTok() != T_RIGHT )
1815 Expecting( T_RIGHT );
1817 else if( tok == T_image_type )
1824 if( tok != T_smd && tok != T_pin )
1825 Unexpected( CurText() );
1829 if( NextTok() != T_RIGHT )
1830 Expecting( T_RIGHT );
1853 }
while( IsSymbol( tok = NextTok() ) );
1856 Expecting( T_LEFT );
1858 if( NextTok() != T_rule )
1859 Expecting( T_rule );
1872 if( !IsSymbol( tok ) )
1873 Expecting(
"component_id" );
1879 if( tok == T_NUMBER )
1883 point.
x = strtod( CurText(), 0 );
1885 if( NextTok() != T_NUMBER )
1886 Expecting( T_NUMBER );
1888 point.
y = strtod( CurText(), 0 );
1894 if( tok != T_front && tok != T_back )
1895 Expecting(
"front|back" );
1899 if( NextTok() != T_NUMBER )
1900 Expecting(
"rotation" );
1905 while( ( tok = NextTok() ) != T_RIGHT )
1908 Expecting( T_LEFT );
1917 if( tok == T_x || tok == T_y || tok == T_xy || tok == T_off )
1920 Expecting(
"x|y|xy|off" );
1927 if( tok==T_added || tok==T_deleted || tok==T_substituted )
1930 Expecting(
"added|deleted|substituted");
1934 case T_logical_part:
1940 if( !IsSymbol( tok ) )
1941 Expecting(
"logical_part_id");
1964 if( tok == T_position || tok == T_gate || tok == T_subgate || tok == T_pin )
1967 Expecting(
"position|gate|subgate|pin" );
1991 NeedSYMBOLorNUMBER();
2007 if( !IsSymbol( tok ) && tok != T_NUMBER )
2008 Expecting(
"image_id" );
2012 while( ( tok = NextTok() ) != T_RIGHT )
2015 Expecting( T_LEFT );
2023 place =
new PLACE( growth );
2024 growth->
m_places.push_back( place );
2039 while( ( tok = NextTok() ) != T_RIGHT )
2042 Unexpected( T_EOF );
2045 Expecting( T_LEFT );
2055 if( tok == T_resolution )
2061 case T_place_control:
2065 if( tok != T_flip_style )
2066 Expecting( T_flip_style );
2070 if( tok == T_mirror_first || tok == T_rotate_first )
2073 Expecting(
"mirror_first|rotate_first" );
2112 if( !IsSymbol( tok ) && tok != T_NUMBER )
2113 Expecting(
"m_padstack_id" );
2117 while( ( tok = NextTok() ) != T_RIGHT )
2120 Expecting( T_LEFT );
2137 if( tok != T_on && tok != T_off )
2138 Expecting(
"on|off" );
2147 if( tok != T_on && tok != T_off )
2148 Expecting(
"on|off" );
2156 shape =
new SHAPE( growth );
2164 if( tok != T_off && tok != T_on )
2165 Expecting(
"off|on" );
2172 if( NextTok() != T_use_via )
2173 Expecting( T_use_via );
2199 Unexpected( CurText() );
2215 while( ( tok = NextTok() ) != T_RIGHT )
2218 Expecting( T_LEFT );
2224 case T_polyline_path:
2241 if( !strcmp(
"circ", CurText() ) )
2262 growth->
shape =
new PATH( growth, tok );
2273 if( tok!=T_on && tok!=T_off )
2274 Expecting(
"on|off" );
2281 window =
new WINDOW( growth );
2287 Unexpected( CurText() );
2314 if( !IsSymbol( tok ) && tok != T_NUMBER )
2315 Expecting(
"image_id" );
2319 while( ( tok = NextTok() ) != T_RIGHT )
2322 Expecting( T_LEFT );
2339 if( tok != T_front && tok != T_back && tok != T_both )
2340 Expecting(
"front|back|both" );
2348 outline =
new SHAPE( growth, T_outline );
2349 growth->
Append( outline );
2377 case T_place_keepout:
2379 case T_wire_keepout:
2380 case T_bend_keepout:
2381 case T_elongate_keepout:
2383 keepout =
new KEEPOUT( growth, tok );
2389 Unexpected( CurText() );
2405 if( !IsSymbol( tok ) && tok!=T_NUMBER )
2406 Expecting(
"m_padstack_id" );
2410 while( ( tok = NextTok() ) != T_RIGHT )
2416 if( tok != T_rotate )
2417 Expecting( T_rotate );
2419 if( NextTok() != T_NUMBER )
2420 Expecting( T_NUMBER );
2427 if( !IsSymbol( tok ) && tok != T_NUMBER )
2428 Expecting(
"pin_id" );
2432 if( NextTok() != T_NUMBER )
2433 Expecting( T_NUMBER );
2435 growth->
m_vertex.
x = strtod( CurText(), 0 );
2437 if( NextTok() != T_NUMBER )
2438 Expecting( T_NUMBER );
2440 growth->
m_vertex.
y = strtod( CurText(), 0 );
2464 while( ( tok = NextTok() ) != T_RIGHT )
2467 Expecting( T_LEFT );
2496 Unexpected( CurText() );
2528 if( !IsSymbol( tok ) )
2529 Expecting(
"net_id" );
2533 while( ( tok = NextTok() ) != T_RIGHT )
2536 Expecting( T_LEFT );
2548 if( NextTok() != T_NUMBER )
2549 Expecting( T_NUMBER );
2558 pin_refs = &growth->
m_pins;
2574 pin_refs = &growth->
m_load;
2585 while( ( tok = NextTok() ) != T_RIGHT )
2588 pin_refs->push_back(
empty );
2590 PIN_REF* pin_ref = &pin_refs->back();
2609 if( tok!=T_fix && tok!=T_normal )
2610 Expecting(
"fix|normal" );
2638 fromto =
new FROMTO( growth );
2644 Unexpected( CurText() );
2659 while( ( tok = NextTok() ) != T_RIGHT )
2662 Expecting( T_LEFT );
2670 fromto =
new FROMTO( growth );
2683 Unexpected( CurText() );
2708 while( IsSymbol( tok = NextTok() ) )
2710 growth->
m_net_ids.push_back( CurText() );
2714 while( tok != T_RIGHT )
2717 Expecting( T_LEFT );
2748 std::string builder;
2749 int bracketNesting = 1;
2752 while( bracketNesting != 0 && tok != T_EOF )
2758 else if( tok == T_RIGHT )
2761 if( bracketNesting >= 1 )
2763 T previousTok = (T) PrevTok();
2765 if( previousTok != T_LEFT && previousTok != T_circuit && tok != T_RIGHT )
2768 if( tok == T_STRING )
2771 builder += CurText();
2773 if( tok == T_STRING )
2779 if( bracketNesting == 0 )
2787 Unexpected( T_EOF );
2793 Unexpected( CurText() );
2818 while( ( tok = NextTok() ) != T_RIGHT )
2821 Expecting( T_LEFT );
2829 net =
new NET( growth );
2830 growth->
m_nets.push_back( net );
2836 myclass =
new CLASS( growth );
2842 Unexpected( CurText() );
2856 while( IsSymbol( tok = NextTok() ) )
2859 if( tok != T_RIGHT )
2860 Expecting( T_RIGHT );
2885 char old = SetStringDelimiter( 0 );
2887 if( !IsSymbol(NextTok() ) )
2889 SetStringDelimiter( old );
2890 Expecting( T_SYMBOL );
2895 if( !IsSymbol(NextTok() ) )
2897 SetStringDelimiter( old );
2898 Expecting( T_SYMBOL );
2903 SetStringDelimiter( old );
2905 while( ( tok = NextTok() ) != T_RIGHT )
2908 Expecting( T_LEFT );
2917 if( tok != T_fix && tok != T_normal && tok != T_soft )
2918 Expecting(
"fix|normal|soft" );
2951 Unexpected( CurText() );
2978 while( ( tok = NextTok() ) != T_RIGHT )
2981 Expecting( T_LEFT );
3003 case T_polyline_path:
3025 NeedSYMBOLorNUMBER();
3031 if( NextTok() != T_NUMBER )
3032 Expecting( T_NUMBER );
3034 growth->
m_turret = atoi( CurText() );
3041 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3042 Expecting(
"fix|route|normal|protect" );
3051 if( tok != T_test && tok != T_fanout && tok != T_bus && tok != T_jumper )
3052 Expecting(
"test|fanout|bus|jumper" );
3066 window =
new WINDOW( growth );
3085 Unexpected( CurText() );
3115 while( ( tok = NextTok() ) == T_NUMBER )
3117 point.
x = strtod( CurText(), 0 );
3119 if( NextTok() != T_NUMBER )
3120 Expecting(
"vertex.y" );
3122 point.
y = strtod( CurText(), 0 );
3127 while( tok != T_RIGHT )
3130 Expecting( T_LEFT );
3143 if( NextTok() != T_NUMBER )
3144 Expecting(
"<via#>" );
3153 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3154 Expecting(
"fix|route|normal|protect" );
3163 if( tok != T_test && tok != T_fanout && tok != T_jumper && tok != T_virtual_pin )
3164 Expecting(
"test|fanout|jumper|virtual_pin" );
3168 if( tok == T_virtual_pin )
3181 while( IsSymbol( tok ) )
3187 if( tok != T_RIGHT )
3188 Expecting( T_RIGHT );
3198 Unexpected( CurText() );
3219 while( ( tok = NextTok() ) != T_RIGHT )
3222 Expecting( T_LEFT );
3246 wire =
new WIRE( growth );
3247 growth->
wires.push_back( wire );
3254 growth->
wire_vias.push_back( wire_via );
3259 Unexpected( CurText() );
3277 while( ( tok = NextTok() ) != T_RIGHT )
3280 Expecting( T_LEFT );
3286 case T_created_time:
3298 Unexpected( CurText() );
3312 while( ( tok = NextTok() ) != T_RIGHT )
3315 Expecting( T_LEFT );
3324 growth->
ancestors.push_back( ancestor );
3329 while( ( tok = NextTok() ) != T_RIGHT )
3332 Expecting( T_LEFT );
3338 case T_created_time:
3345 growth->
comments.push_back( CurText() );
3350 Unexpected( CurText() );
3357 Unexpected( CurText() );
3383 std::stringstream fullPath;
3384 fullPath << CurText();
3386 while( ( tok = NextTok() ) != T_LEFT )
3387 fullPath <<
" " << CurText();
3394 Expecting( T_LEFT );
3447 Unexpected( CurText() );
3449 }
while( ( tok = NextTok() ) != T_RIGHT );
3464 while( ( tok = NextTok() ) != T_RIGHT )
3467 Expecting( T_LEFT );
3488 Unexpected( CurText() );
3509 while( ( tok = NextTok() ) != T_RIGHT )
3512 Expecting( T_LEFT );
3541 case T_structure_out:
3558 while( ( tok = NextTok() ) != T_RIGHT )
3561 Expecting( T_LEFT );
3567 if( tok != T_net && !( tok == T_SYMBOL && !strcmp( CurText(),
"Net" ) ) )
3568 Unexpected( CurText() );
3571 net_out =
new NET_OUT( growth );
3573 growth->
net_outs.push_back( net_out );
3580 while( ( tok = NextTok() ) != T_RIGHT )
3583 Unexpected( CurText() );
3588 Unexpected( CurText() );
3608 NeedSYMBOLorNUMBER();
3609 growth->
net_id = CurText();
3611 while( ( tok = NextTok() ) != T_RIGHT )
3614 Expecting( T_LEFT );
3623 if( tok!= T_NUMBER )
3624 Expecting( T_NUMBER );
3634 growth->
rules =
new RULE( growth, tok );
3640 wire =
new WIRE( growth );
3641 growth->
wires.push_back( wire );
3648 growth->
wire_vias.push_back( wire_via );
3660 Unexpected( CurText() );
3676 growth->
net_id = CurText();
3678 while( ( tok = NextTok() ) != T_RIGHT )
3688 else if( tok == T_LEFT )
3695 growth->
net_id = CurText();
3699 Unexpected( CurText() );
3769 return SPECCTRA_DB::TokenName(
type );
3783 out->
Print( nestLevel,
"(%s\n",
Name() );
3787 out->
Print( nestLevel,
")\n" );
3793 for(
int i = 0; i <
Length(); ++i )
3802 for(
unsigned i = 0; i <
kids.size(); ++i )
3806 if( repeats == instanceNum )
3826 if( !lhs->
m_hash.size() )
3829 if( !rhs->
m_hash.size() )
3847 if( !lhs->
m_hash.size() )
3850 if( !rhs->
m_hash.size() )
3874 ELEM( T_parser, aParent )
3897 out->
Print( nestLevel,
"(host_cad \"%s\")\n",
host_cad.c_str() );
3902 const std::string& s1 = *i++;
3903 const std::string& s2 = *i++;
3907 out->
Print( nestLevel,
"(constant %s%s%s %s%s%s)\n",
3908 q1, s1.c_str(), q1, q2, s2.c_str(), q2 );
3913 out->
Print( nestLevel,
"(routes_include%s%s%s)\n",
3920 out->
Print( nestLevel,
"(wires_include testpoint)\n" );
3923 out->
Print( nestLevel,
"(via_rotate_first off)\n" );
3938 useMultiLine =
true;
3941 out->
Print( nestLevel+1,
"%s",
"" );
3945 useMultiLine =
false;
3957 const char* space =
" ";
3980 out->
Print( 0,
"\n" );
3987 out->
Print( nestLevel + 1,
"(property \n" );
3990 i->Format( out, nestLevel + 2 );
3992 out->
Print( nestLevel + 1,
")\n" );
4025 out->
Print( 0,
")\n" );
wxString GetBuildVersion()
Get the full KiCad version string.
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
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)
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)
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)
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.
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.
LSET is a set of PCB_LAYER_IDs.
LSEQ CuStack() const
Return a sequence of copper layers in starting from the front/top and extending to the back/bottom.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
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.
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.