Subversion Repositories Vertical

Rev

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