Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 11 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* generics.c */ |
1 | /* generics.c */ |
2 | /* contains the database functions for lookup of generic information */ |
2 | /* contains the database functions for lookup of generic information */ |
3 | /* |
3 | /* |
4 | * $Header: c:\\cygwin\\cvsroot/Vert03/vertlib/generic.c,v 1.1.1.1 2003/11/04 23:34:57 mjames |
4 | * $Header: c:\\cygwin\\cvsroot/Vert03/vertlib/generic.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $ |
- | 5 | * $Log: generic.c,v $ |
|
5 | * Exp $ $Log: generic.c,v $ Revision 1.1.1.1 2003/11/04 23:34:57 mjames Imported into local |
6 | * Revision 1.1.1.1 2003/11/04 23:34:57 mjames |
6 | * repositrory |
7 | * Imported into local repositrory |
7 | * |
8 | * |
8 | * Revision 1.15 2002/09/30 13:27:43 MJAMES |
9 | * Revision 1.15 2002/09/30 13:27:43 MJAMES |
9 | * Created function to tidy up partition generics. |
10 | * Created function to tidy up partition generics. |
10 | * |
11 | * |
11 | * Revision 1.14 2002/09/18 08:51:33 mjames |
12 | * Revision 1.14 2002/09/18 08:51:33 mjames |
Line 63... | Line 64... | ||
63 | * Mike put it here |
64 | * Mike put it here |
64 | * |
65 | * |
65 | * |
66 | * |
66 | * Revision 1.28 2000/10/12 15:32:26 15:32:26 mjames (Mike James) |
67 | * Revision 1.28 2000/10/12 15:32:26 15:32:26 mjames (Mike James) |
67 | * Removed <cr> |
68 | * Removed <cr> |
68 | * |
69 | * |
69 | * Revision 1.27 2000/10/04 10:37:06 10:37:06 mjames (Mike James) |
70 | * Revision 1.27 2000/10/04 10:37:06 10:37:06 mjames (Mike James) |
70 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
71 | * Modified for Vertical2 : support COMPONENTS and SIGNALS |
71 | * |
72 | * |
72 | * Revision 1.27 2000/10/04 10:37:06 10:37:06 mjames (Mike James) |
73 | * Revision 1.27 2000/10/04 10:37:06 10:37:06 mjames (Mike James) |
73 | * Part of Release PSAVAT01 |
74 | * Part of Release PSAVAT01 |
74 | * |
75 | * |
75 | * Revision 1.26 2000/10/02 11:04:14 11:04:14 mjames (Mike James) |
76 | * Revision 1.26 2000/10/02 11:04:14 11:04:14 mjames (Mike James) |
76 | * new_vhdl |
77 | * new_vhdl |
77 | * |
78 | * |
78 | * Revision 1.25 2000/09/27 14:42:15 14:42:15 mjames (Mike James) |
79 | * Revision 1.25 2000/09/27 14:42:15 14:42:15 mjames (Mike James) |
79 | * Part of Release Sep_27_ST_2000 |
80 | * Part of Release Sep_27_ST_2000 |
80 | * |
81 | * |
81 | * Revision 1.24 2000/09/27 10:45:43 10:45:43 mjames (Mike James) |
82 | * Revision 1.24 2000/09/27 10:45:43 10:45:43 mjames (Mike James) |
82 | * Started using the g_class member of the generic structu[re |
83 | * Started using the g_class member of the generic structu[re |
83 | * |
84 | * |
84 | * Revision 1.23 2000/09/21 10:15:45 10:15:45 mjames (Mike James) |
85 | * Revision 1.23 2000/09/21 10:15:45 10:15:45 mjames (Mike James) |
85 | * Part of Release Sep21Alpha |
86 | * Part of Release Sep21Alpha |
86 | * |
87 | * |
87 | * Revision 1.22 2000/08/25 09:57:12 09:57:12 mjames (Mike James) |
88 | * Revision 1.22 2000/08/25 09:57:12 09:57:12 mjames (Mike James) |
88 | * Part of Release Aug25_alpha |
89 | * Part of Release Aug25_alpha |
89 | * |
90 | * |
90 | * Revision 1.21 2000/08/16 08:57:28 08:57:28 mjames (Mike James) |
91 | * Revision 1.21 2000/08/16 08:57:28 08:57:28 mjames (Mike James) |
91 | * Part of Release CD01_Aug2000 |
92 | * Part of Release CD01_Aug2000 |
92 | * |
93 | * |
93 | * Revision 1.20 2000/08/14 14:45:09 14:45:09 mjames (Mike James) |
94 | * Revision 1.20 2000/08/14 14:45:09 14:45:09 mjames (Mike James) |
94 | * Part of Release Aug_14_2000 |
95 | * Part of Release Aug_14_2000 |
95 | * |
96 | * |
96 | * Revision 1.19 2000/08/11 08:30:30 08:30:30 mjames (Mike James) |
97 | * Revision 1.19 2000/08/11 08:30:30 08:30:30 mjames (Mike James) |
97 | * Part of Release Aug_11_2000 |
98 | * Part of Release Aug_11_2000 |
98 | * |
99 | * |
99 | * Revision 1.18 2000/08/09 10:31:44 10:31:44 mjames (Mike James) |
100 | * Revision 1.18 2000/08/09 10:31:44 10:31:44 mjames (Mike James) |
100 | * Part of Release Aug__9_2000 |
101 | * Part of Release Aug__9_2000 |
101 | * |
102 | * |
102 | * Revision 1.17 2000/05/31 11:42:53 11:42:53 mjames (Mike James) |
103 | * Revision 1.17 2000/05/31 11:42:53 11:42:53 mjames (Mike James) |
103 | * Part of Release May_31_2000 |
104 | * Part of Release May_31_2000 |
104 | * |
105 | * |
105 | * Revision 1.16 2000/05/08 17:01:35 17:01:35 mjames (Mike James) |
106 | * Revision 1.16 2000/05/08 17:01:35 17:01:35 mjames (Mike James) |
106 | * Part of Release May__8_2000 |
107 | * Part of Release May__8_2000 |
107 | * |
108 | * |
108 | * Revision 1.15 2000/05/08 16:59:28 16:59:28 mjames (Mike James) |
109 | * Revision 1.15 2000/05/08 16:59:28 16:59:28 mjames (Mike James) |
109 | * Part of Release May__8_2000 |
110 | * Part of Release May__8_2000 |
110 | * |
111 | * |
111 | * Revision 1.14 2000/05/08 16:57:05 16:57:05 mjames (Mike James) |
112 | * Revision 1.14 2000/05/08 16:57:05 16:57:05 mjames (Mike James) |
112 | * Part of Release May__8_2000 |
113 | * Part of Release May__8_2000 |
113 | * |
114 | * |
114 | * Revision 1.13 2000/03/08 16:19:08 16:19:08 mjames (Mike James) |
115 | * Revision 1.13 2000/03/08 16:19:08 16:19:08 mjames (Mike James) |
115 | * New version including PC |
116 | * New version including PC |
116 | * |
117 | * |
117 | * Revision 1.10 2000/01/20 15:58:44 15:58:44 mjames (Mike James) |
118 | * Revision 1.10 2000/01/20 15:58:44 15:58:44 mjames (Mike James) |
118 | * Part of Release R22 |
119 | * Part of Release R22 |
119 | * |
120 | * |
120 | * Revision 1.9 99/12/22 11:15:25 11:15:25 mjames (Mike James) |
121 | * Revision 1.9 99/12/22 11:15:25 11:15:25 mjames (Mike James) |
121 | * Part of Release Dec_22_1999 |
122 | * Part of Release Dec_22_1999 |
122 | * |
123 | * |
123 | * Revision 1.8 99/11/23 13:52:05 13:52:05 mjames (Mike James) |
124 | * Revision 1.8 99/11/23 13:52:05 13:52:05 mjames (Mike James) |
124 | * Addded syntax to support special generics for Certify support |
125 | * Addded syntax to support special generics for Certify support |
125 | * |
126 | * |
126 | * Revision 1.7 99/06/25 14:35:35 14:35:35 mjames (Mike James) |
127 | * Revision 1.7 99/06/25 14:35:35 14:35:35 mjames (Mike James) |
127 | * Added in reference to expression.h, but no changes made |
128 | * Added in reference to expression.h, but no changes made |
128 | * to the function of acfread yet. |
129 | * to the function of acfread yet. |
129 | * |
130 | * |
130 | * Revision 1.6 99/06/18 09:24:17 09:24:17 mjames (Mike James) |
131 | * Revision 1.6 99/06/18 09:24:17 09:24:17 mjames (Mike James) |
131 | * Added new VHDL printing of generic information |
132 | * Added new VHDL printing of generic information |
132 | * |
133 | * |
133 | * Revision 1.5 99/05/04 09:51:21 09:51:21 mjames (Mike James) |
134 | * Revision 1.5 99/05/04 09:51:21 09:51:21 mjames (Mike James) |
134 | * Amended generic lookup rules |
135 | * Amended generic lookup rules |
135 | * |
136 | * |
136 | * Revision 1.4 98/08/12 14:20:50 14:20:50 mjames (Mike James) |
137 | * Revision 1.4 98/08/12 14:20:50 14:20:50 mjames (Mike James) |
137 | * removed bug in generic lookup. |
138 | * removed bug in generic lookup. |
138 | * |
139 | * |
139 | * Revision 1.3 98/07/14 13:24:16 13:24:16 mjames (Mike James) |
140 | * Revision 1.3 98/07/14 13:24:16 13:24:16 mjames (Mike James) |
140 | * fixed errors in lookup of generic variables - |
141 | * fixed errors in lookup of generic variables - |
141 | * now works better |
142 | * now works better |
142 | * |
143 | * |
143 | * Revision 1.2 98/03/16 11:37:09 11:37:09 mjames (Mike James) |
144 | * Revision 1.2 98/03/16 11:37:09 11:37:09 mjames (Mike James) |
144 | * Updated generic storage and lookup |
145 | * Updated generic storage and lookup |
145 | * |
146 | * |
146 | * Revision 1.1 98/02/11 11:26:11 11:26:11 mjames (Mike James) |
147 | * Revision 1.1 98/02/11 11:26:11 11:26:11 mjames (Mike James) |
147 | * Initial revision |
148 | * Initial revision |
148 | * |
149 | * |
149 | */ |
150 | */ |
150 | #include "generic.h" |
- | |
151 | - | ||
152 | #include "cmdlog.h" |
- | |
153 | #include "cmdparse.h" |
- | |
154 | #include "database.h" |
- | |
155 | #include "expression.h" |
- | |
156 | #include "vertcl_main.h" |
- | |
157 | - | ||
158 | #include <ctype.h> |
- | |
159 | #include <stdio.h> |
151 | #include <stdio.h> |
160 | #include <stdlib.h> |
- | |
161 | #include <string.h> |
152 | #include <string.h> |
- | 153 | #include <stdlib.h> |
|
- | 154 | #include <ctype.h> |
|
- | 155 | ||
- | 156 | #include "vertcl_main.h" |
|
- | 157 | #include "expression.h" |
|
- | 158 | #include "generic.h" |
|
- | 159 | #include "database.h" |
|
- | 160 | #include "cmdparse.h" |
|
- | 161 | #include "cmdlog.h" |
|
162 | /* this is included regardless of the translator being built */ |
162 | /* this is included regardless of the translator being built */ |
163 | #include "acf_yacc.h" |
163 | #include "acf_yacc.h" |
164 | 164 | ||
165 | #ident \ |
- | |
166 | "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/generic.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
- | |
167 | 165 | ||
168 | generic_info_t *global_generics = NULL; /* list of user set generics */ |
- | |
169 | 166 | ||
- | 167 | #ident "@(#)$Header: c:\\cygwin\\cvsroot/Vert03/vertlib/generic.c,v 1.1.1.1 2003/11/04 23:34:57 mjames Exp $" |
|
- | 168 | ||
- | 169 | generic_info_t * global_generics=NULL; /* list of user set generics */ |
|
- | 170 | ||
170 | generic_info_t *partition_generics = NULL; /* list of all unique generic names found on |
171 | generic_info_t * partition_generics = NULL; /* list of all unique generic names found on |
171 | entities within a partition */ |
172 | entities within a partition */ |
172 | /* This function converts an integer value expressed in a number base |
173 | /* This function converts an integer value expressed in a number base |
173 | e.g. 2_1010110 binary |
174 | e.g. 2_1010110 binary |
174 | 16_0xf002 hex |
175 | 16_0xf002 hex |
175 | 3234 decimal */ |
176 | 3234 decimal */ |
176 | int convert_num (char *string, int *value) |
177 | int convert_num(char * string,int * value) { |
177 | { |
- | |
178 | char *endptr; |
178 | char * endptr; |
179 | int base; |
179 | int base; |
180 | long val; |
180 | long val; |
181 | /* identify numbers like base_nnnnnn */ |
181 | /* identify numbers like base_nnnnnn */ |
182 | if (isdigit (string[0])) |
182 | if(isdigit(string[0])) { |
183 | { |
- | |
184 | val = strtol (string, &endptr, 10); |
183 | val = strtol(string,&endptr,10); |
185 | if (*endptr == '_') |
184 | if (*endptr=='_') { |
186 | { |
- | |
187 | base = (int) val; |
185 | base=(int)val; |
188 | endptr++; |
186 | endptr++; |
189 | val = (int) strtol (endptr, &endptr, base); |
187 | val = (int)strtol(endptr,&endptr,base); |
190 | } |
188 | } |
191 | *value = (int) val; |
189 | *value = (int)val; |
192 | return 1; /* success */ |
190 | return 1; /* success */ |
193 | } |
191 | } |
194 | else |
- | |
195 | { |
192 | else { |
196 | /* *value = 1; */ |
193 | /* *value = 1; */ |
197 | return 0; /* fail */ |
194 | return 0;/* fail */ |
198 | } |
195 | } |
199 | } |
196 | } |
- | 197 | ||
- | 198 | ||
200 | 199 | ||
201 | __declspec(dllexport) generic_type_t |
200 | __declspec (dllexport) generic_type_t get_generic_value( |
202 | get_generic_value (generic_info_t **list, char *string, generic_info_t *result) |
201 | generic_info_t ** list, char * string, |
203 | { |
- | |
- | 202 | generic_info_t * result) { |
|
204 | generic_info_t *ptr; |
203 | generic_info_t * ptr ; |
205 | int val; |
204 | int val; |
206 | 205 | ||
207 | if (list) |
206 | if(list) |
208 | ptr = *list; |
207 | ptr = * list; |
209 | 208 | ||
210 | result->g_type = NO_VALUE; /* Unknown information */ |
209 | result->g_type = NO_VALUE; /* Unknown information */ |
211 | /* identify numbers like base_nnnnnn */ |
210 | /* identify numbers like base_nnnnnn */ |
212 | if (convert_num (string, &val) == 1) |
211 | if(convert_num(string,&val)==1) { |
213 | { |
- | |
214 | result->g_type = IS_INTEGER; |
212 | result->g_type = IS_INTEGER; |
215 | result->expr = compile_constant (val); |
213 | result->expr = compile_constant(val); |
216 | } |
214 | } |
217 | else |
215 | else { |
218 | { |
216 | |
219 | /* look up name and see if it has an integer value */ |
217 | /* look up name and see if it has an integer value */ |
220 | while (ptr) |
- | |
221 | { |
218 | while(ptr) { |
222 | if (strcmp2 (ptr->name, string) == 0) |
219 | if(strcmp2(ptr->name,string)==0) |
223 | break; |
220 | break; |
224 | ptr = ptr->next; |
221 | ptr=ptr->next; |
225 | } |
222 | } |
226 | if (ptr) |
- | |
227 | { |
223 | if(ptr) { |
228 | /* printf("%s : found value = %d\n",string,ptr->value); */ |
224 | /* printf("%s : found value = %d\n",string,ptr->value); */ |
229 | *result = *ptr; |
225 | *result = *ptr; |
230 | /* printf("%s : found value = %s\n",string,ptr->name); */ |
226 | /* printf("%s : found value = %s\n",string,ptr->name); */ |
231 | } |
227 | } |
232 | /* check to see if the string returned is valid in future at this point */ |
228 | /* check to see if the string returned is valid in future at this point */ |
233 | } |
229 | } |
234 | #if defined DEBUG_EXPRESSION |
230 | #if defined DEBUG_EXPRESSION |
235 | if (ptr) |
231 | if(ptr) |
236 | printf ("GET %s %p looked up\n", ptr->name, ptr); |
232 | printf("GET %s %p looked up\n",ptr->name,ptr); |
237 | #endif |
233 | #endif |
238 | return result->g_type; |
234 | return result->g_type; |
239 | } |
235 | } |
240 | 236 | ||
241 | __declspec(dllexport) generic_info_t *get_generic_ref (generic_info_t **list, char *string) |
237 | __declspec (dllexport) generic_info_t * get_generic_ref( |
242 | { |
- | |
- | 238 | generic_info_t ** list, char * string) { |
|
243 | generic_info_t *ptr; |
239 | generic_info_t * ptr ; |
244 | if (list) |
240 | if(list) |
245 | { |
241 | { |
246 | ptr = *list; |
242 | ptr = * list; |
247 | } |
243 | } |
248 | else |
244 | else |
249 | { |
245 | { |
250 | return NULL; |
246 | return NULL; |
251 | } |
247 | } |
252 | /* look up name and see if it has an integer value */ |
248 | /* look up name and see if it has an integer value */ |
253 | while (ptr) |
249 | while(ptr) { |
254 | { |
- | |
255 | if (strcmp2 (ptr->name, string) == 0) |
250 | if(strcmp2(ptr->name,string)==0) |
256 | break; |
251 | break; |
257 | #if defined DEBUG_EXPRESSION |
252 | #if defined DEBUG_EXPRESSION |
258 | if (ptr) |
253 | if(ptr) |
259 | printf ("REF %s %p looked up\n", ptr->name, ptr); |
254 | printf("REF %s %p looked up\n",ptr->name,ptr); |
260 | #endif |
255 | #endif |
261 | ptr = ptr->next; |
256 | ptr=ptr->next; |
262 | } |
257 | } |
263 | 258 | ||
264 | #if defined DEBUG_EXPRESSION |
259 | #if defined DEBUG_EXPRESSION |
265 | if (ptr) |
260 | if(ptr) |
266 | printf ("REF %s %p looked up\n", ptr->name, ptr); |
261 | printf("REF %s %p looked up\n",ptr->name,ptr); |
267 | #endif |
262 | #endif |
268 | return ptr; |
263 | return ptr; |
269 | } |
264 | } |
270 | 265 | ||
- | 266 | ||
271 | /* this function makes a copy of the generic passed to it */ |
267 | /* this function makes a copy of the generic passed to it */ |
272 | /* but it cannot make a copy of the expression because it |
268 | /* but it cannot make a copy of the expression because it |
273 | * requires knowledge of whether this generic is local to |
269 | * requires knowledge of whether this generic is local to |
274 | * a component instance or global : this is done by the caller |
270 | * a component instance or global : this is done by the caller |
275 | */ |
271 | */ |
276 | __declspec(dllexport) |
- | |
277 | generic_info_t *set_generic_value (generic_info_t **list, generic_info_t *info) |
272 | __declspec (dllexport) generic_info_t * set_generic_value(generic_info_t ** list, generic_info_t * info) { |
278 | { |
- | |
279 | generic_info_t *ptr, *prev; |
273 | generic_info_t * ptr,* prev; |
280 | - | ||
281 | prev = NULL; |
- | |
282 | if (list) |
- | |
283 | ptr = *list; |
- | |
284 | else |
- | |
285 | return NULL; |
- | |
286 | 274 | ||
- | 275 | prev = NULL; |
|
- | 276 | if(list) |
|
287 | while (ptr) |
277 | ptr = * list; |
288 | { |
278 | else |
- | 279 | return NULL; |
|
- | 280 | ||
- | 281 | ||
- | 282 | while(ptr) { |
|
289 | if (strcmp2 (ptr->name, info->name) == 0) |
283 | if(strcmp2(ptr->name,info->name)==0) |
290 | break; |
284 | break; |
291 | prev = ptr; |
285 | prev=ptr; |
292 | ptr = ptr->next; |
286 | ptr=ptr->next; |
- | 287 | } |
|
293 | } |
288 | |
294 | 289 | ||
295 | /* there is no existing generic of the appropriate name */ |
290 | /* there is no existing generic of the appropriate name */ |
296 | 291 | ||
297 | if (!ptr) |
292 | if (!ptr) { |
298 | { |
- | |
299 | ptr = calloc (1, sizeof (generic_info_t)); |
293 | ptr=calloc(1,sizeof(generic_info_t)); |
300 | if (!prev) |
294 | if(!prev) |
301 | *list = ptr; |
295 | *list = ptr; |
302 | else |
296 | else |
303 | prev->next = ptr; |
297 | prev->next = ptr; |
304 | ptr->next = NULL; |
298 | ptr->next = NULL; |
305 | ptr->expr_ref = NULL; |
299 | ptr->expr_ref = NULL; |
306 | ptr->is_component_generic = |
- | |
307 | info->is_component_generic; /* allows me to find which list defined on */ |
300 | ptr->is_component_generic = info->is_component_generic; /* allows me to find which list defined on */ |
308 | ptr->name = allocstr (info->name); |
301 | ptr->name = allocstr(info->name); |
309 | } |
302 | } |
310 | else |
- | |
311 | { |
303 | else { |
312 | /* free(ptr->typename); */ |
304 | /* free(ptr->typename); */ |
313 | /* free(ptr->valuename); */ |
305 | /* free(ptr->valuename); */ |
314 | } |
306 | } |
315 | if (ptr) |
307 | if(ptr) { |
316 | { |
- | |
317 | #if defined DEBUG_EXPRESSION |
308 | #if defined DEBUG_EXPRESSION |
318 | printf ("SET %s %p assign '", info->name, ptr); |
309 | printf("SET %s %p assign '",info->name,ptr); |
319 | print_expression (stdout, info->expr, 0); |
310 | print_expression(stdout,info->expr,0); |
320 | printf ("'=%d was '", eval_expression (info->expr, list)); |
311 | printf("'=%d was '",eval_expression(info->expr,list)); |
321 | print_expression (stdout, ptr->expr, 0); |
312 | print_expression(stdout,ptr->expr,0); |
322 | printf ("'\n"); |
313 | printf("'\n"); |
323 | #endif |
314 | #endif |
324 | ptr->typename = allocstr (info->typename); |
315 | ptr->typename = allocstr(info->typename); |
325 | 316 | ||
326 | ptr->valid = 0; |
317 | ptr->valid = 0; |
327 | ptr->expr = info->expr; |
318 | ptr->expr = info->expr; |
328 | ptr->g_type = info->g_type; |
319 | ptr->g_type = info->g_type; |
329 | ptr->g_class = info->g_class; |
320 | ptr->g_class = info->g_class; |
330 | } |
321 | } |
331 | return ptr; |
322 | return ptr; |
332 | } |
323 | } |
333 | 324 | ||
334 | /* new delete generic call is used to clean up databases */ |
325 | /* new delete generic call is used to clean up databases */ |
335 | __declspec(dllexport) int del_generic_value (generic_info_t **list, generic_info_t *info) |
326 | __declspec (dllexport) int del_generic_value(generic_info_t ** list, generic_info_t * info) { |
336 | { |
- | |
337 | generic_info_t *ptr, *prev = NULL; |
327 | generic_info_t * ptr,* prev = NULL; |
338 | - | ||
339 | if (list) |
- | |
340 | ptr = *list; |
- | |
341 | else |
- | |
342 | return 1; |
- | |
343 | 328 | ||
- | 329 | if(list) |
|
344 | while (ptr) |
330 | ptr = * list; |
- | 331 | else |
|
345 | { |
332 | return 1; |
- | 333 | ||
- | 334 | ||
- | 335 | while(ptr) { |
|
346 | if (strcmp2 (ptr->name, info->name) == 0) |
336 | if(strcmp2(ptr->name,info->name)==0) |
347 | break; |
337 | break; |
348 | prev = ptr; |
338 | prev=ptr; |
- | 339 | ptr=ptr->next; |
|
- | 340 | } |
|
- | 341 | ||
- | 342 | if (!ptr) |
|
- | 343 | return 1; |
|
- | 344 | ||
- | 345 | /* we have found a generic of the appropriate name and now |
|
- | 346 | * it will be deleted. We cannot remove any of the expressions |
|
- | 347 | * or strings used as they may be shared if they were declared |
|
- | 348 | * with the use of a wildcard assignment. Pay the price |
|
- | 349 | * of a potential memory leak here .... */ |
|
- | 350 | ||
- | 351 | if (prev) |
|
349 | ptr = ptr->next; |
352 | prev->next = ptr->next; |
350 | } |
353 | else |
- | 354 | *list = ptr->next; |
|
- | 355 | ||
- | 356 | free(ptr); /* we can be sure this is unique however */ |
|
351 | 357 | ||
352 | if (!ptr) |
- | |
353 | return 1; |
- | |
354 | - | ||
355 | /* we have found a generic of the appropriate name and now |
- | |
356 | * it will be deleted. We cannot remove any of the expressions |
- | |
357 | * or strings used as they may be shared if they were declared |
- | |
358 | * with the use of a wildcard assignment. Pay the price |
- | |
359 | * of a potential memory leak here .... */ |
- | |
360 | - | ||
361 | if (prev) |
- | |
362 | prev->next = ptr->next; |
- | |
363 | else |
- | |
364 | *list = ptr->next; |
- | |
365 | - | ||
366 | free (ptr); /* we can be sure this is unique however */ |
- | |
367 | - | ||
368 | return 0; |
358 | return 0; |
369 | } |
359 | } |
370 | 360 | ||
371 | #define MAXINDENT 8 |
361 | #define MAXINDENT 8 |
372 | 362 | ||
373 | static char linebuff[MAXIDLEN]; |
- | |
374 | - | ||
375 | static char *escape_quote (char *str) |
- | |
376 | { |
- | |
377 | char *f = str, *t = linebuff; |
- | |
378 | while (*f) |
- | |
379 | { |
- | |
380 | if (*f == '\"' || *f == '\\') |
- | |
381 | *t++ = '\\'; |
- | |
382 | *t++ = *f++; |
- | |
383 | } |
- | |
384 | *t = 0; |
- | |
385 | return linebuff; |
- | |
386 | } |
- | |
387 | 363 | ||
388 | __declspec(dllexport) void list_generic_values (FILE *f, generic_info_t **list, int indent) |
- | |
389 | { |
- | |
390 | generic_info_t *ptr; |
- | |
391 | int i; |
- | |
392 | char indents[MAXINDENT + 1]; |
364 | static char linebuff[MAXIDLEN]; |
393 | 365 | ||
- | 366 | static char * escape_quote(char * str) { |
|
- | 367 | char *f = str,*t = linebuff; |
|
- | 368 | while (*f) { |
|
- | 369 | if (*f=='\"' || *f=='\\') |
|
- | 370 | *t++ = '\\'; |
|
- | 371 | *t++ = *f++; |
|
- | 372 | } |
|
- | 373 | *t=0; |
|
- | 374 | return linebuff; |
|
- | 375 | } |
|
- | 376 | ||
- | 377 | ||
- | 378 | ||
- | 379 | __declspec (dllexport)void list_generic_values(FILE * f,generic_info_t ** list,int indent) { |
|
- | 380 | generic_info_t * ptr; |
|
- | 381 | int i; |
|
- | 382 | char indents[MAXINDENT+1]; |
|
- | 383 | ||
- | 384 | if(list) |
|
394 | if (list) |
385 | ptr = *list; |
- | 386 | else |
|
- | 387 | ptr = NULL; |
|
- | 388 | /* build up the line of indents */ |
|
- | 389 | for(i=0;(i<indent) && (i<MAXINDENT); indents[i++]=' '); |
|
- | 390 | indents[indent] = 0; |
|
- | 391 | ||
- | 392 | ||
- | 393 | fprintf(f,"%sGENERIC -- Generic constants \n",indents); |
|
- | 394 | while(ptr) { |
|
- | 395 | char * string = NULL; |
|
- | 396 | if (ptr->expr) |
|
- | 397 | string = ptr->expr->left.s; /* pickup string for future use */ |
|
- | 398 | fprintf(f,"%s %-20s : ",indents,ptr->name); /* print its name */ |
|
- | 399 | ||
- | 400 | switch(ptr->g_type) { |
|
- | 401 | case NO_VALUE: |
|
- | 402 | case IS_STRING: |
|
- | 403 | case IS_ENV_VAL: |
|
- | 404 | fprintf(f," %-10s := \"%s\"", |
|
- | 405 | ptr->typename? ptr->typename :"", |
|
- | 406 | string?escape_quote(string):""); |
|
- | 407 | break; |
|
- | 408 | case IS_ATTRIBUTE: |
|
- | 409 | fprintf(f," attribute "); |
|
- | 410 | if (ptr->g_class == DEFINED) { |
|
- | 411 | fprintf(f," := "); |
|
- | 412 | print_expression(f,ptr->expr,0); |
|
- | 413 | } |
|
- | 414 | break; |
|
- | 415 | case IS_BOOLEAN: |
|
- | 416 | fprintf(f," boolean "); |
|
- | 417 | if (ptr->g_class == DEFINED) { |
|
- | 418 | fprintf(f," := "); |
|
- | 419 | print_expression(f,ptr->expr,0); |
|
- | 420 | } |
|
- | 421 | break; |
|
- | 422 | case IS_INTEGER: |
|
- | 423 | fprintf(f," integer "); |
|
- | 424 | if (ptr->g_class == DEFINED) { |
|
395 | ptr = *list; |
425 | fprintf(f," := "); |
- | 426 | print_expression(f,ptr->expr,0); |
|
- | 427 | } |
|
- | 428 | break; |
|
- | 429 | case TO: |
|
- | 430 | case DOWNTO: |
|
- | 431 | fprintf(f," integer range "); |
|
- | 432 | if (ptr->g_class == DEFINED) { |
|
- | 433 | fprintf(f," := "); |
|
- | 434 | print_range_expression(f,ptr->expr,0); |
|
- | 435 | } |
|
- | 436 | break; |
|
- | 437 | ||
- | 438 | ||
- | 439 | case IS_DECLARATION_DIRECTIVE: |
|
- | 440 | if (!ISNULLSTR(string)) |
|
- | 441 | fprintf(f," declaration := \"%s\"",escape_quote(string)); |
|
396 | else |
442 | else |
397 | ptr = NULL; |
- | |
398 | /* build up the line of indents */ |
- | |
399 | for (i = 0; (i < indent) && (i < MAXINDENT); indents[i++] = ' ') |
- | |
400 | ; |
- | |
401 | indents[indent] = 0; |
443 | fprintf(f," declaration"); |
402 | - | ||
403 | fprintf (f, "%sGENERIC -- Generic constants \n", indents); |
- | |
404 | while (ptr) |
- | |
405 | { |
444 | break; |
406 | char *string = NULL; |
- | |
407 | if (ptr->expr) |
- | |
408 | string = ptr->expr->left.s; /* pickup string for future use */ |
- | |
409 | fprintf (f, "%s %-20s : ", indents, ptr->name); /* print its name */ |
- | |
410 | - | ||
411 | switch (ptr->g_type) |
- | |
412 | { |
- | |
413 | case NO_VALUE: |
- | |
414 | case IS_STRING: |
- | |
415 | case IS_ENV_VAL: |
- | |
416 | fprintf ( |
- | |
417 | f, |
- | |
418 | " %-10s := \"%s\"", |
- | |
419 | ptr->typename ? ptr->typename : "", |
- | |
420 | string ? escape_quote (string) : ""); |
- | |
421 | break; |
- | |
422 | case IS_ATTRIBUTE: |
- | |
423 | fprintf (f, " attribute "); |
- | |
424 | if (ptr->g_class == DEFINED) |
- | |
425 | { |
- | |
426 | fprintf (f, " := "); |
- | |
427 | print_expression (f, ptr->expr, 0); |
- | |
428 | } |
- | |
429 | break; |
- | |
430 | case IS_BOOLEAN: |
- | |
431 | fprintf (f, " boolean "); |
- | |
432 | if (ptr->g_class == DEFINED) |
- | |
433 | { |
- | |
434 | fprintf (f, " := "); |
- | |
435 | print_expression (f, ptr->expr, 0); |
- | |
436 | } |
- | |
437 | break; |
- | |
438 | case IS_INTEGER: |
- | |
439 | fprintf (f, " integer "); |
- | |
440 | if (ptr->g_class == DEFINED) |
- | |
441 | { |
- | |
442 | fprintf (f, " := "); |
- | |
443 | print_expression (f, ptr->expr, 0); |
- | |
444 | } |
- | |
445 | break; |
- | |
446 | case TO: |
- | |
447 | case DOWNTO: |
- | |
448 | fprintf (f, " integer range "); |
- | |
449 | if (ptr->g_class == DEFINED) |
- | |
450 | { |
- | |
451 | fprintf (f, " := "); |
- | |
452 | print_range_expression (f, ptr->expr, 0); |
- | |
453 | } |
- | |
454 | break; |
- | |
455 | - | ||
456 | case IS_DECLARATION_DIRECTIVE: |
- | |
457 | if (!ISNULLSTR (string)) |
- | |
458 | fprintf (f, " declaration := \"%s\"", escape_quote (string)); |
- | |
459 | else |
- | |
460 | fprintf (f, " declaration"); |
- | |
461 | break; |
- | |
462 | case IS_INSTANCE_DIRECTIVE: |
445 | case IS_INSTANCE_DIRECTIVE: |
463 | if (!ISNULLSTR (string)) |
446 | if (!ISNULLSTR(string)) |
464 | fprintf (f, " instance := \"%s\"", escape_quote (string)); |
447 | fprintf(f," instance := \"%s\"",escape_quote(string)); |
465 | else |
448 | else |
466 | fprintf (f, " instance"); |
449 | fprintf(f," instance"); |
467 | break; |
450 | break; |
468 | }; |
451 | }; |
469 | 452 | ||
470 | if (ptr->next) |
453 | if(ptr->next) |
471 | fprintf (f, ";\n"); |
454 | fprintf(f,";\n"); |
472 | ptr = ptr->next; |
455 | ptr=ptr->next; |
473 | } |
456 | } |
474 | fprintf (f, "\n%sEND;\n\n", indents); |
457 | fprintf(f,"\n%sEND;\n\n",indents); |
475 | } |
458 | } |
476 | 459 | ||
477 | __declspec(dllexport) void list_VHDL_generic_map_values (FILE *f, generic_info_t **list) |
460 | __declspec (dllexport) void list_VHDL_generic_map_values(FILE * f,generic_info_t ** list ) { |
478 | { |
- | |
479 | generic_info_t *ptr = *list; |
461 | generic_info_t * ptr = *list; |
480 | if (ptr) |
462 | if (ptr) { |
481 | { |
- | |
482 | fprintf (f, "-- Generic constants\n"); |
463 | fprintf(f,"-- Generic constants\n"); |
483 | fprintf (f, " GENERIC MAP ( \n"); |
464 | fprintf(f," GENERIC MAP ( \n" ); |
484 | } |
465 | } |
485 | while (ptr) |
466 | while(ptr) { |
486 | { |
- | |
487 | /* only integer and string generic constants OK */ |
467 | /* only integer and string generic constants OK */ |
488 | switch (ptr->g_type) |
468 | switch(ptr->g_type) { |
489 | { |
469 | case IS_STRING: |
490 | case IS_STRING: |
470 | case IS_INTEGER: |
491 | case IS_INTEGER: |
471 | case IS_BOOLEAN: |
492 | case IS_BOOLEAN: |
472 | fprintf(f," %-10s => ", |
493 | fprintf (f, " %-10s => ", ptr->name ? ptr->name : ""); |
473 | ptr->name? ptr->name :""); |
494 | print_expression (f, ptr->expr, 0); |
474 | print_expression(f,ptr->expr,0); |
495 | break; |
475 | break; |
496 | default: |
476 | default: |
497 | fprintf (f, "-- %-10s", ptr->name ? ptr->name : ""); |
477 | fprintf(f,"-- %-10s", |
498 | break; |
478 | ptr->name? ptr->name :""); |
499 | } |
479 | break; |
- | 480 | } |
|
500 | 481 | ||
501 | if (ptr->next) |
482 | if(ptr->next) |
502 | fprintf (f, ",\n"); |
483 | fprintf(f,",\n"); |
503 | else |
484 | else |
504 | fprintf (f, "\n )\n"); /* no closing semi on GENERIC MAP */ |
485 | fprintf(f,"\n )\n"); /* no closing semi on GENERIC MAP */ |
505 | ptr = ptr->next; |
486 | ptr=ptr->next; |
506 | } |
487 | } |
507 | } |
488 | } |
508 | 489 | ||
509 | /********************************************************************/ |
490 | /********************************************************************/ |
510 | __declspec(dllexport) int print_VHDL_constant ( |
- | |
511 | FILE *f, char *s, generic_info_t *ptr, generic_print_style recurse_generics) |
491 | __declspec (dllexport) int print_VHDL_constant(FILE * f,char * s,generic_info_t * ptr,generic_print_style recurse_generics) { |
512 | { |
- | |
513 | expression_t *exp; |
492 | expression_t * exp; |
514 | if (!ptr) |
493 | if (!ptr) |
515 | return 0; |
494 | return 0; |
516 | exp = ptr->expr; |
495 | exp = ptr->expr; |
517 | 496 | ||
518 | if (exp) |
497 | if (exp) { |
519 | { |
- | |
520 | switch (ptr->g_type) |
498 | switch(ptr->g_type) { |
521 | { |
- | |
522 | case TXT_STRING: |
499 | case TXT_STRING: |
523 | fprintf (f, " %s %-20s : string := ", s, ptr->name); |
500 | fprintf(f," %s %-20s : string := ",s,ptr->name); |
524 | print_expression (f, exp, recurse_generics); |
501 | print_expression(f,exp,recurse_generics); |
525 | return 1; |
502 | return 1; |
526 | break; |
503 | break; |
527 | case TO: |
504 | case TO: |
528 | case DOWNTO: |
505 | case DOWNTO: |
529 | fprintf (f, " %s %-20s : integer range:= ", s, ptr->name); |
506 | fprintf(f," %s %-20s : integer range:= ",s,ptr->name); |
530 | print_range_expression (f, exp, recurse_generics); |
507 | print_range_expression(f,exp,recurse_generics); |
531 | return 1; |
508 | return 1; |
532 | break; |
509 | break; |
533 | 510 | ||
534 | case IS_INTEGER: |
511 | case IS_INTEGER: |
535 | fprintf (f, " %s %-20s : integer:= ", s, ptr->name); |
512 | fprintf(f," %s %-20s : integer:= ",s,ptr->name); |
536 | print_expression (f, exp, recurse_generics); |
513 | print_expression(f,exp,recurse_generics); |
537 | return 1; |
514 | return 1; |
538 | break; |
515 | break; |
539 | case IS_BOOLEAN: |
516 | case IS_BOOLEAN: |
540 | fprintf (f, " %s %-20s : boolean:= ", s, ptr->name); |
517 | fprintf(f," %s %-20s : boolean:= ",s,ptr->name); |
541 | print_expression (f, exp, recurse_generics); |
518 | print_expression(f,exp,recurse_generics); |
542 | return 1; |
519 | return 1; |
543 | break; |
- | |
544 | default: |
- | |
545 | return 0; |
- | |
546 | /* nothing */ |
- | |
547 | }; |
520 | break; |
548 | } |
521 | default: |
549 | return 0; |
522 | return 0; |
- | 523 | /* nothing */ |
|
- | 524 | }; |
|
- | 525 | } |
|
- | 526 | return 0; |
|
550 | } |
527 | } |
551 | 528 | ||
552 | /********************************************************************/ |
529 | /********************************************************************/ |
553 | __declspec(dllexport) void list_VHDL_generic_values (FILE *f, generic_info_t **list) |
530 | __declspec (dllexport) void list_VHDL_generic_values(FILE * f,generic_info_t ** list ) { |
554 | { |
- | |
555 | generic_info_t *ptr; |
531 | generic_info_t * ptr; |
556 | int printed; |
532 | int printed; |
557 | ptr = *list; |
533 | ptr = *list; |
558 | 534 | ||
559 | if (ptr) |
535 | if (ptr) { |
560 | { |
- | |
561 | fprintf (f, "-- Generic constants\n"); |
536 | fprintf(f,"-- Generic constants\n"); |
562 | fprintf (f, " GENERIC ( \n"); |
537 | fprintf(f," GENERIC ( \n" ); |
563 | } |
538 | } |
564 | printed = 0; |
539 | printed = 0; |
565 | while (ptr) |
540 | while(ptr) { |
566 | { |
- | |
567 | if (printed) |
541 | if (printed) |
568 | fprintf (f, ";\n"); |
542 | fprintf(f,";\n"); |
569 | printed = print_VHDL_constant (f, "", ptr, 0); |
543 | printed = print_VHDL_constant(f,"",ptr,0); |
570 | ptr = ptr->next; |
544 | ptr=ptr->next; |
571 | } |
545 | } |
572 | if (*list) |
546 | if (*list) |
573 | fprintf (f, ");\n"); /* closing semi on GENERIC */ |
547 | fprintf(f,");\n"); /* closing semi on GENERIC */ |
574 | } |
548 | } |
575 | /********************************************************************/ |
549 | /********************************************************************/ |
576 | void list_VHDL_constants (FILE *f, generic_info_t **list) |
550 | void list_VHDL_constants(FILE * f,generic_info_t ** list ) { |
577 | { |
- | |
578 | generic_info_t *ptr = *list; |
551 | generic_info_t * ptr = *list; |
579 | 552 | ||
580 | while (ptr) |
- | |
581 | { /* recursively expand generics to the full expression */ |
553 | while(ptr) { /* recursively expand generics to the full expression */ |
582 | if (print_VHDL_constant (f, " CONSTANT ", ptr, 1)) |
554 | if(print_VHDL_constant(f," CONSTANT ",ptr,1)) |
583 | fprintf (f, ";\n"); |
555 | fprintf(f,";\n"); |
584 | ptr = ptr->next; |
556 | ptr=ptr->next; |
585 | } |
557 | } |
586 | fprintf (f, "\n"); |
558 | fprintf(f,"\n"); |
587 | } |
559 | |
- | 560 | } |
|
588 | /********************************************************************/ |
561 | /********************************************************************/ |
589 | /* this was used before CONSTANTS were used. Keeping it because it |
562 | /* this was used before CONSTANTS were used. Keeping it because it |
590 | * will be useful when name spaces are properly implemented : if there |
563 | * will be useful when name spaces are properly implemented : if there |
591 | * are any unresolved global generics then partition generics should be |
564 | * are any unresolved global generics then partition generics should be |
592 | * created |
565 | * created |
593 | */ |
566 | */ |
594 | 567 | ||
- | 568 | ||
595 | /********************************************************************/ |
569 | /********************************************************************/ |
596 | 570 | ||
597 | void setup_generic_types (generic_info_t *list) |
571 | void setup_generic_types(generic_info_t* list) { |
598 | { |
- | |
599 | generic_info_t *ptr = list; |
572 | generic_info_t * ptr = list; |
600 | /* invalidate all values */ |
573 | /* invalidate all values */ |
601 | while (ptr) |
574 | while (ptr) { |
602 | { |
- | |
603 | ptr->valid = 0; |
575 | ptr->valid = 0; |
604 | ptr = ptr->next; |
576 | ptr= ptr->next; |
605 | } |
577 | } |
606 | ptr = list; |
578 | ptr = list; |
607 | while (ptr) |
579 | while (ptr) { |
608 | { |
- | |
609 | if (!ptr->valid) |
580 | if (!ptr->valid) { |
610 | { |
- | |
611 | /* this simply does type extraction from the expression |
581 | /* this simply does type extraction from the expression |
612 | component now */ |
582 | component now */ |
613 | eval_gen_expression (ptr); |
583 | eval_gen_expression(ptr); |
614 | } |
584 | } |
615 | ptr->valid = 1; |
585 | ptr->valid = 1; |
616 | ptr = ptr->next; |
586 | ptr= ptr->next; |
617 | } |
587 | } |
618 | } |
588 | } |
619 | 589 | ||
620 | /* if a generic has an expression which is a string or integer constant, |
590 | /* if a generic has an expression which is a string or integer constant, |
621 | transfer it to the other list */ |
591 | transfer it to the other list */ |
622 | void transfer_constant_generics (generic_info_t **src, generic_info_t **dst) |
592 | void transfer_constant_generics(generic_info_t ** src,generic_info_t ** dst) { |
- | 593 | generic_info_t * prev, * curr, * next; |
|
- | 594 | prev = NULL; |
|
- | 595 | curr = *src; |
|
- | 596 | ||
- | 597 | while(curr) { |
|
- | 598 | expression_t * exp; |
|
- | 599 | exp = curr->expr; |
|
- | 600 | next= curr->next; /* remember the next pointer for later */ |
|
- | 601 | if (exp && (exp->opcode == EXP_STRING || exp->opcode == EXP_CONSTANT)) { |
|
- | 602 | if(prev) |
|
- | 603 | prev->next = curr->next; /* link over it */ |
|
- | 604 | if(curr == *src) /* if was first element of list, set head to next */ |
|
- | 605 | *src = curr->next; |
|
- | 606 | curr->next = *dst; /* link to old head of destination list */ |
|
- | 607 | *dst = curr; /* place on head of destination list */ |
|
- | 608 | ||
- | 609 | } |
|
- | 610 | else |
|
- | 611 | prev = curr; /* only move on prev if we have not removed curr..*/ |
|
- | 612 | curr = next; |
|
- | 613 | } |
|
- | 614 | } |
|
- | 615 | ||
623 | { |
616 | |
- | 617 | extern void clear_partition_generics(generic_info_t ** list) |
|
- | 618 | { |
|
624 | generic_info_t *prev, *curr, *next; |
619 | generic_info_t* ptr, * prev_ptr; |
- | 620 | expr_ref_t * refs, * prev_refs; |
|
- | 621 | ptr = * list; |
|
- | 622 | while(ptr) |
|
- | 623 | { |
|
- | 624 | prev_ptr = ptr; |
|
- | 625 | refs = ptr->expr_ref; |
|
- | 626 | while (refs) |
|
- | 627 | { |
|
625 | prev = NULL; |
628 | prev_refs = refs; |
- | 629 | if(refs->expr) |
|
- | 630 | { |
|
- | 631 | refs -> expr->opcode = EXP_UNDEF_VAR; |
|
- | 632 | refs -> expr->left.g = NULL; |
|
- | 633 | } |
|
- | 634 | refs = refs->expr_ref; |
|
- | 635 | free(prev_refs); |
|
- | 636 | }; |
|
626 | curr = *src; |
637 | ptr = ptr -> next; |
- | 638 | free(prev_ptr); |
|
- | 639 | }; |
|
- | 640 | *list = NULL; |
|
- | 641 | } |
|
- | 642 | ||
- | 643 | ||
627 | 644 | ||
628 | while (curr) |
- | |
629 | { |
- | |
630 | expression_t *exp; |
- | |
631 | exp = curr->expr; |
- | |
632 | next = curr->next; /* remember the next pointer for later */ |
- | |
633 | if (exp && (exp->opcode == EXP_STRING || exp->opcode == EXP_CONSTANT)) |
- | |
634 | { |
- | |
635 | if (prev) |
- | |
636 | prev->next = curr->next; /* link over it */ |
- | |
637 | if (curr == *src) /* if was first element of list, set head to next */ |
- | |
638 | *src = curr->next; |
- | |
639 | curr->next = *dst; /* link to old head of destination list */ |
- | |
640 | *dst = curr; /* place on head of destination list */ |
- | |
641 | } |
- | |
642 | else |
- | |
643 | prev = curr; /* only move on prev if we have not removed curr..*/ |
- | |
644 | curr = next; |
- | |
645 | } |
- | |
646 | } |
- | |
647 | 645 | ||
648 | extern void clear_partition_generics (generic_info_t **list) |
- | |
649 | { |
- | |
650 | generic_info_t *ptr, *prev_ptr; |
- | |
651 | expr_ref_t *refs, *prev_refs; |
- | |
652 | ptr = *list; |
- | |
653 | while (ptr) |
- | |
654 | { |
- | |
655 | prev_ptr = ptr; |
- | |
656 | refs = ptr->expr_ref; |
- | |
657 | while (refs) |
- | |
658 | { |
- | |
659 | prev_refs = refs; |
- | |
660 | if (refs->expr) |
- | |
661 | { |
- | |
662 | refs->expr->opcode = EXP_UNDEF_VAR; |
- | |
663 | refs->expr->left.g = NULL; |
- | |
664 | } |
- | |
665 | refs = refs->expr_ref; |
- | |
666 | free (prev_refs); |
- | |
667 | }; |
- | |
668 | ptr = ptr->next; |
- | |
669 | free (prev_ptr); |
- | |
670 | }; |
- | |
671 | *list = NULL; |
- | |
672 | } |
- | |
673 | 646 | ||
674 | /* compute the values of all expressions */ |
647 | /* compute the values of all expressions */ |
675 | 648 | ||
676 | void elaborate_all (void) |
649 | void elaborate_all(void) { |
677 | { |
- | |
678 | socket_t *socket; |
650 | socket_t * socket; |
679 | 651 | ||
680 | printf ("elaborate\n"); |
652 | printf("elaborate\n"); |
681 | setup_generic_types (global_generics); |
653 | setup_generic_types(global_generics); |
682 | setup_generic_types (partition_generics); |
654 | setup_generic_types(partition_generics); |
683 | transfer_constant_generics (&global_generics, &partition_generics); |
655 | transfer_constant_generics(&global_generics,&partition_generics); |
684 | socket = socket_head; |
656 | socket = socket_head; |
685 | while (socket) |
657 | while (socket) { |
- | 658 | setup_generic_types(socket->generics); |
|
- | 659 | socket = socket->next; |
|
- | 660 | } |
|
- | 661 | } |
|
- | 662 | ||
- | 663 | ||
- | 664 | ||
- | 665 | void copy_declaration_generics(socket_t * skt,socket_t * from) { |
|
- | 666 | generic_info_t * src; |
|
- | 667 | ||
- | 668 | /* puts("copy_declaration_generics"); */ |
|
- | 669 | src = from->generics; |
|
- | 670 | while(src) { |
|
- | 671 | if (get_generic_ref(&skt->generics,src->name)) |
|
- | 672 | set_generic_value(&(skt->generics), src) ; |
|
- | 673 | src = src->next; |
|
686 | { |
674 | } |
- | 675 | src = skt->unrouted_generics; |
|
- | 676 | while(src) { |
|
- | 677 | if (get_generic_ref(&skt->generics,src->name)) |
|
687 | setup_generic_types (socket->generics); |
678 | set_generic_value(&(skt->generics), src) ; |
688 | socket = socket->next; |
679 | src = src->next; |
689 | } |
680 | } |
- | 681 | puts("done declaration generics"); |
|
- | 682 | ||
- | 683 | } |
|
- | 684 | ||
- | 685 | ||
690 | } |
686 | |
691 | 687 | ||
692 | void copy_declaration_generics (socket_t *skt, socket_t *from) |
- | |
693 | { |
- | |
694 | generic_info_t *src; |
- | |
695 | - | ||
696 | /* puts("copy_declaration_generics"); */ |
- | |
697 | src = from->generics; |
- | |
698 | while (src) |
- | |
699 | { |
- | |
700 | if (get_generic_ref (&skt->generics, src->name)) |
- | |
701 | set_generic_value (&(skt->generics), src); |
- | |
702 | src = src->next; |
- | |
703 | } |
- | |
704 | src = skt->unrouted_generics; |
- | |
705 | while (src) |
- | |
706 | { |
- | |
707 | if (get_generic_ref (&skt->generics, src->name)) |
- | |
708 | set_generic_value (&(skt->generics), src); |
- | |
709 | src = src->next; |
- | |
710 | } |
- | |
711 | puts ("done declaration generics"); |
- | |
712 | } |
- |