73 return SPECCTRA_LEXER::TokenName( aTok );
102 for(
int i = 0; i < int(
m_layerIds.size() ); ++i )
104 if( 0 == aLayerName.compare(
m_layerIds[i] ) )
116 static const char pin_def[] =
"<pin_reference>::=<component_id>-<pin_id>";
118 if( !IsSymbol( (
T) CurTok() ) )
119 Expecting( pin_def );
123 if( CurTok() != T_STRING )
125 const char* toktext = CurText();
126 const char* dash = strchr( toktext,
'-' );
129 Expecting( pin_def );
131 while( toktext != dash )
132 *component_id += *toktext++;
137 *pin_id += *toktext++;
141 *component_id = CurText();
146 Expecting( pin_def );
165 static const char time_toks[] =
"<month> <day> <hour> : <minute> : <second> <year> or <month> <day> <hour>:<minute>:<second> <year>";
167 static const char* months[] = {
168 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
169 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
nullptr
174 const char* ptok = CurText();
178 for(
int m = 0; months[m]; ++m )
180 if( !strcasecmp( months[m], ptok ) )
189 if( tok != T_NUMBER )
190 Expecting( time_toks );
192 mytime.tm_mday = atoi( CurText() );
196 if( tok == T_NUMBER )
198 mytime.tm_hour = atoi( CurText() );
203 if( *CurText() !=
':' || strlen( CurText() ) != 1 )
204 Expecting( time_toks );
208 if( tok != T_NUMBER )
209 Expecting( time_toks );
211 mytime.tm_min = atoi( CurText() );
216 if( *CurText() !=
':' || strlen( CurText() ) != 1 )
217 Expecting( time_toks );
221 if( tok != T_NUMBER )
222 Expecting( time_toks );
224 mytime.tm_sec = atoi( CurText() );
226 else if( tok == T_SYMBOL )
228 wxString str = wxString( CurText() );
229 wxArrayString arr = wxSplit( str,
':',
'\0' );
231 if( arr.size() != 3 )
232 Expecting( time_toks );
234 mytime.tm_hour = wxAtoi( arr[0] );
235 mytime.tm_min = wxAtoi( arr[1] );
236 mytime.tm_sec = wxAtoi( arr[2] );
241 if( tok != T_NUMBER )
242 Expecting( time_toks );
244 mytime.tm_year = atoi( CurText() ) - 1900;
246 *time_stamp = mktime( &mytime );
254 PushReader( &curr_reader );
256 if( NextTok() != T_LEFT )
259 if( NextTok() != T_pcb )
273 PushReader( &curr_reader );
275 if( NextTok() != T_LEFT )
278 if( NextTok() != T_session )
279 Expecting( T_session );
319 while( (tok = NextTok()) != T_RIGHT )
393 Unexpected( CurText() );
426 while( (tok = NextTok()) != T_RIGHT )
438 if( tok != T_QUOTE_DEF )
439 Expecting( T_QUOTE_DEF );
441 SetStringDelimiter( (
unsigned char) *CurText() );
447 case T_space_in_quoted_tokens:
450 if( tok!=T_on && tok!=T_off )
451 Expecting(
"on|off" );
453 SetSpaceInQuotedTokens( tok==T_on );
465 NeedSYMBOLorNUMBER();
471 NeedSYMBOLorNUMBER();
473 NeedSYMBOLorNUMBER();
480 case T_write_resolution:
481 while( (tok = NextTok()) != T_RIGHT )
484 Expecting( T_SYMBOL );
489 Expecting( T_NUMBER );
496 case T_routes_include:
497 while( (tok = NextTok()) != T_RIGHT )
507 case T_image_conductor:
511 Expecting(
"testpoint|guides|image_conductor" );
517 case T_wires_include:
520 if( tok != T_testpoint )
521 Expecting( T_testpoint );
527 case T_case_sensitive:
530 if( tok!=T_on && tok!=T_off )
531 Expecting(
"on|off" );
537 case T_via_rotate_first:
540 if( tok!=T_on && tok!=T_off )
541 Expecting(
"on|off" );
547 case T_generated_by_freeroute:
553 Unexpected( CurText() );
562 wxString str = wxString( CurText() ).MakeLower();
564 if( str == wxS(
"inch" ) )
565 growth->
units = T_inch;
566 else if( str == wxS(
"mil" ) )
567 growth->
units = T_mil;
568 else if( str == wxS(
"cm" ) )
569 growth->
units = T_cm;
570 else if( str == wxS(
"mm" ) )
571 growth->
units = T_mm;
572 else if( str == wxS(
"um" ) )
573 growth->
units = T_um;
575 Expecting(
"inch|mil|cm|mm|um" );
579 if( tok != T_NUMBER )
580 Expecting( T_NUMBER );
582 growth->
value = atoi( CurText() );
602 Expecting(
"inch|mil|cm|mm|um" );
617 if( NextTok() != T_NUMBER )
618 Expecting( T_NUMBER );
631 while( ( tok = NextTok() ) != T_RIGHT )
636 if( NextTok() != T_layer_pair )
637 Expecting( T_layer_pair );
650 while( ( tok = NextTok() ) != T_RIGHT )
675 case T_layer_noise_weight:
683 case T_place_boundary:
708 growth->
m_planes.push_back( plane );
714 region =
new REGION( growth );
721 stringprop =
new STRINGPROP( growth, T_snap_angle );
722 growth->
Append( stringprop );
744 layer =
new LAYER( growth );
745 growth->
m_layers.push_back( layer );
766 case T_place_keepout:
770 case T_elongate_keepout:
772 keepout =
new KEEPOUT( growth, tok );
785 Unexpected( CurText() );
803 while( tok != T_RIGHT )
814 layer =
new LAYER( growth );
815 growth->
m_layers.push_back( layer );
828 Unexpected( CurText() );
842 growth->
m_name = CurText();
849 while( tok != T_RIGHT )
858 case T_sequence_number:
859 if( NextTok() != T_NUMBER )
860 Expecting( T_NUMBER );
898 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:
1008 growth->
shape =
new PATH( growth, tok );
1021 Unexpected( CurText() );
1034 Expecting( T_LEFT );
1040 if( growth->
paths.size() )
1041 Unexpected(
"rect when path already encountered" );
1047 else if( tok == T_path )
1050 Unexpected(
"path when rect already encountered" );
1055 Expecting( T_path );
1063 if( tok == T_RIGHT )
1074 Expecting(
"rect|path" );
1083 if( !IsSymbol( tok ) && tok != T_NUMBER )
1084 Expecting(
"layer_id" );
1088 if( NextTok() != T_NUMBER )
1089 Expecting(
"aperture_width" );
1099 if( tok != T_NUMBER )
1100 Expecting( T_NUMBER );
1102 ptTemp.
x = strtod( CurText(),
nullptr );
1104 if( NextTok() != T_NUMBER )
1105 Expecting( T_NUMBER );
1107 ptTemp.
y = strtod( CurText(),
nullptr );
1109 growth->
points.push_back( ptTemp );
1111 }
while( ( tok = NextTok() ) != T_RIGHT && tok != T_LEFT );
1115 if( NextTok() != T_aperture_type )
1116 Expecting( T_aperture_type );
1120 if( tok!=T_round && tok!=T_square )
1121 Expecting(
"round|square" );
1135 if( NextTok() != T_NUMBER )
1136 Expecting( T_NUMBER );
1138 growth->
point0.
x = strtod( CurText(),
nullptr );
1140 if( NextTok() != T_NUMBER )
1141 Expecting( T_NUMBER );
1143 growth->
point0.
y = strtod( CurText(),
nullptr );
1145 if( NextTok() != T_NUMBER )
1146 Expecting( T_NUMBER );
1148 growth->
point1.
x = strtod( CurText(),
nullptr );
1150 if( NextTok() != T_NUMBER )
1151 Expecting( T_NUMBER );
1153 growth->
point1.
y = strtod( CurText(),
nullptr );
1163 NeedSYMBOLorNUMBER();
1166 if( NextTok() != T_NUMBER )
1167 Expecting( T_NUMBER );
1169 growth->
diameter = strtod( CurText(), 0 );
1173 if( tok == T_NUMBER )
1175 growth->
vertex.
x = strtod( CurText(), 0 );
1177 if( NextTok() != T_NUMBER )
1178 Expecting( T_NUMBER );
1180 growth->
vertex.
y = strtod( CurText(), 0 );
1185 if( tok != T_RIGHT )
1186 Expecting( T_RIGHT );
1195 if( NextTok() != T_NUMBER )
1196 Expecting( T_NUMBER );
1200 for(
int i = 0; i < 3; ++i )
1202 if( NextTok() != T_NUMBER )
1203 Expecting( T_NUMBER );
1205 growth->
vertex[i].
x = strtod( CurText(), 0 );
1207 if( NextTok() != T_NUMBER )
1208 Expecting( T_NUMBER );
1210 growth->
vertex[i].
y = strtod( CurText(), 0 );
1220 growth->
value = CurText();
1230 Unexpected( CurText() );
1232 growth->
value = tok;
1242 while( ( tok = NextTok() ) != T_RIGHT )
1246 if( NextTok() != T_spare )
1247 Expecting( T_spare );
1249 while( (tok = NextTok()) != T_RIGHT )
1251 if( !IsSymbol( tok ) )
1252 Expecting( T_SYMBOL );
1254 growth->
m_spares.push_back( CurText() );
1257 else if( IsSymbol( tok ) )
1263 Unexpected( CurText() );
1273 while( (tok = NextTok()) != T_RIGHT )
1276 Expecting( T_LEFT );
1285 if( tok!=T_on && tok!=T_off )
1286 Expecting(
"on|off" );
1293 case T_route_to_fanout_only:
1294 case T_force_to_terminal_point:
1295 case T_same_net_checking:
1296 case T_checking_trim_by_pin:
1297 case T_noise_calculation:
1298 case T_noise_accumulation:
1299 case T_include_pins_in_crosstalk:
1301 case T_average_pair_length:
1302 case T_crosstalk_model:
1303 case T_roundoff_rotation:
1305 case T_reroute_order_viols:
1307 tokprop =
new TOKPROP( growth, tok );
1308 growth->
Append( tokprop );
1313 Unexpected( CurText() );
1324 while( ( tok = NextTok() ) != T_RIGHT )
1327 Expecting( T_LEFT );
1329 NeedSYMBOLorNUMBER();
1330 property.name = CurText();
1332 NeedSYMBOLorNUMBER();
1333 property.value = CurText();
1335 growth->push_back( property );
1346 if( !IsSymbol( tok ) )
1347 Expecting( T_SYMBOL );
1349 growth->
name = CurText();
1351 while( ( tok = NextTok() ) != T_RIGHT )
1354 Expecting( T_LEFT );
1363 if( tok != T_signal && tok != T_power && tok != T_mixed && tok != T_jumper )
1364 Expecting(
"signal|power|mixed|jumper" );
1368 if( NextTok()!=T_RIGHT )
1374 growth->
rules =
new RULE( growth, T_rule );
1390 case T_positive_diagonal:
1391 case T_negative_diagonal:
1398 if( !strcmp(
"hori", CurText() ) )
1403 else if( !strcmp(
"vert", CurText() ) )
1409 Expecting(
"horizontal|vertical|orthogonal|positive_diagonal|negative_diagonal|"
1413 if( NextTok() != T_RIGHT )
1414 Expecting( T_RIGHT );
1433 growth->
cost = -atoi( CurText() );
1436 Expecting(
"forbidden|high|medium|low|free|<positive_integer>|-1" );
1443 if( NextTok() != T_type )
1444 Unexpected( CurText() );
1448 if( tok!=T_length && tok!=T_way )
1449 Expecting(
"length|way" );
1453 if( NextTok()!=T_RIGHT )
1454 Expecting( T_RIGHT );
1459 if( tok != T_RIGHT )
1460 Expecting( T_RIGHT );
1465 while( ( tok = NextTok() ) != T_RIGHT )
1467 if( !IsSymbol( tok ) )
1468 Expecting( T_SYMBOL );
1470 growth->
use_net.push_back( CurText() );
1476 Unexpected( CurText() );
1484 std::string builder;
1485 int bracketNesting = 1;
1488 while( bracketNesting != 0 && tok != T_EOF )
1494 else if( tok==T_RIGHT )
1497 if( bracketNesting >= 1 )
1499 if( PrevTok() != T_LEFT && tok != T_RIGHT && ( tok != T_LEFT || bracketNesting > 2 ) )
1502 if( tok == T_STRING )
1505 builder += CurText();
1507 if( tok == T_STRING )
1514 if( bracketNesting == 1 )
1516 growth->
m_rules.push_back( builder );
1522 Unexpected( T_EOF );
1527void SPECCTRA_DB::doPLACE_RULE( PLACE_RULE* growth,
bool expect_object_type )
1540 Expecting( T_LEFT );
1544 if( tok == T_object_type )
1546 if( !expect_object_type )
1561 growth->object_type = tok;
1574 growth->object_type = tok;
1577 Unexpected( CurText() );
1583 Unexpected( CurText() );
1592 if( tok != T_image_type )
1593 Expecting( T_image_type );
1597 if( tok!=T_smd && tok!=T_pin )
1598 Expecting(
"smd|pin" );
1605 if( tok != T_RIGHT )
1606 Expecting( T_RIGHT );
1624 if( IsSymbol( tok ) )
1633 Expecting( T_LEFT );
1656 case T_region_class:
1659 growth->
Append( stringprop );
1663 case T_region_class_class:
1666 growth->
Append( class_class );
1679 Unexpected( CurText() );
1684 if( tok == T_RIGHT )
1687 Expecting( T_rule );
1700 Expecting( T_LEFT );
1702 while( ( tok = NextTok() ) != T_RIGHT )
1716 if( growth->
Type() == T_region_class_class )
1720 rule =
new RULE( growth, T_rule );
1727 if( growth->
Type() == T_region_class_class )
1732 growth->
Append( layer_rule );
1749 if( !IsSymbol( tok ) )
1750 Expecting(
"class_id" );
1752 growth->
class_ids.push_back( CurText() );
1758 if( !IsSymbol( tok ) )
1759 Expecting(
"class_id" );
1761 growth->
class_ids.push_back( CurText() );
1763 }
while( ( tok = NextTok() ) != T_RIGHT );
1780 if( NextTok() != T_NUMBER )
1781 Expecting( T_NUMBER );
1788 while( ( tok = NextTok() ) != T_RIGHT )
1790 if( tok == T_direction )
1797 if( tok != T_x && tok != T_y )
1798 Unexpected( CurText() );
1802 if( NextTok() != T_RIGHT )
1805 else if( tok == T_offset )
1810 if( NextTok() != T_NUMBER )
1811 Expecting( T_NUMBER );
1813 growth->
m_offset = strtod( CurText(), 0 );
1815 if( NextTok() != T_RIGHT )
1816 Expecting( T_RIGHT );
1818 else if( tok == T_image_type )
1825 if( tok != T_smd && tok != T_pin )
1826 Unexpected( CurText() );
1830 if( NextTok() != T_RIGHT )
1831 Expecting( T_RIGHT );
1854 }
while( IsSymbol( tok = NextTok() ) );
1857 Expecting( T_LEFT );
1859 if( NextTok() != T_rule )
1860 Expecting( T_rule );
1873 if( !IsSymbol( tok ) )
1874 Expecting(
"component_id" );
1880 if( tok == T_NUMBER )
1884 point.
x = strtod( CurText(), 0 );
1886 if( NextTok() != T_NUMBER )
1887 Expecting( T_NUMBER );
1889 point.
y = strtod( CurText(), 0 );
1895 if( tok != T_front && tok != T_back )
1896 Expecting(
"front|back" );
1900 if( NextTok() != T_NUMBER )
1901 Expecting(
"rotation" );
1906 while( ( tok = NextTok() ) != T_RIGHT )
1909 Expecting( T_LEFT );
1918 if( tok == T_x || tok == T_y || tok == T_xy || tok == T_off )
1921 Expecting(
"x|y|xy|off" );
1928 if( tok==T_added || tok==T_deleted || tok==T_substituted )
1931 Expecting(
"added|deleted|substituted");
1935 case T_logical_part:
1941 if( !IsSymbol( tok ) )
1942 Expecting(
"logical_part_id");
1965 if( tok == T_position || tok == T_gate || tok == T_subgate || tok == T_pin )
1968 Expecting(
"position|gate|subgate|pin" );
1992 NeedSYMBOLorNUMBER();
2008 if( !IsSymbol( tok ) && tok != T_NUMBER )
2009 Expecting(
"image_id" );
2013 while( ( tok = NextTok() ) != T_RIGHT )
2016 Expecting( T_LEFT );
2024 place =
new PLACE( growth );
2025 growth->
m_places.push_back( place );
2040 while( ( tok = NextTok() ) != T_RIGHT )
2043 Unexpected( T_EOF );
2046 Expecting( T_LEFT );
2056 if( tok == T_resolution )
2062 case T_place_control:
2066 if( tok != T_flip_style )
2067 Expecting( T_flip_style );
2071 if( tok == T_mirror_first || tok == T_rotate_first )
2074 Expecting(
"mirror_first|rotate_first" );
2113 if( !IsSymbol( tok ) && tok != T_NUMBER )
2114 Expecting(
"m_padstack_id" );
2118 while( ( tok = NextTok() ) != T_RIGHT )
2121 Expecting( T_LEFT );
2138 if( tok != T_on && tok != T_off )
2139 Expecting(
"on|off" );
2148 if( tok != T_on && tok != T_off )
2149 Expecting(
"on|off" );
2157 shape =
new SHAPE( growth );
2165 if( tok != T_off && tok != T_on )
2166 Expecting(
"off|on" );
2173 if( NextTok() != T_use_via )
2174 Expecting( T_use_via );
2200 Unexpected( CurText() );
2216 while( ( tok = NextTok() ) != T_RIGHT )
2219 Expecting( T_LEFT );
2225 case T_polyline_path:
2242 if( !strcmp(
"circ", CurText() ) )
2263 growth->
shape =
new PATH( growth, tok );
2274 if( tok!=T_on && tok!=T_off )
2275 Expecting(
"on|off" );
2282 window =
new WINDOW( growth );
2288 Unexpected( CurText() );
2315 if( !IsSymbol( tok ) && tok != T_NUMBER )
2316 Expecting(
"image_id" );
2320 while( ( tok = NextTok() ) != T_RIGHT )
2323 Expecting( T_LEFT );
2340 if( tok != T_front && tok != T_back && tok != T_both )
2341 Expecting(
"front|back|both" );
2349 outline =
new SHAPE( growth, T_outline );
2350 growth->
Append( outline );
2378 case T_place_keepout:
2380 case T_wire_keepout:
2381 case T_bend_keepout:
2382 case T_elongate_keepout:
2384 keepout =
new KEEPOUT( growth, tok );
2390 Unexpected( CurText() );
2406 if( !IsSymbol( tok ) && tok!=T_NUMBER )
2407 Expecting(
"m_padstack_id" );
2411 while( ( tok = NextTok() ) != T_RIGHT )
2417 if( tok != T_rotate )
2418 Expecting( T_rotate );
2420 if( NextTok() != T_NUMBER )
2421 Expecting( T_NUMBER );
2428 if( !IsSymbol( tok ) && tok != T_NUMBER )
2429 Expecting(
"pin_id" );
2433 if( NextTok() != T_NUMBER )
2434 Expecting( T_NUMBER );
2436 growth->
m_vertex.
x = strtod( CurText(), 0 );
2438 if( NextTok() != T_NUMBER )
2439 Expecting( T_NUMBER );
2441 growth->
m_vertex.
y = strtod( CurText(), 0 );
2465 while( ( tok = NextTok() ) != T_RIGHT )
2468 Expecting( T_LEFT );
2497 Unexpected( CurText() );
2529 if( !IsSymbol( tok ) )
2530 Expecting(
"net_id" );
2534 while( ( tok = NextTok() ) != T_RIGHT )
2537 Expecting( T_LEFT );
2549 if( NextTok() != T_NUMBER )
2550 Expecting( T_NUMBER );
2559 pin_refs = &growth->
m_pins;
2575 pin_refs = &growth->
m_load;
2586 while( ( tok = NextTok() ) != T_RIGHT )
2589 pin_refs->push_back(
empty );
2591 PIN_REF* pin_ref = &pin_refs->back();
2610 if( tok!=T_fix && tok!=T_normal )
2611 Expecting(
"fix|normal" );
2639 fromto =
new FROMTO( growth );
2645 Unexpected( CurText() );
2660 while( ( tok = NextTok() ) != T_RIGHT )
2663 Expecting( T_LEFT );
2671 fromto =
new FROMTO( growth );
2684 Unexpected( CurText() );
2709 while( IsSymbol( tok = NextTok() ) )
2711 growth->
m_net_ids.push_back( CurText() );
2715 while( tok != T_RIGHT )
2718 Expecting( T_LEFT );
2749 std::string builder;
2750 int bracketNesting = 1;
2753 while( bracketNesting != 0 && tok != T_EOF )
2759 else if( tok == T_RIGHT )
2762 if( bracketNesting >= 1 )
2764 T previousTok = (
T) PrevTok();
2766 if( previousTok != T_LEFT && previousTok != T_circuit && tok != T_RIGHT )
2769 if( tok == T_STRING )
2772 builder += CurText();
2774 if( tok == T_STRING )
2780 if( bracketNesting == 0 )
2788 Unexpected( T_EOF );
2794 Unexpected( CurText() );
2819 while( ( tok = NextTok() ) != T_RIGHT )
2822 Expecting( T_LEFT );
2830 net =
new NET( growth );
2831 growth->
m_nets.push_back( net );
2837 myclass =
new CLASS( growth );
2843 Unexpected( CurText() );
2857 while( IsSymbol( tok = NextTok() ) )
2860 if( tok != T_RIGHT )
2861 Expecting( T_RIGHT );
2886 char old = SetStringDelimiter( 0 );
2888 if( !IsSymbol(NextTok() ) )
2890 SetStringDelimiter( old );
2891 Expecting( T_SYMBOL );
2896 if( !IsSymbol(NextTok() ) )
2898 SetStringDelimiter( old );
2899 Expecting( T_SYMBOL );
2904 SetStringDelimiter( old );
2906 while( ( tok = NextTok() ) != T_RIGHT )
2909 Expecting( T_LEFT );
2918 if( tok != T_fix && tok != T_normal && tok != T_soft )
2919 Expecting(
"fix|normal|soft" );
2952 Unexpected( CurText() );
2979 while( ( tok = NextTok() ) != T_RIGHT )
2982 Expecting( T_LEFT );
3004 case T_polyline_path:
3026 NeedSYMBOLorNUMBER();
3032 if( NextTok() != T_NUMBER )
3033 Expecting( T_NUMBER );
3035 growth->
m_turret = atoi( CurText() );
3042 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3043 Expecting(
"fix|route|normal|protect" );
3052 if( tok != T_test && tok != T_fanout && tok != T_bus && tok != T_jumper )
3053 Expecting(
"test|fanout|bus|jumper" );
3067 window =
new WINDOW( growth );
3086 Unexpected( CurText() );
3116 while( ( tok = NextTok() ) == T_NUMBER )
3118 point.
x = strtod( CurText(), 0 );
3120 if( NextTok() != T_NUMBER )
3121 Expecting(
"vertex.y" );
3123 point.
y = strtod( CurText(), 0 );
3128 while( tok != T_RIGHT )
3131 Expecting( T_LEFT );
3144 if( NextTok() != T_NUMBER )
3145 Expecting(
"<via#>" );
3154 if( tok != T_fix && tok != T_route && tok != T_normal && tok != T_protect )
3155 Expecting(
"fix|route|normal|protect" );
3164 if( tok != T_test && tok != T_fanout && tok != T_jumper && tok != T_virtual_pin )
3165 Expecting(
"test|fanout|jumper|virtual_pin" );
3169 if( tok == T_virtual_pin )
3182 while( IsSymbol( tok ) )
3188 if( tok != T_RIGHT )
3189 Expecting( T_RIGHT );
3199 Unexpected( CurText() );
3220 while( ( tok = NextTok() ) != T_RIGHT )
3223 Expecting( T_LEFT );
3247 wire =
new WIRE( growth );
3248 growth->
wires.push_back( wire );
3255 growth->
wire_vias.push_back( wire_via );
3260 Unexpected( CurText() );
3278 while( ( tok = NextTok() ) != T_RIGHT )
3281 Expecting( T_LEFT );
3287 case T_created_time:
3299 Unexpected( CurText() );
3313 while( ( tok = NextTok() ) != T_RIGHT )
3316 Expecting( T_LEFT );
3325 growth->
ancestors.push_back( ancestor );
3330 while( ( tok = NextTok() ) != T_RIGHT )
3333 Expecting( T_LEFT );
3339 case T_created_time:
3346 growth->
comments.push_back( CurText() );
3351 Unexpected( CurText() );
3358 Unexpected( CurText() );
3384 std::stringstream fullPath;
3385 fullPath << CurText();
3387 while( ( tok = NextTok() ) != T_LEFT )
3388 fullPath <<
" " << CurText();
3395 Expecting( T_LEFT );
3448 Unexpected( CurText() );
3450 }
while( ( tok = NextTok() ) != T_RIGHT );
3465 while( ( tok = NextTok() ) != T_RIGHT )
3468 Expecting( T_LEFT );
3489 Unexpected( CurText() );
3510 while( ( tok = NextTok() ) != T_RIGHT )
3513 Expecting( T_LEFT );
3542 case T_structure_out:
3559 while( ( tok = NextTok() ) != T_RIGHT )
3562 Expecting( T_LEFT );
3568 if( tok != T_net && !( tok == T_SYMBOL && !strcmp( CurText(),
"Net" ) ) )
3569 Unexpected( CurText() );
3572 net_out =
new NET_OUT( growth );
3574 growth->
net_outs.push_back( net_out );
3581 while( ( tok = NextTok() ) != T_RIGHT )
3584 Unexpected( CurText() );
3589 Unexpected( CurText() );
3609 NeedSYMBOLorNUMBER();
3610 growth->
net_id = CurText();
3612 while( ( tok = NextTok() ) != T_RIGHT )
3615 Expecting( T_LEFT );
3624 if( tok!= T_NUMBER )
3625 Expecting( T_NUMBER );
3635 growth->
rules =
new RULE( growth, tok );
3641 wire =
new WIRE( growth );
3642 growth->
wires.push_back( wire );
3649 growth->
wire_vias.push_back( wire_via );
3661 Unexpected( CurText() );
3677 growth->
net_id = CurText();
3679 while( ( tok = NextTok() ) != T_RIGHT )
3689 else if( tok == T_LEFT )
3696 growth->
net_id = CurText();
3700 Unexpected( CurText() );
3770 return SPECCTRA_DB::TokenName(
type );
3784 out->
Print( nestLevel,
"(%s\n",
Name() );
3788 out->
Print( nestLevel,
")\n" );
3794 for(
int i = 0; i <
Length(); ++i )
3803 for(
unsigned i = 0; i <
kids.size(); ++i )
3807 if( repeats == instanceNum )
3827 if( !lhs->
m_hash.size() )
3830 if( !rhs->
m_hash.size() )
3848 if( !lhs->
m_hash.size() )
3851 if( !rhs->
m_hash.size() )
3875 ELEM( T_parser, aParent )
3898 out->
Print( nestLevel,
"(host_cad \"%s\")\n",
host_cad.c_str() );
3903 const std::string& s1 = *i++;
3904 const std::string& s2 = *i++;
3908 out->
Print( nestLevel,
"(constant %s%s%s %s%s%s)\n",
3909 q1, s1.c_str(), q1, q2, s2.c_str(), q2 );
3914 out->
Print( nestLevel,
"(routes_include%s%s%s)\n",
3921 out->
Print( nestLevel,
"(wires_include testpoint)\n" );
3924 out->
Print( nestLevel,
"(via_rotate_first off)\n" );
3939 useMultiLine =
true;
3942 out->
Print( nestLevel+1,
"%s",
"" );
3946 useMultiLine =
false;
3958 const char* space =
" ";
3981 out->
Print( 0,
"\n" );
3988 out->
Print( nestLevel + 1,
"(property \n" );
3991 i->Format( out, nestLevel + 2 );
3993 out->
Print( nestLevel + 1,
")\n" );
4026 out->
Print( 0,
")\n" );
wxString GetBuildVersion()
Get the full KiCad version string.
Information pertinent to a Pcbnew printed circuit board.
int GetCopperLayerCount() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
The <class_descriptor> in the specctra spec.
STRINGS m_circuit
circuit descriptor list
LAYER_RULES m_layer_rules
Implement a <component_descriptor> in the specctra dsn spec.
The <component_order_descriptor>.
A <plane_descriptor> in the specctra dsn spec.
int FindElem(DSN_T aType, int instanceNum=0)
Find a particular instance number of a given type of ELEM.
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Write the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
ELEM_ARRAY kids
ELEM pointers.
ELEM * At(int aIndex) const
int Length() const
Return the number of ELEMs in this holder.
A base class for any DSN element class.
std::string makeHash()
Return a string which uniquely represents this ELEM among other ELEMs of the same derived class as "t...
const char * Name() const
virtual void Format(OUTPUTFORMATTER *out, int nestLevel)
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
ELEM(DSN_T aType, ELEM *aParent=nullptr)
virtual UNIT_RES * GetUnits() const
Return the units for this section.
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel)
Write the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
static STRING_FORMATTER sf
LAYER_RULES m_layer_rules
DSN_T m_grid_type
T_via | T_wire | T_via_keepout | T_place | T_snap.
DSN_T m_direction
T_x | T_y | -1 for both.
std::string m_hash
a hash string used by Compare(), not Format()ed/exported.
static int Compare(IMAGE *lhs, IMAGE *rhs)
Compare two objects of this type and returns <0, 0, or >0.
Used for <keepout_descriptor> and <plane_descriptor>.
SPECCTRA_LAYER_PAIRS layer_pairs
DSN_T layer_type
one of: T_signal, T_power, T_mixed, T_jumper
int cost_type
T_length | T_way.
int direction
[forbidden | high | medium | low | free | <positive_integer> | -1]
A <library_descriptor> in the specctra dsn specification.
void AddPadstack(PADSTACK *aPadstack)
A <net_out_descriptor> of the specctra dsn spec.
A <net_descriptor> in the DSN spec.
LAYER_RULES m_layer_rules
COMP_ORDER * m_comp_order
DSN_T m_pins_type
T_pins | T_order, type of field 'pins' below.
Hold either a via or a pad definition.
std::string m_hash
a hash string used by Compare(), not Format()ed/exported.
std::string m_padstack_id
static int Compare(PADSTACK *lhs, PADSTACK *rhs)
Compare two objects of this type and returns <0, 0, or >0.
A configuration record per the SPECCTRA DSN file spec.
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Write the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
bool routes_include_image_conductor
bool routes_include_guides
bool wires_include_testpoint
STRINGS constants
This holds pairs of strings, one pair for each constant definition.
bool routes_include_testpoint
bool generated_by_freeroute
bool space_in_quoted_tokens
Support both the <path_descriptor> and the <polygon_descriptor> per the specctra dsn spec.
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
void SetRotation(double aRotation)
std::string m_padstack_id
Implement a <placement_reference> in the specctra dsn spec.
void SetVertex(const POINT &aVertex)
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
void SetRotation(double aRotation)
std::string m_logical_part
std::string m_part_number
std::string m_component_id
reference designator
POINT point0
one of two opposite corners
STRUCTURE_OUT * structure_out
A <rule_descriptor> in the specctra dsn spec.
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
STRINGS m_rules
rules are saved in std::string form.
A <session_file_descriptor> in the specctra dsn spec.
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
A "(shape ..)" element in the specctra dsn spec.
void doUNIT(UNIT_RES *growth)
void doCOMPONENT(COMPONENT *growth)
void doWAS_IS(WAS_IS *growth)
void doPLACEMENT(PLACEMENT *growth)
void doNET_OUT(NET_OUT *growth)
void buildLayerMaps(BOARD *aBoard)
Create a few data translation structures for layer name and number mapping between the DSN::PCB struc...
void doCLASS(CLASS *growth)
void SetSESSION(SESSION *aSession)
Delete any existing SESSION and replaces it with the given one.
void doSTRUCTURE_OUT(STRUCTURE_OUT *growth)
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()
return AllCuMask( MAX_CU_LAYERS );
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.
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.