71 return SPECCTRA_LEXER::TokenName( aTok );
87 kiNdx >= 0; --kiNdx, ++pcbNdx )
89 LAYER_NUM kilayer = (kiNdx>0 && kiNdx==layerCount-1) ?
F_Cu : kiNdx;
92 pcbLayer2kicad[pcbNdx] = kilayer;
93 kicadLayer2pcb[kilayer] = pcbNdx;
104 if( i < layerCount-1 )
126 for(
int i=0; i < int(
m_layerIds.size()); ++i )
128 if( 0 == aLayerName.compare(
m_layerIds[i] ) )
138 static const char pin_def[] =
"<pin_reference>::=<component_id>-<pin_id>";
140 if( !IsSymbol( (T) CurTok() ) )
141 Expecting( pin_def );
145 if( CurTok() != T_STRING )
147 const char* toktext = CurText();
148 const char* dash = strchr( toktext,
'-' );
151 Expecting( pin_def );
153 while( toktext != dash )
154 *component_id += *toktext++;
159 *pin_id += *toktext++;
165 *component_id = CurText();
169 Expecting( pin_def );
183 static const char time_toks[] =
"<month> <day> <hour> : <minute> : <second> <year>";
185 static const char* months[] = {
186 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
187 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
NULL 192 const char* ptok = CurText();
195 for(
int m=0; months[m]; ++m )
197 if( !strcasecmp( months[m], ptok ) )
205 if( tok != T_NUMBER )
206 Expecting( time_toks );
207 mytime.tm_mday = atoi( CurText() );
210 if( tok != T_NUMBER )
211 Expecting( time_toks );
212 mytime.tm_hour = atoi( CurText() );
216 if( *CurText() !=
':' || strlen( CurText() )!=1 )
217 Expecting( time_toks );
220 if( tok != T_NUMBER )
221 Expecting( time_toks );
222 mytime.tm_min = atoi( CurText() );
226 if( *CurText() !=
':' || strlen( CurText() )!=1 )
227 Expecting( time_toks );
230 if( tok != T_NUMBER )
231 Expecting( time_toks );
232 mytime.tm_sec = atoi( CurText() );
235 if( tok != T_NUMBER )
236 Expecting( time_toks );
237 mytime.tm_year = atoi( CurText() ) - 1900;
239 *time_stamp = mktime( &mytime );
247 PushReader( &curr_reader );
249 if( NextTok() != T_LEFT )
252 if( NextTok() != T_pcb )
266 PushReader( &curr_reader );
268 if( NextTok() != T_LEFT )
271 if( NextTok() != T_session )
272 Expecting( T_session );
312 while( (tok = NextTok()) != T_RIGHT )
377 Unexpected( CurText() );
409 while( (tok = NextTok()) != T_RIGHT )
419 if( tok != T_QUOTE_DEF )
420 Expecting( T_QUOTE_DEF );
421 SetStringDelimiter( (
unsigned char) *CurText() );
427 case T_space_in_quoted_tokens:
429 if( tok!=T_on && tok!=T_off )
430 Expecting(
"on|off" );
431 SetSpaceInQuotedTokens( tok==T_on );
443 NeedSYMBOLorNUMBER();
449 NeedSYMBOLorNUMBER();
451 NeedSYMBOLorNUMBER();
458 case T_write_resolution:
459 while( (tok = NextTok()) != T_RIGHT )
462 Expecting( T_SYMBOL );
465 Expecting( T_NUMBER );
470 case T_routes_include:
471 while( (tok = NextTok()) != T_RIGHT )
481 case T_image_conductor:
485 Expecting(
"testpoint|guides|image_conductor" );
490 case T_wires_include:
492 if( tok != T_testpoint )
493 Expecting( T_testpoint );
498 case T_case_sensitive:
500 if( tok!=T_on && tok!=T_off )
501 Expecting(
"on|off" );
506 case T_via_rotate_first:
508 if( tok!=T_on && tok!=T_off )
509 Expecting(
"on|off" );
514 case T_generated_by_freeroute:
520 Unexpected( CurText() );
540 Expecting(
"inch|mil|cm|mm|um" );
544 if( tok != T_NUMBER )
545 Expecting( T_NUMBER );
547 growth->
value = atoi( CurText() );
567 Expecting(
"inch|mil|cm|mm|um" );
582 if( NextTok() != T_NUMBER )
583 Expecting( T_NUMBER );
595 while( (tok = NextTok()) != T_RIGHT )
600 if( NextTok() != T_layer_pair )
601 Expecting( T_layer_pair );
614 while( (tok = NextTok()) != T_RIGHT )
636 case T_layer_noise_weight:
643 case T_place_boundary:
665 growth->
planes.push_back( plane );
671 region =
new REGION( growth );
672 growth->
regions.push_back( region );
678 stringprop =
new STRINGPROP( growth, T_snap_angle );
679 growth->
Append( stringprop );
686 growth->
via =
new VIA( growth );
699 layer =
new LAYER( growth );
700 growth->
layers.push_back( layer );
707 growth->
rules =
new RULE( growth, T_rule );
719 case T_place_keepout:
723 case T_elongate_keepout:
725 keepout =
new KEEPOUT( growth, tok );
726 growth->
keepouts.push_back( keepout );
732 grid =
new GRID( growth );
733 growth->
grids.push_back( grid );
738 Unexpected( CurText() );
756 while( tok != T_RIGHT )
766 layer =
new LAYER( growth );
767 growth->
layers.push_back( layer );
774 growth->
rules =
new RULE( growth, T_rule );
779 Unexpected( CurText() );
793 growth->
name = CurText();
800 while( tok != T_RIGHT )
808 case T_sequence_number:
809 if( NextTok() != T_NUMBER )
810 Expecting( T_NUMBER );
818 growth->
rules =
new RULE( growth, T_rule );
843 case T_polyline_path:
864 window =
new WINDOW( growth );
865 growth->
windows.push_back( window );
870 Unexpected( CurText() );
889 while( tok != T_RIGHT )
900 while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
905 Unexpected( CurText() );
917 while( tok != T_RIGHT )
939 case T_polyline_path:
959 Unexpected( CurText() );
977 if( growth->
paths.size() )
978 Unexpected(
"rect when path already encountered" );
984 else if( tok == T_path )
987 Unexpected(
"path when rect already encountered" );
994 PATH* path =
new PATH( growth, T_path );
995 growth->
paths.push_back( path );
1000 if( tok == T_RIGHT )
1010 Expecting(
"rect|path" );
1018 if( !IsSymbol( tok ) && tok != T_NUMBER )
1019 Expecting(
"layer_id" );
1023 if( NextTok() != T_NUMBER )
1024 Expecting(
"aperture_width" );
1034 if( tok != T_NUMBER )
1035 Expecting( T_NUMBER );
1036 ptTemp.
x = strtod( CurText(),
NULL );
1038 if( NextTok() != T_NUMBER )
1039 Expecting( T_NUMBER );
1040 ptTemp.
y = strtod( CurText(),
NULL );
1042 growth->
points.push_back( ptTemp );
1044 }
while( (tok = NextTok())!=T_RIGHT && tok!=T_LEFT );
1048 if( NextTok() != T_aperture_type )
1049 Expecting( T_aperture_type );
1052 if( tok!=T_round && tok!=T_square )
1053 Expecting(
"round|square" );
1067 if( NextTok() != T_NUMBER )
1068 Expecting( T_NUMBER );
1071 if( NextTok() != T_NUMBER )
1072 Expecting( T_NUMBER );
1075 if( NextTok() != T_NUMBER )
1076 Expecting( T_NUMBER );
1079 if( NextTok() != T_NUMBER )
1080 Expecting( T_NUMBER );
1091 NeedSYMBOLorNUMBER();
1094 if( NextTok() != T_NUMBER )
1095 Expecting( T_NUMBER );
1096 growth->
diameter = strtod( CurText(), 0 );
1099 if( tok == T_NUMBER )
1101 growth->
vertex.
x = strtod( CurText(), 0 );
1103 if( NextTok() != T_NUMBER )
1104 Expecting( T_NUMBER );
1105 growth->
vertex.
y = strtod( CurText(), 0 );
1110 if( tok != T_RIGHT )
1111 Expecting( T_RIGHT );
1120 if( NextTok() != T_NUMBER )
1121 Expecting( T_NUMBER );
1124 for(
int i=0; i<3; ++i )
1126 if( NextTok() != T_NUMBER )
1127 Expecting( T_NUMBER );
1128 growth->
vertex[i].
x = strtod( CurText(), 0 );
1130 if( NextTok() != T_NUMBER )
1131 Expecting( T_NUMBER );
1132 growth->
vertex[i].
y = strtod( CurText(), 0 );
1142 growth->
value = CurText();
1152 Unexpected( CurText() );
1154 growth->
value = tok;
1164 while( (tok = NextTok()) != T_RIGHT )
1168 if( NextTok() != T_spare )
1169 Expecting( T_spare );
1171 while( (tok = NextTok()) != T_RIGHT )
1173 if( !IsSymbol( tok ) )
1174 Expecting( T_SYMBOL );
1176 growth->
spares.push_back( CurText() );
1179 else if( IsSymbol( tok ) )
1181 growth->
padstacks.push_back( CurText() );
1184 Unexpected( CurText() );
1193 while( (tok = NextTok()) != T_RIGHT )
1196 Expecting( T_LEFT );
1203 if( tok!=T_on && tok!=T_off )
1204 Expecting(
"on|off" );
1210 case T_route_to_fanout_only:
1211 case T_force_to_terminal_point:
1212 case T_same_net_checking:
1213 case T_checking_trim_by_pin:
1214 case T_noise_calculation:
1215 case T_noise_accumulation:
1216 case T_include_pins_in_crosstalk:
1218 case T_average_pair_length:
1219 case T_crosstalk_model:
1220 case T_roundoff_rotation:
1222 case T_reroute_order_viols:
1224 tokprop =
new TOKPROP( growth, tok );
1225 growth->
Append( tokprop );
1230 Unexpected( CurText() );
1241 while( (tok = NextTok()) != T_RIGHT )
1244 Expecting( T_LEFT );
1246 NeedSYMBOLorNUMBER();
1247 property.name = CurText();
1249 NeedSYMBOLorNUMBER();
1250 property.value = CurText();
1252 growth->push_back( property );
1263 if( !IsSymbol(tok) )
1264 Expecting(T_SYMBOL);
1266 growth->
name = CurText();
1268 while( (tok = NextTok()) != T_RIGHT )
1271 Expecting( T_LEFT );
1278 if( tok!=T_signal && tok!=T_power && tok!=T_mixed && tok!=T_jumper )
1279 Expecting(
"signal|power|mixed|jumper" );
1281 if( NextTok()!=T_RIGHT )
1286 growth->
rules =
new RULE( growth, T_rule );
1301 case T_positive_diagonal:
1302 case T_negative_diagonal:
1309 if( !strcmp(
"hori", CurText() ) )
1314 else if( !strcmp(
"vert", CurText() ) )
1319 Expecting(
"horizontal|vertical|orthogonal|positive_diagonal|negative_diagonal|diagonal|off" );
1321 if( NextTok()!=T_RIGHT )
1339 growth->
cost = -atoi( CurText() );
1342 Expecting(
"forbidden|high|medium|low|free|<positive_integer>|-1" );
1347 if( NextTok() != T_type )
1348 Unexpected( CurText() );
1351 if( tok!=T_length && tok!=T_way )
1352 Expecting(
"length|way" );
1355 if( NextTok()!=T_RIGHT )
1365 while( (tok = NextTok()) != T_RIGHT )
1367 if( !IsSymbol(tok) )
1368 Expecting( T_SYMBOL );
1370 growth->
use_net.push_back( CurText() );
1375 Unexpected( CurText() );
1383 std::string builder;
1384 int bracketNesting = 1;
1387 while( bracketNesting!=0 && tok!=T_EOF )
1394 else if( tok==T_RIGHT )
1397 if( bracketNesting >= 1 )
1399 if( PrevTok()!=T_LEFT && tok!=T_RIGHT && (tok!=T_LEFT || bracketNesting>2) )
1405 builder += CurText();
1414 if( bracketNesting == 1 )
1416 growth->
rules.push_back( builder );
1422 Unexpected( T_EOF );
1427 void SPECCTRA_DB::doPLACE_RULE( PLACE_RULE* growth,
bool expect_object_type )
1440 Expecting( T_LEFT );
1443 if( tok==T_object_type )
1445 if( !expect_object_type )
1459 growth->object_type = tok;
1471 growth->object_type = tok;
1474 Unexpected( CurText() );
1479 Unexpected( CurText() );
1486 if( tok != T_image_type )
1487 Expecting( T_image_type );
1490 if( tok!=T_smd && tok!=T_pin )
1491 Expecting(
"smd|pin" );
1498 if( tok != T_RIGHT )
1499 Expecting( T_RIGHT );
1526 Expecting( T_LEFT );
1546 case T_region_class:
1549 growth->
Append( stringprop );
1553 case T_region_class_class:
1556 growth->
Append( class_class );
1563 growth->
rules =
new RULE( growth, T_rule );
1568 Unexpected( CurText() );
1572 if( tok == T_RIGHT )
1574 if( !growth->
rules )
1575 Expecting( T_rule );
1587 Expecting( T_LEFT );
1589 while( (tok = NextTok()) != T_RIGHT )
1602 if( growth->
Type() == T_region_class_class )
1605 rule =
new RULE( growth, T_rule );
1612 if( growth->
Type() == T_region_class_class )
1616 growth->
Append( layer_rule );
1633 if( !IsSymbol( tok ) )
1634 Expecting(
"class_id" );
1636 growth->
class_ids.push_back( CurText() );
1641 if( !IsSymbol( tok ) )
1642 Expecting(
"class_id" );
1644 growth->
class_ids.push_back( CurText() );
1646 }
while( (tok = NextTok()) != T_RIGHT );
1662 if( NextTok() != T_NUMBER )
1663 Expecting( T_NUMBER );
1664 growth->
dimension = strtod( CurText(), 0 );
1668 while( (tok=NextTok()) != T_RIGHT )
1670 if( tok==T_direction )
1675 if( tok!=T_x && tok!=T_y )
1676 Unexpected( CurText() );
1678 if( NextTok() != T_RIGHT )
1681 else if( tok==T_offset )
1686 if( NextTok() != T_NUMBER )
1687 Expecting( T_NUMBER );
1689 growth->
offset = strtod( CurText(), 0 );
1691 if( NextTok() != T_RIGHT )
1694 else if( tok==T_image_type )
1699 if( tok!=T_smd && tok!=T_pin )
1700 Unexpected( CurText() );
1702 if( NextTok() != T_RIGHT )
1723 growth->
layer_ids.push_back( CurText() );
1725 }
while( IsSymbol(tok = NextTok()) );
1728 Expecting( T_LEFT );
1730 if( NextTok() != T_rule )
1731 Expecting( T_rule );
1733 growth->
rule =
new RULE( growth, T_rule );
1744 if( !IsSymbol( tok ) )
1745 Expecting(
"component_id" );
1750 if( tok == T_NUMBER )
1754 point.
x = strtod( CurText(), 0 );
1756 if( NextTok() != T_NUMBER )
1757 Expecting( T_NUMBER );
1758 point.
y = strtod( CurText(), 0 );
1763 if( tok!=T_front && tok!=T_back )
1764 Expecting(
"front|back" );
1767 if( NextTok() != T_NUMBER )
1768 Expecting(
"rotation" );
1772 while( (tok = NextTok()) != T_RIGHT )
1775 Expecting( T_LEFT );
1782 if( tok==T_x || tok==T_y || tok==T_xy || tok==T_off )
1785 Expecting(
"x|y|xy|off");
1790 if( tok==T_added || tok==T_deleted || tok==T_substituted )
1793 Expecting(
"added|deleted|substituted");
1796 case T_logical_part:
1800 if( !IsSymbol( tok ) )
1801 Expecting(
"logical_part_id");
1820 if( tok==T_position || tok==T_gate || tok==T_subgate || tok==T_pin )
1823 Expecting(
"position|gate|subgate|pin");
1829 growth->
rules =
new RULE( growth, T_rule );
1843 NeedSYMBOLorNUMBER();
1859 if( !IsSymbol( tok ) && tok != T_NUMBER )
1860 Expecting(
"image_id" );
1863 while( (tok = NextTok()) != T_RIGHT )
1866 Expecting( T_LEFT );
1873 place =
new PLACE( growth );
1874 growth->
places.push_back( place );
1889 while( (tok = NextTok()) != T_RIGHT )
1892 Unexpected( T_EOF );
1895 Expecting( T_LEFT );
1904 if( tok==T_resolution )
1910 case T_place_control:
1913 if( tok != T_flip_style )
1914 Expecting( T_flip_style );
1917 if( tok==T_mirror_first || tok==T_rotate_first )
1920 Expecting(
"mirror_first|rotate_first" );
1959 if( !IsSymbol( tok ) && tok!=T_NUMBER )
1960 Expecting(
"padstack_id" );
1964 while( (tok = NextTok()) != T_RIGHT )
1967 Expecting( T_LEFT );
1981 if( tok!=T_on && tok!=T_off )
1982 Expecting(
"on|off" );
1989 if( tok!=T_on && tok!=T_off )
1990 Expecting(
"on|off" );
1997 shape =
new SHAPE( growth );
2004 if( tok!=T_off && tok!=T_on )
2005 Expecting(
"off|on" );
2010 if( NextTok() != T_use_via )
2011 Expecting( T_use_via );
2014 growth->
via_id = CurText();
2029 growth->
rules =
new RULE( growth, T_rule );
2034 Unexpected( CurText() );
2050 while( (tok = NextTok()) != T_RIGHT )
2053 Expecting( T_LEFT );
2058 case T_polyline_path:
2074 if( !strcmp(
"circ", CurText() ) )
2095 growth->
shape =
new PATH( growth, tok );
2106 if( tok!=T_on && tok!=T_off )
2107 Expecting(
"on|off" );
2114 window =
new WINDOW( growth );
2115 growth->
windows.push_back( window );
2120 Unexpected( CurText() );
2147 if( !IsSymbol( tok ) && tok != T_NUMBER )
2148 Expecting(
"image_id" );
2152 while( (tok = NextTok()) != T_RIGHT )
2155 Expecting( T_LEFT );
2169 if( tok!=T_front && tok!=T_back && tok!=T_both )
2170 Expecting(
"front|back|both" );
2177 outline =
new SHAPE( growth, T_outline );
2178 growth->
Append( outline );
2184 pin =
new PIN( growth );
2185 growth->
pins.push_back( pin );
2192 growth->
rules =
new RULE( growth, tok );
2204 case T_place_keepout:
2206 case T_wire_keepout:
2207 case T_bend_keepout:
2208 case T_elongate_keepout:
2210 keepout =
new KEEPOUT( growth, tok );
2211 growth->
keepouts.push_back( keepout );
2216 Unexpected( CurText() );
2232 if( !IsSymbol( tok ) && tok!=T_NUMBER )
2233 Expecting(
"padstack_id" );
2237 while( (tok = NextTok()) != T_RIGHT )
2242 if( tok != T_rotate )
2243 Expecting( T_rotate );
2245 if( NextTok() != T_NUMBER )
2246 Expecting( T_NUMBER );
2252 if( !IsSymbol(tok) && tok!=T_NUMBER )
2253 Expecting(
"pin_id" );
2255 growth->
pin_id = CurText();
2257 if( NextTok() != T_NUMBER )
2258 Expecting( T_NUMBER );
2259 growth->
vertex.
x = strtod( CurText(), 0 );
2261 if( NextTok() != T_NUMBER )
2262 Expecting( T_NUMBER );
2263 growth->
vertex.
y = strtod( CurText(), 0 );
2287 while( (tok = NextTok()) != T_RIGHT )
2290 Expecting( T_LEFT );
2311 image =
new IMAGE( growth );
2312 growth->
images.push_back( image );
2317 Unexpected( CurText() );
2349 if( !IsSymbol( tok ) )
2350 Expecting(
"net_id" );
2352 growth->
net_id = CurText();
2354 while( (tok = NextTok()) != T_RIGHT )
2357 Expecting( T_LEFT );
2368 if( NextTok() != T_NUMBER )
2369 Expecting( T_NUMBER );
2377 pin_refs = &growth->
pins;
2381 pin_refs = &growth->
expose;
2389 pin_refs = &growth->
source;
2393 pin_refs = &growth->
load;
2403 while( (tok = NextTok()) != T_RIGHT )
2406 pin_refs->push_back(
empty );
2408 PIN_REF* pin_ref = &pin_refs->back();
2424 if( tok!=T_fix && tok!=T_normal )
2425 Expecting(
"fix|normal" );
2438 growth->
rules =
new RULE( growth, T_rule );
2451 fromto =
new FROMTO( growth );
2452 growth->
fromtos.push_back( fromto );
2457 Unexpected( CurText() );
2472 while( (tok = NextTok()) != T_RIGHT )
2475 Expecting( T_LEFT );
2482 fromto =
new FROMTO( growth );
2483 growth->
fromtos.push_back( fromto );
2495 Unexpected( CurText() );
2520 while( IsSymbol(tok = NextTok()) )
2522 growth->
net_ids.push_back( CurText() );
2526 while( tok != T_RIGHT )
2529 Expecting( T_LEFT );
2537 growth->
rules =
new RULE( growth, T_rule );
2557 std::string builder;
2558 int bracketNesting = 1;
2561 while( bracketNesting!=0 && tok!=T_EOF )
2568 else if( tok==T_RIGHT )
2571 if( bracketNesting >= 1 )
2573 T previousTok = (T) PrevTok();
2575 if( previousTok!=T_LEFT && previousTok!=T_circuit && tok!=T_RIGHT )
2581 builder += CurText();
2589 if( bracketNesting == 0 )
2591 growth->
circuit.push_back( builder );
2597 Unexpected( T_EOF );
2602 Unexpected( CurText() );
2627 while( (tok = NextTok()) != T_RIGHT )
2630 Expecting( T_LEFT );
2637 net =
new NET( growth );
2638 growth->
nets.push_back( net );
2644 myclass =
new CLASS( growth );
2645 growth->
classes.push_back( myclass );
2650 Unexpected( CurText() );
2664 while( IsSymbol(tok = NextTok()) )
2669 if( tok != T_RIGHT )
2670 Expecting( T_RIGHT );
2695 char old = SetStringDelimiter( 0 );
2697 if( !IsSymbol(NextTok() ) )
2699 SetStringDelimiter( old );
2700 Expecting( T_SYMBOL );
2704 if( !IsSymbol(NextTok() ) )
2706 SetStringDelimiter( old );
2707 Expecting( T_SYMBOL );
2709 growth->
toText = CurText();
2711 SetStringDelimiter( old );
2713 while( (tok = NextTok()) != T_RIGHT )
2716 Expecting( T_LEFT );
2723 if( tok!=T_fix && tok!=T_normal && tok!=T_soft )
2724 Expecting(
"fix|normal|soft" );
2732 growth->
rules =
new RULE( growth, T_rule );
2744 if( growth->
net_id.size() )
2747 growth->
net_id = CurText();
2754 Unexpected( CurText() );
2781 while( (tok = NextTok()) != T_RIGHT )
2784 Expecting( T_LEFT );
2803 case T_polyline_path:
2811 growth->
shape =
new PATH( growth, tok );
2823 NeedSYMBOLorNUMBER();
2824 growth->
net_id = CurText();
2829 if( NextTok() != T_NUMBER )
2830 Expecting( T_NUMBER );
2831 growth->
turret = atoi( CurText() );
2837 if( tok!=T_fix && tok!=T_route && tok!=T_normal && tok!=T_protect )
2838 Expecting(
"fix|route|normal|protect" );
2845 if( tok!=T_test && tok!=T_fanout && tok!=T_bus && tok!=T_jumper )
2846 Expecting(
"test|fanout|bus|jumper" );
2853 growth->
shield = CurText();
2859 window =
new WINDOW( growth );
2860 growth->
windows.push_back( window );
2877 Unexpected( CurText() );
2907 while( (tok = NextTok()) == T_NUMBER )
2909 point.
x = strtod( CurText(), 0 );
2911 if( NextTok() != T_NUMBER )
2912 Expecting(
"vertex.y" );
2914 point.
y = strtod( CurText(), 0 );
2916 growth->
vertexes.push_back( point );
2919 while( tok != T_RIGHT )
2922 Expecting( T_LEFT );
2929 growth->
net_id = CurText();
2934 if( NextTok() != T_NUMBER )
2935 Expecting(
"<via#>" );
2942 if( tok!=T_fix && tok!=T_route && tok!=T_normal && tok!=T_protect )
2943 Expecting(
"fix|route|normal|protect" );
2950 if( tok!=T_test && tok!=T_fanout && tok!=T_jumper && tok!=T_virtual_pin )
2951 Expecting(
"test|fanout|jumper|virtual_pin" );
2953 if( tok == T_virtual_pin )
2964 while( IsSymbol(tok) )
2969 if( tok != T_RIGHT )
2970 Expecting( T_RIGHT );
2979 Unexpected( CurText() );
3000 while( (tok = NextTok()) != T_RIGHT )
3003 Expecting( T_LEFT );
3024 wire =
new WIRE( growth );
3025 growth->
wires.push_back( wire );
3032 growth->
wire_vias.push_back( wire_via );
3037 Unexpected( CurText() );
3055 while( (tok = NextTok()) != T_RIGHT )
3058 Expecting( T_LEFT );
3063 case T_created_time:
3075 Unexpected( CurText() );
3089 while( (tok = NextTok()) != T_RIGHT )
3092 Expecting( T_LEFT );
3100 growth->
ancestors.push_back( ancestor );
3105 while( (tok = NextTok()) != T_RIGHT )
3108 Expecting( T_LEFT );
3113 case T_created_time:
3120 growth->
comments.push_back( CurText() );
3125 Unexpected( CurText() );
3131 Unexpected( CurText() );
3158 while( (tok = NextTok()) != T_RIGHT )
3161 Expecting( T_LEFT );
3208 Unexpected( CurText() );
3225 while( (tok = NextTok()) != T_RIGHT )
3229 Expecting( T_LEFT );
3249 Unexpected( CurText() );
3270 while( (tok = NextTok()) != T_RIGHT )
3273 Expecting( T_LEFT );
3288 #if 0 // Electra 2.9.1 emits two (parser ) elements in a row. 3299 case T_structure_out:
3314 while( (tok = NextTok()) != T_RIGHT )
3317 Expecting( T_LEFT );
3321 Unexpected( CurText() );
3324 net_out =
new NET_OUT( growth );
3326 growth->
net_outs.push_back( net_out );
3332 Unexpected( CurText() );
3352 NeedSYMBOLorNUMBER();
3353 growth->
net_id = CurText();
3355 while( (tok = NextTok()) != T_RIGHT )
3358 Expecting( T_LEFT );
3365 if( tok!= T_NUMBER )
3366 Expecting( T_NUMBER );
3374 growth->
rules =
new RULE( growth, tok );
3380 wire =
new WIRE( growth );
3381 growth->
wires.push_back( wire );
3388 growth->
wire_vias.push_back( wire_via );
3400 Unexpected( CurText() );
3416 growth->
net_id = CurText();
3418 while( (tok = NextTok()) != T_RIGHT )
3428 else if( tok == T_LEFT )
3433 growth->
net_id = CurText();
3437 Unexpected( CurText() );
3507 return SPECCTRA_DB::TokenName(
type );
3521 out->
Print( nestLevel,
"(%s\n",
Name() );
3525 out->
Print( nestLevel,
")\n" );
3531 for(
int i=0; i<
Length(); ++i )
3541 for(
unsigned i=0; i<
kids.size(); ++i )
3545 if( repeats == instanceNum )
3567 if( !lhs->
hash.size() )
3570 if( !rhs->
hash.size() )
3573 int result = lhs->
hash.compare( rhs->
hash );
3589 if( !lhs->
hash.size() )
3592 if( !rhs->
hash.size() )
3595 int result = lhs->
hash.compare( rhs->
hash );
3619 ELEM( T_parser, aParent )
3642 out->
Print( nestLevel,
"(host_cad \"%s\")\n",
host_cad.c_str() );
3647 const std::string& s1 = *i++;
3648 const std::string& s2 = *i++;
3652 out->
Print( nestLevel,
"(constant %s%s%s %s%s%s)\n",
3654 q2, s2.c_str(), q2 );
3658 out->
Print( nestLevel,
"(routes_include%s%s%s)\n",
3664 out->
Print( nestLevel,
"(wires_include testpoint)\n" );
3667 out->
Print( nestLevel,
"(via_rotate_first off)\n" );
3682 useMultiLine =
true;
3684 out->
Print( nestLevel,
"(%s %s%s%s\n",
Name(),
3687 out->
Print( nestLevel+1,
"%s",
"" );
3691 useMultiLine =
false;
3693 out->
Print( nestLevel,
"(%s %s%s%s",
Name(),
3706 const char* space =
" ";
3723 out->
Print( 0,
"%s(logical_part %s%s%s)", space,
3730 out->
Print( 0,
"\n" );
3738 out->
Print( nestLevel+1,
"(property \n" );
3740 for( PROPERTIES::const_iterator i =
properties.begin();
3743 i->Format( out, nestLevel+2 );
3745 out->
Print( nestLevel+1,
")\n" );
3758 out->
Print( nestLevel+1,
"(PN %s%s%s)\n",
3773 out->
Print( 0,
"%s(PN %s%s%s)", space,
3778 out->
Print( 0,
")\n" );
void LoadSESSION(const wxString &aFilename)
Function LoadSESSION is a recursive descent parser for a SPECCTRA DSN "session" file.
VIA corresponds to the <via_descriptor> in the specctra dsn spec.
void doLAYER_NOISE_WEIGHT(LAYER_NOISE_WEIGHT *growth)
PIN_REF corresponds to the <pin_reference> definition in the specctra dsn spec.
bool space_in_quoted_tokens
static int Compare(IMAGE *lhs, IMAGE *rhs)
Function Compare compares two objects of this type and returns <0, 0, or >0.
void buildLayerMaps(BOARD *aBoard)
Function buildLayerMaps creates a few data translation structures for layer name and number mapping b...
void doKEEPOUT(KEEPOUT *growth)
ELEM(DSN_T aType, ELEM *aParent=0)
NET corresponds to a <net_descriptor> in the DSN spec.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
This source file implements export and import capabilities to the specctra dsn file format.
void doCLASS_CLASS(CLASS_CLASS *growth)
STRINGS circuit
circuit descriptor list
void doGRID(GRID *growth)
DSN_T direction
T_x | T_y | -1 for both.
void doWIRE(WIRE *growth)
void doCONTROL(CONTROL *growth)
void doROUTE(ROUTE *growth)
Struct PIN_PAIR is used within the WAS_IS class below to hold a pair of PIN_REFs and corresponds to t...
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
SESSION corresponds to the <session_file_descriptor> in the specctra dsn spec.
void doTOKPROP(TOKPROP *growth)
void doLAYER(LAYER *growth)
void doSPECCTRA_LAYER_PAIR(SPECCTRA_LAYER_PAIR *growth)
static int Compare(PADSTACK *lhs, PADSTACK *rhs)
Function Compare compares two objects of this type and returns <0, 0, or >0.
const char * Name() const
void doPROPERTIES(PROPERTIES *growth)
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
void doSTRUCTURE_OUT(STRUCTURE_OUT *growth)
bool routes_include_testpoint
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel)
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
void doPLACE(PLACE *growth)
UNIT_RES is a holder for either a T_unit or T_resolution object which are usually mutually exclusive ...
DSN_T type
T_fix | T_normal.
STRINGS m_layerIds
indexed by PCB layer number
void doRESOLUTION(UNIT_RES *growth)
void doWIRING(WIRING *growth)
CLASS corresponds to the <class_descriptor> in the specctra spec.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
void doREGION(REGION *growth)
void SetPCB(PCB *aPcb)
Function SetPCB deletes any existing PCB and replaces it with the given one.
void SetRotation(double aRotation)
void doCOMPONENT(COMPONENT *growth)
A name/value tuple with unique names and optional values.
WAS_IS corresponds to the <was_is_descriptor> in the specctra dsn spec.
static PCB * MakePCB()
Function MakePCB makes a PCB with all the default ELEMs and parts on the heap.
DSN_T grid_type
T_via | T_wire | T_via_keepout | T_place | T_snap.
void doIMAGE(IMAGE *growth)
int cost_type
T_length | T_way.
STRUCTURE_OUT * structure_out
BOUNDARY * place_boundary
RULE corresponds to the <rule_descriptor> in the specctra dsn spec.
void SetVertex(const POINT &aVertex)
std::string makeHash()
Function makeHash returns a string which uniquely represents this ELEM amoung other ELEMs of the same...
This file contains miscellaneous commonly used macros and functions.
void doLIBRARY(LIBRARY *growth)
void doANCESTOR(ANCESTOR *growth)
void doWINDOW(WINDOW *growth)
void SetSESSION(SESSION *aSession)
Function SetSESSION deletes any existing SESSION and replaces it with the given one.
int findLayerName(const std::string &aLayerName) const
Function findLayerName returns the PCB layer index for a given layer name, within the specctra sessio...
void doRULE(RULE *growth)
PATH supports both the <path_descriptor> and the <polygon_descriptor> per the specctra dsn spec.
COMP_ORDER corresponds to the <component_order_descriptor>.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
DSN_T layer_type
one of: T_signal, T_power, T_mixed, T_jumper
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
void doCOMP_ORDER(COMP_ORDER *growth)
PCB_LAYER_ID
A quick note on layer IDs:
A LINE_READER that reads from an open file.
POINT point0
one of two opposite corners
std::vector< int > m_kicadLayer2pcb
maps BOARD layer number to PCB layer numbers
TOKPROP is a container for a single property whose value is another DSN_T token.
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
void doCLASS(CLASS *growth)
COPPER_PLANE corresponds to a <plane_descriptor> in the specctra dsn spec.
wxString GetBuildVersion()
Get the full KiCad version string.
bool routes_include_image_conductor
void doPADSTACK(PADSTACK *growth)
void doPATH(PATH *growth)
PLACE implements the <placement_reference> in the specctra dsn spec.
void doSUPPLY_PIN(SUPPLY_PIN *growth)
LAYER_NOISE_WEIGHT * layer_noise_weight
void doRECTANGLE(RECTANGLE *growth)
void doHISTORY(HISTORY *growth)
std::string hash
a hash string used by Compare(), not Format()ed/exported.
void readTIME(time_t *time_stamp)
Function readTIME reads a <time_stamp> which consists of 8 lexer tokens: "month date hour : minute : ...
ELEM_ARRAY kids
ELEM pointers.
void AddPadstack(PADSTACK *aPadstack)
std::string component_id
reference designator
PADSTACK holds either a via or a pad definition.
void doSTRUCTURE(STRUCTURE *growth)
void doCLASSES(CLASSES *growth)
void doWIRE_VIA(WIRE_VIA *growth)
virtual void Format(OUTPUTFORMATTER *out, int nestLevel)
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
void doCIRCLE(CIRCLE *growth)
This item represents a net.
void SetRotation(double aRotation)
int LAYER_NUM
This can be replaced with int and removed.
SHAPE corresponds to the "(shape ..)" element in the specctra dsn spec.
void doSTRINGPROP(STRINGPROP *growth)
void LoadPCB(const wxString &aFilename)
Function LoadPCB is a recursive descent parser for a SPECCTRA DSN "design" file.
void doTOPOLOGY(TOPOLOGY *growth)
COMPONENT implements the <component_descriptor> in the specctra dsn spec.
LIBRARY corresponds to the <library_descriptor> in the specctra dsn specification.
STRINGS constants
This holds pairs of strings, one pair for each constant definition.
std::vector< PCB_LAYER_ID > m_pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Struct POINT is a holder for a point in the SPECCTRA DSN coordinate system.
WIRE corresponds to <wire_shape_descriptor> in the specctra dsn spec.
std::vector< PIN_REF > PIN_REFS
void ExportPCB(const wxString &aFilename, bool aNameChange=false)
Function ExportPCB writes the internal PCB instance out as a SPECTRA DSN format file.
Information pertinent to a Pcbnew printed circuit board.
int FindElem(DSN_T aType, int instanceNum=0)
Function FindElem finds a particular instance number of a given type of ELEM.
static UNIT_RES Default
A static instance which holds the default units of T_inch and 2540000.
void doSHAPE(SHAPE *growth)
STRINGPROP is a container for a single property whose value is a string.
void readCOMPnPIN(std::string *component_id, std::string *pid_id)
Function readCOMPnPIN reads a <pin_reference> and splits it into the two parts which are on either si...
int GetCopperLayerCount() const
void doLAYER_RULE(LAYER_RULE *growth)
bool routes_include_guides
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
static bool empty(const wxTextEntryBase *aCtrl)
const char * GetTokenText(T aTok)
Function GetTokenText is in the DSN namespace and returns the C string representing a SPECCTRA_DB::ke...
NET_OUT corresponds to the <net_out_descriptor> of the specctra dsn spec.
virtual UNIT_RES * GetUnits() const
Function GetUnits returns the units for this section.
void doPLACEMENT(PLACEMENT *growth)
int cost
[forbidden | high | medium | low | free | <positive_integer> | -1]
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
ELEM * At(int aIndex) const
WIRE_VIA corresponds to <wire_via_descriptor> in the specctra dsn spec.
void doNETWORK(NETWORK *growth)
void doNET_OUT(NET_OUT *growth)
ELEM is a base class for any DSN element class.
std::string virtual_pin_name
bool wires_include_testpoint
void doCONNECT(CONNECT *growth)
SUPPLY_PIN corresponds to the <supply_pin_descriptor> in the specctra dsn spec.
void ExportSESSION(const wxString &aFilename)
Function ExportSESSION writes the internal SESSION instance out as a SPECTRA DSN format file.
std::string hash
a hash string used by Compare(), not Format()ed/exported.
KEEPOUT is used for <keepout_descriptor> and <plane_descriptor>.
void doQARC(QARC *growth)
void doSESSION(SESSION *growth)
void doPARSER(PARSER *growth)
int Length() const
Function Length returns the number of ELEMs in this ELEM.
PARSER is simply a configuration record per the SPECCTRA DSN file spec.
void doFROMTO(FROMTO *growth)
PCB_LAYER_ID ToLAYER_ID(int aLayer)
WIRING corresponds to <wiring_descriptor> in the specctra dsn spec.
void doUNIT(UNIT_RES *growth)
static STRING_FORMATTER sf
void doWAS_IS(WAS_IS *growth)
SPECCTRA_LAYER_PAIRS layer_pairs
void doBOUNDARY(BOUNDARY *growth)
STRINGS rules
rules are saved in std::string form.
bool generated_by_freeroute
DSN_T pins_type
T_pins | T_order, type of field 'pins' below.