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    :                   Druc.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 "vrd.h"
52 # include "GRM.h"
53 # include "GSB.h"
54 # include "GRM_window.h"
55 # include "GRM_druc.h"
56 
57 /*------------------------------------------------------------\
58 |                                                             |
59 |                          Variables                          |
60 |                                                             |
61 \------------------------------------------------------------*/
62 
63    rdsfig_list *GraalFigureDruc    = (rdsfig_list *)0;
64    rdsrec_list *GraalRectangleDruc = (rdsrec_list *)0;
65    rdsrec_list *GraalCurrentDruc   = (rdsrec_list *)0;
66 
67 /*------------------------------------------------------------\
68 |                                                             |
69 |                          Functions                          |
70 |                                                             |
71 \------------------------------------------------------------*/
72 /*------------------------------------------------------------\
73 |                                                             |
74 |                       GraalAddDruc                          |
75 |                                                             |
76 \------------------------------------------------------------*/
77 
GraalAddDruc(DrucRec)78 rdsrec_list *GraalAddDruc( DrucRec )
79 
80    rdsrec_list *DrucRec;
81 {
82   rdsrec_list *ScanDrucRec;
83   rdsrec_list *ScanRec;
84   rdsrec_list *First;
85   rdsrec_list *Link = NULL;
86 
87   rdsbegin();
88 
89   First = (rdsrec_list *)NULL;
90 
91   if ( ! IsGraalDruc( DrucRec ) )
92   {
93     ScanDrucRec = DrucRec;
94 
95     do
96     {
97       ScanRec =
98 
99         addrdsfigrec( GraalFigureRds, ScanDrucRec->NAME,
100                       GetRdsLayer( ScanDrucRec ),
101                       ScanDrucRec->X, ScanDrucRec->Y,
102                       ScanDrucRec->DX, ScanDrucRec->DY );
103 
104       SetGraalDruc( ScanRec );
105       SetGraalDruc( ScanDrucRec );
106 
107       if ( ScanRec->NEXT != (rdsrec_list *)NULL )
108       {
109         GRAAL_PREVIOUS( ScanRec->NEXT ) = &ScanRec->NEXT;
110       }
111 
112       GRAAL_PREVIOUS( ScanRec ) =
113 
114         &GraalFigureRds->LAYERTAB[ GetRdsLayer( ScanRec ) ];
115 
116       GraalInsertRectangle( ScanRec );
117 
118       if ( First == (rdsrec_list *)NULL )
119       {
120         First = ScanRec;
121         Link  = ScanRec;
122       }
123       else
124       {
125         Link->USER = (void *)ScanRec;
126         Link       = ScanRec;
127       }
128 
129       ScanDrucRec = MACRO_NEXT_EQUI( ScanDrucRec );
130     }
131     while ( ScanDrucRec != DrucRec );
132 
133     Link->USER = (void *)First;
134   }
135 
136   rdsend();
137   return( First );
138 }
139 
140 /*------------------------------------------------------------\
141 |                                                             |
142 |                       GraalDelDruc                          |
143 |                                                             |
144 \------------------------------------------------------------*/
145 
GraalDelDruc(Rectangle)146 void GraalDelDruc( Rectangle )
147 
148   rdsrec_list *Rectangle;
149 {
150   rdsrec_list *ScanRec;
151   rdsrec_list *DelRec;
152 
153   rdsbegin();
154 
155   ScanRec = Rectangle;
156 
157   do
158   {
159     DelRec  = ScanRec;
160     ScanRec = (rdsrec_list *)(ScanRec->USER);
161 
162     *(GRAAL_PREVIOUS( DelRec )) = DelRec->NEXT;
163 
164     if ( DelRec->NEXT != (rdsrec_list *)NULL )
165     {
166       GRAAL_PREVIOUS( DelRec->NEXT ) = GRAAL_PREVIOUS( DelRec );
167     }
168 
169     GraalEraseRectangle( DelRec );
170 
171     freerdsrec( DelRec, GRAAL_SIZE );
172   }
173   while ( ScanRec != Rectangle );
174 
175   rdsend();
176 }
177 
178 /*------------------------------------------------------------\
179 |                                                             |
180 |                       GraalDelDrucFigure                    |
181 |                                                             |
182 \------------------------------------------------------------*/
183 
GraalDelDrucFigure()184 void GraalDelDrucFigure()
185 {
186   if ( GraalFigureDruc != (rdsfig_list *)0 )
187   {
188     GraalCurrentDruc = (rdsrec_list *)0;
189 
190     delrdsfig( GraalFigureDruc->NAME );
191     GraalFigureDruc = (rdsfig_list *)0;
192 
193     if ( GraalRectangleDruc != (rdsrec_list *)0 )
194     {
195       GraalDelDruc( GraalRectangleDruc );
196       GraalRectangleDruc = (rdsrec_list *)0;
197     }
198   }
199 }
200