KiCad PCB EDA Suite
specctra.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
5  * Copyright (C) 2007-2015 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef SPECCTRA_H_
26 #define SPECCTRA_H_
27 
28 
29 // see http://www.boost.org/libs/ptr_container/doc/ptr_sequence_adapter.html
30 #include <boost/ptr_container/ptr_vector.hpp>
31 
32 // see http://www.boost.org/libs/ptr_container/doc/ptr_set.html
33 #include <boost/ptr_container/ptr_set.hpp>
34 
35 #include <fctsys.h>
36 #include <specctra_lexer.h>
37 #include <pcbnew.h>
38 
39 #include <memory>
40 
41 // all outside the DSN namespace:
42 class BOARD;
43 class TRACK;
44 class VIA;
45 class NETCLASS;
46 class MODULE;
48 
49 typedef DSN::T DSN_T;
50 
51 
74 namespace DSN {
75 
76 
77 class SPECCTRA_DB;
78 
79 
86 const char* GetTokenText( T aTok );
87 
88 
94 struct POINT
95 {
96  double x;
97  double y;
98 
99  POINT() { x=0.0; y=0.0; }
100 
101  POINT( double aX, double aY ) :
102  x(aX), y(aY)
103  {
104  }
105 
106  bool operator==( const POINT& other ) const
107  {
108  return x==other.x && y==other.y;
109  }
110 
111  bool operator!=( const POINT& other ) const
112  {
113  return !( *this == other );
114  }
115 
116  POINT& operator+=( const POINT& other )
117  {
118  x += other.x;
119  y += other.y;
120  return *this;
121  }
122 
123  POINT& operator=( const POINT& other )
124  {
125  x = other.x;
126  y = other.y;
127  return *this;
128  }
129 
137  {
138  if( x == -0.0 )
139  x = 0.0;
140  if( y == -0.0 )
141  y = 0.0;
142  }
143 
152  void Format( OUTPUTFORMATTER* out, int nestLevel ) const
153  {
154  out->Print( nestLevel, " %.6g %.6g", x, y );
155  }
156 };
157 
158 typedef std::vector<std::string> STRINGS;
159 typedef std::vector<POINT> POINTS;
160 
161 struct PROPERTY
162 {
163  std::string name;
164  std::string value;
165 
174  void Format( OUTPUTFORMATTER* out, int nestLevel ) const
175  {
176  const char* quoteName = out->GetQuoteChar( name.c_str() );
177  const char* quoteValue = out->GetQuoteChar( value.c_str() );
178 
179  out->Print( nestLevel, "(%s%s%s %s%s%s)\n",
180  quoteName, name.c_str(), quoteName,
181  quoteValue, value.c_str(), quoteValue );
182  }
183 };
184 typedef std::vector<PROPERTY> PROPERTIES;
185 
186 
187 class UNIT_RES;
188 
194 class ELEM
195 {
196  friend class SPECCTRA_DB;
197 
198 protected:
201 
202 
212  std::string makeHash()
213  {
214  sf.Clear();
215  FormatContents( &sf, 0 );
216  sf.StripUseless();
217 
218  return sf.GetString();
219  }
220 
221  // avoid creating this for every compare, make static.
223 
224 
225 public:
226 
227  ELEM( DSN_T aType, ELEM* aParent = 0 );
228 
229  virtual ~ELEM();
230 
231  DSN_T Type() const { return type; }
232 
233  const char* Name() const;
234 
235 
242  virtual UNIT_RES* GetUnits() const;
243 
252  virtual void Format( OUTPUTFORMATTER* out, int nestLevel );
253 
254 
264  virtual void FormatContents( OUTPUTFORMATTER* out, int nestLevel )
265  {
266  // overridden in ELEM_HOLDER
267  }
268 
269  void SetParent( ELEM* aParent )
270  {
271  parent = aParent;
272  }
273 };
274 
275 
281 class ELEM_HOLDER : public ELEM
282 {
283  friend class SPECCTRA_DB;
284 
285  typedef boost::ptr_vector<ELEM> ELEM_ARRAY;
286 
287  ELEM_ARRAY kids;
288 
289 public:
290 
291  ELEM_HOLDER( DSN_T aType, ELEM* aParent = 0 ) :
292  ELEM( aType, aParent )
293  {
294  }
295 
296  virtual void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override;
297 
298 
299  //-----< list operations >--------------------------------------------
300 
308  int FindElem( DSN_T aType, int instanceNum = 0 );
309 
310 
316  int Length() const
317  {
318  return kids.size();
319  }
320 
321  void Append( ELEM* aElem )
322  {
323  kids.push_back( aElem );
324  }
325 
326  ELEM* Replace( int aIndex, ELEM* aElem )
327  {
328  ELEM_ARRAY::auto_type ret = kids.replace( aIndex, aElem );
329  return ret.release();
330  }
331 
332  ELEM* Remove( int aIndex )
333  {
334  ELEM_ARRAY::auto_type ret = kids.release( kids.begin()+aIndex );
335  return ret.release();
336  }
337 
338  void Insert( int aIndex, ELEM* aElem )
339  {
340  kids.insert( kids.begin()+aIndex, aElem );
341  }
342 
343  ELEM* At( int aIndex ) const
344  {
345  // we have varying sized objects and are using polymorphism, so we
346  // must return a pointer not a reference.
347  return (ELEM*) &kids[aIndex];
348  }
349 
350  ELEM* operator[]( int aIndex ) const
351  {
352  return At( aIndex );
353  }
354 
355  void Delete( int aIndex )
356  {
357  kids.erase( kids.begin()+aIndex );
358  }
359 };
360 
361 
367 class PARSER : public ELEM
368 {
369  friend class SPECCTRA_DB;
370 
380 
382  STRINGS constants;
383 
384  std::string host_cad;
385  std::string host_version;
386 
387 
388 public:
389 
390  PARSER( ELEM* aParent );
391 
392  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override;
393 };
394 
395 
401 class UNIT_RES : public ELEM
402 {
403  friend class SPECCTRA_DB;
404 
406  int value;
407 
408 public:
409 
415 
416  UNIT_RES( ELEM* aParent, DSN_T aType ) :
417  ELEM( aType, aParent )
418  {
419  units = T_inch;
420  value = 2540000;
421  }
422 
423  DSN_T GetEngUnits() const { return units; }
424  int GetValue() const { return value; }
425 
426  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
427  {
428  if( type == T_unit )
429  out->Print( nestLevel, "(%s %s)\n", Name(),
430  GetTokenText(units) );
431 
432  else // T_resolution
433  out->Print( nestLevel, "(%s %s %d)\n", Name(),
434  GetTokenText(units), value );
435  }
436 };
437 
438 
439 class RECTANGLE : public ELEM
440 {
441  friend class SPECCTRA_DB;
442 
443  std::string layer_id;
444 
447 
448 public:
449 
450  RECTANGLE( ELEM* aParent ) :
451  ELEM( T_rect, aParent )
452  {
453  }
454 
455  void SetLayerId( const char* aLayerId )
456  {
457  layer_id = aLayerId;
458  }
459 
460  void SetCorners( const POINT& aPoint0, const POINT& aPoint1 )
461  {
462  point0 = aPoint0;
463  point0.FixNegativeZero();
464 
465  point1 = aPoint1;
466  point1.FixNegativeZero();
467  }
468 
469  POINT GetOrigin() { return point0; }
470  POINT GetEnd() { return point1; }
471 
472  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
473  {
474  const char* newline = nestLevel ? "\n" : "";
475 
476  const char* quote = out->GetQuoteChar( layer_id.c_str() );
477 
478  out->Print( nestLevel, "(%s %s%s%s %.6g %.6g %.6g %.6g)%s",
479  Name(),
480  quote, layer_id.c_str(), quote,
481  point0.x, point0.y,
482  point1.x, point1.y,
483  newline );
484  }
485 };
486 
487 
492 class RULE : public ELEM
493 {
494  friend class SPECCTRA_DB;
495 
496  STRINGS rules;
497 
498 public:
499 
500  RULE( ELEM* aParent, DSN_T aType ) :
501  ELEM( aType, aParent )
502  {
503  }
504 
505  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
506  {
507  out->Print( nestLevel, "(%s", Name() );
508 
509  bool singleLine;
510 
511  if( rules.size() == 1 )
512  {
513  singleLine = true;
514  out->Print( 0, " %s)", rules.begin()->c_str() );
515  }
516 
517  else
518  {
519  out->Print( 0, "\n" );
520  singleLine = false;
521  for( STRINGS::const_iterator i = rules.begin(); i!=rules.end(); ++i )
522  out->Print( nestLevel+1, "%s\n", i->c_str() );
523  out->Print( nestLevel, ")" );
524  }
525 
526  if( nestLevel || !singleLine )
527  out->Print( 0, "\n" );
528  }
529 };
530 
531 
532 class LAYER_RULE : public ELEM
533 {
534  friend class SPECCTRA_DB;
535 
536  STRINGS layer_ids;
538 
539 public:
540 
541  LAYER_RULE( ELEM* aParent ) :
542  ELEM( T_layer_rule, aParent )
543  {
544  rule = 0;
545  }
547  {
548  delete rule;
549  }
550 
551  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
552  {
553  out->Print( nestLevel, "(%s", Name() );
554 
555  for( STRINGS::const_iterator i=layer_ids.begin(); i!=layer_ids.end(); ++i )
556  {
557  const char* quote = out->GetQuoteChar( i->c_str() );
558  out->Print( 0, " %s%s%s", quote, i->c_str(), quote );
559  }
560  out->Print( 0 , "\n" );
561 
562  if( rule )
563  rule->Format( out, nestLevel+1 );
564 
565  out->Print( nestLevel, ")\n" );
566  }
567 };
568 typedef boost::ptr_vector<LAYER_RULE> LAYER_RULES;
569 
570 
576 class PATH : public ELEM
577 {
578  friend class SPECCTRA_DB;
579 
580  std::string layer_id;
582 
583  POINTS points;
585 
586 public:
587 
588  PATH( ELEM* aParent, DSN_T aType = T_path ) :
589  ELEM( aType, aParent )
590  {
591  aperture_width = 0.0;
592  aperture_type = T_round;
593  }
594 
595  void AppendPoint( const POINT& aPoint )
596  {
597  points.push_back( aPoint );
598  }
599 
600  POINTS& GetPoints() {return points; }
601 
602  void SetLayerId( const char* aLayerId )
603  {
604  layer_id = aLayerId;
605  }
606 
607  void SetAperture( double aWidth )
608  {
609  aperture_width = aWidth;
610  }
611 
612  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
613  {
614  const char* newline = nestLevel ? "\n" : "";
615 
616  const char* quote = out->GetQuoteChar( layer_id.c_str() );
617 
618  const int RIGHTMARGIN = 70;
619  int perLine = out->Print( nestLevel, "(%s %s%s%s %.6g",
620  Name(),
621  quote, layer_id.c_str(), quote,
622  aperture_width );
623 
624  int wrapNest = std::max( nestLevel+1, 6 );
625  for( unsigned i=0; i<points.size(); ++i )
626  {
627  if( perLine > RIGHTMARGIN )
628  {
629  out->Print( 0, "\n" );
630  perLine = out->Print( wrapNest, "%s", "" );
631  }
632  else
633  perLine += out->Print( 0, " " );
634 
635  perLine += out->Print( 0, "%.6g %.6g", points[i].x, points[i].y );
636  }
637 
638  if( aperture_type == T_square )
639  {
640  out->Print( 0, "(aperture_type square)" );
641  }
642 
643  out->Print( 0, ")%s", newline );
644  }
645 };
646 typedef boost::ptr_vector<PATH> PATHS;
647 
648 
649 class BOUNDARY : public ELEM
650 {
651  friend class SPECCTRA_DB;
652 
653  // only one or the other of these two is used, not both
654  PATHS paths;
656 
657 
658 public:
659 
660  BOUNDARY( ELEM* aParent, DSN_T aType = T_boundary ) :
661  ELEM( aType, aParent )
662  {
663  rectangle = 0;
664  }
665 
667  {
668  delete rectangle;
669  }
670 
674  void GetCorners( std::vector<double>& aBuffer )
675  {
676  if( rectangle )
677  {
678  aBuffer.push_back( rectangle->GetOrigin().x );
679  aBuffer.push_back( rectangle->GetOrigin().y );
680 
681  aBuffer.push_back( rectangle->GetOrigin().x );
682  aBuffer.push_back( rectangle->GetEnd().y );
683 
684  aBuffer.push_back( rectangle->GetEnd().x );
685  aBuffer.push_back( rectangle->GetEnd().y );
686 
687  aBuffer.push_back( rectangle->GetEnd().x );
688  aBuffer.push_back( rectangle->GetOrigin().y );
689  }
690  else
691  {
692  for( PATHS::iterator i=paths.begin(); i!=paths.end(); ++i )
693  {
694  POINTS& plist = i->GetPoints();
695  for( unsigned jj = 0; jj < plist.size(); jj++ )
696  {
697  aBuffer.push_back( plist[jj].x );
698  aBuffer.push_back( plist[jj].y );
699  }
700  }
701  }
702  }
703 
704 
705  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
706  {
707  out->Print( nestLevel, "(%s\n", Name() );
708 
709  if( rectangle )
710  rectangle->Format( out, nestLevel+1 );
711  else
712  {
713  for( PATHS::iterator i=paths.begin(); i!=paths.end(); ++i )
714  i->Format( out, nestLevel+1 );
715  }
716 
717  out->Print( nestLevel, ")\n" );
718  }
719 };
720 
721 
722 class CIRCLE : public ELEM
723 {
724  friend class SPECCTRA_DB;
725 
726  std::string layer_id;
727 
728  double diameter;
729  POINT vertex; // POINT's constructor sets to (0,0)
730 
731 public:
732  CIRCLE( ELEM* aParent ) :
733  ELEM( T_circle, aParent )
734  {
735  diameter = 0.0;
736  }
737 
738  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
739  {
740  const char* newline = nestLevel ? "\n" : "";
741 
742  const char* quote = out->GetQuoteChar( layer_id.c_str() );
743  out->Print( nestLevel, "(%s %s%s%s %.6g", Name(),
744  quote, layer_id.c_str(), quote,
745  diameter );
746 
747  if( vertex.x!=0.0 || vertex.y!=0.0 )
748  out->Print( 0, " %.6g %.6g)%s", vertex.x, vertex.y, newline );
749  else
750  out->Print( 0, ")%s", newline );
751  }
752 
753  void SetLayerId( const char* aLayerId )
754  {
755  layer_id = aLayerId;
756  }
757 
758  void SetDiameter( double aDiameter )
759  {
760  diameter = aDiameter;
761  }
762 
763  void SetVertex( const POINT& aVertex )
764  {
765  vertex = aVertex;
766  }
767 };
768 
769 
770 class QARC : public ELEM
771 {
772  friend class SPECCTRA_DB;
773 
774  std::string layer_id;
777 
778 public:
779  QARC( ELEM* aParent ) :
780  ELEM( T_qarc, aParent )
781  {
782  aperture_width = 0.0;
783  }
784 
785  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
786  {
787  const char* newline = nestLevel ? "\n" : "";
788 
789  const char* quote = out->GetQuoteChar( layer_id.c_str() );
790  out->Print( nestLevel, "(%s %s%s%s %.6g", Name() ,
791  quote, layer_id.c_str(), quote,
793 
794  for( int i=0; i<3; ++i )
795  out->Print( 0, " %.6g %.6g", vertex[i].x, vertex[i].y );
796 
797  out->Print( 0, ")%s", newline );
798  }
799 
800  void SetLayerId( const char* aLayerId )
801  {
802  layer_id = aLayerId;
803  }
804  void SetStart( const POINT& aStart )
805  {
806  vertex[0] = aStart;
807  // no -0.0 on the printouts!
808  vertex[0].FixNegativeZero();
809  }
810  void SetEnd( const POINT& aEnd )
811  {
812  vertex[1] = aEnd;
813  // no -0.0 on the printouts!
814  vertex[1].FixNegativeZero();
815  }
816  void SetCenter( const POINT& aCenter )
817  {
818  vertex[2] = aCenter;
819  // no -0.0 on the printouts!
820  vertex[2].FixNegativeZero();
821  }
822 };
823 
824 
825 class WINDOW : public ELEM
826 {
827  friend class SPECCTRA_DB;
828 
829 protected:
830  /* <shape_descriptor >::=
831  [<rectangle_descriptor> |
832  <circle_descriptor> |
833  <polygon_descriptor> |
834  <path_descriptor> |
835  <qarc_descriptor> ]
836  */
838 
839 public:
840 
841  WINDOW( ELEM* aParent, DSN_T aType = T_window ) :
842  ELEM( aType, aParent )
843  {
844  shape = 0;
845  }
846 
848  {
849  delete shape;
850  }
851 
852  void SetShape( ELEM* aShape )
853  {
854  delete shape;
855  shape = aShape;
856 
857  if( aShape )
858  {
859  wxASSERT(aShape->Type()==T_rect || aShape->Type()==T_circle
860  || aShape->Type()==T_qarc || aShape->Type()==T_path
861  || aShape->Type()==T_polygon);
862 
863  aShape->SetParent( this );
864  }
865  }
866 
867  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
868  {
869  out->Print( nestLevel, "(%s ", Name() );
870 
871  if( shape )
872  shape->Format( out, 0 );
873 
874  out->Print( 0, ")\n" );
875  }
876 };
877 typedef boost::ptr_vector<WINDOW> WINDOWS;
878 
879 
884 class KEEPOUT : public ELEM
885 {
886  friend class SPECCTRA_DB;
887 
888 protected:
889  std::string name;
893 
894  WINDOWS windows;
895 
896  /* <shape_descriptor >::=
897  [<rectangle_descriptor> |
898  <circle_descriptor> |
899  <polygon_descriptor> |
900  <path_descriptor> |
901  <qarc_descriptor> ]
902  */
904 
905 public:
906 
912  KEEPOUT( ELEM* aParent, DSN_T aType ) :
913  ELEM( aType, aParent )
914  {
915  rules = 0;
916  place_rules = 0;
917  shape = 0;
918 
919  sequence_number = -1;
920  }
921 
923  {
924  delete rules;
925  delete place_rules;
926  delete shape;
927  }
928 
929  void SetShape( ELEM* aShape )
930  {
931  delete shape;
932  shape = aShape;
933 
934  if( aShape )
935  {
936  wxASSERT(aShape->Type()==T_rect || aShape->Type()==T_circle
937  || aShape->Type()==T_qarc || aShape->Type()==T_path
938  || aShape->Type()==T_polygon);
939 
940  aShape->SetParent( this );
941  }
942  }
943 
944  void AddWindow( WINDOW* aWindow )
945  {
946  aWindow->SetParent( this );
947  windows.push_back( aWindow );
948  }
949 
950  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
951  {
952  const char* newline = "\n";
953 
954  out->Print( nestLevel, "(%s", Name() );
955 
956  if( name.size() )
957  {
958  const char* quote = out->GetQuoteChar( name.c_str() );
959  out->Print( 0, " %s%s%s", quote, name.c_str(), quote );
960  }
961  // Could be not needed:
962 #if 1
963  else
964  out->Print( 0, " \"\"" ); // the zone with no name or net_code == 0
965 #endif
966 
967  if( sequence_number != -1 )
968  out->Print( 0, " (sequence_number %d)", sequence_number );
969 
970  if( shape )
971  {
972  out->Print( 0, " " );
973  shape->Format( out, 0 );
974  }
975 
976  if( rules )
977  {
978  out->Print( 0, "%s", newline );
979  newline = "";
980  rules->Format( out, nestLevel+1 );
981  }
982 
983  if( place_rules )
984  {
985  out->Print( 0, "%s", newline );
986  newline = "";
987  place_rules->Format( out, nestLevel+1 );
988  }
989 
990  if( windows.size() )
991  {
992  out->Print( 0, "%s", newline );
993  newline = "";
994 
995  for( WINDOWS::iterator i=windows.begin(); i!=windows.end(); ++i )
996  i->Format( out, nestLevel+1 );
997 
998  out->Print( nestLevel, ")\n" );
999  }
1000  else
1001  out->Print( 0, ")\n" );
1002  }
1003 };
1004 typedef boost::ptr_vector<KEEPOUT> KEEPOUTS;
1005 
1006 
1011 class VIA : public ELEM
1012 {
1013  friend class SPECCTRA_DB;
1014 
1015  STRINGS padstacks;
1016  STRINGS spares;
1017 
1018 public:
1019 
1020  VIA( ELEM* aParent ) :
1021  ELEM( T_via, aParent )
1022  {
1023  }
1024 
1025  void AppendVia( const char* aViaName )
1026  {
1027  padstacks.push_back( aViaName );
1028  }
1029 
1030  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1031  {
1032  const int RIGHTMARGIN = 80;
1033  int perLine = out->Print( nestLevel, "(%s", Name() );
1034 
1035  for( STRINGS::iterator i=padstacks.begin(); i!=padstacks.end(); ++i )
1036  {
1037  if( perLine > RIGHTMARGIN )
1038  {
1039  out->Print( 0, "\n" );
1040  perLine = out->Print( nestLevel+1, "%s", "");
1041  }
1042 
1043  const char* quote = out->GetQuoteChar( i->c_str() );
1044  perLine += out->Print( 0, " %s%s%s", quote, i->c_str(), quote );
1045  }
1046 
1047  if( spares.size() )
1048  {
1049  out->Print( 0, "\n" );
1050 
1051  perLine = out->Print( nestLevel+1, "(spare" );
1052 
1053  for( STRINGS::iterator i=spares.begin(); i!=spares.end(); ++i )
1054  {
1055  if( perLine > RIGHTMARGIN )
1056  {
1057  out->Print( 0, "\n" );
1058  perLine = out->Print( nestLevel+2, "%s", "");
1059  }
1060  const char* quote = out->GetQuoteChar( i->c_str() );
1061  perLine += out->Print( 0, " %s%s%s", quote, i->c_str(), quote );
1062  }
1063 
1064  out->Print( 0, ")" );
1065  }
1066 
1067  out->Print( 0, ")\n" );
1068  }
1069 };
1070 
1071 
1072 class CLASSES : public ELEM
1073 {
1074  friend class SPECCTRA_DB;
1075 
1076  STRINGS class_ids;
1077 
1078 public:
1079  CLASSES( ELEM* aParent ) :
1080  ELEM( T_classes, aParent )
1081  {
1082  }
1083 
1084  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
1085  {
1086  for( STRINGS::iterator i=class_ids.begin(); i!=class_ids.end(); ++i )
1087  {
1088  const char* quote = out->GetQuoteChar( i->c_str() );
1089  out->Print( nestLevel, "%s%s%s\n", quote, i->c_str(), quote );
1090  }
1091  }
1092 };
1093 
1094 
1095 class CLASS_CLASS : public ELEM_HOLDER
1096 {
1097  friend class SPECCTRA_DB;
1098 
1100 
1101  /* rule | layer_rule are put into the kids container.
1102  */
1103 
1104 
1105 public:
1106 
1112  CLASS_CLASS( ELEM* aParent, DSN_T aType ) :
1113  ELEM_HOLDER( aType, aParent )
1114  {
1115  classes = 0;
1116  }
1117 
1119  {
1120  delete classes;
1121  }
1122 
1123  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
1124  {
1125  if( classes )
1126  classes->Format( out, nestLevel );
1127 
1128  // format the kids
1129  ELEM_HOLDER::FormatContents( out, nestLevel );
1130  }
1131 };
1132 
1133 
1134 class CONTROL : public ELEM_HOLDER
1135 {
1136  friend class SPECCTRA_DB;
1137 
1140 
1141 public:
1142  CONTROL( ELEM* aParent ) :
1143  ELEM_HOLDER( T_control, aParent )
1144  {
1145  via_at_smd = false;
1146  via_at_smd_grid_on = false;
1147  }
1148 
1150  {
1151  }
1152 
1153  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1154  {
1155  out->Print( nestLevel, "(%s\n", Name() );
1156 
1157  //if( via_at_smd )
1158  {
1159  out->Print( nestLevel+1, "(via_at_smd %s", via_at_smd ? "on" : "off" );
1160  if( via_at_smd_grid_on )
1161  out->Print( 0, " grid %s", via_at_smd_grid_on ? "on" : "off" );
1162 
1163  out->Print( 0, ")\n" );
1164  }
1165 
1166  for( int i=0; i<Length(); ++i )
1167  {
1168  At(i)->Format( out, nestLevel+1 );
1169  }
1170 
1171  out->Print( nestLevel, ")\n" );
1172  }
1173 };
1174 
1175 
1176 class LAYER : public ELEM
1177 {
1178  friend class SPECCTRA_DB;
1179 
1180  std::string name;
1183  int cost;
1186  STRINGS use_net;
1187 
1188  PROPERTIES properties;
1189 
1190 public:
1191 
1192  LAYER( ELEM* aParent ) :
1193  ELEM( T_layer, aParent )
1194  {
1195  layer_type = T_signal;
1196  direction = -1;
1197  cost = -1;
1198  cost_type = -1;
1199 
1200  rules = 0;
1201  }
1202 
1204  {
1205  delete rules;
1206  }
1207 
1208  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1209  {
1210  const char* quote = out->GetQuoteChar( name.c_str() );
1211 
1212  out->Print( nestLevel, "(%s %s%s%s\n", Name(),
1213  quote, name.c_str(), quote );
1214 
1215  out->Print( nestLevel+1, "(type %s)\n", GetTokenText( layer_type ) );
1216 
1217  if( properties.size() )
1218  {
1219  out->Print( nestLevel+1, "(property\n" );
1220 
1221  for( PROPERTIES::iterator i = properties.begin(); i != properties.end(); ++i )
1222  {
1223  i->Format( out, nestLevel+2 );
1224  }
1225  out->Print( nestLevel+1, ")\n" );
1226  }
1227 
1228  if( direction != -1 )
1229  out->Print( nestLevel+1, "(direction %s)\n",
1230  GetTokenText( (DSN_T)direction ) );
1231 
1232  if( rules )
1233  rules->Format( out, nestLevel+1 );
1234 
1235  if( cost != -1 )
1236  {
1237  if( cost < 0 )
1238  out->Print( nestLevel+1, "(cost %d", -cost ); // positive integer, stored as negative
1239  else
1240  out->Print( nestLevel+1, "(cost %s", GetTokenText( (DSN_T)cost ) );
1241 
1242  if( cost_type != -1 )
1243  out->Print( 0, " (type %s)", GetTokenText( (DSN_T)cost_type ) );
1244 
1245  out->Print( 0, ")\n" );
1246  }
1247 
1248  if( use_net.size() )
1249  {
1250  out->Print( nestLevel+1, "(use_net" );
1251  for( STRINGS::const_iterator i = use_net.begin(); i!=use_net.end(); ++i )
1252  {
1253  quote = out->GetQuoteChar( i->c_str() );
1254  out->Print( 0, " %s%s%s", quote, i->c_str(), quote );
1255  }
1256  out->Print( 0, ")\n" );
1257  }
1258 
1259  out->Print( nestLevel, ")\n" );
1260  }
1261 };
1262 
1263 typedef boost::ptr_vector<LAYER> LAYERS;
1264 
1265 
1267 {
1268  friend class SPECCTRA_DB;
1269 
1270  std::string layer_id0;
1271  std::string layer_id1;
1272 
1274 
1275 public:
1277  ELEM( T_layer_pair, aParent )
1278  {
1279  layer_weight = 0.0;
1280  }
1281 
1282  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1283  {
1284  const char* quote0 = out->GetQuoteChar( layer_id0.c_str() );
1285  const char* quote1 = out->GetQuoteChar( layer_id1.c_str() );
1286 
1287  out->Print( nestLevel, "(%s %s%s%s %s%s%s %.6g)\n", Name(),
1288  quote0, layer_id0.c_str(), quote0,
1289  quote1, layer_id1.c_str(), quote1,
1290  layer_weight );
1291  }
1292 };
1293 typedef boost::ptr_vector<SPECCTRA_LAYER_PAIR> SPECCTRA_LAYER_PAIRS;
1294 
1295 
1296 class LAYER_NOISE_WEIGHT : public ELEM
1297 {
1298  friend class SPECCTRA_DB;
1299 
1300  SPECCTRA_LAYER_PAIRS layer_pairs;
1301 
1302 public:
1303 
1304  LAYER_NOISE_WEIGHT( ELEM* aParent ) :
1305  ELEM( T_layer_noise_weight, aParent )
1306  {
1307  }
1308 
1309  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1310  {
1311  out->Print( nestLevel, "(%s\n", Name() );
1312 
1313  for( SPECCTRA_LAYER_PAIRS::iterator i=layer_pairs.begin(); i!=layer_pairs.end(); ++i )
1314  i->Format( out, nestLevel+1 );
1315 
1316  out->Print( nestLevel, ")\n" );
1317  }
1318 };
1319 
1320 
1325 class COPPER_PLANE : public KEEPOUT
1326 {
1327  friend class SPECCTRA_DB;
1328 
1329 public:
1330  COPPER_PLANE( ELEM* aParent ) :
1331  KEEPOUT( aParent, T_plane )
1332  {}
1333 };
1334 typedef boost::ptr_vector<COPPER_PLANE> COPPER_PLANES;
1335 
1336 
1342 class TOKPROP : public ELEM
1343 {
1344  friend class SPECCTRA_DB;
1345 
1347 
1348 public:
1349 
1350  TOKPROP( ELEM* aParent, DSN_T aType ) :
1351  ELEM( aType, aParent )
1352  {
1353  // Do not leave uninitialized members
1354  value = T_NONE;
1355  }
1356 
1357  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1358  {
1359  out->Print( nestLevel, "(%s %s)\n", Name(),
1360  GetTokenText( value ) );
1361  }
1362 };
1363 
1364 
1370 class STRINGPROP : public ELEM
1371 {
1372  friend class SPECCTRA_DB;
1373 
1374  std::string value;
1375 
1376 public:
1377 
1378  STRINGPROP( ELEM* aParent, DSN_T aType ) :
1379  ELEM( aType, aParent )
1380  {
1381  }
1382 
1383  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1384  {
1385  const char* quote = out->GetQuoteChar( value.c_str() );
1386 
1387  out->Print( nestLevel, "(%s %s%s%s)\n", Name(),
1388  quote, value.c_str(), quote );
1389  }
1390 };
1391 
1392 
1393 class REGION : public ELEM_HOLDER
1394 {
1395  friend class SPECCTRA_DB;
1396 
1397  std::string region_id;
1398 
1399  //-----<mutually exclusive>--------------------------------------
1402  //-----</mutually exclusive>-------------------------------------
1403 
1404  /* region_net | region_class | region_class_class are all mutually
1405  exclusive and are put into the kids container.
1406  */
1407 
1409 
1410 public:
1411  REGION( ELEM* aParent ) :
1412  ELEM_HOLDER( T_region, aParent )
1413  {
1414  rectangle = 0;
1415  polygon = 0;
1416  rules = 0;
1417  }
1418 
1420  {
1421  delete rectangle;
1422  delete polygon;
1423  delete rules;
1424  }
1425 
1426  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
1427  {
1428  if( region_id.size() )
1429  {
1430  const char* quote = out->GetQuoteChar( region_id.c_str() );
1431  out->Print( nestLevel, "%s%s%s\n", quote, region_id.c_str(), quote );
1432  }
1433 
1434  if( rectangle )
1435  rectangle->Format( out, nestLevel );
1436 
1437  if( polygon )
1438  polygon->Format( out, nestLevel );
1439 
1440  ELEM_HOLDER::FormatContents( out, nestLevel );
1441 
1442  if( rules )
1443  rules->Format( out, nestLevel );
1444  }
1445 };
1446 
1447 
1448 class GRID : public ELEM
1449 {
1450  friend class SPECCTRA_DB;
1451 
1453  double dimension;
1455  double offset;
1457 
1458 public:
1459 
1460  GRID( ELEM* aParent ) :
1461  ELEM( T_grid, aParent )
1462  {
1463  grid_type = T_via;
1464  direction = T_NONE;
1465  dimension = 0.0;
1466  offset = 0.0;
1467  image_type= T_NONE;
1468  }
1469 
1470  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1471  {
1472  out->Print( nestLevel, "(%s %s %.6g",
1473  Name(),
1474  GetTokenText( grid_type ), dimension );
1475 
1476  if( grid_type == T_place )
1477  {
1478  if( image_type==T_smd || image_type==T_pin )
1479  out->Print( 0, " (image_type %s)", GetTokenText( image_type ) );
1480  }
1481  else
1482  {
1483  if( direction==T_x || direction==T_y )
1484  out->Print( 0, " (direction %s)", GetTokenText( direction ) );
1485  }
1486 
1487  if( offset != 0.0 )
1488  out->Print( 0, " (offset %.6g)", offset );
1489 
1490  out->Print( 0, ")\n");
1491  }
1492 };
1493 
1494 
1495 class STRUCTURE_OUT : public ELEM
1496 {
1497  friend class SPECCTRA_DB;
1498 
1499  LAYERS layers;
1501 
1502 public:
1503  STRUCTURE_OUT( ELEM* aParent ) :
1504  ELEM( T_structure_out, aParent )
1505  {
1506  rules = 0;
1507  }
1508 
1510  {
1511  delete rules;
1512  }
1513 
1514  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
1515  {
1516  for( LAYERS::iterator i=layers.begin(); i!=layers.end(); ++i )
1517  i->Format( out, nestLevel );
1518 
1519  if( rules )
1520  rules->Format( out, nestLevel );
1521  }
1522 };
1523 
1524 
1525 class STRUCTURE : public ELEM_HOLDER
1526 {
1527  friend class SPECCTRA_DB;
1528 
1530 
1531  LAYERS layers;
1532 
1534 
1540 
1541  KEEPOUTS keepouts;
1542 
1543  COPPER_PLANES planes;
1544 
1545  typedef boost::ptr_vector<REGION> REGIONS;
1546  REGIONS regions;
1547 
1549 
1550  typedef boost::ptr_vector<GRID> GRIDS;
1551  GRIDS grids;
1552 
1553 public:
1554 
1555  STRUCTURE( ELEM* aParent ) :
1556  ELEM_HOLDER( T_structure, aParent )
1557  {
1558  unit = 0;
1559  layer_noise_weight = 0;
1560  boundary = 0;
1561  place_boundary = 0;
1562  via = 0;
1563  control = 0;
1564  rules = 0;
1565  place_rules = 0;
1566  }
1567 
1569  {
1570  delete unit;
1571  delete layer_noise_weight;
1572  delete boundary;
1573  delete place_boundary;
1574  delete via;
1575  delete control;
1576  delete rules;
1577  delete place_rules;
1578  }
1579 
1580  void SetBOUNDARY( BOUNDARY *aBoundary )
1581  {
1582  delete boundary;
1583  boundary = aBoundary;
1584  if( boundary )
1585  {
1586  boundary->SetParent( this );
1587  }
1588  }
1589 
1590  void SetPlaceBOUNDARY( BOUNDARY *aBoundary )
1591  {
1592  delete place_boundary;
1593  place_boundary = aBoundary;
1594  if( place_boundary )
1595  place_boundary->SetParent( this );
1596  }
1597 
1598  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
1599  {
1600  if( unit )
1601  unit->Format( out, nestLevel );
1602 
1603  for( LAYERS::iterator i=layers.begin(); i!=layers.end(); ++i )
1604  i->Format( out, nestLevel );
1605 
1606  if( layer_noise_weight )
1607  layer_noise_weight->Format( out, nestLevel );
1608 
1609  if( boundary )
1610  boundary->Format( out, nestLevel );
1611 
1612  if( place_boundary )
1613  place_boundary->Format( out, nestLevel );
1614 
1615  for( COPPER_PLANES::iterator i=planes.begin(); i!=planes.end(); ++i )
1616  i->Format( out, nestLevel );
1617 
1618  for( REGIONS::iterator i=regions.begin(); i!=regions.end(); ++i )
1619  i->Format( out, nestLevel );
1620 
1621  for( KEEPOUTS::iterator i=keepouts.begin(); i!=keepouts.end(); ++i )
1622  i->Format( out, nestLevel );
1623 
1624  if( via )
1625  via->Format( out, nestLevel );
1626 
1627  if( control )
1628  control->Format( out, nestLevel );
1629 
1630  for( int i=0; i<Length(); ++i )
1631  {
1632  At(i)->Format( out, nestLevel );
1633  }
1634 
1635  if( rules )
1636  rules->Format( out, nestLevel );
1637 
1638  if( place_rules )
1639  place_rules->Format( out, nestLevel );
1640 
1641  for( GRIDS::iterator i=grids.begin(); i!=grids.end(); ++i )
1642  i->Format( out, nestLevel );
1643  }
1644 
1645  UNIT_RES* GetUnits() const override
1646  {
1647  if( unit )
1648  return unit;
1649 
1650  return ELEM::GetUnits();
1651  }
1652 };
1653 
1654 
1659 class PLACE : public ELEM
1660 {
1661  friend class SPECCTRA_DB;
1662 
1663  std::string component_id;
1664 
1666 
1667  double rotation;
1668 
1671 
1674 
1675  std::string logical_part;
1676 
1678 
1679  PROPERTIES properties;
1680 
1682 
1683  //-----<mutually exclusive>--------------
1686  //-----</mutually exclusive>-------------
1687 
1688  std::string part_number;
1689 
1690 public:
1691 
1692  PLACE( ELEM* aParent ) :
1693  ELEM( T_place, aParent )
1694  {
1695  side = T_front;
1696 
1697  rotation = 0.0;
1698 
1699  hasVertex = false;
1700 
1701  mirror = T_NONE;
1702  status = T_NONE;
1703 
1704  place_rules = 0;
1705 
1706  lock_type = T_NONE;
1707  rules = 0;
1708  region = 0;
1709  }
1710 
1712  {
1713  delete place_rules;
1714  delete rules;
1715  delete region;
1716  }
1717 
1718  void SetVertex( const POINT& aVertex )
1719  {
1720  vertex = aVertex;
1721  vertex.FixNegativeZero();
1722  hasVertex = true;
1723  }
1724 
1725  void SetRotation( double aRotation )
1726  {
1727  rotation = aRotation;
1728  }
1729 
1730  void Format( OUTPUTFORMATTER* out, int nestLevel ) override;
1731 };
1732 typedef boost::ptr_vector<PLACE> PLACES;
1733 
1734 
1739 class COMPONENT : public ELEM
1740 {
1741  friend class SPECCTRA_DB;
1742 
1743 // std::string hash; ///< a hash string used by Compare(), not Format()ed/exported.
1744 
1745  std::string image_id;
1746  PLACES places;
1747 
1748 public:
1749  COMPONENT( ELEM* aParent ) :
1750  ELEM( T_component, aParent )
1751  {
1752  }
1753 
1754  const std::string& GetImageId() const { return image_id; }
1755  void SetImageId( const std::string& aImageId )
1756  {
1757  image_id = aImageId;
1758  }
1759 
1760 
1765 // static int Compare( IMAGE* lhs, IMAGE* rhs );
1766 
1767  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1768  {
1769  const char* quote = out->GetQuoteChar( image_id.c_str() );
1770  out->Print( nestLevel, "(%s %s%s%s\n", Name(),
1771  quote, image_id.c_str(), quote );
1772 
1773  FormatContents( out, nestLevel+1 );
1774 
1775  out->Print( nestLevel, ")\n" );
1776  }
1777 
1778  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
1779  {
1780  for( PLACES::iterator i=places.begin(); i!=places.end(); ++i )
1781  i->Format( out, nestLevel );
1782  }
1783 };
1784 typedef boost::ptr_vector<COMPONENT> COMPONENTS;
1785 
1786 
1787 class PLACEMENT : public ELEM
1788 {
1789  friend class SPECCTRA_DB;
1790 
1792 
1794 
1795  COMPONENTS components;
1796 
1797 public:
1798  PLACEMENT( ELEM* aParent ) :
1799  ELEM( T_placement, aParent )
1800  {
1801  unit = 0;
1802  flip_style = DSN_T( T_NONE );
1803  }
1804 
1806  {
1807  delete unit;
1808  }
1809 
1817  COMPONENT* LookupCOMPONENT( const std::string& imageName )
1818  {
1819  for( unsigned i=0; i<components.size(); ++i )
1820  {
1821  if( 0 == components[i].GetImageId().compare( imageName ) )
1822  return &components[i];
1823  }
1824 
1825  COMPONENT* added = new COMPONENT(this);
1826  components.push_back( added );
1827  added->SetImageId( imageName );
1828  return added;
1829  }
1830 
1831  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
1832  {
1833  if( unit )
1834  unit->Format( out, nestLevel );
1835 
1836  if( flip_style != DSN_T( T_NONE ) )
1837  {
1838  out->Print( nestLevel, "(place_control (flip_style %s))\n",
1839  GetTokenText( flip_style ) );
1840  }
1841 
1842  for( COMPONENTS::iterator i=components.begin(); i!=components.end(); ++i )
1843  i->Format( out, nestLevel );
1844  }
1845 
1846  UNIT_RES* GetUnits() const override
1847  {
1848  if( unit )
1849  return unit;
1850 
1851  return ELEM::GetUnits();
1852  }
1853 };
1854 
1855 
1863 class SHAPE : public WINDOW
1864 {
1865  friend class SPECCTRA_DB;
1866 
1868 
1869  /* <shape_descriptor >::=
1870  [<rectangle_descriptor> |
1871  <circle_descriptor> |
1872  <polygon_descriptor> |
1873  <path_descriptor> |
1874  <qarc_descriptor> ]
1875  ELEM* shape; // inherited from WINDOW
1876  */
1877 
1878  WINDOWS windows;
1879 
1880 public:
1881 
1886  SHAPE( ELEM* aParent, DSN_T aType = T_shape ) :
1887  WINDOW( aParent, aType )
1888  {
1889  connect = T_on;
1890  }
1891 
1892  void SetConnect( DSN_T aConnect )
1893  {
1894  connect = aConnect;
1895  }
1896 
1897  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1898  {
1899  out->Print( nestLevel, "(%s ", Name() );
1900 
1901  if( shape )
1902  shape->Format( out, 0 );
1903 
1904  if( connect == T_off )
1905  out->Print( 0, "(connect %s)", GetTokenText( connect ) );
1906 
1907  if( windows.size() )
1908  {
1909  out->Print( 0, "\n" );
1910 
1911  for( WINDOWS::iterator i=windows.begin(); i!=windows.end(); ++i )
1912  i->Format( out, nestLevel+1 );
1913 
1914  out->Print( nestLevel, ")\n" );
1915  }
1916  else
1917  out->Print( 0, ")\n" );
1918  }
1919 };
1920 
1921 
1922 class PIN : public ELEM
1923 {
1924  friend class SPECCTRA_DB;
1925 
1926  std::string padstack_id;
1927  double rotation;
1929  std::string pin_id;
1931 
1933 
1934 
1935 public:
1936  PIN( ELEM* aParent ) :
1937  ELEM( T_pin, aParent )
1938  {
1939  rotation = 0.0;
1940  isRotated = false;
1941  kiNetCode = 0;
1942  }
1943 
1944  void SetRotation( double aRotation )
1945  {
1946  rotation = aRotation;
1947  isRotated = (aRotation != 0.0);
1948  }
1949 
1950  void SetVertex( const POINT& aPoint )
1951  {
1952  vertex = aPoint;
1953  vertex.FixNegativeZero();
1954  }
1955 
1956  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
1957  {
1958  const char* quote = out->GetQuoteChar( padstack_id.c_str() );
1959  if( isRotated )
1960  out->Print( nestLevel, "(pin %s%s%s (rotate %.6g)",
1961  quote, padstack_id.c_str(), quote,
1962  rotation
1963  );
1964  else
1965  out->Print( nestLevel, "(pin %s%s%s", quote, padstack_id.c_str(), quote );
1966 
1967  quote = out->GetQuoteChar( pin_id.c_str() );
1968  out->Print( 0, " %s%s%s %.6g %.6g)\n", quote, pin_id.c_str(), quote,
1969  vertex.x, vertex.y );
1970  }
1971 };
1972 typedef boost::ptr_vector<PIN> PINS;
1973 
1974 
1975 class LIBRARY;
1976 class IMAGE : public ELEM_HOLDER
1977 {
1978  friend class SPECCTRA_DB;
1979  friend class LIBRARY;
1980 
1981  std::string hash;
1982 
1983  std::string image_id;
1986 
1987  /* The grammar spec says only one outline is supported, but I am seeing
1988  *.dsn examples with multiple outlines. So the outlines will go into
1989  the kids list.
1990  */
1991 
1992  PINS pins;
1993 
1996 
1997  KEEPOUTS keepouts;
1998 
2000 
2001 public:
2002 
2003  IMAGE( ELEM* aParent ) :
2004  ELEM_HOLDER( T_image, aParent )
2005  {
2006  side = T_both;
2007  unit = 0;
2008  rules = 0;
2009  place_rules = 0;
2010  duplicated = 0;
2011  }
2013  {
2014  delete unit;
2015  delete rules;
2016  delete place_rules;
2017  }
2018 
2023  static int Compare( IMAGE* lhs, IMAGE* rhs );
2024 
2025  std::string GetImageId()
2026  {
2027  if( duplicated )
2028  {
2029  char buf[32];
2030 
2031  std::string ret = image_id;
2032  ret += "::";
2033  sprintf( buf, "%d", duplicated );
2034  ret += buf;
2035  return ret;
2036  }
2037 
2038  return image_id;
2039  }
2040 
2041  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
2042  {
2043  std::string imageId = GetImageId();
2044 
2045  const char* quote = out->GetQuoteChar( imageId.c_str() );
2046 
2047  out->Print( nestLevel, "(%s %s%s%s", Name(),
2048  quote, imageId.c_str(), quote );
2049 
2050  FormatContents( out, nestLevel+1 );
2051 
2052  out->Print( nestLevel, ")\n" );
2053  }
2054 
2055  // this is here for makeHash()
2056  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
2057  {
2058  if( side != T_both )
2059  out->Print( 0, " (side %s)", GetTokenText( side ) );
2060 
2061  out->Print( 0, "\n");
2062 
2063  if( unit )
2064  unit->Format( out, nestLevel );
2065 
2066  // format the kids, which in this class are the shapes
2067  ELEM_HOLDER::FormatContents( out, nestLevel );
2068 
2069  for( PINS::iterator i=pins.begin(); i!=pins.end(); ++i )
2070  i->Format( out, nestLevel );
2071 
2072  if( rules )
2073  rules->Format( out, nestLevel );
2074 
2075  if( place_rules )
2076  place_rules->Format( out, nestLevel );
2077 
2078  for( KEEPOUTS::iterator i=keepouts.begin(); i!=keepouts.end(); ++i )
2079  i->Format( out, nestLevel );
2080  }
2081 
2082 
2083  UNIT_RES* GetUnits() const override
2084  {
2085  if( unit )
2086  return unit;
2087 
2088  return ELEM::GetUnits();
2089  }
2090 };
2091 typedef boost::ptr_vector<IMAGE> IMAGES;
2092 
2093 
2098 class PADSTACK : public ELEM_HOLDER
2099 {
2100  friend class SPECCTRA_DB;
2101 
2102  std::string hash;
2103 
2104  std::string padstack_id;
2106 
2107  /* The shapes are stored in the kids list */
2108 
2112  std::string via_id;
2113 
2115 
2116 public:
2117 
2125  ELEM_HOLDER( T_padstack, NULL )
2126  {
2127  unit = 0;
2128  rotate = T_on;
2129  absolute = T_off;
2130  rules = 0;
2131  attach = T_off;
2132  }
2134  {
2135  delete unit;
2136  delete rules;
2137  }
2138 
2139  const std::string& GetPadstackId()
2140  {
2141  return padstack_id;
2142  }
2143 
2148  static int Compare( PADSTACK* lhs, PADSTACK* rhs );
2149 
2150 
2151  void SetPadstackId( const char* aPadstackId )
2152  {
2153  padstack_id = aPadstackId;
2154  }
2155 
2156  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
2157  {
2158  const char* quote = out->GetQuoteChar( padstack_id.c_str() );
2159 
2160  out->Print( nestLevel, "(%s %s%s%s\n", Name(),
2161  quote, padstack_id.c_str(), quote );
2162 
2163  FormatContents( out, nestLevel+1 );
2164 
2165  out->Print( nestLevel, ")\n" );
2166  }
2167 
2168 
2169  // this factored out for use by Compare()
2170  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
2171  {
2172  if( unit )
2173  unit->Format( out, nestLevel );
2174 
2175  // format the kids, which in this class are the shapes
2176  ELEM_HOLDER::FormatContents( out, nestLevel );
2177 
2178  out->Print( nestLevel, "%s", "" );
2179 
2180  // spec for <attach_descriptor> says default is on, so
2181  // print the off condition to override this.
2182  if( attach == T_off )
2183  out->Print( 0, "(attach off)" );
2184  else if( attach == T_on )
2185  {
2186  const char* quote = out->GetQuoteChar( via_id.c_str() );
2187  out->Print( 0, "(attach on (use_via %s%s%s))",
2188  quote, via_id.c_str(), quote );
2189  }
2190 
2191  if( rotate == T_off ) // print the non-default
2192  out->Print( 0, "(rotate %s)", GetTokenText( rotate ) );
2193 
2194  if( absolute == T_on ) // print the non-default
2195  out->Print( 0, "(absolute %s)", GetTokenText( absolute ) );
2196 
2197  out->Print( 0, "\n" );
2198 
2199  if( rules )
2200  rules->Format( out, nestLevel );
2201  }
2202 
2203 
2204  UNIT_RES* GetUnits() const override
2205  {
2206  if( unit )
2207  return unit;
2208 
2209  return ELEM::GetUnits();
2210  }
2211 };
2212 typedef boost::ptr_vector<PADSTACK> PADSTACKS;
2213 
2214 
2219 inline bool operator<( const PADSTACK& lhs, const PADSTACK& rhs )
2220 {
2221  return PADSTACK::Compare( (PADSTACK*) &lhs, (PADSTACK*) &rhs ) < 0;
2222 }
2223 
2224 
2231 class LIBRARY : public ELEM
2232 {
2233  friend class SPECCTRA_DB;
2234 
2236  IMAGES images;
2237 
2238  PADSTACKS padstacks;
2239  PADSTACKS vias;
2240 
2241 public:
2242 
2243  LIBRARY( ELEM* aParent, DSN_T aType = T_library ) :
2244  ELEM( aType, aParent )
2245  {
2246  unit = 0;
2247 // via_start_index = -1; // 0 or greater means there is at least one via
2248  }
2250  {
2251  delete unit;
2252  }
2253 
2254  void AddPadstack( PADSTACK* aPadstack )
2255  {
2256  aPadstack->SetParent( this );
2257  padstacks.push_back( aPadstack );
2258  }
2259 
2260 /*
2261  void SetViaStartIndex( int aIndex )
2262  {
2263  via_start_index = aIndex;
2264  }
2265  int GetViaStartIndex()
2266  {
2267  return via_start_index;
2268  }
2269 */
2270 
2271 
2277  int FindIMAGE( IMAGE* aImage )
2278  {
2279  unsigned i;
2280  for( i=0; i<images.size(); ++i )
2281  {
2282  if( 0 == IMAGE::Compare( aImage, &images[i] ) )
2283  return (int) i;
2284  }
2285 
2286  // There is no match to the IMAGE contents, but now generate a unique
2287  // name for it.
2288  int dups = 1;
2289  for( i=0; i<images.size(); ++i )
2290  {
2291  if( 0 == aImage->image_id.compare( images[i].image_id ) )
2292  aImage->duplicated = dups++;
2293  }
2294 
2295  return -1;
2296  }
2297 
2298 
2303  void AppendIMAGE( IMAGE* aImage )
2304  {
2305  aImage->SetParent( this );
2306  images.push_back( aImage );
2307  }
2308 
2318  {
2319  int ndx = FindIMAGE( aImage );
2320  if( ndx == -1 )
2321  {
2322  AppendIMAGE( aImage );
2323  return aImage;
2324  }
2325  return &images[ndx];
2326  }
2327 
2333  int FindVia( PADSTACK* aVia )
2334  {
2335  for( unsigned i=0; i<vias.size(); ++i )
2336  {
2337  if( 0 == PADSTACK::Compare( aVia, &vias[i] ) )
2338  return int( i );
2339  }
2340  return -1;
2341  }
2342 
2347  void AppendVia( PADSTACK* aVia )
2348  {
2349  aVia->SetParent( this );
2350  vias.push_back( aVia );
2351  }
2352 
2353 
2358  void AppendPADSTACK( PADSTACK* aPadstack )
2359  {
2360  aPadstack->SetParent( this );
2361  padstacks.push_back( aPadstack );
2362  }
2363 
2373  {
2374  int ndx = FindVia( aVia );
2375  if( ndx == -1 )
2376  {
2377  AppendVia( aVia );
2378  return aVia;
2379  }
2380  return &vias[ndx];
2381  }
2382 
2388  PADSTACK* FindPADSTACK( const std::string& aPadstackId )
2389  {
2390  for( unsigned i=0; i<padstacks.size(); ++i )
2391  {
2392  PADSTACK* ps = &padstacks[i];
2393  if( 0 == ps->GetPadstackId().compare( aPadstackId ) )
2394  return ps;
2395  }
2396  return NULL;
2397  }
2398 
2399  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
2400  {
2401  if( unit )
2402  unit->Format( out, nestLevel );
2403 
2404  for( IMAGES::iterator i=images.begin(); i!=images.end(); ++i )
2405  i->Format( out, nestLevel );
2406 
2407  for( PADSTACKS::iterator i=padstacks.begin(); i!=padstacks.end(); ++i )
2408  i->Format( out, nestLevel );
2409 
2410  for( PADSTACKS::iterator i=vias.begin(); i!=vias.end(); ++i )
2411  i->Format( out, nestLevel );
2412  }
2413 
2414  UNIT_RES* GetUnits() const override
2415  {
2416  if( unit )
2417  return unit;
2418 
2419  return ELEM::GetUnits();
2420  }
2421 };
2422 
2423 
2428 struct PIN_REF : public ELEM
2429 {
2430  std::string component_id;
2431  std::string pin_id;
2432 
2433  PIN_REF( ELEM* aParent ) :
2434  ELEM( T_pin, aParent )
2435  {
2436  }
2437 
2438 
2444  int FormatIt( OUTPUTFORMATTER* out, int nestLevel )
2445  {
2446  // only print the newline if there is a nest level, and make
2447  // the quotes unconditional on this one.
2448  const char* newline = nestLevel ? "\n" : "";
2449 
2450  const char* cquote = out->GetQuoteChar( component_id.c_str() );
2451  const char* pquote = out->GetQuoteChar( pin_id.c_str() );
2452 
2453  return out->Print( nestLevel, "%s%s%s-%s%s%s%s",
2454  cquote, component_id.c_str(), cquote,
2455  pquote, pin_id.c_str(), pquote,
2456  newline );
2457  }
2458 };
2459 typedef std::vector<PIN_REF> PIN_REFS;
2460 
2461 
2462 class FROMTO : public ELEM
2463 {
2464  friend class SPECCTRA_DB;
2465 
2466  std::string fromText;
2467  std::string toText;
2468 
2470  std::string net_id;
2472 // std::string circuit;
2473  LAYER_RULES layer_rules;
2474 
2475 
2476 public:
2477  FROMTO( ELEM* aParent ) :
2478  ELEM( T_fromto, aParent )
2479  {
2480  rules = 0;
2481  fromto_type = DSN_T( T_NONE );
2482  }
2484  {
2485  delete rules;
2486  }
2487 
2488  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
2489  {
2490  // no quoting on these two, the lexer preserved the quotes on input
2491  out->Print( nestLevel, "(%s %s %s ",
2492  Name(), fromText.c_str(), toText.c_str() );
2493 
2494  if( fromto_type != DSN_T( T_NONE ) )
2495  out->Print( 0, "(type %s)", GetTokenText( fromto_type ) );
2496 
2497  if( net_id.size() )
2498  {
2499  const char* quote = out->GetQuoteChar( net_id.c_str() );
2500  out->Print( 0, "(net %s%s%s)", quote, net_id.c_str(), quote );
2501  }
2502 
2503  bool singleLine = true;
2504 
2505  if( rules || layer_rules.size() )
2506  {
2507  out->Print( 0, "\n" );
2508  singleLine = false;
2509  }
2510 
2511  if( rules )
2512  rules->Format( out, nestLevel+1 );
2513 
2514  /*
2515  if( circuit.size() )
2516  out->Print( nestLevel, "%s\n", circuit.c_str() );
2517  */
2518 
2519  for( LAYER_RULES::iterator i=layer_rules.begin(); i!=layer_rules.end(); ++i )
2520  i->Format( out, nestLevel+1 );
2521 
2522  out->Print( singleLine ? 0 : nestLevel, ")" );
2523  if( nestLevel || !singleLine )
2524  out->Print( 0, "\n" );
2525  }
2526 };
2527 typedef boost::ptr_vector<FROMTO> FROMTOS;
2528 
2529 
2534 class COMP_ORDER : public ELEM
2535 {
2536  friend class SPECCTRA_DB;
2537 
2538  STRINGS placement_ids;
2539 
2540 public:
2541  COMP_ORDER( ELEM* aParent ) :
2542  ELEM( T_comp_order, aParent )
2543  {
2544  }
2545 
2546  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
2547  {
2548  out->Print( nestLevel, "(%s", Name() );
2549 
2550  for( STRINGS::iterator i=placement_ids.begin(); i!=placement_ids.end(); ++i )
2551  {
2552  const char* quote = out->GetQuoteChar( i->c_str() );
2553  out->Print( 0, " %s%s%s", quote, i->c_str(), quote );
2554  }
2555 
2556  out->Print( 0, ")" );
2557  if( nestLevel )
2558  out->Print( 0, "\n" );
2559  }
2560 };
2561 typedef boost::ptr_vector<COMP_ORDER> COMP_ORDERS;
2562 
2568 class NET : public ELEM
2569 {
2570  friend class SPECCTRA_DB;
2571 
2572  std::string net_id;
2575 
2577  PIN_REFS pins;
2578 
2579  PIN_REFS expose;
2580  PIN_REFS noexpose;
2581  PIN_REFS source;
2582  PIN_REFS load;
2583  PIN_REFS terminator;
2584 
2586 
2588 
2590 
2591  LAYER_RULES layer_rules;
2592 
2593  FROMTOS fromtos;
2594 
2596 
2597 public:
2598 
2599  NET( ELEM* aParent ) :
2600  ELEM( T_net, aParent )
2601  {
2602  unassigned = false;
2603  net_number = T_NONE;
2604  pins_type = T_pins;
2605 
2606  type = T_NONE;
2607  supply = T_NONE;
2608 
2609  rules = 0;
2610  comp_order = 0;
2611  }
2612 
2614  {
2615  delete rules;
2616  delete comp_order;
2617  }
2618 
2619  int FindPIN_REF( const std::string& aComponent )
2620  {
2621  for( unsigned i=0; i<pins.size(); ++i )
2622  {
2623  if( 0 == aComponent.compare( pins[i].component_id ) )
2624  return int(i);
2625  }
2626  return -1;
2627  }
2628 
2629  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
2630  {
2631  const char* quote = out->GetQuoteChar( net_id.c_str() );
2632  const char* space = " ";
2633 
2634  out->Print( nestLevel, "(%s %s%s%s", Name(),
2635  quote, net_id.c_str(), quote );
2636 
2637  if( unassigned )
2638  {
2639  out->Print( 0, "%s(unassigned)", space );
2640  space = ""; // only needed one space
2641  }
2642 
2643  if( net_number != T_NONE )
2644  {
2645  out->Print( 0, "%s(net_number %d)", space, net_number );
2646  // space = "";
2647  }
2648 
2649  out->Print( 0, "\n" );
2650 
2651  if( pins.size() )
2652  {
2653  const int RIGHTMARGIN = 80;
2654  int perLine = out->Print( nestLevel+1, "(%s", GetTokenText( pins_type ) );
2655 
2656  for( PIN_REFS::iterator i=pins.begin(); i!=pins.end(); ++i )
2657  {
2658  if( perLine > RIGHTMARGIN )
2659  {
2660  out->Print( 0, "\n");
2661  perLine = out->Print( nestLevel+2, "%s", "" );
2662  }
2663  else
2664  perLine += out->Print( 0, " " );
2665 
2666  perLine += i->FormatIt( out, 0 );
2667  }
2668  out->Print( 0, ")\n" );
2669  }
2670 
2671  if( comp_order )
2672  comp_order->Format( out, nestLevel+1 );
2673 
2674  if( type != T_NONE )
2675  out->Print( nestLevel+1, "(type %s)\n", GetTokenText( type ) );
2676 
2677  if( rules )
2678  rules->Format( out, nestLevel+1 );
2679 
2680  for( LAYER_RULES::iterator i=layer_rules.begin(); i!=layer_rules.end(); ++i )
2681  i->Format( out, nestLevel+1 );
2682 
2683  for( FROMTOS::iterator i=fromtos.begin(); i!=fromtos.end(); ++i )
2684  i->Format( out, nestLevel+1 );
2685 
2686  out->Print( nestLevel, ")\n" );
2687  }
2688 };
2689 typedef boost::ptr_vector<NET> NETS;
2690 
2691 
2692 class TOPOLOGY : public ELEM
2693 {
2694  friend class SPECCTRA_DB;
2695 
2696  FROMTOS fromtos;
2697 
2698  COMP_ORDERS comp_orders;
2699 
2700 public:
2701  TOPOLOGY( ELEM* aParent ) :
2702  ELEM( T_topology, aParent )
2703  {
2704  }
2705 
2706  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
2707  {
2708  for( FROMTOS::iterator i=fromtos.begin(); i!=fromtos.end(); ++i )
2709  i->Format( out, nestLevel );
2710 
2711  for( COMP_ORDERS::iterator i=comp_orders.begin(); i!=comp_orders.end(); ++i )
2712  i->Format( out, nestLevel );
2713  }
2714 };
2715 
2716 
2721 class CLASS : public ELEM
2722 {
2723  friend class SPECCTRA_DB;
2724 
2725  std::string class_id;
2726 
2727  STRINGS net_ids;
2728 
2730  STRINGS circuit;
2731 
2733 
2734  LAYER_RULES layer_rules;
2735 
2737 
2738 public:
2739 
2740  CLASS( ELEM* aParent ) :
2741  ELEM( T_class, aParent )
2742  {
2743  rules = 0;
2744  topology = 0;
2745  }
2747  {
2748  delete rules;
2749  delete topology;
2750  }
2751 
2752 
2753  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
2754  {
2755  const char* quote = out->GetQuoteChar( class_id.c_str() );
2756 
2757  int perLine = out->Print( nestLevel, "(%s %s%s%s",
2758  Name(),
2759  quote, class_id.c_str(), quote );
2760 
2761  const int RIGHTMARGIN = 72;
2762 
2763  for( STRINGS::iterator i=net_ids.begin(); i!=net_ids.end(); ++i )
2764  {
2765  const char* space = " ";
2766  if( perLine > RIGHTMARGIN )
2767  {
2768  out->Print( 0, "\n" );
2769  perLine = out->Print( nestLevel+1, "%s", "" );
2770  space = ""; // no space at first net_id of the line
2771  }
2772 
2773  quote = out->GetQuoteChar( i->c_str() );
2774  perLine += out->Print( 0, "%s%s%s%s", space, quote, i->c_str(), quote );
2775  }
2776 
2777  bool newLine = false;
2778  if( circuit.size() || rules || layer_rules.size() || topology )
2779  {
2780  out->Print( 0, "\n" );
2781  newLine = true;
2782  }
2783 
2784  if( circuit.size() )
2785  {
2786  out->Print( nestLevel+1, "(circuit\n" );
2787  for( STRINGS::iterator i=circuit.begin(); i!=circuit.end(); ++i )
2788  out->Print( nestLevel+2, "%s\n", i->c_str() );
2789  out->Print( nestLevel+1, ")\n" );
2790  }
2791 
2792  if( rules )
2793  rules->Format( out, nestLevel+1 );
2794 
2795  for( LAYER_RULES::iterator i=layer_rules.begin(); i!=layer_rules.end(); ++i )
2796  i->Format( out, nestLevel+1 );
2797 
2798  if( topology )
2799  topology->Format( out, nestLevel+1 );
2800 
2801  out->Print( newLine ? nestLevel : 0, ")\n" );
2802  }
2803 };
2804 typedef boost::ptr_vector<CLASS> CLASSLIST;
2805 
2806 
2807 class NETWORK : public ELEM
2808 {
2809  friend class SPECCTRA_DB;
2810 
2811  NETS nets;
2812  CLASSLIST classes;
2813 
2814 
2815 public:
2816 
2817  NETWORK( ELEM* aParent ) :
2818  ELEM( T_network, aParent )
2819  {
2820  }
2821 
2822  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
2823  {
2824  for( NETS::iterator i=nets.begin(); i!=nets.end(); ++i )
2825  i->Format( out, nestLevel );
2826 
2827  for( CLASSLIST::iterator i=classes.begin(); i!=classes.end(); ++i )
2828  i->Format( out, nestLevel );
2829  }
2830 };
2831 
2832 
2833 class CONNECT : public ELEM
2834 {
2835  // @todo not completed.
2836 
2837 public:
2838  CONNECT( ELEM* aParent ) :
2839  ELEM( T_connect, aParent ) {}
2840 };
2841 
2842 
2847 class WIRE : public ELEM
2848 {
2849  friend class SPECCTRA_DB;
2850 
2851  /* <shape_descriptor >::=
2852  [<rectangle_descriptor> |
2853  <circle_descriptor> |
2854  <polygon_descriptor> |
2855  <path_descriptor> |
2856  <qarc_descriptor> ]
2857  */
2859 
2860  std::string net_id;
2861  int turret;
2864  std::string shield;
2865  WINDOWS windows;
2867  bool supply;
2868 
2869 public:
2870  WIRE( ELEM* aParent ) :
2871  ELEM( T_wire, aParent )
2872  {
2873  shape = 0;
2874  connect = 0;
2875 
2876  turret = -1;
2877  wire_type = T_NONE;
2878  attr = T_NONE;
2879  supply = false;
2880  }
2881 
2883  {
2884  delete shape;
2885  delete connect;
2886  }
2887 
2888  void SetShape( ELEM* aShape )
2889  {
2890  delete shape;
2891  shape = aShape;
2892 
2893  if( aShape )
2894  {
2895  wxASSERT(aShape->Type()==T_rect || aShape->Type()==T_circle
2896  || aShape->Type()==T_qarc || aShape->Type()==T_path
2897  || aShape->Type()==T_polygon);
2898 
2899  aShape->SetParent( this );
2900  }
2901  }
2902 
2903  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
2904  {
2905  out->Print( nestLevel, "(%s ", Name() );
2906 
2907  if( shape )
2908  shape->Format( out, 0 );
2909 
2910  if( net_id.size() )
2911  {
2912  const char* quote = out->GetQuoteChar( net_id.c_str() );
2913  out->Print( 0, "(net %s%s%s)",
2914  quote, net_id.c_str(), quote );
2915  }
2916 
2917  if( turret >= 0 )
2918  out->Print( 0, "(turrent %d)", turret );
2919 
2920  if( wire_type != T_NONE )
2921  out->Print( 0, "(type %s)", GetTokenText( wire_type ) );
2922 
2923  if( attr != T_NONE )
2924  out->Print( 0, "(attr %s)", GetTokenText( attr ) );
2925 
2926  if( shield.size() )
2927  {
2928  const char* quote = out->GetQuoteChar( shield.c_str() );
2929  out->Print( 0, "(shield %s%s%s)",
2930  quote, shield.c_str(), quote );
2931  }
2932 
2933  if( windows.size() )
2934  {
2935  out->Print( 0, "\n" );
2936 
2937  for( WINDOWS::iterator i=windows.begin(); i!=windows.end(); ++i )
2938  i->Format( out, nestLevel+1 );
2939  }
2940 
2941  if( connect )
2942  connect->Format( out, 0 );
2943 
2944  if( supply )
2945  out->Print( 0, "(supply)" );
2946 
2947  out->Print( 0, ")\n" );
2948  }
2949 };
2950 typedef boost::ptr_vector<WIRE> WIRES;
2951 
2952 
2957 class WIRE_VIA : public ELEM
2958 {
2959  friend class SPECCTRA_DB;
2960 
2961  std::string padstack_id;
2962  POINTS vertexes;
2963  std::string net_id;
2967  std::string virtual_pin_name;
2969  bool supply;
2970 
2971 
2972 public:
2973  WIRE_VIA( ELEM* aParent ) :
2974  ELEM( T_via, aParent )
2975  {
2976  via_number = -1;
2977  via_type = T_NONE;
2978  attr = T_NONE;
2979  supply = false;
2980  }
2981 
2982  const std::string& GetPadstackId()
2983  {
2984  return padstack_id;
2985  }
2986 
2987  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
2988  {
2989  const char* quote = out->GetQuoteChar( padstack_id.c_str() );
2990 
2991  const int RIGHTMARGIN = 80;
2992  int perLine = out->Print( nestLevel, "(%s %s%s%s",
2993  Name(),
2994  quote, padstack_id.c_str(), quote );
2995 
2996  for( POINTS::iterator i=vertexes.begin(); i!=vertexes.end(); ++i )
2997  {
2998  if( perLine > RIGHTMARGIN )
2999  {
3000  out->Print( 0, "\n" );
3001  perLine = out->Print( nestLevel+1, "%s", "" );
3002  }
3003  else
3004  perLine += out->Print( 0, " " );
3005 
3006  perLine += out->Print( 0, "%.6g %.6g", i->x, i->y );
3007  }
3008 
3009  if( net_id.size() || via_number!=-1 || via_type!=T_NONE || attr!=T_NONE || supply)
3010  out->Print( 0, " " );
3011 
3012  if( net_id.size() )
3013  {
3014  if( perLine > RIGHTMARGIN )
3015  {
3016  out->Print( 0, "\n" );
3017  perLine = out->Print( nestLevel+1, "%s", "" );
3018  }
3019  quote = out->GetQuoteChar( net_id.c_str() );
3020  perLine += out->Print( 0, "(net %s%s%s)", quote, net_id.c_str(), quote );
3021  }
3022 
3023  if( via_number != -1 )
3024  {
3025  if( perLine > RIGHTMARGIN )
3026  {
3027  out->Print( 0, "\n" );
3028  perLine = out->Print( nestLevel+1, "%s", "" );
3029  }
3030  perLine += out->Print( 0, "(via_number %d)", via_number );
3031  }
3032 
3033  if( via_type != T_NONE )
3034  {
3035  if( perLine > RIGHTMARGIN )
3036  {
3037  out->Print( 0, "\n" );
3038  perLine = out->Print( nestLevel+1, "%s", "" );
3039  }
3040  perLine += out->Print( 0, "(type %s)", GetTokenText( via_type ) );
3041  }
3042 
3043  if( attr != T_NONE )
3044  {
3045  if( perLine > RIGHTMARGIN )
3046  {
3047  out->Print( 0, "\n" );
3048  perLine = out->Print( nestLevel+1, "%s", "" );
3049  }
3050  if( attr == T_virtual_pin )
3051  {
3052  quote = out->GetQuoteChar( virtual_pin_name.c_str() );
3053  perLine += out->Print( 0, "(attr virtual_pin %s%s%s)",
3054  quote, virtual_pin_name.c_str(), quote );
3055  }
3056  else
3057  perLine += out->Print( 0, "(attr %s)", GetTokenText( attr ) );
3058  }
3059 
3060  if( supply )
3061  {
3062  if( perLine > RIGHTMARGIN )
3063  {
3064  out->Print( 0, "\n" );
3065  perLine = out->Print( nestLevel+1, "%s", "" );
3066  }
3067  perLine += out->Print( 0, "(supply)" );
3068  }
3069 
3070  if( contact_layers.size() )
3071  {
3072  out->Print( 0, "\n" );
3073  out->Print( nestLevel+1, "(contact\n" );
3074 
3075  for( STRINGS::iterator i=contact_layers.begin(); i!=contact_layers.end(); ++i )
3076  {
3077  quote = out->GetQuoteChar( i->c_str() );
3078  out->Print( nestLevel+2, "%s%s%s\n", quote, i->c_str(), quote );
3079  }
3080  out->Print( nestLevel+1, "))\n" );
3081  }
3082  else
3083  out->Print( 0, ")\n" );
3084  }
3085 };
3086 typedef boost::ptr_vector<WIRE_VIA> WIRE_VIAS;
3087 
3088 
3093 class WIRING : public ELEM
3094 {
3095  friend class SPECCTRA_DB;
3096 
3098  WIRES wires;
3099  WIRE_VIAS wire_vias;
3100 
3101 public:
3102 
3103  WIRING( ELEM* aParent ) :
3104  ELEM( T_wiring, aParent )
3105  {
3106  unit = 0;
3107  }
3109  {
3110  delete unit;
3111  }
3112 
3113  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
3114  {
3115  if( unit )
3116  unit->Format( out, nestLevel );
3117 
3118  for( WIRES::iterator i=wires.begin(); i!=wires.end(); ++i )
3119  i->Format( out, nestLevel );
3120 
3121  for( WIRE_VIAS::iterator i=wire_vias.begin(); i!=wire_vias.end(); ++i )
3122  i->Format( out, nestLevel );
3123  }
3124 
3125  UNIT_RES* GetUnits() const override
3126  {
3127  if( unit )
3128  return unit;
3129 
3130  return ELEM::GetUnits();
3131  }
3132 };
3133 
3134 
3135 class PCB : public ELEM
3136 {
3137  friend class SPECCTRA_DB;
3138 
3139  std::string pcbname;
3148 
3149 public:
3150 
3151  PCB( ELEM* aParent = 0 ) :
3152  ELEM( T_pcb, aParent )
3153  {
3154  parser = 0;
3155  resolution = 0;
3156  unit = 0;
3157  structure = 0;
3158  placement = 0;
3159  library = 0;
3160  network = 0;
3161  wiring = 0;
3162  }
3163 
3165  {
3166  delete parser;
3167  delete resolution;
3168  delete unit;
3169  delete structure;
3170  delete placement;
3171  delete library;
3172  delete network;
3173  delete wiring;
3174  }
3175 
3176  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
3177  {
3178  const char* quote = out->GetQuoteChar( pcbname.c_str() );
3179 
3180  out->Print( nestLevel, "(%s %s%s%s\n", Name(),
3181  quote, pcbname.c_str(), quote );
3182 
3183  if( parser )
3184  parser->Format( out, nestLevel+1 );
3185 
3186  if( resolution )
3187  resolution->Format( out, nestLevel+1 );
3188 
3189  if( unit )
3190  unit->Format( out, nestLevel+1 );
3191 
3192  if( structure )
3193  structure->Format( out, nestLevel+1 );
3194 
3195  if( placement )
3196  placement->Format( out, nestLevel+1 );
3197 
3198  if( library )
3199  library->Format( out, nestLevel+1 );
3200 
3201  if( network )
3202  network->Format( out, nestLevel+1 );
3203 
3204  if( wiring )
3205  wiring->Format( out, nestLevel+1 );
3206 
3207  out->Print( nestLevel, ")\n" );
3208  }
3209 
3210  UNIT_RES* GetUnits() const override
3211  {
3212  if( unit )
3213  return unit;
3214 
3215  if( resolution )
3216  return resolution->GetUnits();
3217 
3218  return ELEM::GetUnits();
3219  }
3220 };
3221 
3222 
3223 class ANCESTOR : public ELEM
3224 {
3225  friend class SPECCTRA_DB;
3226 
3227  std::string filename;
3228  std::string comment;
3229  time_t time_stamp;
3230 
3231 
3232 public:
3233  ANCESTOR( ELEM* aParent ) :
3234  ELEM( T_ancestor, aParent )
3235  {
3236  time_stamp = time(NULL);
3237  }
3238 
3239  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
3240  {
3241  char temp[80];
3242  struct tm* tmp;
3243 
3244  tmp = localtime( &time_stamp );
3245  strftime( temp, sizeof(temp), "%b %d %H : %M : %S %Y", tmp );
3246 
3247  // format the time first to temp
3248  // filename may be empty, so quote it just in case.
3249  out->Print( nestLevel, "(%s \"%s\" (created_time %s)\n",
3250  Name(),
3251  filename.c_str(),
3252  temp );
3253 
3254  if( comment.size() )
3255  {
3256  const char* quote = out->GetQuoteChar( comment.c_str() );
3257  out->Print( nestLevel+1, "(comment %s%s%s)\n",
3258  quote, comment.c_str(), quote );
3259  }
3260 
3261  out->Print( nestLevel, ")\n" );
3262  }
3263 };
3264 typedef boost::ptr_vector<ANCESTOR> ANCESTORS;
3265 
3266 
3267 class HISTORY : public ELEM
3268 {
3269  friend class SPECCTRA_DB;
3270 
3271  ANCESTORS ancestors;
3272  time_t time_stamp;
3273  STRINGS comments;
3274 
3275 public:
3276 
3277  HISTORY( ELEM* aParent ) :
3278  ELEM( T_history, aParent )
3279  {
3280  time_stamp = time(NULL);
3281  }
3282 
3283  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
3284  {
3285  for( ANCESTORS::iterator i=ancestors.begin(); i!=ancestors.end(); ++i )
3286  i->Format( out, nestLevel );
3287 
3288  char temp[80];
3289  struct tm* tmp;
3290 
3291  tmp = localtime( &time_stamp );
3292  strftime( temp, sizeof(temp), "%b %d %H : %M : %S %Y", tmp );
3293 
3294  // format the time first to temp
3295  out->Print( nestLevel, "(self (created_time %s)\n", temp );
3296 
3297  for( STRINGS::iterator i=comments.begin(); i!=comments.end(); ++i )
3298  {
3299  const char* quote = out->GetQuoteChar( i->c_str() );
3300  out->Print( nestLevel+1, "(comment %s%s%s)\n",
3301  quote, i->c_str(), quote );
3302  }
3303 
3304  out->Print( nestLevel, ")\n" );
3305  }
3306 };
3307 
3308 
3313 class SUPPLY_PIN : public ELEM
3314 {
3315  friend class SPECCTRA_DB;
3316 
3317  PIN_REFS pin_refs;
3318  std::string net_id;
3319 
3320 public:
3321  SUPPLY_PIN( ELEM* aParent ) :
3322  ELEM( T_supply_pin, aParent )
3323  {
3324  }
3325 
3326  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
3327  {
3328  bool singleLine = pin_refs.size() <= 1;
3329  out->Print( nestLevel, "(%s", Name() );
3330 
3331  if( singleLine )
3332  {
3333  out->Print( 0, "%s", " " );
3334  pin_refs.begin()->Format( out, 0 );
3335  }
3336  else
3337  {
3338  for( PIN_REFS::iterator i=pin_refs.begin(); i!=pin_refs.end(); ++i )
3339  i->FormatIt( out, nestLevel+1 );
3340  }
3341 
3342  if( net_id.size() )
3343  {
3344  const char* newline = singleLine ? "" : "\n";
3345 
3346  const char* quote = out->GetQuoteChar( net_id.c_str() );
3347  out->Print( singleLine ? 0 : nestLevel+1,
3348  " (net %s%s%s)%s", quote, net_id.c_str(), quote, newline );
3349  }
3350 
3351  out->Print( singleLine ? 0 : nestLevel, ")\n");
3352  }
3353 };
3354 typedef boost::ptr_vector<SUPPLY_PIN> SUPPLY_PINS;
3355 
3356 
3361 class NET_OUT : public ELEM
3362 {
3363  friend class SPECCTRA_DB;
3364 
3365  std::string net_id;
3368  WIRES wires;
3369  WIRE_VIAS wire_vias;
3370  SUPPLY_PINS supply_pins;
3371 
3372 
3373 public:
3374  NET_OUT( ELEM* aParent ) :
3375  ELEM( T_net_out, aParent )
3376  {
3377  rules = 0;
3378  net_number = -1;
3379  }
3381  {
3382  delete rules;
3383  }
3384 
3385  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
3386  {
3387  const char* quote = out->GetQuoteChar( net_id.c_str() );
3388 
3389  // cannot use Type() here, it is T_net_out and we need "(net "
3390  out->Print( nestLevel, "(net %s%s%s\n",
3391  quote, net_id.c_str(), quote );
3392 
3393  if( net_number>= 0 )
3394  out->Print( nestLevel+1, "(net_number %d)\n", net_number );
3395 
3396  if( rules )
3397  rules->Format( out, nestLevel+1 );
3398 
3399  for( WIRES::iterator i=wires.begin(); i!=wires.end(); ++i )
3400  i->Format( out, nestLevel+1 );
3401 
3402  for( WIRE_VIAS::iterator i=wire_vias.begin(); i!=wire_vias.end(); ++i )
3403  i->Format( out, nestLevel+1 );
3404 
3405  for( SUPPLY_PINS::iterator i=supply_pins.begin(); i!=supply_pins.end(); ++i )
3406  i->Format( out, nestLevel+1 );
3407 
3408  out->Print( nestLevel, ")\n" );
3409  }
3410 };
3411 typedef boost::ptr_vector<NET_OUT> NET_OUTS;
3412 
3413 
3414 class ROUTE : public ELEM
3415 {
3416  friend class SPECCTRA_DB;
3417 
3422  NET_OUTS net_outs;
3423 // TEST_POINTS* test_points;
3424 
3425 public:
3426 
3427  ROUTE( ELEM* aParent ) :
3428  ELEM( T_route, aParent )
3429  {
3430  resolution = 0;
3431  parser = 0;
3432  structure_out = 0;
3433  library = 0;
3434  }
3436  {
3437  delete resolution;
3438  delete parser;
3439  delete structure_out;
3440  delete library;
3441 // delete test_points;
3442  }
3443 
3444  UNIT_RES* GetUnits() const override
3445  {
3446  if( resolution )
3447  return resolution;
3448 
3449  return ELEM::GetUnits();
3450  }
3451 
3452  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
3453  {
3454  if( resolution )
3455  resolution->Format( out, nestLevel );
3456 
3457  if( parser )
3458  parser->Format( out, nestLevel );
3459 
3460  if( structure_out )
3461  structure_out->Format( out, nestLevel );
3462 
3463  if( library )
3464  library->Format( out, nestLevel );
3465 
3466  if( net_outs.size() )
3467  {
3468  out->Print( nestLevel, "(network_out\n" );
3469  for( NET_OUTS::iterator i=net_outs.begin(); i!=net_outs.end(); ++i )
3470  i->Format( out, nestLevel+1 );
3471  out->Print( nestLevel, ")\n" );
3472  }
3473 
3474 // if( test_poinst )
3475 // test_points->Format( out, nestLevel );
3476  }
3477 };
3478 
3479 
3485 struct PIN_PAIR
3486 {
3487  PIN_PAIR( ELEM* aParent = 0 ) :
3488  was( aParent ),
3489  is( aParent )
3490  {
3491  }
3492 
3495 };
3496 typedef std::vector<PIN_PAIR> PIN_PAIRS;
3497 
3498 
3503 class WAS_IS : public ELEM
3504 {
3505  friend class SPECCTRA_DB;
3506 
3507  PIN_PAIRS pin_pairs;
3508 
3509 public:
3510  WAS_IS( ELEM* aParent ) :
3511  ELEM( T_was_is, aParent )
3512  {
3513  }
3514 
3515  void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
3516  {
3517  for( PIN_PAIRS::iterator i=pin_pairs.begin(); i!=pin_pairs.end(); ++i )
3518  {
3519  out->Print( nestLevel, "(pins " );
3520  i->was.Format( out, 0 );
3521  out->Print( 0, " " );
3522  i->is.Format( out, 0 );
3523  out->Print( 0, ")\n" );
3524  }
3525  }
3526 };
3527 
3528 
3533 class SESSION : public ELEM
3534 {
3535  friend class SPECCTRA_DB;
3536 
3537  std::string session_id;
3538  std::string base_design;
3539 
3545 
3546 /* not supported:
3547  FLOOR_PLAN* floor_plan;
3548  NET_PIN_CHANGES* net_pin_changes;
3549  SWAP_HISTORY* swap_history;
3550 */
3551 
3552 public:
3553 
3554  SESSION( ELEM* aParent = 0 ) :
3555  ELEM( T_session, aParent )
3556  {
3557  history = 0;
3558  structure = 0;
3559  placement = 0;
3560  was_is = 0;
3561  route = 0;
3562  }
3564  {
3565  delete history;
3566  delete structure;
3567  delete placement;
3568  delete was_is;
3569  delete route;
3570  }
3571 
3572  void Format( OUTPUTFORMATTER* out, int nestLevel ) override
3573  {
3574  const char* quote = out->GetQuoteChar( session_id.c_str() );
3575  out->Print( nestLevel, "(%s %s%s%s\n", Name(),
3576  quote, session_id.c_str(), quote );
3577 
3578  out->Print( nestLevel+1, "(base_design \"%s\")\n", base_design.c_str() );
3579 
3580  if( history )
3581  history->Format( out, nestLevel+1 );
3582 
3583  if( structure )
3584  structure->Format( out, nestLevel+1 );
3585 
3586  if( placement )
3587  placement->Format( out, nestLevel+1 );
3588 
3589  if( was_is )
3590  was_is->Format( out, nestLevel+1 );
3591 
3592  if( route )
3593  route->Format( out, nestLevel+1 );
3594 
3595  out->Print( nestLevel, ")\n" );
3596  }
3597 };
3598 
3599 typedef boost::ptr_set<PADSTACK> PADSTACKSET;
3600 
3601 
3608 {
3610  static const KEYWORD keywords[];
3611  static const unsigned keywordCount;
3612 
3615  wxString filename;
3616  std::string quote_char;
3617 
3619 
3621 
3622  STRINGS layerIds;
3623 
3625  std::vector<int> kicadLayer2pcb;
3626 
3628  std::vector<PCB_LAYER_ID> pcbLayer2kicad;
3629 
3632 
3635 
3636  static const KICAD_T scanPADs[];
3637 
3638  PADSTACKSET padstackset;
3639 
3641  std::vector<NET*> nets;
3642 
3646 
3647 
3654  void buildLayerMaps( BOARD* aBoard );
3655 
3664  int findLayerName( const std::string& aLayerName ) const;
3665 
3682  void readCOMPnPIN( std::string* component_id, std::string* pid_id );
3683 
3698  void readTIME( time_t* time_stamp );
3699 
3700  void doPCB( PCB* growth );
3701  void doPARSER( PARSER* growth );
3702  void doRESOLUTION( UNIT_RES* growth );
3703  void doUNIT( UNIT_RES* growth );
3704  void doSTRUCTURE( STRUCTURE* growth );
3705  void doSTRUCTURE_OUT( STRUCTURE_OUT* growth );
3706  void doLAYER_NOISE_WEIGHT( LAYER_NOISE_WEIGHT* growth );
3708  void doBOUNDARY( BOUNDARY* growth );
3709  void doRECTANGLE( RECTANGLE* growth );
3710  void doPATH( PATH* growth );
3711  void doSTRINGPROP( STRINGPROP* growth );
3712  void doTOKPROP( TOKPROP* growth );
3713  void doVIA( VIA* growth );
3714  void doCONTROL( CONTROL* growth );
3715  void doLAYER( LAYER* growth );
3716  void doRULE( RULE* growth );
3717  void doKEEPOUT( KEEPOUT* growth );
3718  void doCIRCLE( CIRCLE* growth );
3719  void doQARC( QARC* growth );
3720  void doWINDOW( WINDOW* growth );
3721  void doCONNECT( CONNECT* growth );
3722  void doREGION( REGION* growth );
3723  void doCLASS_CLASS( CLASS_CLASS* growth );
3724  void doLAYER_RULE( LAYER_RULE* growth );
3725  void doCLASSES( CLASSES* growth );
3726  void doGRID( GRID* growth );
3727  void doPLACE( PLACE* growth );
3728  void doCOMPONENT( COMPONENT* growth );
3729  void doPLACEMENT( PLACEMENT* growth );
3730  void doPROPERTIES( PROPERTIES* growth );
3731  void doPADSTACK( PADSTACK* growth );
3732  void doSHAPE( SHAPE* growth );
3733  void doIMAGE( IMAGE* growth );
3734  void doLIBRARY( LIBRARY* growth );
3735  void doPIN( PIN* growth );
3736  void doNET( NET* growth );
3737  void doNETWORK( NETWORK* growth );
3738  void doCLASS( CLASS* growth );
3739  void doTOPOLOGY( TOPOLOGY* growth );
3740  void doFROMTO( FROMTO* growth );
3741  void doCOMP_ORDER( COMP_ORDER* growth );
3742  void doWIRE( WIRE* growth );
3743  void doWIRE_VIA( WIRE_VIA* growth );
3744  void doWIRING( WIRING* growth );
3745  void doSESSION( SESSION* growth );
3746  void doANCESTOR( ANCESTOR* growth );
3747  void doHISTORY( HISTORY* growth );
3748  void doROUTE( ROUTE* growth );
3749  void doWAS_IS( WAS_IS* growth );
3750  void doNET_OUT( NET_OUT* growth );
3751  void doSUPPLY_PIN( SUPPLY_PIN* growth );
3752 
3753  //-----<FromBOARD>-------------------------------------------------------
3754 
3762  void fillBOUNDARY( BOARD* aBoard, BOUNDARY* aBoundary );
3763 
3772  IMAGE* makeIMAGE( BOARD* aBoard, MODULE* aModule );
3773 
3782  PADSTACK* makePADSTACK( BOARD* aBoard, D_PAD* aPad );
3783 
3794  PADSTACK* makeVia( int aCopperDiameter, int aDrillDiameter,
3795  int aTopLayer, int aBotLayer );
3796 
3804  PADSTACK* makeVia( const ::VIA* aVia );
3805 
3810  void deleteNETs()
3811  {
3812  for( unsigned n=0; n<nets.size(); ++n )
3813  delete nets[n];
3814 
3815  nets.clear();
3816  }
3817 
3822  void exportNETCLASS( std::shared_ptr<NETCLASS> aNetClass, BOARD* aBoard );
3823 
3824  //-----</FromBOARD>------------------------------------------------------
3825 
3826  //-----<FromSESSION>-----------------------------------------------------
3827 
3832  TRACK* makeTRACK( PATH* aPath, int aPointIndex, int aNetcode );
3833 
3839  ::VIA* makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNetCode, int aViaDrillDefault );
3840 
3841  //-----</FromSESSION>----------------------------------------------------
3842 
3843 public:
3844 
3846  SPECCTRA_LEXER( 0 ) // LINE_READER* == NULL, no DSNLEXER::PushReader()
3847  {
3848  // The LINE_READER will be pushed from an automatic instantiation,
3849  // we don't own it:
3850  wxASSERT( !iOwnReaders );
3851 
3852  pcb = 0;
3853  session = 0;
3854  quote_char += '"';
3855  modulesAreFlipped = false;
3856 
3857  SetSpecctraMode( true );
3858 
3859  // Avoid not initialized members:
3860  routeResolution = NULL;
3861  sessionBoard = NULL;
3862  m_top_via_layer = 0;
3863  m_bot_via_layer = 0;
3864  }
3865 
3866  virtual ~SPECCTRA_DB()
3867  {
3868  delete pcb;
3869  delete session;
3870 
3871  deleteNETs();
3872  }
3873 
3878  static PCB* MakePCB();
3879 
3884  void SetPCB( PCB* aPcb )
3885  {
3886  delete pcb;
3887  pcb = aPcb;
3888  }
3889  PCB* GetPCB() { return pcb; }
3890 
3895  void SetSESSION( SESSION* aSession )
3896  {
3897  delete session;
3898  session = aSession;
3899  }
3900  SESSION* GetSESSION() { return session; }
3901 
3911  void LoadPCB( const wxString& aFilename );
3912 
3923  void LoadSESSION( const wxString& aFilename );
3924 
3934  void ExportPCB( wxString aFilename, bool aNameChange=false );
3935 
3947  void FromBOARD( BOARD* aBoard );
3948 
3957  void FromSESSION( BOARD* aBoard );
3958 
3965  void ExportSESSION( wxString aFilename );
3966 
3971  void FlipMODULEs( BOARD* aBoard );
3972 
3977  void RevertMODULEs( BOARD* aBoard );
3978 };
3979 
3980 
3981 } // namespace DSN
3982 
3983 #endif // SPECCTRA_H_
3984 
3985 //EOF
bool operator==(const POINT &other) const
Definition: specctra.h:106
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:3515
DSN_T units
Definition: specctra.h:405
void LoadSESSION(const wxString &aFilename)
Function LoadSESSION is a recursive descent parser for a SPECCTRA DSN "session" file.
Definition: specctra.cpp:262
PCB(ELEM *aParent=0)
Definition: specctra.h:3151
IMAGE(ELEM *aParent)
Definition: specctra.h:2003
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:3385
Class VIA corresponds to the in the specctra dsn spec.
Definition: specctra.h:1011
boost::ptr_vector< SUPPLY_PIN > SUPPLY_PINS
Definition: specctra.h:3354
boost::ptr_vector< COMP_ORDER > COMP_ORDERS
Definition: specctra.h:2561
void FixNegativeZero()
Function FixNegativeZero will change negative zero to positive zero in the IEEE floating point storag...
Definition: specctra.h:136
void doLAYER_NOISE_WEIGHT(LAYER_NOISE_WEIGHT *growth)
Definition: specctra.cpp:590
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:3239
TRACK * makeTRACK(PATH *aPath, int aPointIndex, int aNetcode)
Function makeTRACK creates a TRACK form the PATH and BOARD info.
boost::ptr_vector< PADSTACK > PADSTACKS
Definition: specctra.h:2212
Class PIN_REF corresponds to the definition in the specctra dsn spec.
Definition: specctra.h:2428
LIBRARY(ELEM *aParent, DSN_T aType=T_library)
Definition: specctra.h:2243
bool space_in_quoted_tokens
Definition: specctra.h:372
DSN_T side
Definition: specctra.h:1984
POINT vertex[3]
Definition: specctra.h:776
std::string layer_id
Definition: specctra.h:443
void SetAperture(double aWidth)
Definition: specctra.h:607
std::string pin_id
Definition: specctra.h:1929
void buildLayerMaps(BOARD *aBoard)
Function buildLayerMaps creates a few data translation structures for layer name and number mapping b...
Definition: specctra.cpp:74
Class SPECCTRA_LEXER is an automatically generated class using the TokenList2DnsLexer.cmake technology, based on keywords provided by file: /home/kicad/workspace/kicad-doxygen/pcbnew/specctra.keywords.
void SetLayerId(const char *aLayerId)
Definition: specctra.h:800
void doKEEPOUT(KEEPOUT *growth)
Definition: specctra.cpp:787
DSN_T fromto_type
Definition: specctra.h:2469
void SetImageId(const std::string &aImageId)
Definition: specctra.h:1755
DSN_T lock_type
Definition: specctra.h:1681
double aperture_width
Definition: specctra.h:775
std::string shield
Definition: specctra.h:2864
ELEM * operator[](int aIndex) const
Definition: specctra.h:350
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:705
DSN::T DSN_T
Definition: specctra.h:47
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:2414
CLASSES(ELEM *aParent)
Definition: specctra.h:1079
NET(ELEM *aParent)
Definition: specctra.h:2599
boost::ptr_vector< NET > NETS
Definition: specctra.h:2689
RULE * rules
Definition: specctra.h:2114
PIN(ELEM *aParent)
Definition: specctra.h:1936
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:2706
ELEM(DSN_T aType, ELEM *aParent=0)
Definition: specctra.cpp:3490
boost::ptr_vector< CLASS > CLASSLIST
Definition: specctra.h:2804
LAYER(ELEM *aParent)
Definition: specctra.h:1192
virtual ~SPECCTRA_DB()
Definition: specctra.h:3866
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:2822
void SetPlaceBOUNDARY(BOUNDARY *aBoundary)
Definition: specctra.h:1590
STRINGS placement_ids
Definition: specctra.h:2538
DSN_T attr
Definition: specctra.h:2863
Class NET corresponds to a in the DSN spec.
Definition: specctra.h:2568
SHAPE(ELEM *aParent, DSN_T aType=T_shape)
Constructor SHAPE alternatively takes a DSN_T aType of T_outline.
Definition: specctra.h:1886
This source file implements export and import capabilities to the specctra dsn file format...
Definition: specctra.cpp:62
COPPER_PLANES planes
Definition: specctra.h:1543
std::vector< PROPERTY > PROPERTIES
Definition: specctra.h:184
SESSION * GetSESSION()
Definition: specctra.h:3900
PIN_PAIRS pin_pairs
Definition: specctra.h:3507
CIRCLE(ELEM *aParent)
Definition: specctra.h:732
CLASSES * classes
Definition: specctra.h:1099
void doCLASS_CLASS(CLASS_CLASS *growth)
Definition: specctra.cpp:1580
STRINGS circuit
circuit descriptor list
Definition: specctra.h:2730
STRINGS comments
Definition: specctra.h:3273
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2629
int FindPIN_REF(const std::string &aComponent)
Definition: specctra.h:2619
void doGRID(GRID *growth)
Definition: specctra.cpp:1648
void SetStart(const POINT &aStart)
Definition: specctra.h:804
double y
Definition: specctra.h:97
std::string net_id
Definition: specctra.h:2572
bool via_rotate_first
Definition: specctra.h:378
DSN_T direction
T_x | T_y | -1 for both.
Definition: specctra.h:1454
UNIT_RES * unit
Definition: specctra.h:3097
FROMTOS fromtos
Definition: specctra.h:2593
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2987
boost::ptr_vector< PIN > PINS
Definition: specctra.h:1972
boost::ptr_vector< LAYER > LAYERS
Definition: specctra.h:1263
void doWIRE(WIRE *growth)
Definition: specctra.cpp:2757
STRINGS padstacks
Definition: specctra.h:1015
KEEPOUTS keepouts
Definition: specctra.h:1997
POINTS & GetPoints()
Definition: specctra.h:600
std::string component_id
Definition: specctra.h:2430
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1357
void doCONTROL(CONTROL *growth)
Definition: specctra.cpp:1187
boost::ptr_vector< WIRE_VIA > WIRE_VIAS
Definition: specctra.h:3086
PIN_REFS pin_refs
Definition: specctra.h:3317
CONTROL(ELEM *aParent)
Definition: specctra.h:1142
T
enum T contains all this lexer's tokens.
virtual UNIT_RES * GetUnits() const
Function GetUnits returns the units for this section.
Definition: specctra.cpp:3506
RULE * rules
Definition: specctra.h:1539
void doROUTE(ROUTE *growth)
Definition: specctra.cpp:3251
boost::ptr_vector< COPPER_PLANE > COPPER_PLANES
Definition: specctra.h:1334
STRINGS class_ids
Definition: specctra.h:1076
Struct PIN_PAIR is used within the WAS_IS class below to hold a pair of PIN_REFs and corresponds to t...
Definition: specctra.h:3485
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:3572
boost::ptr_vector< PATH > PATHS
Definition: specctra.h:646
PINS pins
Definition: specctra.h:1992
Class SESSION corresponds to the in the specctra dsn spec.
Definition: specctra.h:3533
void doTOKPROP(TOKPROP *growth)
Definition: specctra.cpp:1145
NET_OUTS net_outs
Definition: specctra.h:3422
void doLAYER(LAYER *growth)
Definition: specctra.cpp:1257
static const KEYWORD keywords[]
specctra DSN keywords
Definition: specctra.h:3610
double offset
Definition: specctra.h:1455
ELEM * shape
Definition: specctra.h:903
int duplicated
no. times this image_id is duplicated
Definition: specctra.h:1999
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:2056
void doSPECCTRA_LAYER_PAIR(SPECCTRA_LAYER_PAIR *growth)
Definition: specctra.cpp:574
RULE * rules
Definition: specctra.h:2471
std::string base_design
Definition: specctra.h:3538
PADSTACKSET padstackset
Definition: specctra.h:3638
static int Compare(PADSTACK *lhs, PADSTACK *rhs)
Function Compare compares two objects of this type and returns <0, 0, or >0.
Definition: specctra.cpp:3561
int FindVia(PADSTACK *aVia)
Function FindVia searches this LIBRARY for a via which matches the argument.
Definition: specctra.h:2333
PLACE(ELEM *aParent)
Definition: specctra.h:1692
void doPROPERTIES(PROPERTIES *growth)
Definition: specctra.cpp:1234
std::string part_number
Definition: specctra.h:1688
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:2399
std::string net_id
Definition: specctra.h:3318
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:505
PADSTACKS vias
Definition: specctra.h:2239
void doSTRUCTURE_OUT(STRUCTURE_OUT *growth)
Definition: specctra.cpp:744
std::string name
Definition: specctra.h:163
POINT & operator+=(const POINT &other)
Definition: specctra.h:116
RULE * rules
Definition: specctra.h:2589
bool routes_include_testpoint
Definition: specctra.h:375
void doNET(NET *growth)
Definition: specctra.cpp:2320
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1282
std::string logical_part
Definition: specctra.h:1675
RULE * rules
Definition: specctra.h:891
IMAGE * LookupIMAGE(IMAGE *aImage)
Function LookupIMAGE will add the image only if one exactly like it does not already exist in the ima...
Definition: specctra.h:2317
int FindIMAGE(IMAGE *aImage)
Function FindIMAGE searches this LIBRARY for an image which matches the argument. ...
Definition: specctra.h:2277
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1470
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel)
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:264
PIN_REF(ELEM *aParent)
Definition: specctra.h:2433
void SetLayerId(const char *aLayerId)
Definition: specctra.h:602
void SetLayerId(const char *aLayerId)
Definition: specctra.h:753
UNIT_RES * unit
Definition: specctra.h:1529
void doPLACE(PLACE *growth)
Definition: specctra.cpp:1738
void doVIA(VIA *growth)
Definition: specctra.cpp:1158
POINTS vertexes
Definition: specctra.h:2962
Class UNIT_RES is a holder for either a T_unit or T_resolution object which are usually mutually excl...
Definition: specctra.h:401
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2546
void Delete(int aIndex)
Definition: specctra.h:355
int kiNetCode
KiCad netcode.
Definition: specctra.h:1932
DSN_T type
T_fix | T_normal.
Definition: specctra.h:2585
std::string quote_char
Definition: specctra.h:3616
NET_OUT(ELEM *aParent)
Definition: specctra.h:3374
void SetConnect(DSN_T aConnect)
Definition: specctra.h:1892
void fillBOUNDARY(BOARD *aBoard, BOUNDARY *aBoundary)
Function fillBOUNDARY makes the board perimeter for the DSN file by filling the BOUNDARY element in t...
UNIT_RES * unit
Definition: specctra.h:2105
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:551
UNIT_RES * resolution
Definition: specctra.h:3141
int Length() const
Function Length returns the number of ELEMs in this ELEM.
Definition: specctra.h:316
RECTANGLE(ELEM *aParent)
Definition: specctra.h:450
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
UNIT_RES * unit
Definition: specctra.h:2235
WIRE_VIA(ELEM *aParent)
Definition: specctra.h:2973
void doRESOLUTION(UNIT_RES *growth)
Definition: specctra.cpp:526
void doWIRING(WIRING *growth)
Definition: specctra.cpp:2983
void AppendPoint(const POINT &aPoint)
Definition: specctra.h:595
Class CLASS corresponds to the in the specctra spec.
Definition: specctra.h:2721
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1208
boost::ptr_vector< ELEM > ELEM_ARRAY
Definition: specctra.h:285
void doREGION(REGION *growth)
Definition: specctra.cpp:1511
SESSION(ELEM *aParent=0)
Definition: specctra.h:3554
PLACES places
Definition: specctra.h:1746
double x
Definition: specctra.h:96
int direction
Definition: specctra.h:1182
ELEM * At(int aIndex) const
Definition: specctra.h:343
boost::ptr_vector< NET_OUT > NET_OUTS
Definition: specctra.h:3411
STRUCTURE * structure
Definition: specctra.h:3541
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:3452
std::string via_id
Definition: specctra.h:2112
static const unsigned keywordCount
Definition: specctra.h:3611
ELEM * parent
Definition: specctra.h:200
void SetPCB(PCB *aPcb)
Function SetPCB deletes any existing PCB and replaces it with the given one.
Definition: specctra.h:3884
PADSTACK()
Constructor PADSTACK() cannot take ELEM* aParent because PADSTACKSET confuses this with a copy constr...
Definition: specctra.h:2124
void SetRotation(double aRotation)
Definition: specctra.h:1944
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:2083
STRUCTURE * structure
Definition: specctra.h:3143
virtual ~ELEM()
Definition: specctra.cpp:3497
ELEM * Replace(int aIndex, ELEM *aElem)
Definition: specctra.h:326
void doCOMPONENT(COMPONENT *growth)
Definition: specctra.cpp:1853
PIN_REFS noexpose
Definition: specctra.h:2580
UNIT_RES(ELEM *aParent, DSN_T aType)
Definition: specctra.h:416
COMP_ORDER * comp_order
Definition: specctra.h:2595
RULE * rules
Definition: specctra.h:1408
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:1426
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2156
WIRING * wiring
Definition: specctra.h:3147
void SetLayerId(const char *aLayerId)
Definition: specctra.h:455
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:1831
PIN_REF was
Definition: specctra.h:3493
Class WAS_IS corresponds to the in the specctra dsn spec.
Definition: specctra.h:3503
static PCB * MakePCB()
Function MakePCB makes a PCB with all the default ELEMs and parts on the heap.
Definition: specctra.cpp:3463
std::string net_id
Definition: specctra.h:2963
int FormatIt(OUTPUTFORMATTER *out, int nestLevel)
Function FormatIt is like Format() but is not virual and returns the number of characters that were o...
Definition: specctra.h:2444
DSN_T grid_type
T_via | T_wire | T_via_keepout | T_place | T_snap.
Definition: specctra.h:1452
std::string class_id
Definition: specctra.h:2725
void doIMAGE(IMAGE *growth)
Definition: specctra.cpp:2123
void SetVertex(const POINT &aPoint)
Definition: specctra.h:1950
int cost_type
T_length | T_way.
Definition: specctra.h:1184
IMAGES images
Definition: specctra.h:2236
STRUCTURE_OUT * structure_out
Definition: specctra.h:3420
DSN_T image_type
Definition: specctra.h:1456
std::string layer_id
Definition: specctra.h:580
PIN_REF is
Definition: specctra.h:3494
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2753
void SetSpecctraMode(bool aMode)
Function SetSpecctraMode changes the behavior of this lexer into or out of "specctra mode"...
Definition: dsnlexer.cpp:153
BOUNDARY * place_boundary
Definition: specctra.h:1536
std::string value
Definition: specctra.h:164
bool supply
Definition: specctra.h:2867
time_t time_stamp
Definition: specctra.h:3272
boost::ptr_vector< LAYER_RULE > LAYER_RULES
Definition: specctra.h:568
IMAGE * makeIMAGE(BOARD *aBoard, MODULE *aModule)
Function makeIMAGE allocates an IMAGE on the heap and creates all the PINs according to the D_PADs in...
DSN_T via_type
Definition: specctra.h:2965
DSN_T status
Definition: specctra.h:1673
CONNECT(ELEM *aParent)
Definition: specctra.h:2838
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
void ExportPCB(wxString aFilename, bool aNameChange=false)
Function ExportPCB writes the internal PCB instance out as a SPECTRA DSN format file.
Definition: specctra.cpp:3438
void FlipMODULEs(BOARD *aBoard)
Function FlipMODULEs flips the modules which are on the back side of the board to the front...
Class RULE corresponds to the in the specctra dsn spec.
Definition: specctra.h:492
void SetVertex(const POINT &aVertex)
Definition: specctra.h:1718
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:3210
RECTANGLE * rectangle
Definition: specctra.h:1400
std::string makeHash()
Function makeHash returns a string which uniquely represents this ELEM amoung other ELEMs of the same...
Definition: specctra.h:212
CONTROL * control
Definition: specctra.h:1538
LAYER_NOISE_WEIGHT(ELEM *aParent)
Definition: specctra.h:1304
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:3283
void doLIBRARY(LIBRARY *growth)
Definition: specctra.cpp:2266
void SetShape(ELEM *aShape)
Definition: specctra.h:852
PADSTACK * makePADSTACK(BOARD *aBoard, D_PAD *aPad)
Function makePADSTACK creates a PADSTACK which matches the given pad.
ROUTE(ELEM *aParent)
Definition: specctra.h:3427
void doANCESTOR(ANCESTOR *growth)
Definition: specctra.cpp:3039
STRINGS layer_ids
Definition: specctra.h:536
static const KICAD_T scanPADs[]
Definition: specctra.h:3636
POINT vertex
Definition: specctra.h:1670
void doWINDOW(WINDOW *growth)
Definition: specctra.cpp:912
void SetSESSION(SESSION *aSession)
Function SetSESSION deletes any existing SESSION and replaces it with the given one.
Definition: specctra.h:3895
void doRULE(RULE *growth)
Definition: specctra.cpp:1379
static int Compare(IMAGE *lhs, IMAGE *rhs)
Function Compare compares two objects of this type and returns <0, 0, or >0.
Definition: specctra.cpp:3585
Class PATH supports both the and the per the specctra dsn spec...
Definition: specctra.h:576
bool unassigned
Definition: specctra.h:2573
int turret
Definition: specctra.h:2861
const char * Name() const
Definition: specctra.cpp:3501
WAS_IS(ELEM *aParent)
Definition: specctra.h:3510
Class COMP_ORDER corresponds to the .
Definition: specctra.h:2534
boost::ptr_vector< WINDOW > WINDOWS
Definition: specctra.h:877
void exportNETCLASS(std::shared_ptr< NETCLASS > aNetClass, BOARD *aBoard)
Function exportNETCLASS exports aNetClass to the DSN file.
FROMTOS fromtos
Definition: specctra.h:2696
const std::string & GetPadstackId()
Definition: specctra.h:2139
double rotation
Definition: specctra.h:1667
bool hasVertex
Definition: specctra.h:1669
ELEM * shape
Definition: specctra.h:2858
DSN_T layer_type
one of: T_signal, T_power, T_mixed, T_jumper
Definition: specctra.h:1181
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:3444
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:426
PCB * GetPCB()
Definition: specctra.h:3889
void doCOMP_ORDER(COMP_ORDER *growth)
Definition: specctra.cpp:2653
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2488
void SetShape(ELEM *aShape)
Definition: specctra.h:929
std::string comment
Definition: specctra.h:3228
ANCESTORS ancestors
Definition: specctra.h:3271
WIRES wires
Definition: specctra.h:3098
RULE * place_rules
Definition: specctra.h:1548
bool isRotated
Definition: specctra.h:1928
POINT point0
one of two opposite corners
Definition: specctra.h:445
DSN_T GetEngUnits() const
Definition: specctra.h:423
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:1846
LAYER_RULES layer_rules
Definition: specctra.h:2473
PADSTACK * FindPADSTACK(const std::string &aPadstackId)
Function FindPADSTACK searches the padstack container by name.
Definition: specctra.h:2388
SUPPLY_PIN(ELEM *aParent)
Definition: specctra.h:3321
STRUCTURE_OUT(ELEM *aParent)
Definition: specctra.h:1503
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:1084
std::string image_id
Definition: specctra.h:1983
int net_number
Definition: specctra.h:2574
std::string name
Definition: specctra.h:1180
WIRES wires
Definition: specctra.h:3368
PIN_REFS terminator
Definition: specctra.h:2583
std::string net_id
Definition: specctra.h:2470
STRINGPROP(ELEM *aParent, DSN_T aType)
Definition: specctra.h:1378
Class TOKPROP is a container for a single property whose value is another DSN_T token.
Definition: specctra.h:1342
void AddWindow(WINDOW *aWindow)
Definition: specctra.h:944
std::string session_id
Definition: specctra.h:3537
void AppendIMAGE(IMAGE *aImage)
Function AppendIMAGE adds the image to the image list.
Definition: specctra.h:2303
boost::ptr_vector< REGION > REGIONS
Definition: specctra.h:1545
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:3176
std::string host_version
Definition: specctra.h:385
RULE * place_rules
Definition: specctra.h:1995
void doCLASS(CLASS *growth)
Definition: specctra.cpp:2498
DSN_T rotate
Definition: specctra.h:2109
boost::ptr_vector< COMPONENT > COMPONENTS
Definition: specctra.h:1784
Class COPPER_PLANE corresponds to a in the specctra dsn spec.
Definition: specctra.h:1325
void deleteNETs()
Function deleteNETs deletes all the NETs that may be in here.
Definition: specctra.h:3810
DSN_T attach
Definition: specctra.h:2111
bool routes_include_image_conductor
Definition: specctra.h:377
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1309
std::string padstack_id
Definition: specctra.h:2961
Class SHAPE_POLY_SET.
void doPADSTACK(PADSTACK *growth)
Definition: specctra.cpp:1938
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:472
RULE * rules
Definition: specctra.h:3367
DSN_T side
Definition: specctra.h:1665
void doPATH(PATH *growth)
Definition: specctra.cpp:1012
GRID(ELEM *aParent)
Definition: specctra.h:1460
Class PLACE implements the in the specctra dsn spec.
Definition: specctra.h:1659
void doSUPPLY_PIN(SUPPLY_PIN *growth)
Definition: specctra.cpp:3402
LAYER_NOISE_WEIGHT * layer_noise_weight
Definition: specctra.h:1533
Class NETCLASS handles a collection of nets and the parameters used to route or test these nets...
SPECCTRA_LAYER_PAIR(ELEM *aParent)
Definition: specctra.h:1276
void doRECTANGLE(RECTANGLE *growth)
Definition: specctra.cpp:1060
bool via_at_smd
Definition: specctra.h:1138
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:1598
wxString filename
Definition: specctra.h:3615
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:3113
void doHISTORY(HISTORY *growth)
Definition: specctra.cpp:3077
PROPERTIES properties
Definition: specctra.h:1679
PARSER * parser
Definition: specctra.h:3419
DSN_T connect
Definition: specctra.h:1867
PIN_REFS expose
Definition: specctra.h:2579
LIBRARY * library
Definition: specctra.h:3421
std::string hash
a hash string used by Compare(), not Format()ed/exported.
Definition: specctra.h:2102
void readTIME(time_t *time_stamp)
Function readTIME reads a which consists of 8 lexer tokens: "month date hour : minute : ...
Definition: specctra.cpp:177
std::vector< PIN_PAIR > PIN_PAIRS
Definition: specctra.h:3496
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
RULE * place_rules
Definition: specctra.h:1677
PATH * polygon
Definition: specctra.h:1401
std::string filename
Definition: specctra.h:3227
SUPPLY_PINS supply_pins
Definition: specctra.h:3370
std::string region_id
Definition: specctra.h:1397
bool operator<(const PADSTACK &lhs, const PADSTACK &rhs)
Function operator< is used by the PADSTACKSET boost::ptr_set below.
Definition: specctra.h:2219
std::string image_id
Definition: specctra.h:1745
WIRING(ELEM *aParent)
Definition: specctra.h:3103
void AddPadstack(PADSTACK *aPadstack)
Definition: specctra.h:2254
::VIA * makeVIA(PADSTACK *aPadstack, const POINT &aPoint, int aNetCode, int aViaDrillDefault)
Function makeVIA instantiates a KiCad VIA on the heap and initializes it with internal values consist...
KEEPOUT(ELEM *aParent, DSN_T aType)
Constructor KEEPOUT requires a DSN_T because this class is used for T_place_keepout, T_via_keepout, T_wire_keepout, T_bend_keepout, and T_elongate_keepout as well as T_keepout.
Definition: specctra.h:912
WIRE(ELEM *aParent)
Definition: specctra.h:2870
boost::ptr_set< PADSTACK > PADSTACKSET
Definition: specctra.h:3599
TOKPROP(ELEM *aParent, DSN_T aType)
Definition: specctra.h:1350
boost::ptr_vector< GRID > GRIDS
Definition: specctra.h:1550
COMPONENT(ELEM *aParent)
Definition: specctra.h:1749
std::string component_id
reference designator
Definition: specctra.h:1663
bool iOwnReaders
on readerStack, should I delete them?
Definition: dsnlexer.h:83
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:738
Class PADSTACK holds either a via or a pad definition.
Definition: specctra.h:2098
void Append(ELEM *aElem)
Definition: specctra.h:321
PLACEMENT(ELEM *aParent)
Definition: specctra.h:1798
boost::ptr_vector< KEEPOUT > KEEPOUTS
Definition: specctra.h:1004
WIRE_VIAS wire_vias
Definition: specctra.h:3099
int m_top_via_layer
specctra cu layers, 0 based index:
Definition: specctra.h:3644
const std::string & GetString()
Definition: richio.h:475
std::vector< std::string > STRINGS
Definition: specctra.h:158
RULE(ELEM *aParent, DSN_T aType)
Definition: specctra.h:500
FROMTO(ELEM *aParent)
Definition: specctra.h:2477
Class SPECCTRA_DB holds a DSN data tree, usually coming from a DSN file.
Definition: specctra.h:3607
void AppendPADSTACK(PADSTACK *aPadstack)
Function AppendPADSTACK adds the padstack to the padstack container.
Definition: specctra.h:2358
std::string fromText
Definition: specctra.h:2466
void ExportSESSION(wxString aFilename)
Function ExportSESSION writes the internal SESSION instance out as a SPECTRA DSN format file...
Definition: specctra.cpp:3452
CLASS(ELEM *aParent)
Definition: specctra.h:2740
STRING_FORMATTER sf
Definition: specctra.h:3620
PIN_REFS load
Definition: specctra.h:2582
WIRE_VIAS wire_vias
Definition: specctra.h:3369
POINT vertex
Definition: specctra.h:729
CLASSLIST classes
Definition: specctra.h:2812
REGIONS regions
Definition: specctra.h:1546
const std::string & GetImageId() const
Definition: specctra.h:1754
void doPCB(PCB *growth)
Definition: specctra.cpp:282
WINDOWS windows
Definition: specctra.h:2865
RECTANGLE * rectangle
Definition: specctra.h:655
RULE * rules
Definition: specctra.h:1684
TOPOLOGY(ELEM *aParent)
Definition: specctra.h:2701
int findLayerName(const std::string &aLayerName) const
Function findLayerName returns the PCB layer index for a given layer name, within the specctra sessio...
Definition: specctra.cpp:124
void doSTRUCTURE(STRUCTURE *growth)
Definition: specctra.cpp:610
std::vector< int > kicadLayer2pcb
maps BOARD layer number to PCB layer numbers
Definition: specctra.h:3625
void Format(OUTPUTFORMATTER *out, int nestLevel) const
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:174
void doCLASSES(CLASSES *growth)
Definition: specctra.cpp:1625
POINT GetEnd()
Definition: specctra.h:470
double dimension
Definition: specctra.h:1453
COMPONENT * LookupCOMPONENT(const std::string &imageName)
Function LookupCOMPONENT looks up a COMPONENT by name.
Definition: specctra.h:1817
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:1514
std::string layer_id
Definition: specctra.h:726
std::string padstack_id
Definition: specctra.h:1926
std::string layer_id
Definition: specctra.h:774
UNIT_RES * resolution
Definition: specctra.h:3418
void doWIRE_VIA(WIRE_VIA *growth)
Definition: specctra.cpp:2879
PARSER * parser
Definition: specctra.h:3140
virtual void Format(OUTPUTFORMATTER *out, int nestLevel)
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.cpp:3515
DSN_T type
Definition: specctra.h:199
bool operator!=(const POINT &other) const
Definition: specctra.h:111
void doCIRCLE(CIRCLE *growth)
Definition: specctra.cpp:1085
static const char * GetQuoteChar(const char *wrapee, const char *quote_char)
Function GetQuoteChar performs quote character need determination according to the Specctra DSN speci...
Definition: richio.cpp:327
DSN_T supply
T_power | T_ground.
Definition: specctra.h:2587
void SetRotation(double aRotation)
Definition: specctra.h:1725
SESSION * session
Definition: specctra.h:3614
LIBRARY * library
Definition: specctra.h:3145
DSN_T flip_style
Definition: specctra.h:1793
std::string GetImageId()
Definition: specctra.h:2025
YYCODETYPE lhs
QARC(ELEM *aParent)
Definition: specctra.h:779
ANCESTOR(ELEM *aParent)
Definition: specctra.h:3233
Class SHAPE corresponds to the "(shape ..)" element in the specctra dsn spec.
Definition: specctra.h:1863
boost::ptr_vector< FROMTO > FROMTOS
Definition: specctra.h:2527
bool modulesAreFlipped
Definition: specctra.h:3618
PLACEMENT * placement
Definition: specctra.h:3542
LAYER_RULES layer_rules
Definition: specctra.h:2591
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1030
void doSTRINGPROP(STRINGPROP *growth)
Definition: specctra.cpp:1137
const std::string & GetPadstackId()
Definition: specctra.h:2982
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1897
void doPIN(PIN *growth)
Definition: specctra.cpp:2219
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1956
STRINGS spares
Definition: specctra.h:1016
time_t time_stamp
Definition: specctra.h:3229
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:2204
void Format(OUTPUTFORMATTER *out, int nestLevel) const
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:152
std::vector< POINT > POINTS
Definition: specctra.h:159
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:785
COMP_ORDERS comp_orders
Definition: specctra.h:2698
void LoadPCB(const wxString &aFilename)
Function LoadPCB is a recursive descent parser for a SPECCTRA DSN "design" file.
Definition: specctra.cpp:243
boost::ptr_vector< IMAGE > IMAGES
Definition: specctra.h:2091
RULE * rules
Definition: specctra.h:1185
void RevertMODULEs(BOARD *aBoard)
Function RevertMODULEs flips the modules which were on the back side of the board back to the back...
COMP_ORDER(ELEM *aParent)
Definition: specctra.h:2541
bool case_sensitive
Definition: specctra.h:373
void doTOPOLOGY(TOPOLOGY *growth)
Definition: specctra.cpp:2460
PADSTACK * LookupVia(PADSTACK *aVia)
Function LookupVia will add the via only if one exactly like it does not already exist in the padstac...
Definition: specctra.h:2372
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:1645
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Compare compares two objects of this type and returns <0, 0, or >0.
Definition: specctra.h:1767
Class COMPONENT implements the in the specctra dsn spec.
Definition: specctra.h:1739
Class LIBRARY corresponds to the in the specctra dsn specification.
Definition: specctra.h:2231
STRINGS constants
This holds pairs of strings, one pair for each constant definition.
Definition: specctra.h:382
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:612
char string_quote
Definition: specctra.h:371
Struct POINT is a holder for a point in the SPECCTRA DSN coordinate system.
Definition: specctra.h:94
std::string host_cad
Definition: specctra.h:384
POINT point1
Definition: specctra.h:446
void FromBOARD(BOARD *aBoard)
Function FromBOARD adds the entire BOARD to the PCB but does not write it out.
UNIT_RES * unit
Definition: specctra.h:1791
REGION(ELEM *aParent)
Definition: specctra.h:1411
boost::ptr_vector< SPECCTRA_LAYER_PAIR > SPECCTRA_LAYER_PAIRS
Definition: specctra.h:1293
WINDOW(ELEM *aParent, DSN_T aType=T_window)
Definition: specctra.h:841
double rotation
Definition: specctra.h:1927
void Insert(int aIndex, ELEM *aElem)
Definition: specctra.h:338
Class WIRE corresponds to in the specctra dsn spec.
Definition: specctra.h:2847
std::vector< PIN_REF > PIN_REFS
Definition: specctra.h:2459
PATHS paths
Definition: specctra.h:654
int GetValue() const
Definition: specctra.h:424
void SetCorners(const POINT &aPoint0, const POINT &aPoint1)
Definition: specctra.h:460
STRINGS contact_layers
Definition: specctra.h:2968
int net_number
Definition: specctra.h:3366
STRINGS layerIds
indexed by PCB layer number
Definition: specctra.h:3622
DSN_T value
Definition: specctra.h:1346
void AppendVia(PADSTACK *aVia)
Function AppendVia adds aVia to the internal via container.
Definition: specctra.h:2347
boost::ptr_vector< PLACE > PLACES
Definition: specctra.h:1732
DSN_T aperture_type
Definition: specctra.h:584
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
int sequence_number
Definition: specctra.h:890
POINTS points
Definition: specctra.h:583
POINT & operator=(const POINT &other)
Definition: specctra.h:123
POINT(double aX, double aY)
Definition: specctra.h:101
int FindElem(DSN_T aType, int instanceNum=0)
Function FindElem finds a particular instance number of a given type of ELEM.
Definition: specctra.cpp:3534
static UNIT_RES Default
A static instance which holds the default units of T_inch and 2540000.
Definition: specctra.h:414
bool via_at_smd_grid_on
Definition: specctra.h:1139
PLACEMENT * placement
Definition: specctra.h:3144
void doSHAPE(SHAPE *growth)
Definition: specctra.cpp:2038
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:1778
Class STRINGPROP is a container for a single property whose value is a string.
Definition: specctra.h:1370
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:2170
PIN_PAIR(ELEM *aParent=0)
Definition: specctra.h:3487
LAYER_RULES layer_rules
Definition: specctra.h:2734
void readCOMPnPIN(std::string *component_id, std::string *pid_id)
Function readCOMPnPIN reads a and splits it into the two parts which are on either si...
Definition: specctra.cpp:134
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:3326
RULE * rules
Definition: specctra.h:2732
boost::ptr_vector< ANCESTOR > ANCESTORS
Definition: specctra.h:3264
UNIT_RES * unit
Definition: specctra.h:1985
void doLAYER_RULE(LAYER_RULE *growth)
Definition: specctra.cpp:1713
bool routes_include_guides
Definition: specctra.h:376
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.cpp:3525
void SetEnd(const POINT &aEnd)
Definition: specctra.h:810
void SetShape(ELEM *aShape)
Definition: specctra.h:2888
RULE * rules
Definition: specctra.h:1994
double aperture_width
Definition: specctra.h:581
REGION * region
Definition: specctra.h:1685
BOUNDARY * boundary
Definition: specctra.h:1535
DSN_T mirror
Definition: specctra.h:1672
void SetBOUNDARY(BOUNDARY *aBoundary)
Definition: specctra.h:1580
std::string padstack_id
Definition: specctra.h:2104
void AppendVia(const char *aViaName)
Definition: specctra.h:1025
const char * GetTokenText(T aTok)
Function GetTokenText is in the DSN namespace and returns the C string representing a SPECCTRA_DB::ke...
Definition: specctra.cpp:69
ROUTE * route
Definition: specctra.h:3544
void GetCorners(std::vector< double > &aBuffer)
GetCorners fills aBuffer with a list of coordinates (x,y) of corners.
Definition: specctra.h:674
Class NET_OUT corresponds to the of the specctra dsn spec.
Definition: specctra.h:3361
PARSER(ELEM *aParent)
Definition: specctra.cpp:3618
UNIT_RES * unit
Definition: specctra.h:3142
STRINGS use_net
Definition: specctra.h:1186
ELEM * shape
Definition: specctra.h:837
void doPLACEMENT(PLACEMENT *growth)
Definition: specctra.cpp:1883
int cost
[forbidden | high | medium | low | free | | -1]
Definition: specctra.h:1183
BOARD * sessionBoard
a copy to avoid passing as an argument, memory for it is not owned here.
Definition: specctra.h:3634
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.cpp:3674
boost::ptr_vector< WIRE > WIRES
Definition: specctra.h:2950
LAYERS layers
Definition: specctra.h:1531
POINT GetOrigin()
Definition: specctra.h:469
STRUCTURE(ELEM *aParent)
Definition: specctra.h:1555
PATH(ELEM *aParent, DSN_T aType=T_path)
Definition: specctra.h:588
PIN_REFS pins
Definition: specctra.h:2577
void StripUseless()
Function StripUseless removes whitespace, '(', and ')' from the mystring.
Definition: richio.cpp:500
Class WIRE_VIA corresponds to in the specctra dsn spec.
Definition: specctra.h:2957
void FromSESSION(BOARD *aBoard)
Function FromSESSION adds the entire SESSION info to a BOARD but does not write it out...
void doNETWORK(NETWORK *growth)
Definition: specctra.cpp:2608
std::string value
Definition: specctra.h:1374
TOPOLOGY * topology
Definition: specctra.h:2736
void doNET_OUT(NET_OUT *growth)
Definition: specctra.cpp:3334
PIN_REFS source
Definition: specctra.h:2581
Class ELEM is a base class for any DSN element class.
Definition: specctra.h:194
UNIT_RES * GetUnits() const override
Function GetUnits returns the units for this section.
Definition: specctra.h:3125
void SetVertex(const POINT &aVertex)
Definition: specctra.h:763
std::string virtual_pin_name
Definition: specctra.h:2967
std::string pin_id
Definition: specctra.h:2431
HISTORY(ELEM *aParent)
Definition: specctra.h:3277
WINDOWS windows
Definition: specctra.h:894
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2903
CLASS_CLASS(ELEM *aParent, DSN_T aType)
Constructor CLASS_CLASS.
Definition: specctra.h:1112
DSN_T wire_type
Definition: specctra.h:2862
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
WINDOWS windows
Definition: specctra.h:1878
CONNECT * connect
Definition: specctra.h:2866
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:867
bool wires_include_testpoint
Definition: specctra.h:374
LAYER_RULE(ELEM *aParent)
Definition: specctra.h:541
std::vector< PCB_LAYER_ID > pcbLayer2kicad
maps PCB layer number to BOARD layer numbers
Definition: specctra.h:3628
Class ELEM_HOLDER is a holder for any DSN class.
Definition: specctra.h:281
void doCONNECT(CONNECT *growth)
Definition: specctra.cpp:877
DSN_T Type() const
Definition: specctra.h:231
PROPERTIES properties
Definition: specctra.h:1188
STRINGS net_ids
Definition: specctra.h:2727
NETWORK(ELEM *aParent)
Definition: specctra.h:2817
Class SUPPLY_PIN corresponds to the in the specctra dsn spec.
Definition: specctra.h:3313
std::string hash
a hash string used by Compare(), not Format()ed/exported.
Definition: specctra.h:1981
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1383
DSN_T absolute
Definition: specctra.h:2110
std::string pcbname
Definition: specctra.h:3139
Class KEEPOUT is used for and .
Definition: specctra.h:884
void doQARC(QARC *growth)
Definition: specctra.cpp:1113
std::string name
Definition: specctra.h:889
NETWORK * network
Definition: specctra.h:3146
void doSESSION(SESSION *growth)
Definition: specctra.cpp:3133
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:950
Class STRING_FORMATTER implements OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:445
std::vector< NET * > nets
we don't want ownership here permanently, so we don't use boost::ptr_vector
Definition: specctra.h:3641
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.cpp:3638
HISTORY * history
Definition: specctra.h:3540
Struct KEYWORD holds a keyword string and its unique integer token.
Definition: dsnlexer.h:40
void doPARSER(PARSER *growth)
Definition: specctra.cpp:387
RULE * place_rules
Definition: specctra.h:892
WAS_IS * was_is
Definition: specctra.h:3543
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:1153
PADSTACKS padstacks
all except vias, which are in 'vias'
Definition: specctra.h:2238
void SetPadstackId(const char *aPadstackId)
Definition: specctra.h:2151
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2041
std::string toText
Definition: specctra.h:2467
BOUNDARY(ELEM *aParent, DSN_T aType=T_boundary)
Definition: specctra.h:660
ELEM * Remove(int aIndex)
Definition: specctra.h:332
UNIT_RES * routeResolution
used during FromSESSION() only, memory for it is not owned here.
Definition: specctra.h:3631
void SetParent(ELEM *aParent)
Definition: specctra.h:269
void SetDiameter(double aDiameter)
Definition: specctra.h:758
Class PARSER is simply a configuration record per the SPECCTRA DSN file spec.
Definition: specctra.h:367
COPPER_PLANE(ELEM *aParent)
Definition: specctra.h:1330
void doFROMTO(FROMTO *growth)
Definition: specctra.cpp:2671
void SetCenter(const POINT &aCenter)
Definition: specctra.h:816
Class WIRING corresponds to in the specctra dsn spec.
Definition: specctra.h:3093
COMPONENTS components
Definition: specctra.h:1795
void doUNIT(UNIT_RES *growth)
Definition: specctra.cpp:553
std::string net_id
Definition: specctra.h:3365
ELEM_HOLDER(DSN_T aType, ELEM *aParent=0)
Definition: specctra.h:291
std::string net_id
Definition: specctra.h:2860
POINT vertex
Definition: specctra.h:1930
VIA(ELEM *aParent)
Definition: specctra.h:1020
static STRING_FORMATTER sf
Definition: specctra.h:222
PADSTACK * makeVia(int aCopperDiameter, int aDrillDiameter, int aTopLayer, int aBotLayer)
Function makeVia makes a round through hole PADSTACK using the given KiCad diameter in deci-mils...
void doWAS_IS(WAS_IS *growth)
Definition: specctra.cpp:3210
SPECCTRA_LAYER_PAIRS layer_pairs
Definition: specctra.h:1300
void Clear()
Function Clear clears the buffer and empties the internal string.
Definition: richio.h:464
void FormatContents(OUTPUTFORMATTER *out, int nestLevel) override
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:1123
void doBOUNDARY(BOUNDARY *growth)
Definition: specctra.cpp:965
double diameter
Definition: specctra.h:728
STRINGS rules
rules are saved in std::string form.
Definition: specctra.h:496
bool generated_by_freeroute
Definition: specctra.h:379
DSN_T pins_type
T_pins | T_order, type of field 'pins' below.
Definition: specctra.h:2576
KEEPOUTS keepouts
Definition: specctra.h:1541