2 * This file is part of the Alliance CAD System
3 * Copyright (C) Laboratoire LIP6 - D\8epartement ASIM
4 * Universite Pierre et Marie Curie
6 * Home page : http://www-asim.lip6.fr/alliance/
7 * E-mail support : mailto:alliance-support@asim.lip6.fr
9 * This library is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Library General Public License as published
11 * by the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
14 * Alliance VLSI CAD System is distributed in the hope that it will be
15 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17 * Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with the GNU C Library; see the file COPYING. If not, write to the Free
21 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* 10/26/95 Cone Netlist Structure functions: inoutcone.c */
28 /*============================================================================*
29 | function checkincone(); |
30 | return a number, sum of the links and branches of a specified cone (that |
31 | may eventually be deprived of one branch and, or of one link) being driven |
32 | by a certain cone or connector |
33 *============================================================================*/
35 checkincone(ptcone
, ptbranch
, ptlink
, data
)
37 branch_list
*ptbranch
;
42 branch_list
*ptbranch1
;
47 if (CNS_TRACE_MODE
>= CNS_TRACE
)
48 (void) printf("TRA_cns checkincone\n");
51 (void) fflush(stdout
);
52 (void) fprintf(stderr
, "*** cns error ***");
53 (void) fprintf(stderr
, " checkincone() impossible: NULL pointer !\n");
57 for (ptbranch1
= ptcone
->BREXT
; ptbranch1
!= NULL
; ptbranch1
= ptbranch1
->NEXT
) {
58 if (ptbranch1
!= ptbranch
) {
59 for (ptlink1
= ptbranch1
->LINK
; ptlink1
!= NULL
; ptlink1
= ptlink1
->NEXT
) {
60 if (ptlink1
!= ptlink
) {
61 if ((ptlink1
->TYPE
& CNS_ACTIVE
) == CNS_ACTIVE
) {
62 if ((ptptype1
= getptype(ptlink1
->ULINK
.LOTRS
->USER
, (long) CNS_DRIVINGCONE
)) != NULL
) {
63 if (ptptype1
->DATA
== data
) {
68 else if ((ptlink1
->TYPE
& CNS_EXT
) == CNS_EXT
) {
69 if (ptlink1
->ULINK
.LOCON
== (locon_list
*) data
) {
77 for (ptbranch1
= ptcone
->BRVDD
; ptbranch1
!= NULL
; ptbranch1
= ptbranch1
->NEXT
) {
78 if (ptbranch1
!= ptbranch
) {
79 for (ptlink1
= ptbranch1
->LINK
; ptlink1
!= NULL
; ptlink1
= ptlink1
->NEXT
) {
80 if (ptlink1
!= ptlink
) {
81 if ((ptlink1
->TYPE
& CNS_ACTIVE
) == CNS_ACTIVE
) {
82 if ((ptptype1
= getptype(ptlink1
->ULINK
.LOTRS
->USER
, (long) CNS_DRIVINGCONE
)) != NULL
) {
83 if (ptptype1
->DATA
== data
) {
88 else if ((ptlink1
->TYPE
& CNS_EXT
) == CNS_EXT
) {
89 if (ptlink1
->ULINK
.LOCON
== (locon_list
*) data
) {
97 for (ptbranch1
= ptcone
->BRGND
; ptbranch1
!= NULL
; ptbranch1
= ptbranch1
->NEXT
) {
98 if (ptbranch1
!= ptbranch
) {
99 for (ptlink1
= ptbranch1
->LINK
; ptlink1
!= NULL
; ptlink1
= ptlink1
->NEXT
) {
100 if (ptlink1
!= ptlink
) {
101 if ((ptlink1
->TYPE
& CNS_ACTIVE
) == CNS_ACTIVE
) {
102 if ((ptptype1
= getptype(ptlink1
->ULINK
.LOTRS
->USER
, (long) CNS_DRIVINGCONE
)) != NULL
) {
103 if (ptptype1
->DATA
== data
) {
108 else if ((ptlink1
->TYPE
& CNS_EXT
) == CNS_EXT
) {
109 if (ptlink1
->ULINK
.LOCON
== (locon_list
*) data
) {
117 for (ptbranch1
= ptcone
->BRVSS
; ptbranch1
!= NULL
; ptbranch1
= ptbranch1
->NEXT
) {
118 if (ptbranch1
!= ptbranch
) {
119 for (ptlink1
= ptbranch1
->LINK
; ptlink1
!= NULL
; ptlink1
= ptlink1
->NEXT
) {
120 if (ptlink1
!= ptlink
) {
121 if ((ptlink1
->TYPE
& CNS_ACTIVE
) == CNS_ACTIVE
) {
122 if ((ptptype1
= getptype(ptlink1
->ULINK
.LOTRS
->USER
, (long) CNS_DRIVINGCONE
)) != NULL
) {
123 if (ptptype1
->DATA
== data
) {
128 else if ((ptlink1
->TYPE
& CNS_EXT
) == CNS_EXT
) {
129 if (ptlink1
->ULINK
.LOCON
== (locon_list
*) data
) {
140 /*============================================================================*
141 | function addincone(); |
142 | add an element to a cone's INCONE field after having checked its unicity |
143 *============================================================================*/
145 addincone(ptcone
, type
, data
)
154 if (CNS_TRACE_MODE
>= CNS_TRACE
)
155 (void) printf("TRA_cns addincone in\n");
157 if ((ptcone
== NULL
) || (type
== 0) || (data
== NULL
)) {
158 (void) fflush(stdout
);
159 (void) fprintf(stderr
, "*** cns error ***");
160 (void) fprintf(stderr
, " addincone() impossible: NULL pointer(s) !\n");
161 if (CNS_TRACE_MODE
>= CNS_TRACE
)
162 (void) printf("TRA_cns addincone out\n");
166 for (ptedge
= ptcone
->INCONE
; ptedge
!= NULL
; ptedge
= ptedge
->NEXT
) {
167 if (ptedge
->UEDGE
.PTR
== data
) {
173 ptcone
->INCONE
= addedge(ptcone
->INCONE
, type
, data
);
176 if (CNS_TRACE_MODE
>= CNS_TRACE
)
177 (void) printf("TRA_cns addincone out\n");
180 /*============================================================================*
181 | function delincone(); |
182 | delete an element of a cone's INCONE field |
183 *============================================================================*/
185 delincone(ptcone
, type
, data
)
193 if (CNS_TRACE_MODE
>= CNS_TRACE
)
194 (void) printf("TRA_cns delincone in\n");
196 if ((ptcone
== NULL
) || (type
== 0) || (data
== NULL
)) {
197 (void) fflush(stdout
);
198 (void) fprintf(stderr
, "*** cns error ***");
199 (void) fprintf(stderr
, " delincone() impossible: NULL pointer(s) !\n");
200 if (CNS_TRACE_MODE
>= CNS_TRACE
)
201 (void) printf("TRA_cns delincone out\n");
205 for (ptedge
= ptcone
->INCONE
; ptedge
!= NULL
; ptedge
= ptedge
->NEXT
) {
206 if (ptedge
->UEDGE
.PTR
== data
) {
207 ptcone
->INCONE
= deledge(ptcone
->INCONE
, ptedge
);
212 if (CNS_TRACE_MODE
>= CNS_TRACE
)
213 (void) printf("TRA_cns delincone out\n");
216 /*============================================================================*
217 | function appendincone(); |
218 | chain two INCONE edge lists while verifying unicity |
219 *============================================================================*/
221 appendincone(ptcone1
, ptcone2
)
228 if (CNS_TRACE_MODE
>= CNS_TRACE
)
229 (void) printf("TRA_cns appendincone in\n");
231 if ((ptcone1
== NULL
) || (ptcone2
== NULL
)) {
232 (void) fflush(stdout
);
233 (void) fprintf(stderr
, "*** cns error ***");
234 (void) fprintf(stderr
, " appendincone() impossible: NULL pointer(s) !\n");
235 if (CNS_TRACE_MODE
>= CNS_TRACE
)
236 (void) printf("TRA_cns appendincone out\n");
240 for (ptedge2
= ptcone2
->INCONE
; ptedge2
!= NULL
; ptedge2
= ptedge2
->NEXT
) {
241 addincone(ptcone1
, ptedge2
->TYPE
, ptedge2
->UEDGE
.PTR
);
244 if (CNS_TRACE_MODE
>= CNS_TRACE
)
245 (void) printf("TRA_cns appendincone out\n");
248 /*============================================================================*
249 | function viewincone(); |
250 | display the content of any given incone structure |
251 *============================================================================*/
253 viewincone(ptincone
, depth
)
258 char *margin
= (char *) mbkalloc(80);
262 if (CNS_TRACE_MODE
>= CNS_TRACE
)
263 (void) printf("TRA_cns viewincone in\n");
265 if (ptincone
== NULL
) {
266 (void) fflush(stdout
);
267 (void) fprintf(stderr
, "*** cns error ***");
268 (void) fprintf(stderr
, " viewincone() impossible: NULL pointer !\n");
269 if (CNS_TRACE_MODE
>= CNS_TRACE
)
270 (void) printf("TRA_cns viewincone out\n");
278 margin
= strcpy(margin
, " ");
279 while (k
<= CNS_VIEW_LEVEL
) {
280 margin
= strcat(margin
, " ");
285 printf("%sincone->NEXT = 0x%lx\n", margin
, (unsigned long)ptincone
->NEXT
);
286 printf("%sincone->TYPE = 0x%lx\n", margin
, (unsigned long)ptincone
->TYPE
);
287 printf("%sincone->UEDGE.PTR = 0x%lx\n", margin
, (unsigned long)ptincone
->UEDGE
.PTR
);
288 if ((ptincone
->TYPE
& CNS_EXT
) != CNS_EXT
) {
289 if ((depth
>= 1) && (ptincone
->UEDGE
.CONE
!= NULL
)) {
290 viewcone(ptincone
->UEDGE
.CONE
, depth
- 1);
294 if ((depth
>= 1) && (ptincone
->UEDGE
.LOCON
!= NULL
)) {
295 viewcnslocon(ptincone
->UEDGE
.LOCON
, depth
- 1);
298 printf("%sincone->USER = 0x%lx\n", margin
, (unsigned long)ptincone
->USER
);
299 if ((depth
>= 1) && (ptincone
->USER
!= NULL
)) {
300 for (ptptype
= ptincone
->USER
; ptptype
!= NULL
; ptptype
= ptptype
->NEXT
) {
301 viewcnsptype(ptptype
);
308 mbkfree((void *) margin
);
310 if (CNS_TRACE_MODE
>= CNS_TRACE
)
311 (void) printf("TRA_cns viewincone out\n");
314 /*============================================================================*
315 | function addoutcone(); |
316 | add an element to a cone's OUTCONE field after having checked its unicity |
317 *============================================================================*/
319 addoutcone(ptcone
, type
, data
)
328 if (CNS_TRACE_MODE
>= CNS_TRACE
)
329 (void) printf("TRA_cns addoutcone in\n");
331 if ((ptcone
== NULL
) || (type
== 0) || (data
== NULL
)) {
332 (void) fflush(stdout
);
333 (void) fprintf(stderr
, "*** cns error ***");
334 (void) fprintf(stderr
, " addoutcone() impossible: NULL pointer(s) !\n");
335 if (CNS_TRACE_MODE
>= CNS_TRACE
)
336 (void) printf("TRA_cns addoutcone out\n");
340 for (ptedge
= ptcone
->OUTCONE
; ptedge
!= NULL
; ptedge
= ptedge
->NEXT
) {
341 if (ptedge
->UEDGE
.PTR
== data
) {
347 ptcone
->OUTCONE
= addedge(ptcone
->OUTCONE
, type
, data
);
350 if (CNS_TRACE_MODE
>= CNS_TRACE
)
351 (void) printf("TRA_cns addoutcone out\n");
354 /*============================================================================*
355 | function deloutcone(); |
356 | delete an element of a cone's OUTCONE field |
357 *============================================================================*/
359 deloutcone(ptcone
, type
, data
)
367 if (CNS_TRACE_MODE
>= CNS_TRACE
)
368 (void) printf("TRA_cns deloutcone in\n");
370 if ((ptcone
== NULL
) || (type
== 0) || (data
== NULL
)) {
371 (void) fflush(stdout
);
372 (void) fprintf(stderr
, "*** cns error ***");
373 (void) fprintf(stderr
, " deloutcone() impossible: NULL pointer(s) !\n");
374 if (CNS_TRACE_MODE
>= CNS_TRACE
)
375 (void) printf("TRA_cns deloutcone out\n");
379 for (ptedge
= ptcone
->OUTCONE
; ptedge
!= NULL
; ptedge
= ptedge
->NEXT
) {
380 if (ptedge
->UEDGE
.PTR
== data
) {
381 ptcone
->OUTCONE
= deledge(ptcone
->OUTCONE
, ptedge
);
386 if (CNS_TRACE_MODE
>= CNS_TRACE
)
387 (void) printf("TRA_cns deloutcone out\n");
390 /*============================================================================*
391 | function appendoutcone(); |
392 | chain two OUTCONE edge lists while verifying unicity |
393 *============================================================================*/
395 appendoutcone(ptcone1
, ptcone2
)
402 if (CNS_TRACE_MODE
>= CNS_TRACE
)
403 (void) printf("TRA_cns appendoutcone in\n");
405 if ((ptcone1
== NULL
) || (ptcone2
== NULL
)) {
406 (void) fflush(stdout
);
407 (void) fprintf(stderr
, "*** cns error ***");
408 (void) fprintf(stderr
, " appendoutcone() impossible: NULL pointer(s) !\n");
409 if (CNS_TRACE_MODE
>= CNS_TRACE
)
410 (void) printf("TRA_cns appendoutcone out\n");
414 for (ptedge2
= ptcone2
->OUTCONE
; ptedge2
!= NULL
; ptedge2
= ptedge2
->NEXT
) {
415 addoutcone(ptcone1
, ptedge2
->TYPE
, ptedge2
->UEDGE
.PTR
);
418 if (CNS_TRACE_MODE
>= CNS_TRACE
)
419 (void) printf("TRA_cns appendoutcone out\n");
422 /*============================================================================*
423 | function viewoutcone(); |
424 | display the content of any given outcone structure |
425 *============================================================================*/
427 viewoutcone(ptoutcone
, depth
)
428 edge_list
*ptoutcone
;
432 char *margin
= (char *) mbkalloc(80);
436 if (CNS_TRACE_MODE
>= CNS_TRACE
)
437 (void) printf("TRA_cns viewoutcone in\n");
439 if (ptoutcone
== NULL
) {
440 (void) fflush(stdout
);
441 (void) fprintf(stderr
, "*** cns error ***");
442 (void) fprintf(stderr
, " viewoutcone() impossible: NULL pointer(s) !\n");
443 if (CNS_TRACE_MODE
>= CNS_TRACE
)
444 (void) printf("TRA_cns viewoutcone out\n");
452 margin
= strcpy(margin
, " ");
453 while (k
<= CNS_VIEW_LEVEL
) {
454 margin
= strcat(margin
, " ");
459 printf("%soutcone->NEXT = 0x%lx\n", margin
, (unsigned long)ptoutcone
->NEXT
);
460 printf("%soutcone->TYPE = 0x%lx\n", margin
, (unsigned long)ptoutcone
->TYPE
);
461 printf("%soutcone->UEDGE.PTR = 0x%lx\n", margin
, (unsigned long)ptoutcone
->UEDGE
.PTR
);
462 if ((ptoutcone
->TYPE
& CNS_EXT
) != CNS_EXT
) {
463 if ((depth
>= 1) && (ptoutcone
->UEDGE
.CONE
!= NULL
)) {
464 viewcone(ptoutcone
->UEDGE
.CONE
, depth
- 1);
468 if ((depth
>= 1) && (ptoutcone
->UEDGE
.LOCON
!= NULL
)) {
469 viewcnslocon(ptoutcone
->UEDGE
.LOCON
, depth
- 1);
472 printf("%soutcone->USER = 0x%lx\n", margin
, (unsigned long)ptoutcone
->USER
);
473 if ((depth
>= 1) && (ptoutcone
->USER
!= NULL
)) {
474 for (ptptype
= ptoutcone
->USER
; ptptype
!= NULL
; ptptype
= ptptype
->NEXT
) {
475 viewcnsptype(ptptype
);
482 mbkfree((void *) margin
);
484 if (CNS_TRACE_MODE
>= CNS_TRACE
)
485 (void) printf("TRA_cns viewoutcone out\n");