1 /*------------------------------------------------------------\
2 |                                                             |
3 | This file is part of the Alliance CAD System Copyright      |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 |                                                             |
6 | Home page      : http://www-asim.lip6.fr/alliance/          |
7 | E-mail         : mailto:alliance-users@asim.lip6.fr       |
8 |                                                             |
9 | This progam is  free software; you can redistribute it      |
10 | and/or modify it under the  terms of the GNU General Public |
11 | License as  published by the Free Software Foundation;      |
12 | either version 2 of the License, or (at your option) any    |
13 | later version.                                              |
14 |                                                             |
15 | Alliance VLSI  CAD System  is distributed  in the hope that |
16 | it  will be useful, but WITHOUT  ANY WARRANTY;              |
17 | without even the  implied warranty of MERCHANTABILITY or    |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General       |
19 | Public License for more details.                            |
20 |                                                             |
21 | You should have received a copy  of the GNU General Public  |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc.,        |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                     |
25 |                                                             |
26 \------------------------------------------------------------*/
27 
28 /*------------------------------------------------------------\
29 |                                                             |
30 | Tool    :                   GRAAL                           |
31 |                                                             |
32 | File    :                 Connector.c                       |
33 |                                                             |
34 | Author  :                Jacomme Ludovic                    |
35 |                                                             |
36 | Date    :                  28.03.95                         |
37 |                                                             |
38 \------------------------------------------------------------*/
39 /*------------------------------------------------------------\
40 |                                                             |
41 |                         Include Files                       |
42 |                                                             |
43 \------------------------------------------------------------*/
44 
45 # include <stdio.h>
46 # include "mut.h"
47 # include "mph.h"
48 # include "rds.h"
49 # include "rpr.h"
50 # include "rfm.h"
51 # include "GRM.h"
52 # include "GSB.h"
53 # include "GRM_connector.h"
54 
55 /*------------------------------------------------------------\
56 |                                                             |
57 |                          Variables                          |
58 |                                                             |
59 \------------------------------------------------------------*/
60 
61   graalconrec *GraalHeadConRec = (graalconrec *)NULL;
62 
63 /*------------------------------------------------------------\
64 |                                                             |
65 |                          Functions                          |
66 |                                                             |
67 \------------------------------------------------------------*/
68 /*------------------------------------------------------------\
69 |                                                             |
70 |                       Alloc Functions                       |
71 |                                                             |
72 \------------------------------------------------------------*/
73 /*------------------------------------------------------------\
74 |                                                             |
75 |                        GraalAllocConRec                     |
76 |                                                             |
77 \------------------------------------------------------------*/
78 
GraalAllocConRec()79 graalconrec *GraalAllocConRec()
80 {
81   return((graalconrec *)rdsalloc(sizeof(graalconrec), 1));
82 }
83 
84 /*------------------------------------------------------------\
85 |                                                             |
86 |                        Free Functions                       |
87 |                                                             |
88 \------------------------------------------------------------*/
89 /*------------------------------------------------------------\
90 |                                                             |
91 |                         GraalFreeConRec                     |
92 |                                                             |
93 \------------------------------------------------------------*/
94 
GraalFreeConRec(FreeConRec)95 void GraalFreeConRec( FreeConRec )
96 
97    graalconrec *FreeConRec;
98 {
99   rdsfree((char *)FreeConRec, sizeof(graalconrec));
100 }
101 
102 /*------------------------------------------------------------\
103 |                                                             |
104 |                       GraalDelAllConRec                     |
105 |                                                             |
106 \------------------------------------------------------------*/
107 
GraalDelAllConRec()108 void GraalDelAllConRec()
109 
110 {
111   graalconrec *ConRec;
112   graalconrec *DelConRec;
113 
114   rdsbegin();
115 
116   ConRec = GraalHeadConRec;
117 
118   while ( ConRec != (graalconrec *)NULL )
119   {
120     DelConRec = ConRec;
121     ConRec    = ConRec->NEXT;
122 
123     GraalFreeConRec( DelConRec );
124   }
125 
126   GraalHeadConRec = (graalconrec *)NULL;
127 
128   rdsend();
129 }
130 
131 /*------------------------------------------------------------\
132 |                                                             |
133 |                        GraalDelConRec                       |
134 |                                                             |
135 \------------------------------------------------------------*/
136 
GraalDelConRec(Rectangle)137 void GraalDelConRec( Rectangle )
138 
139   rdsrec_list *Rectangle;
140 {
141   rdsrec_list  *ScanRec;
142   graalconrec  *ConRec;
143   graalconrec **Previous;
144 
145   rdsbegin();
146 
147   Previous = &GraalHeadConRec;
148 
149   for ( ConRec  = GraalHeadConRec;
150         ConRec != (graalconrec *)NULL;
151         ConRec  = ConRec->NEXT )
152   {
153     ScanRec = Rectangle;
154 
155     do
156     {
157       if ( ConRec->RECTANGLE == ScanRec )
158       {
159         *Previous = ConRec->NEXT;
160 
161         GraalFreeConRec( ConRec );
162 
163         return;
164       }
165 
166       ScanRec = (rdsrec_list *)ScanRec->USER;
167     }
168     while ( ScanRec != Rectangle );
169 
170     Previous = &ConRec->NEXT;
171   }
172 
173   rdsend();
174 }
175 
176 /*------------------------------------------------------------\
177 |                                                             |
178 |                         GraalAddConRec                      |
179 |                                                             |
180 \------------------------------------------------------------*/
181 
GraalAddConRec(Rectangle)182 void GraalAddConRec( Rectangle )
183 
184   rdsrec_list *Rectangle;
185 {
186   graalconrec *ConRec;
187 
188   rdsbegin();
189 
190   ConRec = GraalAllocConRec();
191 
192   ConRec->NEXT      = GraalHeadConRec;
193   ConRec->RECTANGLE = Rectangle;
194   GraalHeadConRec   = ConRec;
195 
196   rdsend();
197 }
198