FreeCalypso > hg > ueda-linux
annotate netdiff/convert/protel2donl.c @ 135:25634b3977a9
ueda: unet2tedax added
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 07 Sep 2020 01:22:36 +0000 |
parents | 603d8da32fd0 |
children |
rev | line source |
---|---|
132
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program converts a Protel netlist (exported from Altium) into our |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * Diff-Oriented Netlist (DONL) format. |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 static char *infname; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 static FILE *inf; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 static char linebuf[80], netname[80]; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 static int lineno; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 static |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 get_line() |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 char *cp; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 if (!fgets(linebuf, sizeof linebuf, inf)) |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 return(0); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 lineno++; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 cp = index(linebuf, '\n'); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 if (!cp) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 fprintf(stderr, "%s line %d: missing newline\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 *cp = '\0'; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 if (cp > linebuf && cp[-1] == '\r') |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 *--cp = '\0'; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 return(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 static void |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 get_line_notfirst() |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 if (!get_line()) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 fprintf(stderr, "error: unexpected EOF in input\n"); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 if (!strcmp(linebuf, "[")) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 fprintf(stderr, "%s line %d: [ NOT expected\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 if (!strcmp(linebuf, "(")) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 fprintf(stderr, "%s line %d: ( NOT expected\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 static void |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 skip_component_block() |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 int i; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 for (i = 0; i < 6; i++) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 get_line_notfirst(); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 if (!strcmp(linebuf, "]")) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 fprintf(stderr, "%s line %d: ] NOT expected\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 if (!strcmp(linebuf, ")")) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 fprintf(stderr, "%s line %d: ) NOT expected\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 get_line_notfirst(); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 if (strcmp(linebuf, "]")) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 fprintf(stderr, "%s line %d: expected ]\n", infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 static void |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 process_net_point() |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 char *cp; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 cp = index(linebuf, '-'); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 if (!cp) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 fprintf(stderr, "%s line %d: missing \'-\' in net point\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 if (cp == linebuf) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 fprintf(stderr, "%s line %d: refdes part is empty\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 if (!cp[1]) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 fprintf(stderr, "%s line %d: pin number part is empty\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 *cp = '.'; /* our PADS-like convention */ |
133
603d8da32fd0
protel2donl: brown paper bag bugfix
Mychaela Falconia <falcon@freecalypso.org>
parents:
132
diff
changeset
|
102 printf("%s\t%s\n", netname, linebuf); |
132
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 static void |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 process_net_block() |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 get_line_notfirst(); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 if (!strcmp(linebuf, "]")) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 fprintf(stderr, "%s line %d: ] NOT expected\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 if (!strcmp(linebuf, ")")) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 fprintf(stderr, "%s line %d: ) NOT expected\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 if (!linebuf[0]) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 fprintf(stderr, "%s line %d: empty net name\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 strcpy(netname, linebuf); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 for (;;) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 get_line_notfirst(); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 if (!strcmp(linebuf, "]")) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 fprintf(stderr, "%s line %d: ] NOT expected\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 if (!strcmp(linebuf, ")")) |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 break; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 process_net_point(); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 main(argc, argv) |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 char **argv; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 if (argc != 2) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 fprintf(stderr, "usage: %s protel-netlist-file\n", argv[0]); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 infname = argv[1]; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 inf = fopen(infname, "r"); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 if (!inf) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 perror(infname); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 for (;;) { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 if (!get_line()) |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 break; |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 if (!strcmp(linebuf, "[")) |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 skip_component_block(); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 else if (!strcmp(linebuf, "(")) |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 process_net_block(); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 else { |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 fprintf(stderr, |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 "%s line %d: expected beginning of block\n", |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 infname, lineno); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 exit(1); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 } |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 exit(0); |
31ae8105aaa0
netdiff project started with protel2donl
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 } |