Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | mjames | 1 | %{ |
2 | /* |
||
3 | * $Id: eagle_yacc.y,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $ |
||
4 | * |
||
5 | * $Log: eagle_yacc.y,v $ |
||
6 | * Revision 1.1.1.1 2003/11/04 23:34:56 mjames |
||
7 | * Imported into local repositrory |
||
8 | * |
||
9 | * Revision 1.1 2002/12/04 22:28:28 mjames |
||
10 | * Initial release Eagle PCB reader |
||
11 | * |
||
12 | * Revision 1.6 2002/10/02 19:37:27 MJAMES |
||
13 | * Moved dummy functions to a separate support file. |
||
14 | * |
||
15 | * Used correct number of arguments to define_pin |
||
16 | * |
||
17 | * Revision 1.5 2002/09/09 10:16:42 mjames |
||
18 | * Modified expression parser to match CC as previous one was |
||
19 | * broken |
||
20 | * |
||
21 | * Revision 1.4 2001/10/31 22:20:11 mjames |
||
22 | * Tidying up problematical comments caused by CVS |
||
23 | * 'intelligent' comment guessing |
||
24 | * |
||
25 | * Revision 1.3 2001/10/02 20:53:27 mjames |
||
26 | * Moved documentation about code to main program module. |
||
27 | * |
||
28 | * Revision 1.2 2001/09/16 19:56:43 mjames |
||
29 | * tidying |
||
30 | * |
||
31 | * Revision 1.1 2001/07/05 13:10:51 MJAMES |
||
32 | * Created padsread for PADS-PCB netlists |
||
33 | * |
||
34 | * Revision 1.3 2001/06/06 12:10:20 mjames |
||
35 | * Move from HPUX |
||
36 | * |
||
37 | * Revision 1.2 2000/12/04 13:14:03 mjames |
||
38 | * Imported all of the PCB syntax readers. |
||
39 | * |
||
40 | * Converted "a/b" to mean "a" divided by "b" insted of a single string |
||
41 | * "a/b" in Verilog |
||
42 | * |
||
43 | * Revision 1.1.1.1 2000/10/19 21:58:38 mjames |
||
44 | * Mike put it here |
||
45 | * |
||
46 | * |
||
47 | * Revision 1.27 2000/10/04 10:37:07 10:37:07 mjames (Mike James) |
||
48 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
||
49 | * |
||
50 | * Revision 1.24 2000/09/27 10:58:04 10:58:04 mjames (Mike James) |
||
51 | * Using correct return code from yyparse() |
||
52 | * |
||
53 | * Revision 1.13 2000/03/08 16:19:19 16:19:19 mjames (Mike James) |
||
54 | * New version including PC |
||
55 | * |
||
56 | * Revision 1.10 2000/01/20 15:58:46 15:58:46 mjames (Mike James) |
||
57 | * Part of Release R22 |
||
58 | * |
||
59 | * Revision 1.9 99/12/22 11:15:27 11:15:27 mjames (Mike James) |
||
60 | * Part of Release Dec_22_1999 |
||
61 | * |
||
62 | * Revision 1.8 99/06/25 14:35:45 14:35:45 mjames (Mike James) |
||
63 | * Added in reference to expression.h, but no changes made |
||
64 | * to the function of acfread yet. |
||
65 | * |
||
66 | * Revision 1.7 99/05/04 09:52:32 09:52:32 mjames (Mike James) |
||
67 | * General checkin |
||
68 | * |
||
69 | * Revision 1.5 98/07/14 13:24:51 13:24:51 mjames (Mike James) |
||
70 | * Altered calling of some database functions |
||
71 | * |
||
72 | * Revision 1.4 98/02/11 11:26:46 11:26:46 mjames (Mike James) |
||
73 | * Checked in for version 6.2a |
||
74 | * |
||
75 | * Revision 1.3 97/04/23 08:45:10 08:45:10 mjames (Mike James) |
||
76 | * CHecked in for release rel23041997 |
||
77 | * |
||
78 | * Revision 1.2 96/12/23 15:16:50 15:16:50 mjames (Mike James) |
||
79 | * Altered because find_socket takes a reference |
||
80 | * to the head-of-list-pointer noth the pointer itself. |
||
81 | * |
||
82 | * Revision 1.1 96/12/13 08:43:46 08:43:46 mjames (Mike James) |
||
83 | * Initial revision |
||
84 | * |
||
85 | * |
||
86 | * */ |
||
87 | |||
88 | |||
89 | |||
90 | |||
91 | #include <stdio.h> |
||
92 | #include <stdlib.h> |
||
93 | #include <string.h> |
||
94 | #include "expression.h" |
||
95 | #include "generic.h" |
||
96 | #include "database.h" |
||
97 | |||
98 | |||
99 | #ident "@(#)$Header: C:/cvsroot/Vert03/eagle_src/eagle_yacc.y,v 1.1.1.1 2003/11/04 23:34:56 mjames Exp $" |
||
100 | |||
101 | |||
102 | static char text_buff[1024]; |
||
103 | |||
104 | static socket_t * current_chip; |
||
105 | static char curr_net_nam[MAXIDLEN]; |
||
106 | int inside_block; |
||
107 | %} |
||
108 | %union { char * string; } |
||
109 | %token SPC NL |
||
110 | %token <string> ASTRING |
||
111 | |||
112 | %% |
||
113 | eaglefile : lines; |
||
114 | |||
115 | |||
116 | lines : lines line |
||
117 | | line |
||
118 | ; |
||
119 | |||
120 | |||
121 | skip_line : NL |
||
122 | | SPC NL |
||
123 | ; |
||
124 | |||
125 | line : first_line |
||
126 | | add_line |
||
127 | | skip_line |
||
128 | ; |
||
129 | |||
130 | first_line : net_ident SPC socket_pin NL ; |
||
131 | |||
132 | add_line : SPC socket_pin NL; |
||
133 | |||
134 | |||
135 | net_ident : ASTRING { strcpy(curr_net_nam,$1); }; |
||
136 | |||
137 | socket_pin : socket_ident SPC ASTRING { define_pin(&routed_list, |
||
138 | current_chip, |
||
139 | curr_net_nam,BIDIR,0,$3, |
||
140 | default_vhdl_datatype,NULL); }; |
||
141 | |||
142 | |||
143 | socket_ident: ASTRING { current_chip = find_socket(Ident,$1,Create,&socket_head); |
||
144 | set_socket(current_chip,Type,$1) ; /* same type as Ident so can pick up later */ |
||
145 | }; |
||
146 | |||
147 | |||
148 | %% |
||
149 | |||
150 | /* defining lineno here */ |
||
151 | |||
152 | int lineno; |
||
153 | extern char * yytext; |
||
154 | |||
155 | int yyerror(char * x) |
||
156 | { |
||
157 | int token; |
||
158 | printf("-- Error --> %s near string (%s) at line %d\n",x,yytext,lineno); |
||
159 | /* for(token = yylex();token >= 0 && token!=NL;token = yylex()); */ |
||
160 | return 1; |
||
161 | } |
||
162 | |||
163 | int yywrap(void) |
||
164 | { |
||
165 | return 1; |
||
166 | } |
||
167 | |||
168 | |||
169 |