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