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 | File    :                  Search.c                         |
31 |                                                             |
32 | Author  :                Jacomme Ludovic                    |
33 |                                                             |
34 | Date    :                  28.03.95                         |
35 |                                                             |
36 \------------------------------------------------------------*/
37 /*------------------------------------------------------------\
38 |                                                             |
39 |                         Include Files                       |
40 |                                                             |
41 \------------------------------------------------------------*/
42 
43 # include <stdio.h>
44 # include "mut.h"
45 # include "mph.h"
46 # include "rds.h"
47 # include "rpr.h"
48 # include "rfm.h"
49 # include "GRM.h"
50 # include "GSB.h"
51 # include "GRM_search.h"
52 
53 /*------------------------------------------------------------\
54 |                                                             |
55 |                          Variables                          |
56 |                                                             |
57 \------------------------------------------------------------*/
58 
59   graalsearch *GraalHeadSearch = (graalsearch *)NULL;
60 
61 /*------------------------------------------------------------\
62 |                                                             |
63 |                          Functions                          |
64 |                                                             |
65 \------------------------------------------------------------*/
66 /*------------------------------------------------------------\
67 |                                                             |
68 |                       Alloc Functions                       |
69 |                                                             |
70 \------------------------------------------------------------*/
71 /*------------------------------------------------------------\
72 |                                                             |
73 |                        GraalAllocSearch                     |
74 |                                                             |
75 \------------------------------------------------------------*/
76 
GraalAllocSearch()77 graalsearch *GraalAllocSearch()
78 {
79   return((graalsearch *)rdsalloc(sizeof(graalsearch), 1));
80 }
81 
82 /*------------------------------------------------------------\
83 |                                                             |
84 |                        Free Functions                       |
85 |                                                             |
86 \------------------------------------------------------------*/
87 /*------------------------------------------------------------\
88 |                                                             |
89 |                         GraalFreeSearch                     |
90 |                                                             |
91 \------------------------------------------------------------*/
92 
GraalFreeSearch(FreeSearch)93 void GraalFreeSearch( FreeSearch )
94 
95    graalsearch *FreeSearch;
96 {
97   rdsfree((char *)FreeSearch, sizeof(graalsearch));
98 }
99 
100 /*------------------------------------------------------------\
101 |                                                             |
102 |                       GraalSetSearchRectangle               |
103 |                                                             |
104 \------------------------------------------------------------*/
105 
GraalSetSearchRectangle(Rectangle)106 void GraalSetSearchRectangle( Rectangle )
107 
108   rdsrec_list *Rectangle;
109 {
110   rdsrec_list *ScanRec;
111 
112   rdsbegin();
113 
114   ScanRec = Rectangle;
115 
116   do
117   {
118     SetGraalSearch( ScanRec );
119 
120     ScanRec = (rdsrec_list *)ScanRec->USER;
121   }
122   while( Rectangle != ScanRec );
123 
124   rdsend();
125 }
126 
127 /*------------------------------------------------------------\
128 |                                                             |
129 |                       GraalClearSearchRectangle             |
130 |                                                             |
131 \------------------------------------------------------------*/
132 
GraalClearSearchRectangle(Rectangle)133 void GraalClearSearchRectangle( Rectangle )
134 
135   rdsrec_list *Rectangle;
136 {
137   rdsrec_list *ScanRec;
138 
139   rdsbegin();
140 
141   ScanRec = Rectangle;
142 
143   do
144   {
145     ClearGraalSearch( ScanRec );
146 
147     ScanRec = (rdsrec_list *)ScanRec->USER;
148   }
149   while( Rectangle != ScanRec );
150 
151   rdsend();
152 }
153 
154 
155 /*------------------------------------------------------------\
156 |                                                             |
157 |                       GraalAddSearch                        |
158 |                                                             |
159 \------------------------------------------------------------*/
160 
GraalAddSearch(Rectangle)161 void GraalAddSearch( Rectangle )
162 
163    rdsrec_list *Rectangle;
164 {
165   graalsearch *Search;
166 
167   rdsbegin();
168 
169   if ( ! IsGraalSearch( Rectangle ) )
170   {
171     Search = GraalAllocSearch();
172 
173     Search->RECTANGLE = Rectangle;
174     Search->NEXT      = GraalHeadSearch;
175     GraalHeadSearch   = Search;
176 
177     GraalSetSearchRectangle( Rectangle );
178   }
179 
180   rdsend();
181 }
182 
183 /*------------------------------------------------------------\
184 |                                                             |
185 |                       GraalDelSearch                        |
186 |                                                             |
187 \------------------------------------------------------------*/
188 
GraalDelSearch()189 void GraalDelSearch()
190 
191 {
192   graalsearch *Search;
193 
194   rdsbegin();
195 
196   while ( GraalHeadSearch != (graalsearch *)NULL )
197   {
198     Search          = GraalHeadSearch;
199     GraalHeadSearch = GraalHeadSearch->NEXT;
200 
201     GraalClearSearchRectangle( Search->RECTANGLE );
202 
203     GraalFreeSearch( Search );
204   }
205 
206   rdsend();
207 }
208