Subversion Repositories Vertical

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* pads_main*/
  2. /* $Id: eagle_main.c,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $
  3.  *
  4.  * $Log: eagle_main.c,v $
  5.  * Revision 1.1.1.1  2003/11/04 23:34:56  mjames
  6.  * Imported into local repositrory
  7.  *
  8.  * Revision 1.1  2002/12/04 22:28:28  mjames
  9.  * Initial release Eagle PCB reader
  10.  *
  11.  */
  12. /*
  13. @title
  14. PROGRAM eagle_read: Converter for Eagle .net files
  15. @application external
  16. @text
  17. PCB netlist to ACFP converter. Looks for netlists in ASCII containing tags like:
  18. @listing
  19. Netlist
  20.  
  21. Exported from H02SM05.brd at 11-10-2002 12:15:48
  22.  
  23. EAGLE Version 4.09r1 Copyright (c) 1988-2002 CadSoft
  24.  
  25. Net      Part     Pad
  26.  
  27. @text
  28. Commonly seen with a '.net' file suffix. This file is from Eagle PCB.
  29. @text
  30. Usage
  31. @listing
  32. eagle_read <eagle_file> [ d ]
  33. @text
  34. If a lower
  35. case 'd' is present as the second argument, the Bison parser
  36. (interpreter of keywords and syntax) prints extremely verbose diagnostics.
  37. @break
  38. Normally the acfp file produced on standard output is redirected to a file e.g.
  39. @listing
  40. eagle_read file.net > file.acfp
  41. @text
  42. Will produce file.acfp from file.net.
  43. @break
  44. Following this it is necessary to run the output through Vertical again in order to
  45. set up properties on nets (power and ground being made not routable for instance) using the
  46. del routable command. Alternatively the acfp file can be edited to set the net routing
  47. flags for these nets.
  48. @end
  49. */
  50.  
  51. #include <stdio.h>
  52. #include <stdlib.h>
  53. #include <string.h>
  54. #if defined HAS_TCL
  55. #include "tcl_l.h"
  56. #endif
  57. #include "cmdlog.h"
  58. #include "cmdparse.h"
  59. #include "database.h"
  60. #include "expression.h"
  61. #include "generic.h"
  62. #include "printout.h"
  63. #include "routing.h"
  64.  
  65. #ident                                                                                        \
  66.     "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/eagle_src/eagle_main.c,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $";
  67. #if defined YYDEBUG
  68. extern int yydebug;
  69. #else
  70. int yydebug = 0;
  71. #endif
  72.  
  73. extern FILE *yyin;
  74.  
  75. int main (int argc, char *argv[])
  76. {
  77.         InitialiseData ();
  78.         ExecuteString (
  79.             "echo running \\$(VERTICAL_INIT) file name = $(VERTICAL_INIT) ",
  80.             argc - 1,
  81.             (argv + 1));
  82.         ExecuteString ("do $(VERTICAL_INIT) ", argc - 2, (argv + 2));
  83.         Log (LOG_GENERAL, "# Finished initialisation script\n");
  84.         print_header (stdout, "'Eagle_Read': From Eagle PCB .net file");
  85.         yydebug = 0;
  86.         if (argc > 2 && argv[2][0] == 'd')
  87.                 yydebug = 1;
  88.         if (argc > 1)
  89.                 yyin = fopen (argv[1], "r");
  90.         else
  91.                 yyin = stdin;
  92.         if (!yyin)
  93.                 printf ("cannot open input file (%s)\n", argv[1]);
  94.         else
  95.                 while (yyparse () == 0)
  96.                         ;
  97.  
  98.         perform_routing (Free);
  99.         list_database (stdout, 0); /*no jumpers so flatten jumpers arg=0 */
  100.         list_devices (
  101.             stdout,
  102.             PRINT_TYPE | PRINT_EXPAND_BUS | PRINT_GENERIC | PRINT_GROUP | PRINT_ROUTE_FLAGS |
  103.                 PRINT_EQUIVALENT_PINS);
  104. }
  105.